Guest User

Untitled

a guest
Dec 30th, 2021
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 11.30 KB | None | 0 0
  1. #
  2. # WARNING: heavily refactored in 0.9.0 release.  Please review and
  3. #          customize settings for your setup.
  4. #
  5. # Changes:  in most of the cases you should not modify this
  6. #           file, but provide customizations in jail.local file,
  7. #           or separate .conf files under jail.d/ directory, e.g.:
  8. #
  9. # HOW TO ACTIVATE JAILS:
  10. #
  11. # YOU SHOULD NOT MODIFY THIS FILE.
  12. #
  13. # It will probably be overwritten or improved in a distribution update.
  14. #
  15. # Provide customizations in a jail.local file or a jail.d/customisation.local.
  16. # For example to change the default bantime for all jails and to enable the
  17. # ssh-iptables jail the following (uncommented) would appear in the .local file.
  18. # See man 5 jail.conf for details.
  19. #
  20. # [DEFAULT]
  21. # bantime = 1h
  22. #
  23. # [sshd]
  24. # enabled = true
  25. #
  26. # See jail.conf(5) man page for more information
  27.  
  28.  
  29.  
  30. # Comments: use '#' for comment lines and ';' (following a space) for inline comments
  31.  
  32.  
  33. [INCLUDES]
  34.  
  35. #before = paths-distro.conf
  36. before = paths-arch.conf
  37.  
  38. # The DEFAULT allows a global definition of the options. They can be overridden
  39. # in each jail afterwards.
  40.  
  41. [DEFAULT]
  42.  
  43. #
  44. # MISCELLANEOUS OPTIONS
  45. #
  46.  
  47. # "bantime.increment" allows to use database for searching of previously banned ip's to increase a
  48. # default ban time using special formula, default it is banTime * 1, 2, 4, 8, 16, 32...
  49. #bantime.increment = true
  50.  
  51. # "bantime.rndtime" is the max number of seconds using for mixing with random time
  52. # to prevent "clever" botnets calculate exact time IP can be unbanned again:
  53. #bantime.rndtime =
  54.  
  55. # "bantime.maxtime" is the max number of seconds using the ban time can reach (doesn't grow further)
  56. #bantime.maxtime =
  57.  
  58. # "bantime.factor" is a coefficient to calculate exponent growing of the formula or common multiplier,
  59. # default value of factor is 1 and with default value of formula, the ban time
  60. # grows by 1, 2, 4, 8, 16 ...
  61. #bantime.factor = 1
  62.  
  63. # "bantime.formula" used by default to calculate next value of ban time, default value below,
  64. # the same ban time growing will be reached by multipliers 1, 2, 4, 8, 16, 32...
  65. #bantime.formula = ban.Time * (1<<(ban.Count if ban.Count<20 else 20)) * banFactor
  66. #
  67. # more aggressive example of formula has the same values only for factor "2.0 / 2.885385" :
  68. #bantime.formula = ban.Time * math.exp(float(ban.Count+1)*banFactor)/math.exp(1*banFactor)
  69.  
  70. # "bantime.multipliers" used to calculate next value of ban time instead of formula, coresponding
  71. # previously ban count and given "bantime.factor" (for multipliers default is 1);
  72. # following example grows ban time by 1, 2, 4, 8, 16 ... and if last ban count greater as multipliers count,
  73. # always used last multiplier (64 in example), for factor '1' and original ban time 600 - 10.6 hours
  74. #bantime.multipliers = 1 2 4 8 16 32 64
  75. # following example can be used for small initial ban time (bantime=60) - it grows more aggressive at begin,
  76. # for bantime=60 the multipliers are minutes and equal: 1 min, 5 min, 30 min, 1 hour, 5 hour, 12 hour, 1 day, 2 day
  77. #bantime.multipliers = 1 5 30 60 300 720 1440 2880
  78.  
  79. # "bantime.overalljails" (if true) specifies the search of IP in the database will be executed
  80. # cross over all jails, if false (dafault), only current jail of the ban IP will be searched
  81. #bantime.overalljails = false
  82.  
  83. # --------------------
  84.  
  85. # "ignoreself" specifies whether the local resp. own IP addresses should be ignored
  86. # (default is true). Fail2ban will not ban a host which matches such addresses.
  87. #ignoreself = true
  88.  
  89. # "ignoreip" can be a list of IP addresses, CIDR masks or DNS hosts. Fail2ban
  90. # will not ban a host which matches an address in this list. Several addresses
  91. # can be defined using space (and/or comma) separator.
  92. #ignoreip = 127.0.0.1/8 ::1
  93.  
  94. # External command that will take an tagged arguments to ignore, e.g. <ip>,
  95. # and return true if the IP is to be ignored. False otherwise.
  96. #
  97. # ignorecommand = /path/to/command <ip>
  98. ignorecommand =
  99.  
  100. # "bantime" is the number of seconds that a host is banned.
  101. bantime  = 1m
  102.  
  103. # A host is banned if it has generated "maxretry" during the last "findtime"
  104. # seconds.
  105. findtime  = 1m
  106.  
  107. # "maxretry" is the number of failures before a host get banned.
  108. maxretry = 3
  109.  
  110. # "maxmatches" is the number of matches stored in ticket (resolvable via tag <matches> in actions).
  111. maxmatches = %(maxretry)s
  112.  
  113. # "backend" specifies the backend used to get files modification.
  114. # Available options are "pyinotify", "gamin", "polling", "systemd" and "auto".
  115. # This option can be overridden in each jail as well.
  116. #
  117. # pyinotify: requires pyinotify (a file alteration monitor) to be installed.
  118. #              If pyinotify is not installed, Fail2ban will use auto.
  119. # gamin:     requires Gamin (a file alteration monitor) to be installed.
  120. #              If Gamin is not installed, Fail2ban will use auto.
  121. # polling:   uses a polling algorithm which does not require external libraries.
  122. # systemd:   uses systemd python library to access the systemd journal.
  123. #              Specifying "logpath" is not valid for this backend.
  124. #              See "journalmatch" in the jails associated filter config
  125. # auto:      will try to use the following backends, in order:
  126. #              pyinotify, gamin, polling.
  127. #
  128. # Note: if systemd backend is chosen as the default but you enable a jail
  129. #       for which logs are present only in its own log files, specify some other
  130. #       backend for that jail (e.g. polling) and provide empty value for
  131. #       journalmatch. See https://github.com/fail2ban/fail2ban/issues/959#issuecomment-74901200
  132. backend = auto
  133.  
  134. # "usedns" specifies if jails should trust hostnames in logs,
  135. #   warn when DNS lookups are performed, or ignore all hostnames in logs
  136. #
  137. # yes:   if a hostname is encountered, a DNS lookup will be performed.
  138. # warn:  if a hostname is encountered, a DNS lookup will be performed,
  139. #        but it will be logged as a warning.
  140. # no:    if a hostname is encountered, will not be used for banning,
  141. #        but it will be logged as info.
  142. # raw:   use raw value (no hostname), allow use it for no-host filters/actions (example user)
  143. usedns = warn
  144.  
  145. # "logencoding" specifies the encoding of the log files handled by the jail
  146. #   This is used to decode the lines from the log file.
  147. #   Typical examples:  "ascii", "utf-8"
  148. #
  149. #   auto:   will use the system locale setting
  150. logencoding = auto
  151.  
  152. # "enabled" enables the jails.
  153. #  By default all jails are disabled, and it should stay this way.
  154. #  Enable only relevant to your setup jails in your .local or jail.d/*.conf
  155. #
  156. # true:  jail will be enabled and log files will get monitored for changes
  157. # false: jail is not enabled
  158. enabled = false
  159.  
  160.  
  161. # "mode" defines the mode of the filter (see corresponding filter implementation for more info).
  162. mode = normal
  163.  
  164. # "filter" defines the filter to use by the jail.
  165. #  By default jails have names matching their filter name
  166. #
  167. filter = %(__name__)s[mode=%(mode)s]
  168.  
  169.  
  170. #
  171. # ACTIONS
  172. #
  173.  
  174. # Some options used for actions
  175.  
  176. # Destination email address used solely for the interpolations in
  177. # jail.{conf,local,d/*} configuration files.
  178. destemail = root@localhost
  179.  
  180. # Sender email address used solely for some actions
  181. sender = root@<fq-hostname>
  182.  
  183. # E-mail action. Since 0.8.1 Fail2Ban uses sendmail MTA for the
  184. # mailing. Change mta configuration parameter to mail if you want to
  185. # revert to conventional 'mail'.
  186. mta = sendmail
  187.  
  188. # Default protocol
  189. protocol = tcp
  190.  
  191. # Specify chain where jumps would need to be added in ban-actions expecting parameter chain
  192. chain = <known/chain>
  193.  
  194. # Ports to be banned
  195. # Usually should be overridden in a particular jail
  196. port = 0:65535
  197.  
  198. # Format of user-agent https://tools.ietf.org/html/rfc7231#section-5.5.3
  199. fail2ban_agent = Fail2Ban/%(fail2ban_version)s
  200.  
  201. #
  202. # Action shortcuts. To be used to define action parameter
  203.  
  204. # Default banning action (e.g. iptables, iptables-new,
  205. # iptables-multiport, shorewall, etc) It is used to define
  206. # action_* variables. Can be overridden globally or per
  207. # section within jail.local file
  208. banaction = iptables-multiport
  209. banaction_allports = iptables-allports
  210.  
  211. # The simplest action to take: ban only
  212. action_ = %(banaction)s[port="%(port)s", protocol="%(protocol)s", chain="%(chain)s"]
  213.  
  214. # ban & send an e-mail with whois report to the destemail.
  215. action_mw = %(action_)s
  216.             %(mta)s-whois[sender="%(sender)s", dest="%(destemail)s", protocol="%(protocol)s", chain="%(chain)s"]
  217.  
  218. # ban & send an e-mail with whois report and relevant log lines
  219. # to the destemail.
  220. action_mwl = %(action_)s
  221.              %(mta)s-whois-lines[sender="%(sender)s", dest="%(destemail)s", logpath="%(logpath)s", chain="%(chain)s"]
  222.  
  223. # See the IMPORTANT note in action.d/xarf-login-attack for when to use this action
  224. #
  225. # ban & send a xarf e-mail to abuse contact of IP address and include relevant log lines
  226. # to the destemail.
  227. action_xarf = %(action_)s
  228.              xarf-login-attack[service=%(__name__)s, sender="%(sender)s", logpath="%(logpath)s", port="%(port)s"]
  229.  
  230. # ban IP on CloudFlare & send an e-mail with whois report and relevant log lines
  231. # to the destemail.
  232. action_cf_mwl = cloudflare[cfuser="%(cfemail)s", cftoken="%(cfapikey)s"]
  233.                 %(mta)s-whois-lines[sender="%(sender)s", dest="%(destemail)s", logpath="%(logpath)s", chain="%(chain)s"]
  234.  
  235. # Report block via blocklist.de fail2ban reporting service API
  236. #
  237. # See the IMPORTANT note in action.d/blocklist_de.conf for when to use this action.
  238. # Specify expected parameters in file action.d/blocklist_de.local or if the interpolation
  239. # `action_blocklist_de` used for the action, set value of `blocklist_de_apikey`
  240. # in your `jail.local` globally (section [DEFAULT]) or per specific jail section (resp. in
  241. # corresponding jail.d/my-jail.local file).
  242. #
  243. action_blocklist_de  = blocklist_de[email="%(sender)s", service="%(__name__)s", apikey="%(blocklist_de_apikey)s", agent="%(fail2ban_agent)s"]
  244.  
  245. # Report ban via badips.com, and use as blacklist
  246. #
  247. # See BadIPsAction docstring in config/action.d/badips.py for
  248. # documentation for this action.
  249. #
  250. # NOTE: This action relies on banaction being present on start and therefore
  251. # should be last action defined for a jail.
  252. #
  253. action_badips = badips.py[category="%(__name__)s", banaction="%(banaction)s", agent="%(fail2ban_agent)s"]
  254. #
  255. # Report ban via badips.com (uses action.d/badips.conf for reporting only)
  256. #
  257. action_badips_report = badips[category="%(__name__)s", agent="%(fail2ban_agent)s"]
  258.  
  259. # Report ban via abuseipdb.com.
  260. #
  261. # See action.d/abuseipdb.conf for usage example and details.
  262. #
  263. action_abuseipdb = abuseipdb
  264.  
  265. # Choose default action.  To change, just override value of 'action' with the
  266. # interpolation to the chosen action shortcut (e.g.  action_mw, action_mwl, etc) in jail.local
  267. # globally (section [DEFAULT]) or per specific section
  268. action = %(action_)s
  269.  
  270.  
  271. #
  272. # JAILS
  273. #
  274.  
  275. #
  276. # SSH servers
  277. #
  278.  
  279. [sshd]
  280.  
  281. # To use more aggressive sshd modes set filter parameter "mode" in jail.local:
  282. # normal (default), ddos, extra or aggressive (combines all).
  283. # See "tests/files/logs/sshd" or "filter.d/sshd.conf" for usage example and details.
  284. #mode   = normal
  285. enabled = true
  286. port    = 1234,ssh
  287. logpath = /var/log/fail2ban.log
  288. maxretry = 3
  289. backend = %(sshd_backend)s
  290. filter = sshd
  291.  
  292. [dropbear]
  293.  
  294. port     = ssh
  295. logpath  = %(dropbear_log)s
  296. backend  = %(dropbear_backend)s
  297.  
  298.  
  299. [selinux-ssh]
  300.  
  301. port     = ssh
  302. logpath  = %(auditd_log)s
  303.  
  304.  
  305. #
  306. # HTTP servers
  307. #
Advertisement
Add Comment
Please, Sign In to add comment