Created
January 28, 2016 10:14
-
-
Save DavidGarciaCat/4bbcff00af0b9650d577 to your computer and use it in GitHub Desktop.
GNU/Linux Firewall - Default rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # **************************************************************** | |
| # IPTables path | |
| # **************************************************************** | |
| IPT=/sbin/iptables | |
| # **************************************************************** | |
| # Remove/Erase old rules | |
| # **************************************************************** | |
| $IPT -F | |
| $IPT -X | |
| $IPT -Z | |
| $IPT -t nat -F | |
| $IPT -t nat -X | |
| $IPT -t nat -Z | |
| # **************************************************************** | |
| # By default policy: | |
| # ALLOW Output | |
| # DENY Input & Forward | |
| # **************************************************************** | |
| $IPT -P INPUT DROP | |
| $IPT -P OUTPUT ACCEPT | |
| $IPT -P FORWARD DROP | |
| # **************************************************************** | |
| # ALLOW Input from `Local Host` | |
| # **************************************************************** | |
| $IPT -A INPUT -i lo -j ACCEPT | |
| # **************************************************************** | |
| # ALLOW Input just if it is a response from one of our requests | |
| # **************************************************************** | |
| $IPT -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment