Skip to content

Instantly share code, notes, and snippets.

@armetiz
Created October 16, 2012 10:00
Show Gist options
  • Save armetiz/3898446 to your computer and use it in GitHub Desktop.
Save armetiz/3898446 to your computer and use it in GitHub Desktop.
vim /etc/init.d/firewall
#!/bin/bash
### BEGIN INIT INFO
# Provides: firewall
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Apply firewall configuration
# Description: Apply firewall configuration.
### END INIT INFO
# Script iptables Thomas Tourlourat
## Règles iptables.
iptables -I INPUT -i lo -j ACCEPT
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -p tcp -i eth0 --dport ssh -j ACCEPT
iptables -A INPUT -p icmp -i eth0 -j ACCEPT
iptables -P INPUT DROP
chmod +x /etc/init.d/firewall
update-rc.d firewall defaults
reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment