user-documentation/modules/ROOT/partials/installation/post-install/install-fail2ban.adoc

41 lines
1.3 KiB
Text
Raw Permalink Normal View History

2024-02-10 12:18:43 +01:00
// Text excerpt about installing fail2ban
// consumer postinstallation-tasks.adoc (main), hetzner-dc.adoc
The software monitors the log files for authentication errors. In case of multiple retries from the same IP address, it reconfigures the firewall on the fly to block the source IP. This is to prevent bruteforce methods for cracking passwords and bots checking for weak passwords. However, a system administrator may also lock himself out if a mistake is made. Therefore, you can exclude distinct IP addresses, e.g., the administrator's desktop, from blocking.
2024-02-10 12:18:43 +01:00
a. Installation of the software
2024-02-10 12:18:43 +01:00
+
[source,]
----
[…]# dnf install fail2ban
----
b. Create and fill configuration file
+
[source,]
----
[…]# vi /etc/fail2ban/jail.local
# Jail configuration additions for local installation
# Adjust the default configuration's default values
[DEFAULT]
# Optional enter an trusted IP never to ban
#ignoreip = www.xxx.yyy.zzz/32
bantime = 6600
backend = auto
# The main configuration file defines all services but
# deactivates them by default. We have to activate those needed
2024-02-10 12:18:43 +01:00
[sshd]
enabled = true
----
c. Activate software
+
[source,]
----
[…]# systemctl enable fail2ban --now
----
d. Control in the log
+
[source,]
----
[…]# tail -f /var/log/fail2ban.log
----