Script for write blocked IPs to blacklist in Apache2 ------------------------------------------------ #!/bin/bash # Gebannte IPs abrufen und sortieren banned_ips=$(fail2ban-client banned | grep -oE "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+" | sort -u | sed 's/^/Require not ip /') # Einträge in Blocklist schreiben echo -e "$banned_ips" > /etc/apache2/blocklist.conf # Kurze Pause sleep 1 # Apache2 neu laden systemctl reload apache2 Config File for the "iptables" action When use blocklist.sh directly fail2ban will hanging ------------------------------------------------ actionban = -I f2b- 1 -s -j /root/scripte/./blocklist.sh actionunban = -D f2b- -s -j /root/scripte/./blocklist.sh Config File for filter ------------------------------------------------ vi filter.d/guacamole.conf [Definition] failregex =.*Authentication attempt from \[,.*\] for user \".*\" failed. Apache2 Config File ------------------------------------------------ Require all granted Include /etc/apache2/blocklist.conf ProxyPass http://10.0.3.3:10000/guacamole/ flushpackets=on ProxyPassReverse http://10.0.3.3:10000/guacamole/