From 4099897be009c19921873927875c773c0759a2d1 Mon Sep 17 00:00:00 2001 From: sebres Date: Tue, 17 Apr 2018 19:10:31 +0200 Subject: [PATCH] test dummy action first --- fail2ban/tests/servertestcase.py | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/fail2ban/tests/servertestcase.py b/fail2ban/tests/servertestcase.py index c9719bf7..59dfef50 100644 --- a/fail2ban/tests/servertestcase.py +++ b/fail2ban/tests/servertestcase.py @@ -1186,22 +1186,6 @@ class ServerConfigReaderTests(LogCaptureTestCase): # 'start', 'stop' - should be found (logged) on action start/stop, # etc. testJailsActions = ( - # hostsdeny -- - ('j-hostsdeny', 'hostsdeny[name=%(__name__)s, actionstop="rm ", file="/tmp/fail2ban.dummy"]', { - 'ip4': ('family: inet4',), 'ip6': ('family: inet6',), - 'ip4-ban': ( - r'''`printf %b "ALL: 192.0.2.1\n" >> /tmp/fail2ban.dummy`''', - ), - 'ip4-unban': ( - r'''`IP=$(echo "192.0.2.1" | sed 's/[][\.]/\\\0/g') && sed -i "/^ALL: $IP$/d" /tmp/fail2ban.dummy`''', - ), - 'ip6-ban': ( - r'''`printf %b "ALL: [2001:db8::]\n" >> /tmp/fail2ban.dummy`''', - ), - 'ip6-unban': ( - r'''`IP=$(echo "[2001:db8::]" | sed 's/[][\.]/\\\0/g') && sed -i "/^ALL: $IP$/d" /tmp/fail2ban.dummy`''', - ), - }), # dummy -- ('j-dummy', 'dummy[name=%(__name__)s, init="==", target="/tmp/fail2ban.dummy"]', { 'ip4': ('family: inet4',), 'ip6': ('family: inet6',), @@ -1227,6 +1211,22 @@ class ServerConfigReaderTests(LogCaptureTestCase): '`echo "[j-dummy] dummy /tmp/fail2ban.dummy -- unbanned 2001:db8:: (family: inet6)"`', ), }), + # hostsdeny -- + ('j-hostsdeny', 'hostsdeny[name=%(__name__)s, actionstop="rm ", file="/tmp/fail2ban.dummy"]', { + 'ip4': ('family: inet4',), 'ip6': ('family: inet6',), + 'ip4-ban': ( + r'''`printf %b "ALL: 192.0.2.1\n" >> /tmp/fail2ban.dummy`''', + ), + 'ip4-unban': ( + r'''`IP=$(echo "192.0.2.1" | sed 's/[][\.]/\\\0/g') && sed -i "/^ALL: $IP$/d" /tmp/fail2ban.dummy`''', + ), + 'ip6-ban': ( + r'''`printf %b "ALL: [2001:db8::]\n" >> /tmp/fail2ban.dummy`''', + ), + 'ip6-unban': ( + r'''`IP=$(echo "[2001:db8::]" | sed 's/[][\.]/\\\0/g') && sed -i "/^ALL: $IP$/d" /tmp/fail2ban.dummy`''', + ), + }), # iptables-multiport -- ('j-w-iptables-mp', 'iptables-multiport[name=%(__name__)s, bantime="10m", port="http,https", protocol="tcp", chain=""]', { 'ip4': ('`iptables ', 'icmp-port-unreachable'), 'ip6': ('`ip6tables ', 'icmp6-port-unreachable'),