Benutzer-Werkzeuge

Webseiten-Werkzeuge


fail2ban

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen Revision Vorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
fail2ban [31.01.2024]
hochrath [Beste Vorgehensweise]
fail2ban [31.01.2024] (aktuell)
hochrath [Quellen]
Zeile 229: Zeile 229:
 \\ \\
 Nun kann man über die Log-Files sehr schön den Verlauf bei einem fehlerhaften Zugriff beobachten:\\ Nun kann man über die Log-Files sehr schön den Verlauf bei einem fehlerhaften Zugriff beobachten:\\
 +**service fail2ban status**
 <code> <code>
-root@raspberrypi3:/home/pi# **service fail2ban status**+root@raspberrypi3:/home/pi# service fail2ban status
 ● fail2ban.service - Fail2Ban Service ● fail2ban.service - Fail2Ban Service
      Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)      Loaded: loaded (/lib/systemd/system/fail2ban.service; enabled; vendor preset: enabled)
Zeile 247: Zeile 248:
 </code> </code>
  
 +\\
 +**iptables -L**
 <code> <code>
 +root@raspberrypi3:/home/pi# iptables -L
 +Chain INPUT (policy ACCEPT)
 +target     prot opt source               destination
 +f2b-apache404  tcp  --  anywhere             anywhere             multiport dports http,https
  
 +Chain FORWARD (policy ACCEPT)
 +target     prot opt source               destination
 +
 +Chain OUTPUT (policy ACCEPT)
 +target     prot opt source               destination
 +
 +Chain f2b-apache404 (1 references)
 +target     prot opt source               destination
 +RETURN     all  --  anywhere             anywhere
 </code> </code>
  
 +\\
 +**fail2ban-client status apache404**
 <code> <code>
 +root@raspberrypi3:/home/pi# fail2ban-client status apache404
 +Status for the jail: apache404
 +|- Filter
 +|  |- Currently failed: 1
 +|  |- Total failed:     3
 +|  `- File list:        /var/log/apache2/access.log
 +`- Actions
 +   |- Currently banned: 0
 +   |- Total banned:     1
 +   `- Banned IP list:
  
 </code> </code>
  
 +\\
 +\\
 +nun die Webseite nach fehlenden Seiten abfragen:
 +\\
 +**tail -f /var/log/fail2ban.log**
 <code> <code>
 +2024-01-31 16:36:58,105 fail2ban.filter         [23836]: INFO    [apache404] Found 192.168.178.36 - 2024-01-31 16:36:58
 +2024-01-31 16:38:13,892 fail2ban.filter         [23836]: INFO    [apache404] Found 192.168.178.36 - 2024-01-31 16:38:13
 +2024-01-31 16:38:14,032 fail2ban.actions        [23836]: NOTICE  [apache404] Ban 192.168.178.36**Fetter Text**
  
 </code> </code>
  
 +\\
 +**fail2ban-client status apache404**
 +<code>
 +root@raspberrypi3:/home/pi# fail2ban-client status apache404
 +Status for the jail: apache404
 +|- Filter
 +|  |- Currently failed: 0
 +|  |- Total failed:     5
 +|  `- File list:        /var/log/apache2/access.log
 +`- Actions
 +   |- Currently banned: 1
 +   |- Total banned:     2
 +   `- Banned IP list:   192.168.178.36
  
 +</code>
 +
 +\\
 +**iptables -L**
 +<code>
 +root@raspberrypi3:/home/pi# iptables -L
 +Chain INPUT (policy ACCEPT)
 +target     prot opt source               destination
 +f2b-apache404  tcp  --  anywhere             anywhere             multiport dports http,https
 +
 +Chain FORWARD (policy ACCEPT)
 +target     prot opt source               destination
 +
 +Chain OUTPUT (policy ACCEPT)
 +target     prot opt source               destination
 +
 +Chain f2b-apache404 (1 references)
 +target     prot opt source               destination
 +REJECT     all  --  DESKTOP-PQ44AIL.fritz.box  anywhere             reject-with icmp-port-unreachable
 +RETURN     all  --  anywhere             anywhere
 +
 +</code>
  
  
Zeile 267: Zeile 338:
    
  
 +\\
 +\\
 ==== Quellen ==== ==== Quellen ====
  
 https://wiki.ubuntuusers.de/fail2ban/\\ https://wiki.ubuntuusers.de/fail2ban/\\
 https://www.digitalocean.com/community/tutorials/how-to-protect-ssh-with-fail2ban-on-ubuntu-20-04\\ https://www.digitalocean.com/community/tutorials/how-to-protect-ssh-with-fail2ban-on-ubuntu-20-04\\
fail2ban.1706715274.txt.gz · Zuletzt geändert: 31.01.2024 von hochrath