Guest User

jail.conf

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