prerm is in fwsnort 1.6.7-3.
This file is a maintainer script. It is executed when installing (*inst) or removing (*rm) the package.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #!/bin/sh
set -e
if [ "$1" = "remove" ]; then
FWSNORT_CHAINS=$(iptables -L -n | fgrep 'Chain FWSNORT' | awk '{print $2}')
if [ -n "${FWSNORT_CHAINS}" ]; then
# Remove all fwsnort generated firewall rules
fwsnort --ipt-flush
# --ipt-flush doesn't remove the additional chains of fwsnort, but
# --ipt-revert is not recommended for cleaning up according to
# the man page. So do that manually. *sigh*
# Remove all potential leftover references in other chains
iptables -D INPUT ! -i lo -j FWSNORT_INPUT || true
iptables -D FORWARD ! -i lo -j FWSNORT_FORWARD || true
iptables -D OUTPUT ! -o lo -j FWSNORT_OUTPUT || true
# Remove remaining chains
for fwsnort_chain in ${FWSNORT_CHAINS} ; do
iptables -X "${fwsnort_chain}"
done
fi
fi
exit 0
|