Fail2ban Jail Base Specification File # # HOW to ACTIVATE JAILS: # # YOU SHOULD NOT MODIFY THIS FILE
Total Page:16
File Type:pdf, Size:1020Kb
# Fail2Ban jail base specification file # # HOW TO ACTIVATE JAILS: # # YOU SHOULD NOT MODIFY THIS FILE. # # It will probably be overwitten or improved in a distribution update. # # Provide customizations in a jail.local file or a jail.d/customisation.local. # For example to change the default bantime for all jails and to enable the # ssh-iptables jail the following (uncommented) would appear in the .local file. # See man 5 jail.conf for details. # # [DEFAULT] # bantime = 3600 # # [ssh-iptables] # enabled = true # Comments: use '#' for comment lines and ';' (following a space) for inline com ments # The DEFAULT allows a global definition of the options. They can be overridden # in each jail afterwards. [DEFAULT] # "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not # ban a host which matches an address in this list. Several addresses can be # defined using space separator. ignoreip = 127.0.0.1/8 # External command that will take an tagged arguments to ignore, e.g. <ip>, # and return true if the IP is to be ignored. False otherwise. # # ignorecommand = /path/to/command <ip> ignorecommand = # "bantime" is the number of seconds that a host is banned. bantime = 1200 # A host is banned if it has generated "maxretry" during the last "findtime" # seconds. findtime = 1200 # "maxretry" is the number of failures before a host get banned. maxretry = 10 # "backend" specifies the backend used to get files modification. # Available options are "pyinotify", "gamin", "polling" and "auto". # This option can be overridden in each jail as well. # # pyinotify: requires pyinotify (a file alteration monitor) to be installed. # If pyinotify is not installed, Fail2ban will use auto. # gamin: requires Gamin (a file alteration monitor) to be installed. # If Gamin is not installed, Fail2ban will use auto. # polling: uses a polling algorithm which does not require external libraries. # auto: will try to use the following backends, in order: # pyinotify, gamin, polling. backend = auto # "usedns" specifies if jails should trust hostnames in logs, # warn when DNS lookups are performed, or ignore all hostnames in logs # # yes: if a hostname is encountered, a DNS lookup will be performed. # warn: if a hostname is encountered, a DNS lookup will be performed, # but it will be logged as a warning. # no: if a hostname is encountered, will not be used for banning, # but it will be logged as info. usedns = warn # This jail corresponds to the standard configuration in Fail2ban. # The mail-whois action send a notification e-mail with a whois request # in the body. [pam-generic] enabled = true filter = pam-generic action = iptables-allports[name=pam,protocol=all] logpath = /var/log/auth.log [xinetd-fail] enabled = true filter = xinetd-fail action = iptables-allports[name=xinetd,protocol=all] logpath = /var/log/daemon*log [ssh-iptables] enabled = true filter = sshd action = iptables[name=SSH, port=ssh, protocol=tcp] logpath = /var/log/auth.log maxretry = 5 [ssh-ddos] enabled = true filter = sshd-ddos action = iptables[name=SSHDDOS, port=ssh, protocol=tcp] logpath = /var/log/auth.log maxretry = 5 [dropbear] enabled = false filter = dropbear action = iptables[name=dropbear, port=ssh, protocol=tcp] logpath = /var/log/messages maxretry = 5 [proftpd-iptables] enabled = false filter = proftpd action = iptables[name=ProFTPD, port=ftp, protocol=tcp] sendmail-whois[name=ProFTPD, [email protected]] logpath = /var/log/proftpd/proftpd.log maxretry = 6 [gssftpd-iptables] enabled = false filter = gssftpd action = iptables[name=GSSFTPd, port=ftp, protocol=tcp] sendmail-whois[name=GSSFTPd, [email protected]] logpath = /var/log/daemon.log maxretry = 6 [pure-ftpd] enabled = false filter = pure-ftpd action = iptables[name=pureftpd, port=ftp, protocol=tcp] logpath = /var/log/pureftpd.log maxretry = 6 [wuftpd] enabled = false filter = wuftpd action = iptables[name=wuftpd, port=ftp, protocol=tcp] logpath = /var/log/daemon.log maxretry = 6 # This jail forces the backend to "polling". [sasl-iptables] enabled = false filter = postfix-sasl backend = polling action = iptables[name=sasl, port=smtp, protocol=tcp] sendmail-whois[name=sasl, [email protected]] logpath = /var/log/mail.log # ASSP SMTP Proxy Jail [assp] enabled = false filter = assp action = iptables-multiport[name=assp,port="25,465,587"] logpath = /root/path/to/assp/logs/maillog.txt # Here we use TCP-Wrappers instead of Netfilter/Iptables. "ignoreregex" is # used to avoid banning the user "myuser". [ssh-tcpwrapper] enabled = false filter = sshd action = hostsdeny[daemon_list=sshd] sendmail-whois[name=SSH, [email protected]] ignoreregex = for myuser from logpath = /var/log/sshd.log # Here we use blackhole routes for not requiring any additional kernel support # to store large volumes of banned IPs [ssh-route] enabled = false filter = sshd action = route logpath = /var/log/sshd.log maxretry = 5 # Here we use a combination of Netfilter/Iptables and IPsets # for storing large volumes of banned IPs # # IPset comes in two versions. See ipset -V for which one to use # requires the ipset package and kernel support. [ssh-iptables-ipset4] enabled = false filter = sshd action = iptables-ipset-proto4[name=SSH, port=ssh, protocol=tcp] logpath = /var/log/sshd.log maxretry = 5 [ssh-iptables-ipset6] enabled = false filter = sshd action = iptables-ipset-proto6[name=SSH, port=ssh, protocol=tcp, bantime=600] logpath = /var/log/sshd.log maxretry = 5 # bsd-ipfw is ipfw used by BSD. It uses ipfw tables. # table number must be unique. # # This will create a deny rule for that table ONLY if a rule # for the table doesn't ready exist. # [ssh-bsd-ipfw] enabled = false filter = sshd action = bsd-ipfw[port=ssh,table=1] logpath = /var/log/auth.log maxretry = 5 # This jail demonstrates the use of wildcards in "logpath". # Moreover, it is possible to give other files on a new line. [apache-tcpwrapper] enabled = true filter = apache-auth action = hostsdeny logpath = /var/log/apache2/*error.log* /www/logs/*error_log maxretry = 10 [apache-modsecurity] enabled = false filter = apache-modsecurity action = iptables-multiport[name=apache-modsecurity,port="80,443"] logpath = /var/log/apache2/*error.log* /home/www/myhomepage/error.log maxretry = 2 [apache-overflows] enabled = true filter = apache-overflows action = iptables-multiport[name=apache-overflows,port="80,443"] logpath = /var/log/apache2/*error.log* /www/logs/*error_log maxretry = 6 [apache-nohome] enabled = true filter = apache-nohome action = iptables-multiport[name=apache-nohome,port="80,443"] logpath = /var/log/apache2/*error.log* /www/logs/*error_log maxretry = 6 [nginx-http-auth] enabled = false filter = nginx-http-auth action = iptables-multiport[name=nginx-http-auth,port="80,443"] logpath = /var/log/nginx/error.log [squid] enabled = false filter = squid action = iptables-multiport[name=squid,port="80,443,8080"] logpath = /var/log/squid/access.log #home/www/myhomepage/error.lohome/www/myhomepage/error.logg The hosts.deny path can be defined with the "file" argument if it is # not in /etc. [postfix-tcpwrapper] enabled = false filter = postfix action = hostsdeny[file=/not/a/standard/path/hosts.deny] sendmail[name=Postfix, [email protected]] logpath = /var/log/postfix.log bantime = 300 [cyrus-imap] enabled = false filter = cyrus-imap action = iptables-multiport[name=cyrus-imap,port="143,993"] logpath = /var/log/mail*log [courierlogin] enabled = false filter = courierlogin action = iptables-multiport[name=courierlogin,port="25,110,143,465,587,993,995" ] logpath = /var/log/mail*log [couriersmtp] enabled = false filter = couriersmtp action = iptables-multiport[name=couriersmtp,port="25,465,587"] logpath = /var/log/mail*log [qmail-rbl] enabled = false filter = qmail action = iptables-multiport[name=qmail-rbl,port="25,465,587"] logpath = /service/qmail/log/main/current [sieve] enabled = false filter = sieve action = iptables-multiport[name=sieve,port="25,465,587"] logpath = /var/log/mail*log # Do not ban anybody. Just report information about the remote host. # A notification is sent at most every 600 seconds (bantime). [vsftpd-notification] enabled = false filter = vsftpd action = sendmail-whois[name=VSFTPD, [email protected]] logpath = /var/log/vsftpd.log maxretry = 5 bantime = 1800 # Same as above but with banning the IP address. [vsftpd-iptables] enabled = false filter = vsftpd action = iptables[name=VSFTPD, port=ftp, protocol=tcp] sendmail-whois[name=VSFTPD, [email protected]] logpath = /var/log/vsftpd.log maxretry = 5 bantime = 1800 # Ban hosts which agent identifies spammer robots crawling the web # for email addresses. The mail outputs are buffered. [apache-badbots] enabled = true filter = apache-badbots action = iptables-multiport[name=BadBots, port="http,https"] logpath = /var/log/apache2/*error.log* /www/logs/*error_log bantime = 17800 maxretry = 1 # Use shorewall instead of iptables. [apache-shorewall] enabled = false filter = apache-noscript action = shorewall sendmail[name=Postfix, [email protected]] logpath = /var/log/apache2/error_log # Monitor roundcube server [roundcube-iptables] enabled = false filter = roundcube-auth action = iptables-multiport[name=RoundCube, port="http,https"] logpath = /var/log/roundcube/userlogins # Monitor SOGo groupware server [sogo-iptables] enabled = false filter = sogo-auth # without proxy this would be: # port = 20000 action = iptables-multiport[name=SOGo, port="http,https"] logpath = /var/log/sogo/sogo.log [groupoffice] enabled = false filter = groupoffice action = iptables-multiport[name=groupoffice, port="http,https"]