Advertisement
Guest User

Untitled

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