AWS EC2 で iptables を叩くだけでは再起動時に毎回リセットされてしまうので
再起動しても反映されるようにしたいのですが
Amazon Linux2 の場合どこに何を設定するのが普通なのでしょうか
他の Linux だと
/etc/sysconfig/iptables にコマンドを書いて
sudo systemctl enable iptables
でいいみたいなんですが Amazon Linux2 だと iptables コマンド自体はあるのですが
Failed to execute operation: No such file or directory
となってしまいます
AWS inspector の結果
rule 3.5.1.2 Ensure loopback traffic is configured
という項目に違反していて
Rationale
Loopback traffic is generated between processes on machine and is typically critical to operation of the system. The loopback interface is the only place that loopback network (127.0.0.0/8) traffic should be seen, all other interfaces should ignore traffic on this network as an anti-spoofing measure.
Run the following commands to implement the loopback rules:
# iptables -A INPUT -i lo -j ACCEPT
# iptables -A OUTPUT -o lo -j ACCEPT
# iptables -A INPUT -s 127.0.0.0/8 -j DROP
を行うためです