Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best practice for using IPTABLES with an Amazon Linux server?

Amazon has their own port security and IPTABLES is not running by default. Do I need to configure and enable IPTABLES?

like image 325
Scott Daniel Avatar asked Feb 14 '23 21:02

Scott Daniel


1 Answers

Only Whitelists

Amazon effectively only gives you whitelisting ability.

Their documentation points this out directly:

Security group rules are always permissive; you can't create rules that deny access.

If you want fine-grained control over blacklists or you want to set up port forwarding, using iptables is one way to go.

Examples

Perhaps you want to drop packets from a bot scanning your box

$ iptables -I INPUT -s 174.132.223.252 -j DROP

You also might want to run an application as a non-root user on an unprivileged port and forward to port 80.

$ iptables -A PREROUTING -t nat -i eth0 -p tcp --dport 80 -j REDIRECT --to-port 8080
like image 188
Kyle Kelley Avatar answered Apr 28 '23 21:04

Kyle Kelley