Fail2ban: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
== | == Installation == | ||
{{Root|emerge fail2ban}} | {{Root|emerge fail2ban}} | ||
| Line 9: | Line 9: | ||
{{Root|rc-update add fail2ban default}} | {{Root|rc-update add fail2ban default}} | ||
== syslog-ng configuration == | |||
{{File|/etc/syslog-ng/syslog-ng.conf| | {{File|/etc/syslog-ng/syslog-ng.conf| | ||
| Line 49: | Line 28: | ||
{{Root|/etc/init.d/syslog-ng restart}} | {{Root|/etc/init.d/syslog-ng restart}} | ||
{{File|/etc/fail2ban. | == Fail2ban configuration (0.9.x) == | ||
=== Enable the sshd jails and fail2ban reporting via email === | |||
{{File|/etc/fail2ban/jail.local| | |||
<pre> | <pre> | ||
[DEFAULT] | |||
bantime = 86400 | |||
maxretry = 3 | |||
destemail = yourmail@domain.local | |||
sender = fail2ban@hostname | |||
action = %(action_mwl)s | |||
[ | [sshd] | ||
enabled = true | enabled = true | ||
[ | [sshd-ddos] | ||
enabled = true | enabled = true | ||
</pre> | </pre> | ||
}} | }} | ||
=== Optional: Disable the new sqlite feature === | |||
{{File|/etc/ | {{File|/etc/fail2ban/fail2ban.local| | ||
<pre> | <pre> | ||
[Definition] | |||
dbfile = None | |||
</pre> | </pre> | ||
}} | }} | ||
=== Optional: Set the sshd log file path (default is auth.log) === | |||
{{File|/etc/fail2ban/ | {{File|/etc/fail2ban/paths-overrides.local| | ||
<pre> | <pre> | ||
[ | [DEFAULT] | ||
sshd_log = /var/log/sshd.log | |||
</pre> | </pre> | ||
}} | }} | ||
| Line 135: | Line 69: | ||
[[Categorie:Software]] | [[Categorie:Software]] | ||
Revision as of 17:07, 19 March 2014
Installation
# emerge fail2ban
# /etc/init.d/iptables save
# rc-update add iptables default
# rc-update add fail2ban default
syslog-ng configuration
File: /etc/syslog-ng/syslog-ng.conf
destination authlog { file("/var/log/auth.log"); };
filter f_authpriv { facility(auth, authpriv); };
filter f_failed { match("failed"); };
filter f_denied { match("denied"); };
log { source(src); filter(f_authpriv); destination(authlog); };
# touch /var/log/auth.log
# chmod 600 /var/log/auth.log
# /etc/init.d/syslog-ng restart
Fail2ban configuration (0.9.x)
Enable the sshd jails and fail2ban reporting via email
File: /etc/fail2ban/jail.local
[DEFAULT] bantime = 86400 maxretry = 3 destemail = yourmail@domain.local sender = fail2ban@hostname action = %(action_mwl)s [sshd] enabled = true [sshd-ddos] enabled = true
Optional: Disable the new sqlite feature
File: /etc/fail2ban/fail2ban.local
[Definition] dbfile = None
Optional: Set the sshd log file path (default is auth.log)
File: /etc/fail2ban/paths-overrides.local
[DEFAULT] sshd_log = /var/log/sshd.log
# /etc/init.d/fail2ban start