From: Ivan Rako Date: Sun, 27 Dec 2020 22:04:16 +0000 (+0100) Subject: Izmjene za buster. X-Git-Tag: debian/0.10.2+cn10u1^0 X-Git-Url: http://ftp.carnet.hr/carnet-debian/scm?p=fail2ban-cn.git;a=commitdiff_plain;h=25004d7f65cc5d8f80bbb02a9c1e2d1cdaf6aa25 Izmjene za buster. --- diff --git a/debian/postinst b/debian/postinst index 37638c7..3d47138 100755 --- a/debian/postinst +++ b/debian/postinst @@ -49,11 +49,18 @@ if [ -e "$CONF" ]; then 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 + if grep -q '^ignoreip' "$CONF"; then + 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 + elif grep -q '^#ignoreip' "$CONF"; then + echo "CN: Enabling local IP ranges exclusion..." + cp_check_and_sed '^#ignoreip' \ + "s;^#ignoreip.*$;ignoreip = $NETADDR;g" "$CONF" || true + fi fi # restart the services