しつこいドアノックを減らしたい。少なくともSSHは自分からしかできないようにしておきたい。本番用サーバにはこの設定は必須です。なお、リモートから入るときは、作業用サーバを踏み台にして入るようにしています。
# iptables -A INPUT -s 123.123.123.123 -p tcp --dport 22 -j ACCEPT
# iptables -A INPUT -s 123.123.123.223 -p tcp --dport 22 -j ACCEPT
# iptables -A INPUT -p tcp --dport 22 -j REJECT
# iptables -L
Chain INPUT (policy DROP)
target prot opt source destination
ACCEPT tcp -- 123.123.123.123 anywhere tcp dpt:ssh
ACCEPT tcp -- 123.123.123.223 anywhere tcp dpt:ssh
REJECT tcp -- anywhere anywhere tcp dpt:ssh reject-with icmp-port-unreachable
# service iptables save
# systemctl restart iptables