I'm hardening the security groups for EC2 instances running on a default Ubuntu 20.04 AMI. What system services will break after closing all outgoing ports expect TCP 80 and TCP 443? (I'm assuming all ports required by the application are open, too. My concern is about breaking the implicit services provided by the OS.)
My understanding is that allowing TCP 80/443 is enough for the essential OS services. For example, apt-get
updates should work. Or did I miss ports that Ubuntu or AWS will always expect to be open?
Side-note: I wondered how time syncing works. By default, I cannot see any NTP or chrony service preinstalled on the default Ubuntu AMI. Otherwise, UDP port 123 should be open, too. My assumption is that the (guest) hardware clock provided by the VM is already synced by the host (operated by AWS). Apart from that, I cannot think of any port that needs to be allowed from the OS perspective.
Depending on what AWS services the application will use, more ports are required, for example, 6379 for ElastiCache (Redis). Yet I'm concerned about API calls that do not originate from the deployed application. You can assume that the requirements of the application are known. The requirements by the environment (the OS and the EC2 infrastructure) are trickier.