Mehr Sicherheit durch fail2ban: Unterschied zwischen den Versionen
Erscheinungsbild
| Zeile 148: | Zeile 148: | ||
maxretry = 2 | maxretry = 2 | ||
</pre> | |||
''/etc/fail2ban/filter.d/apache-auth.conf'' | |||
<pre> | |||
# Fail2Ban configuration file | |||
# | |||
# Author: Cyril Jaquier | |||
# | |||
# $Revision: 569 $ | |||
# | |||
[Definition] | |||
# Option: failregex | |||
# Notes.: regex to match the password failure messages in the logfile. The | |||
# host must be matched by a group named "host". The tag "<HOST>" can | |||
# be used for standard IP/hostname matching and is only an alias for | |||
# (?:::f{4,6}:)?(?P<host>\S+) | |||
# Values: TEXT | |||
# | |||
failregex = [[]client <HOST>[]] user .* authentication failure | |||
[[]client <HOST>[]] user .* not found | |||
[[]client <HOST>[]] user .* password mismatch | |||
[[]client <HOST>[]] (Digest: )?user .* (authentication failure|not found|password mismatch) | |||
# Option: ignoreregex | |||
# Notes.: regex to ignore. If this regex matches, the line is ignored. | |||
# Values: TEXT | |||
# | |||
ignoreregex = | |||
</pre> | </pre> | ||
Version vom 2. Februar 2011, 11:25 Uhr
Fail2Ban
Dieses kleine Programm lässt sich so konfigurieren, dass es einen Angreifer erkennt, wenn dieser versucht sich einzuloggen und er das Kennwort nicht weiß. Standardmäßig schließt dann fail2ban, mittels Firewall Regel (iptables), den Zugang für das angreifende System für 10 Minuten.
Installation
Debian/Ubuntu Linux
aptitude install fail2ban
Konfiguration
Alle Änderungen des Users können in folgender Datei konfiguriert werden, diese Überschreiben die Datei jail.conf
/etc/fail2ban/jail.local
[DEFAULT]
# "ignoreip" can be an IP address, a CIDR mask or a DNS host
ignoreip = 127.0.0.1
bantime = 3600
maxretry = 3
#
# Destination email address used solely for the interpolations in
# jail.{conf,local} configuration files.
destemail = mymail@mydomain.de
# Choose default action. To change, just override value of 'action' with the
# interpolation to the chosen action shortcut (e.g. action_mw, action_mwl, etc) in jail.local
# globally (section [DEFAULT]) or per specific section
#action = %(action_)s
action = %(action_mw)s
#
# JAILS
#
# Next jails corresponds to the standard configuration in Fail2ban 0.6 which
# was shipped in Debian. Enable any defined here jail by including
#
# [SECTION_NAME]
# enabled = true
#
# in /etc/fail2ban/jail.local.
#
# Optionally you may override any other parameter (e.g. banaction,
# action, port, logpath, etc) in that section within jail.local
[ssh]
enabled = false
port = ssh
filter = sshd
logpath = /var/log/auth.log
maxretry = 6
Konfiguration für Pure-FTPd
Folgendes der Datei hinzufügen:
/etc/fail2ban/jail.local
# # FTP servers # [pure-ftpd] enabled = true port = ftp filter = pure-ftpd logpath = /var/log/messages maxretry = 3
/etc/fail2ban/filter.d/pure-ftpd.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
# Modified: Yaroslav Halchenko for pure-ftpd
#
# $Revision: 3$
#
[Definition]
# Error message specified in multiple languages
__errmsg = (?:Authentication failed for user|Erreur d'authentification pour l'utilisateur)
#
# Option: failregex
# Notes.: regex to match the password failures messages in the logfile. The
# host must be matched by a group named "host". The tag "<HOST>" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}:)?(?P<host>\S+)
# Values: TEXT
#
#failregex = pure-ftpd(?:\[\d+\])?: (.+?@<HOST>) \[WARNING\] %(__errmsg)s \[.+\]$
failregex = pure-ftpd(?:\[\d+\])?: \(.+?@<HOST>\) \[WARNING\] %(__errmsg)s \[.+\]\s*$
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =
Konfiguration für Apache HTTPd
/etc/fail2ban/jail.local
# # HTTP servers # [apache] enabled = true port = http,https filter = apache-auth logpath = /var/log/apache*/*error.log maxretry = 6 # default action is now multiport, so apache-multiport jail was left # for compatibility with previous (<0.7.6-2) releases [apache-multiport] enabled = false port = http,https filter = apache-auth logpath = /var/log/apache*/*error.log maxretry = 6 [apache-noscript] enabled = true port = http,https filter = apache-noscript logpath = /var/log/apache*/*error.log maxretry = 6 [apache-overflows] enabled = true port = http,https filter = apache-overflows logpath = /var/log/apache*/*error.log maxretry = 2
/etc/fail2ban/filter.d/apache-auth.conf
# Fail2Ban configuration file
#
# Author: Cyril Jaquier
#
# $Revision: 569 $
#
[Definition]
# Option: failregex
# Notes.: regex to match the password failure messages in the logfile. The
# host must be matched by a group named "host". The tag "<HOST>" can
# be used for standard IP/hostname matching and is only an alias for
# (?:::f{4,6}:)?(?P<host>\S+)
# Values: TEXT
#
failregex = [[]client <HOST>[]] user .* authentication failure
[[]client <HOST>[]] user .* not found
[[]client <HOST>[]] user .* password mismatch
[[]client <HOST>[]] (Digest: )?user .* (authentication failure|not found|password mismatch)
# Option: ignoreregex
# Notes.: regex to ignore. If this regex matches, the line is ignored.
# Values: TEXT
#
ignoreregex =