projects
/
iptables-cn.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
r12: - add symlink /etc/init.d/iptables -> /etc/init.d/iptables-cn
[iptables-cn.git]
/
debian
/
postinst
diff --git
a/debian/postinst
b/debian/postinst
index
9293ede
..
d4f3626
100755
(executable)
--- a/
debian/postinst
+++ b/
debian/postinst
@@
-30,14
+30,11
@@
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 \
# 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
fi
# remove old iptables init script
-if [ -e /etc/init.d/iptables ]; then
- rm -f /etc/init.d/iptables
- update-rc.d -f iptables remove
-fi
+update-rc.d -f iptables remove >/dev/null 2>&1 || true
# check if old default file exists and import it
if [ -e /etc/default/iptables ]; then
# check if old default file exists and import it
if [ -e /etc/default/iptables ]; then
@@
-48,12
+45,18
@@
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
# 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
+ if ! iptables-save | grep '^-' >/dev/null; then
+ echo "CN: Netfilter rules empty: importing SSH bruteforce rules"
+ . /usr/share/doc/iptables-cn/examples/ssh-bruteforce
+ fi
+ echo "CN: Saving current Netfilter rules to /var/lib/iptables/active"
iptables-save > /var/lib/iptables/active
fi
iptables-save > /var/lib/iptables/active
fi
+
+# create inactive
if [ ! -e /var/lib/iptables/inactive ]; then
if [ ! -e /var/lib/iptables/inactive ]; then
- cp /var/lib/iptables/active /var/lib/iptables/inactive
-fi
+ touch /var/lib/iptables/inactive
+fi
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.