セキュリティ設定

iptables によってソフトウェア的に Firewall を実現できる。不要なポートは開けないことが重要。下記コマンドで iptables の設定を確認。

# /sbin/iptables -L

ssh 以外のサービスは外部からの通信が止められていることを確認。

Chain INPUT (policy ACCEPT)       

num target prot opt source destination        

1 ACCEPT all — anywhere anywhere state RELATED,ESTABLISHED        

2 ACCEPT icmp — anywhere anywhere        

3 ACCEPT all — anywhere anywhere        

4 ACCEPT tcp — anywhere anywhere state NEW tcp dpt:ssh        

5 REJECT all — anywhere anywhere reject-with icmp-host-prohibited

Chain FORWARD (policy ACCEPT)       

num target prot opt source destination        

1 REJECT all — anywhere anywhere reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)       

num target prot opt source destination

ここでは、HTTP と HTTPS の通信を許可。

# /sbin/iptables -I INPUT 5 -p tcp –dport http -j ACCEPT #HTTP

  1. /sbin/iptables -I INPUT 5 -p tcp –dport https -j ACCEPT #HTTPS