projects
/
fail2ban-cn.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
prva verzija za jessie
[fail2ban-cn.git]
/
debian
/
postinst
diff --git
a/debian/postinst
b/debian/postinst
index
ac48914
..
cbd1e67
100755
(executable)
--- a/
debian/postinst
+++ b/
debian/postinst
@@
-30,43
+30,28
@@
esac
# import CN-functions
. /usr/share/carnet-tools/functions.sh
# import CN-functions
. /usr/share/carnet-tools/functions.sh
-CONF=/etc/fail2ban/jail.conf
+CONF="/etc/fail2ban/jail.conf"
if [ -e "$CONF" ]; then
# enable ssh, pam-generic, sasl, proftpd and vsftpd service
if [ -e "$CONF" ]; then
# enable ssh, pam-generic, sasl, proftpd and vsftpd service
- perl -ne 'if (/^\[(ssh|pam-generic|sasl|proftpd|vsftpd)\]/ .. /^enabled/) { $_ =~ s/^enabled\s=\sfalse/enabled = true/gi }; print $_' "$CONF" > "$CONF.$$" && \
+ echo "CN: Enabling SSH, PAM-generic, SASL, ProFTPD, vsftpd and Dovecot support..."
+ perl -ne 'if (/^\[(ssh|pam-generic|sasl|proftpd|vsftpd|dovecot)\]/ .. /^enabled/) { $_ =~ s/^enabled\s+=\s+false/enabled = true/gi }; print $_' "$CONF" > "$CONF.$$" && \
cp_mv "$CONF.$$" "$CONF"
rm -f "$CONF.$$"
cp_mv "$CONF.$$" "$CONF"
rm -f "$CONF.$$"
- # enable dovecot service
- cp -a "$CONF" "$CONF.$$"
- cp-update fail2ban-cn "$CONF.$$" <<EOF
-[dovecot]
-
-enabled = true
-port = 110,143
-protocol = tcp
-filter = dovecot
-logpath = /var/log/mail.log
-EOF
- cp_mv "$CONF.$$" "$CONF"
-
# add network address and class if needed
cp_get_netaddr || true
NETADDR="$RET"
IGNOREIP=$(grep '^ignoreip' "$CONF")
if ! echo "$IGNOREIP" | grep -q "$NETADDR"; then
# add network address and class if needed
cp_get_netaddr || true
NETADDR="$RET"
IGNOREIP=$(grep '^ignoreip' "$CONF")
if ! echo "$IGNOREIP" | grep -q "$NETADDR"; then
+ echo "CN: Enabling local IP ranges exclusion..."
cp_check_and_sed '^ignoreip' \
"s;^\(ignoreip.*\)$;\1 $NETADDR;g" "$CONF" || true
fi
fi
# restart the services
cp_check_and_sed '^ignoreip' \
"s;^\(ignoreip.*\)$;\1 $NETADDR;g" "$CONF" || true
fi
fi
# restart the services
-if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
- invoke-rc.d fail2ban restart || exit $?
-else
- /etc/init.d/fail2ban restart || exit $?
-fi
+service fail2ban restart || exit $?
# 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.