Hi.
Ich bräcuhte mal Hilfe bei der Fail2Ban Konfiguration.
Problem generell: gebannte IP's haben trotz f2b-iptables Eintrag noch Zugriff.
--------------------------------------------------------------------------------------------------
-- LOG:
2022-04-02 18:48:59,264 fail2ban.filter [4351]: INFO [scanbuster] Found 69.30.255.234
2022-04-02 18:49:00,083 fail2ban.actions [4351]: NOTICE [scanbuster] Ban 69.30.255.234
2022-04-02 19:11:36,899 fail2ban.filter [4351]: INFO [scanbuster] Found 69.30.255.234
2022-04-02 19:11:37,723 fail2ban.actions [4351]: NOTICE [scanbuster] 69.30.255.234 already banned
2022-04-02 21:31:04,136 fail2ban.filter [4351]: INFO [scanbuster] Found 69.30.255.234
2022-04-02 21:31:04,457 fail2ban.actions [4351]: NOTICE [scanbuster] 69.30.255.234 already banned
-- IPTABLES:
root@rs55-dns-root:/# iptables -L -n | grep 69.30.255.234
DROP all -- 69.30.255.234 0.0.0.0/0
root@rs55-dns-root:/#
-- IPTABLES-dump (gekürzt):
# Generated by iptables-save v1.6.0 on Sun Apr 3 07:20:24 2022
*filter
:INPUT ACCEPT [7:280]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6:672]
:f2b-scanbuster - [0:0]
-A INPUT -p tcp -m multiport --dports 0:65535 -j f2b-scanbuster
-A f2b-scanbuster -s 81.17.20.98/32 -j DROP
-A f2b-scanbuster -j RETURN
COMMIT
# Completed on Sun Apr 3 07:20:24 2022
-- F2B-Jail:
[scanbuster]
logpath = /var/log/daemon.log
maxretry = 0
bantime = -1
--F2B action -- iptables-multiport.conf:
[INCLUDES]
before = iptables-common.conf
[Definition]
actionstart = <iptables> -N f2b-<name>
<iptables> -A f2b-<name> -j <returntype>
<iptables> -I <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
actionstop = <iptables> -D <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
<iptables> -F f2b-<name>
<iptables> -X f2b-<name>
actioncheck = <iptables> -n -L <chain> | grep -q 'f2b-<name>[ \t]'
actionban = <iptables> -I f2b-<name> 1 -s <ip> -j <blocktype>
/usr/bin/php /home/scanbuster/sbworker.php <name> <protocol> <port> <ip>
actionunban = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
[Init]
--F2B action -- iptables-common.conf:
[INCLUDES]
after = iptables-blocktype.local
iptables-common.local
[Init]
chain = INPUT
name = default
port = ssh
protocol = tcp
blocktype = DROP
returntype = RETURN
lockingopt = -w
iptables = iptables <lockingopt>
--------------------------------------------------------------------------------------------------
... jetzt , wo ich mir das so anschaue ... hmmm "protocol TCP", ...
Ich vermute gerade, f2b sperrt hier nur das tcp protokoll.
Falls ich damit richtig liege: ... Wie kann ich TCP und UDP gleichzeitig sperren?
Ich bräcuhte mal Hilfe bei der Fail2Ban Konfiguration.
Problem generell: gebannte IP's haben trotz f2b-iptables Eintrag noch Zugriff.
--------------------------------------------------------------------------------------------------
-- LOG:
2022-04-02 18:48:59,264 fail2ban.filter [4351]: INFO [scanbuster] Found 69.30.255.234
2022-04-02 18:49:00,083 fail2ban.actions [4351]: NOTICE [scanbuster] Ban 69.30.255.234
2022-04-02 19:11:36,899 fail2ban.filter [4351]: INFO [scanbuster] Found 69.30.255.234
2022-04-02 19:11:37,723 fail2ban.actions [4351]: NOTICE [scanbuster] 69.30.255.234 already banned
2022-04-02 21:31:04,136 fail2ban.filter [4351]: INFO [scanbuster] Found 69.30.255.234
2022-04-02 21:31:04,457 fail2ban.actions [4351]: NOTICE [scanbuster] 69.30.255.234 already banned
-- IPTABLES:
root@rs55-dns-root:/# iptables -L -n | grep 69.30.255.234
DROP all -- 69.30.255.234 0.0.0.0/0
root@rs55-dns-root:/#
-- IPTABLES-dump (gekürzt):
# Generated by iptables-save v1.6.0 on Sun Apr 3 07:20:24 2022
*filter
:INPUT ACCEPT [7:280]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [6:672]
:f2b-scanbuster - [0:0]
-A INPUT -p tcp -m multiport --dports 0:65535 -j f2b-scanbuster
-A f2b-scanbuster -s 81.17.20.98/32 -j DROP
-A f2b-scanbuster -j RETURN
COMMIT
# Completed on Sun Apr 3 07:20:24 2022
-- F2B-Jail:
[scanbuster]
logpath = /var/log/daemon.log
maxretry = 0
bantime = -1
--F2B action -- iptables-multiport.conf:
[INCLUDES]
before = iptables-common.conf
[Definition]
actionstart = <iptables> -N f2b-<name>
<iptables> -A f2b-<name> -j <returntype>
<iptables> -I <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
actionstop = <iptables> -D <chain> -p <protocol> -m multiport --dports <port> -j f2b-<name>
<iptables> -F f2b-<name>
<iptables> -X f2b-<name>
actioncheck = <iptables> -n -L <chain> | grep -q 'f2b-<name>[ \t]'
actionban = <iptables> -I f2b-<name> 1 -s <ip> -j <blocktype>
/usr/bin/php /home/scanbuster/sbworker.php <name> <protocol> <port> <ip>
actionunban = <iptables> -D f2b-<name> -s <ip> -j <blocktype>
[Init]
--F2B action -- iptables-common.conf:
[INCLUDES]
after = iptables-blocktype.local
iptables-common.local
[Init]
chain = INPUT
name = default
port = ssh
protocol = tcp
blocktype = DROP
returntype = RETURN
lockingopt = -w
iptables = iptables <lockingopt>
--------------------------------------------------------------------------------------------------
... jetzt , wo ich mir das so anschaue ... hmmm "protocol TCP", ...
Ich vermute gerade, f2b sperrt hier nur das tcp protokoll.
Falls ich damit richtig liege: ... Wie kann ich TCP und UDP gleichzeitig sperren?