Sha256: 46e205c9236ca5fbb5c6f7975083e7a1fe990f88eb668537fc66ce923bcc33c1

Contents?: true

Size: 1.19 KB

Versions: 27

Compression:

Stored size: 1.19 KB

Contents

#! /bin/sh
# /etc/init.d/firewall
#
# Firewall init script, to be used with /etc/firewall.bash by Jeff Geerling.
#
# @author Jeff Geerling

### 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: Start firewall at boot time.
# Description:       Enable the firewall.
### END INIT INFO

# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting firewall."
    /etc/firewall.bash
    ;;
  stop)
    echo "Stopping firewall."
    iptables -F
    if [ -x "$(which ip6tables 2>/dev/null)" ]; then
        ip6tables -F
    fi
    ;;
  restart)
    echo "Restarting firewall."
    /etc/firewall.bash
    ;;
  status)
    echo -e "`iptables -L -n`"
    EXIT=4 # program or service status is unknown
    NUMBER_OF_RULES=$(iptables-save | grep '^\-' | wc -l)
    if [ 0 -eq $NUMBER_OF_RULES ]; then
        EXIT=3 # program is not running
    else
        EXIT=0 # program is running or service is OK
    fi
    exit $EXIT
    ;;
  *)
    echo "Usage: /etc/init.d/firewall {start|stop|status|restart}"
    exit 1
    ;;
esac

exit 0

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
cloud-mu-3.1.1 ansible/roles/geerlingguy.firewall/templates/firewall.init.j2
cloud-mu-3.1.0 ansible/roles/geerlingguy.firewall/templates/firewall.init.j2
cloud-mu-3.0.2 ansible/roles/geerlingguy.firewall/templates/firewall.init.j2
cloud-mu-3.0.1 ansible/roles/geerlingguy.firewall/templates/firewall.init.j2
cloud-mu-3.0.0 ansible/roles/geerlingguy.firewall/templates/firewall.init.j2
cloud-mu-3.0.0beta ansible/roles/geerlingguy.firewall/templates/firewall.init.j2
cloud-mu-2.1.0beta ansible/roles/geerlingguy.firewall/templates/firewall.init.j2