Skip to content

Instantly share code, notes, and snippets.

@anothergituser
Last active January 20, 2019 12:27
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 anothergituser/d2844c39bfae9039cfe9060170c8814b to your computer and use it in GitHub Desktop.
Save anothergituser/d2844c39bfae9039cfe9060170c8814b to your computer and use it in GitHub Desktop.
iptables systemctl /etc/rc.d/init.d/iptables_user
#!/bin/bash
# chkconfig: - 50 50
# description: Initializes custom firewall
usage ()
{
echo $"Usage: $0 {start|stop|status|restart|condrestart}" 1>&2
}
start ()
{
/usr/sbin/iptables-restore < /etc/iptables/iptables.rules
}
stop ()
{
/usr/sbin/iptables -F
/usr/sbin/iptables -X
}
status ()
{
/usr/sbin/iptables -nvL
}
restart ()
{
stop
start
}
case "$1" in
stop) stop ;;
status) status ;;
start|restart|reload|force-reload) restart ;;
*) usage ;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment