X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?a=blobdiff_plain;f=debian%2Fpostinst;h=2beb6a103d4a7a4535d62395fcbf10fe75b3c22f;hb=287632e70a394374c32cd5b5e587bcc98ef34cd0;hp=43d25c517b9b770e1255af529e186104263512f6;hpb=7bced4abdbe8cade2f9a93dd4f77ff4225f7761a;p=iptables-cn.git diff --git a/debian/postinst b/debian/postinst index 43d25c5..2beb6a1 100755 --- a/debian/postinst +++ b/debian/postinst @@ -30,13 +30,13 @@ esac # fix problem with permissions from the old package if dpkg --compare-versions "$2" lt "2:1.2.11-4"; then chown -f -Rh root:root /var/lib/iptables /etc/init.d/iptables \ - /etc/default/iptables >/dev/null 2>&1 + /etc/default/iptables >/dev/null 2>&1 || true fi # remove old iptables init script if [ -e /etc/init.d/iptables ]; then rm -f /etc/init.d/iptables - update-rc.d iptables remove + update-rc.d -f iptables remove fi # check if old default file exists and import it @@ -48,13 +48,12 @@ fi # REJECT recent if there is none.. # also, save current set of rules into active and inactive configuration if [ ! -e /var/lib/iptables/active ]; then - . /usr/share/doc/iptables-cn/examples/ssh-bruteforce - iptables-save > /var/lib/iptables/active + if ! iptables-save | grep '^-' >/dev/null; then + echo "CN: Netfilter rules empty: importing SSH bruteforce rules" + . /usr/share/doc/iptables-cn/examples/ssh-bruteforce + iptables-save > /var/lib/iptables/active + fi fi -if [ ! -e /var/lib/iptables/inactive ]; then - . /usr/share/doc/iptables-cn/examples/ssh-bruteforce - iptables-save > /var/lib/iptables/inactive -fi # dh_installdeb will replace this with shell code automatically # generated by other debhelper scripts.