Advertisement
starbeamrainbowlabs

Fail2ban configuration file

Apr 28th, 2015
1,432
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
INI file 14.08 KB | None | 0 0
  1. # Fail2Ban configuration file.
  2. #
  3. # This file was composed for Debian systems from the original one
  4. # provided now under /usr/share/doc/fail2ban/examples/jail.conf
  5. # for additional examples.
  6. #
  7. # Comments: use '#' for comment lines and ';' for inline comments
  8. #
  9. # To avoid merges during upgrades DO NOT MODIFY THIS FILE
  10. # and rather provide your changes in /etc/fail2ban/jail.local
  11. #
  12.  
  13. # The DEFAULT allows a global definition of the options. They can be overridden
  14. # in each jail afterwards.
  15.  
  16. [DEFAULT]
  17.  
  18. # "ignoreip" can be an IP address, a CIDR mask or a DNS host. Fail2ban will not
  19. # ban a host which matches an address in this list. Several addresses can be
  20. # defined using space separator.
  21. ignoreip = 127.0.0.1/8 safe.starbeamrainbowlabs.com
  22.  
  23. # External command that will take an tagged arguments to ignore, e.g. <ip>,
  24. # and return true if the IP is to be ignored. False otherwise.
  25. #
  26. # ignorecommand = /path/to/command <ip>
  27. ignorecommand =
  28.  
  29. # "bantime" is the number of seconds that a host is banned.
  30. # 1 hour
  31. bantime  = 3600
  32.  
  33. # A host is banned if it has generated "maxretry" during the last "findtime"
  34. # seconds.
  35. # 5 minutes
  36. findtime = 300
  37. maxretry = 5
  38.  
  39. # "backend" specifies the backend used to get files modification.
  40. # Available options are "pyinotify", "gamin", "polling" and "auto".
  41. # This option can be overridden in each jail as well.
  42. #
  43. # pyinotify: requires pyinotify (a file alteration monitor) to be installed.
  44. #            If pyinotify is not installed, Fail2ban will use auto.
  45. # gamin:     requires Gamin (a file alteration monitor) to be installed.
  46. #            If Gamin is not installed, Fail2ban will use auto.
  47. # polling:   uses a polling algorithm which does not require external libraries.
  48. # auto:      will try to use the following backends, in order:
  49. #            pyinotify, gamin, polling.
  50. backend = auto
  51.  
  52. # "usedns" specifies if jails should trust hostnames in logs,
  53. #   warn when reverse DNS lookups are performed, or ignore all hostnames in logs
  54. #
  55. # yes:   if a hostname is encountered, a reverse DNS lookup will be performed.
  56. # warn:  if a hostname is encountered, a reverse DNS lookup will be performed,
  57. #        but it will be logged as a warning.
  58. # no:    if a hostname is encountered, will not be used for banning,
  59. #        but it will be logged as info.
  60. usedns = warn
  61.  
  62. #
  63. # Destination email address used solely for the interpolations in
  64. # jail.{conf,local} configuration files.
  65. destemail = <email address>
  66.  
  67. #
  68. # Name of the sender for mta actions
  69. sendername = Fail2Ban
  70.  
  71. # Email address of the sender
  72. sender = <email address>
  73.  
  74. #
  75. # ACTIONS
  76. #
  77.  
  78. # Default banning action (e.g. iptables, iptables-new,
  79. # iptables-multiport, shorewall, etc) It is used to define
  80. # action_* variables. Can be overridden globally or per
  81. # section within jail.local file
  82. banaction = iptables-multiport
  83.  
  84. # email action. Since 0.8.1 upstream fail2ban uses sendmail
  85. # MTA for the mailing. Change mta configuration parameter to mail
  86. # if you want to revert to conventional 'mail'.
  87. mta = sendmail
  88.  
  89. # Default protocol
  90. protocol = tcp
  91.  
  92. # Specify chain where jumps would need to be added in iptables-* actions
  93. chain = INPUT
  94.  
  95. #
  96. # Action shortcuts. To be used to define action parameter
  97.  
  98. # The simplest action to take: ban only
  99. action_ = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
  100.  
  101. # ban & send an e-mail with whois report to the destemail.
  102. action_mw = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
  103.               %(mta)s-whois[name=%(__name__)s, dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s", sendername="%(sendername)s"]
  104.  
  105. # ban & send an e-mail with whois report and relevant log lines
  106. # to the destemail.
  107. action_mwl = %(banaction)s[name=%(__name__)s, port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
  108.                %(mta)s-whois-lines[name=%(__name__)s, dest="%(destemail)s", logpath=%(logpath)s, chain="%(chain)s", sendername="%(sendername)s"]
  109.  
  110. # Choose default action.  To change, just override value of 'action' with the
  111. # interpolation to the chosen action shortcut (e.g.  action_mw, action_mwl, etc) in jail.local
  112. # globally (section [DEFAULT]) or per specific section
  113. action = %(action_mwl)s
  114.  
  115. #
  116. # JAILS
  117. #
  118.  
  119. # Next jails corresponds to the standard configuration in Fail2ban 0.6 which
  120. # was shipped in Debian. Enable any defined here jail by including
  121. #
  122. # [SECTION_NAME]
  123. # enabled = true
  124.  
  125. #
  126. # in /etc/fail2ban/jail.local.
  127. #
  128. # Optionally you may override any other parameter (e.g. banaction,
  129. # action, port, logpath, etc) in that section within jail.local
  130.  
  131. [ssh]
  132.  
  133. enabled  = true
  134. port     = 2403
  135. filter   = sshd
  136. logpath  = /var/log/auth.log
  137. maxretry = 5
  138.  
  139. [dropbear]
  140.  
  141. enabled  = false
  142. port     = ssh
  143. filter   = dropbear
  144. logpath  = /var/log/auth.log
  145. maxretry = 6
  146.  
  147. # Generic filter for pam. Has to be used with action which bans all ports
  148. # such as iptables-allports, shorewall
  149. [pam-generic]
  150.  
  151. enabled  = false
  152. # pam-generic filter can be customized to monitor specific subset of 'tty's
  153. filter   = pam-generic
  154. # port actually must be irrelevant but lets leave it all for some possible uses
  155. #port     = all
  156. banaction = iptables-allports
  157. port     = anyport
  158. logpath  = /var/log/auth.log
  159. maxretry = 6
  160.  
  161. [xinetd-fail]
  162.  
  163. enabled   = false
  164. filter    = xinetd-fail
  165. port      = all
  166. banaction = iptables-multiport-log
  167. logpath   = /var/log/daemon.log
  168. maxretry  = 2
  169.  
  170.  
  171. [ssh-ddos]
  172.  
  173. enabled  = false
  174. port     = ssh
  175. filter   = sshd-ddos
  176. logpath  = /var/log/auth.log
  177. maxretry = 6
  178.  
  179.  
  180. # Here we use blackhole routes for not requiring any additional kernel support
  181. # to store large volumes of banned IPs
  182.  
  183. [ssh-route]
  184.  
  185. enabled = false
  186. filter = sshd
  187. action = route
  188. logpath = /var/log/sshd.log
  189. maxretry = 6
  190.  
  191. # Here we use a combination of Netfilter/Iptables and IPsets
  192. # for storing large volumes of banned IPs
  193. #
  194. # IPset comes in two versions. See ipset -V for which one to use
  195. # requires the ipset package and kernel support.
  196. [ssh-iptables-ipset4]
  197.  
  198. enabled  = false
  199. port     = ssh
  200. filter   = sshd
  201. banaction = iptables-ipset-proto4
  202. logpath  = /var/log/sshd.log
  203. maxretry = 6
  204.  
  205. [ssh-iptables-ipset6]
  206.  
  207. enabled  = false
  208. port     = ssh
  209. filter   = sshd
  210. banaction = iptables-ipset-proto6
  211. logpath  = /var/log/sshd.log
  212. maxretry = 6
  213.  
  214.  
  215. #
  216. # HTTP servers
  217. #
  218.  
  219. [apache]
  220.  
  221. enabled  = false
  222. port     = http,https
  223. filter   = apache-auth
  224. logpath  = /var/log/apache*/*error.log
  225. maxretry = 6
  226.  
  227. # default action is now multiport, so apache-multiport jail was left
  228. # for compatibility with previous (<0.7.6-2) releases
  229. [apache-multiport]
  230.  
  231. enabled   = false
  232. port      = http,https
  233. filter    = apache-auth
  234. logpath   = /var/log/apache*/*error.log
  235. maxretry  = 6
  236.  
  237. [apache-noscript]
  238.  
  239. enabled  = false
  240. port     = http,https
  241. filter   = apache-noscript
  242. logpath  = /var/log/apache*/*error.log
  243. maxretry = 6
  244.  
  245. [apache-overflows]
  246.  
  247. enabled  = false
  248. port     = http,https
  249. filter   = apache-overflows
  250. logpath  = /var/log/apache*/*error.log
  251. maxretry = 2
  252.  
  253. [apache-modsecurity]
  254.  
  255. enabled  = false
  256. filter   = apache-modsecurity
  257. port     = http,https
  258. logpath  = /var/log/apache*/*error.log
  259. maxretry = 2
  260.  
  261. [apache-nohome]
  262.  
  263. enabled  = false
  264. filter   = apache-nohome
  265. port     = http,https
  266. logpath  = /var/log/apache*/*error.log
  267. maxretry = 2
  268.  
  269. # Ban attackers that try to use PHP's URL-fopen() functionality
  270. # through GET/POST variables. - Experimental, with more than a year
  271. # of usage in production environments.
  272.  
  273. [php-url-fopen]
  274.  
  275. enabled = false
  276. port    = http,https
  277. filter  = php-url-fopen
  278. logpath = /var/www/*/logs/access_log
  279.  
  280. # A simple PHP-fastcgi jail which works with lighttpd.
  281. # If you run a lighttpd server, then you probably will
  282. # find these kinds of messages in your error_log:
  283. #   ALERT – tried to register forbidden variable ‘GLOBALS’
  284. #   through GET variables (attacker '1.2.3.4', file '/var/www/default/htdocs/index.php')
  285.  
  286. [lighttpd-fastcgi]
  287.  
  288. enabled = false
  289. port    = http,https
  290. filter  = lighttpd-fastcgi
  291. logpath = /var/log/lighttpd/error.log
  292.  
  293. # Same as above for mod_auth
  294. # It catches wrong authentifications
  295.  
  296. [lighttpd-auth]
  297.  
  298. enabled = false
  299. port    = http,https
  300. filter  = suhosin
  301. logpath = /var/log/lighttpd/error.log
  302.  
  303. [nginx-http-auth]
  304.  
  305. enabled = false
  306. filter  = nginx-http-auth
  307. port    = http,https
  308. logpath = /var/log/nginx/error.log
  309.  
  310. # Monitor roundcube server
  311.  
  312. [roundcube-auth]
  313.  
  314. enabled  = false
  315. filter   = roundcube-auth
  316. port     = http,https
  317. logpath  = /var/log/roundcube/userlogins
  318.  
  319.  
  320. [sogo-auth]
  321.  
  322. enabled  = false
  323. filter   = sogo-auth
  324. port     = http, https
  325. # without proxy this would be:
  326. # port    = 20000
  327. logpath  = /var/log/sogo/sogo.log
  328.  
  329.  
  330. #
  331. # FTP servers
  332. #
  333.  
  334. [vsftpd]
  335.  
  336. enabled  = false
  337. port     = ftp,ftp-data,ftps,ftps-data
  338. filter   = vsftpd
  339. logpath  = /var/log/vsftpd.log
  340. # or overwrite it in jails.local to be
  341. # logpath = /var/log/auth.log
  342. # if you want to rely on PAM failed login attempts
  343. # vsftpd's failregex should match both of those formats
  344. maxretry = 6
  345.  
  346.  
  347. [proftpd]
  348.  
  349. enabled  = false
  350. port     = ftp,ftp-data,ftps,ftps-data
  351. filter   = proftpd
  352. logpath  = /var/log/proftpd/proftpd.log
  353. maxretry = 6
  354.  
  355.  
  356. [pure-ftpd]
  357.  
  358. enabled  = false
  359. port     = ftp,ftp-data,ftps,ftps-data
  360. filter   = pure-ftpd
  361. logpath  = /var/log/syslog
  362. maxretry = 6
  363.  
  364.  
  365. [wuftpd]
  366.  
  367. enabled  = false
  368. port     = ftp,ftp-data,ftps,ftps-data
  369. filter   = wuftpd
  370. logpath  = /var/log/syslog
  371. maxretry = 6
  372.  
  373.  
  374. #
  375. # Mail servers
  376. #
  377.  
  378. [postfix]
  379.  
  380. enabled  = false
  381. port     = smtp,ssmtp,submission
  382. filter   = postfix
  383. logpath  = /var/log/mail.log
  384.  
  385.  
  386. [couriersmtp]
  387.  
  388. enabled  = false
  389. port     = smtp,ssmtp,submission
  390. filter   = couriersmtp
  391. logpath  = /var/log/mail.log
  392.  
  393.  
  394. #
  395. # Mail servers authenticators: might be used for smtp,ftp,imap servers, so
  396. # all relevant ports get banned
  397. #
  398.  
  399. [courierauth]
  400.  
  401. enabled  = false
  402. port     = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
  403. filter   = courierlogin
  404. logpath  = /var/log/mail.log
  405.  
  406.  
  407. [sasl]
  408.  
  409. enabled  = false
  410. port     = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
  411. filter   = postfix-sasl
  412. # You might consider monitoring /var/log/mail.warn instead if you are
  413. # running postfix since it would provide the same log lines at the
  414. # "warn" level but overall at the smaller filesize.
  415. logpath  = /var/log/mail.log
  416.  
  417. [dovecot]
  418.  
  419. enabled = false
  420. port    = smtp,ssmtp,submission,imap2,imap3,imaps,pop3,pop3s
  421. filter  = dovecot
  422. logpath = /var/log/mail.log
  423.  
  424. # To log wrong MySQL access attempts add to /etc/my.cnf:
  425. # log-error=/var/log/mysqld.log
  426. # log-warning = 2
  427. [mysqld-auth]
  428.  
  429. enabled  = false
  430. filter   = mysqld-auth
  431. port     = 3306
  432. logpath  = /var/log/mysqld.log
  433.  
  434.  
  435. # DNS Servers
  436.  
  437.  
  438. # These jails block attacks against named (bind9). By default, logging is off
  439. # with bind9 installation. You will need something like this:
  440. #
  441. # logging {
  442. #     channel security_file {
  443. #         file "/var/log/named/security.log" versions 3 size 30m;
  444. #         severity dynamic;
  445. #         print-time yes;
  446. #     };
  447. #     category security {
  448. #         security_file;
  449. #     };
  450. # };
  451. #
  452. # in your named.conf to provide proper logging
  453.  
  454. # !!! WARNING !!!
  455. #   Since UDP is connection-less protocol, spoofing of IP and imitation
  456. #   of illegal actions is way too simple.  Thus enabling of this filter
  457. #   might provide an easy way for implementing a DoS against a chosen
  458. #   victim. See
  459. #    http://nion.modprobe.de/blog/archives/690-fail2ban-+-dns-fail.html
  460. #   Please DO NOT USE this jail unless you know what you are doing.
  461. #[named-refused-udp]
  462. #
  463. #enabled  = false
  464. #port     = domain,953
  465. #protocol = udp
  466. #filter   = named-refused
  467. #logpath  = /var/log/named/security.log
  468.  
  469. [named-refused-tcp]
  470.  
  471. enabled  = false
  472. port     = domain,953
  473. protocol = tcp
  474. filter   = named-refused
  475. logpath  = /var/log/named/security.log
  476.  
  477. [freeswitch]
  478.  
  479. enabled  = false
  480. filter   = freeswitch
  481. logpath  = /var/log/freeswitch.log
  482. maxretry = 10
  483. action   = iptables-multiport[name=freeswitch-tcp, port="5060,5061,5080,5081", protocol=tcp]
  484.            iptables-multiport[name=freeswitch-udp, port="5060,5061,5080,5081", protocol=udp]
  485.  
  486. [ejabberd-auth]
  487.  
  488. enabled  = false
  489. filter   = ejabberd-auth
  490. port     = xmpp-client
  491. protocol = tcp
  492. logpath  = /var/log/ejabberd/ejabberd.log
  493.  
  494.  
  495. # Multiple jails, 1 per protocol, are necessary ATM:
  496. # see https://github.com/fail2ban/fail2ban/issues/37
  497. [asterisk-tcp]
  498.  
  499. enabled  = false
  500. filter   = asterisk
  501. port     = 5060,5061
  502. protocol = tcp
  503. logpath  = /var/log/asterisk/messages
  504.  
  505. [asterisk-udp]
  506.  
  507. enabled  = false
  508. filter   = asterisk
  509. port     = 5060,5061
  510. protocol = udp
  511. logpath  = /var/log/asterisk/messages
  512.  
  513.  
  514. # Jail for more extended banning of persistent abusers
  515. # !!! WARNING !!!
  516. #   Make sure that your loglevel specified in fail2ban.conf/.local
  517. #   is not at DEBUG level -- which might then cause fail2ban to fall into
  518. #   an infinite loop constantly feeding itself with non-informative lines
  519. [recidive]
  520.  
  521. enabled  = false
  522. filter   = recidive
  523. logpath  = /var/log/fail2ban.log
  524. action   = iptables-allports[name=recidive]
  525.            sendmail-whois-lines[name=recidive, logpath=/var/log/fail2ban.log]
  526. bantime  = 604800  ; 1 week
  527. findtime = 86400   ; 1 day
  528. maxretry = 5
  529.  
  530. # See the IMPORTANT note in action.d/blocklist_de.conf for when to
  531. # use this action
  532. #
  533. # Report block via blocklist.de fail2ban reporting service API
  534. # See action.d/blocklist_de.conf for more information
  535. [ssh-blocklist]
  536.  
  537. enabled  = false
  538. filter   = sshd
  539. action   = iptables[name=SSH, port=ssh, protocol=tcp]
  540.            sendmail-whois[name=SSH, dest="%(destemail)s", sender="%(sender)s", sendername="%(sendername)s"]
  541.            blocklist_de[email="%(sender)s", apikey="xxxxxx", service="%(filter)s"]
  542. logpath  = /var/log/sshd.log
  543. maxretry = 20
  544.  
  545.  
  546. # consider low maxretry and a long bantime
  547. # nobody except your own Nagios server should ever probe nrpe
  548. [nagios]
  549. enabled  = false
  550. filter   = nagios
  551. action   = iptables[name=Nagios, port=5666, protocol=tcp]
  552.            sendmail-whois[name=Nagios, dest="%(destemail)s", sender="%(sender)s", sendername="%(sendername)s"]
  553. logpath  = /var/log/messages     ; nrpe.cfg may define a different log_facility
  554. maxretry = 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement