Skip to content

Instantly share code, notes, and snippets.

@anthonysr
Created June 10, 2015 19:02
Show Gist options
  • Save anthonysr/ef2c619573b7c222d31e to your computer and use it in GitHub Desktop.
Save anthonysr/ef2c619573b7c222d31e to your computer and use it in GitHub Desktop.
check_iptables_reload_chains
#!/bin/bash
#
# Check if /etc/default/iptables exists *and* contains RELOAD_CHAINS=1
# If yes, echo "RELOAD_CHAINS_BLOCKED" in any other case, echo "OK"
#
RELOAD_FILE=testreloadfile
RELOAD_CHAINS=1
# Load defaults
if [ -f ${RELOAD_FILE} ]; then
. ${RELOAD_FILE}
fi
# See if we should run
if [ ${RELOAD_CHAINS} -ne 1 ]; then
echo "RELOAD_CHAINS!=1, check /etc/default/iptables, not reloading rules!"
exit 1
else
echo "OK"
fi
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment