Advertisement
aka144

jail.conf

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