Network ACLs Vs Security Groups

Sorry if this has already been discussed but I did a quick search and couldn’t find anything.

We’re in the process of deploying workspaces as a remote machine deployment solution. We have all the VPCs locked down with ACLs. All workspaces within the subnet will be treated equally so are security groups redundant?

If I was to setup both the NACLs and Security Groups they would have the exact same list of ports so it sounds like I’ll be doubling my work and adding extra complexity for no additional security or am I missing something?

Thanks.

NACLS and SGs don’t act the same. SGs are “stateful” while NACLs are “stateless” I’d see the list below of the full rundown of the difference between the two. While it may appear that it is a lot of upfront effort that seems redundant, keep in mind you want defense in depth. If one of the instances behind the NACL is compromised, you’ll have nothing to stop it from accessing other instances in the subnet, at least at the network level. You can use the same SG across multiple instances as well, so you can use them over and over again, you don’t have to create a fresh one for each instance. I’d say as a strong security posture you should be using both.

https://tutorialsdojo.com/security-group-vs-nacl/

That is a good point. Thanks for the response!

ACL’s work at the subnet level whereas Security Groups are at the compute level. You have to associate a Security Group with EC2 so if you are primarily using these you would have to double your work to use ACLs as well.

ACLs are stateless and process rules in order.
Security groups are stateful and process the rules in groups.

From my perspective, NACLs should be used to block malicious known IP addresses, non authorized ports, … while staying high level (fine-grained approach).
Then, security groups should be used for a coarse-grained approach where you specify specific IP ranges and ports that you only allow for a specific instance.

I find this is the easiest solution as already mentioned NACLs are stateless and quite hard to configure (if inbound traffic is allowed, the outbound too). Also, the default behaviour for security groups is to block everything so that it is easier to apply the least privilege principle.

Developers with access to Security Groups? This seems like a license for 0.0.0.0/0.

The defence in depth argument is one I was also going to make. If the NACLs fail, perhaps that underlying code has an unknown exploitable bug or someone removes them by accident, the security groups are there as redundancy.

I also don’t seem the harm in iptables/nftables if you have the time.

Of course! Best of luck in your implementation.

That’s what firewall manager is for.

Also booo nacls. We don’t have any really great reason for them and they are confusing and difficult to manage and troubleshoot. I prefer to be all in on security groups and firewall manager. That said, ive seen engineers treat security groups like selinux and ‘just turn it off’

One important notes is that removing an Allow rule on a SG can take up to a week to take effect on long lived connections, because of how state is managed.

NACLs take effect instantly.

Yea, fair and it will be set and forget so I guess its not like we’ll constantly be updating changes across both.

I get that but doesnt really fit my use case.

We will be using WorkSpaces so we cant apply a security group to a single instance, all WorkSpaces in the directory are automatically assigned a security group which cannot be changed (you can add another one but you cannot get rid of the default)

Thanks for the response though.