Skip to content

Instantly share code, notes, and snippets.

@kawahiro311
Last active August 29, 2015 14:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kawahiro311/26b63b68cac16e0188a7 to your computer and use it in GitHub Desktop.
Save kawahiro311/26b63b68cac16e0188a7 to your computer and use it in GitHub Desktop.
最低限のiptables
*filter
# 受信/転送を破棄・送信を許可
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
# ループバックアドレスからの送受信を許可
-A INPUT -i lo -j ACCEPT
-A OUTPUT -o lo -j ACCEPT
# ssh
-A INPUT -m state --state NEW -p tcp --dport 22 -s xxx.xxx.xxx.xxx -j ACCEPT
# http, https
-A INPUT -m state --state NEW -p tcp --dport 443 -j ACCEPT
-A INPUT -m state --state NEW -p tcp --dport 80 -j ACCEPT
# smtp
-A INPUT -m state --state NEW -p tcp --dport 25 -j ACCEPT
# 接続済みパケットの送受信を許可
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
COMMIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment