2023-03-23 21:14:53 +01:00
|
|
|
---
|
2023-04-12 10:29:29 +02:00
|
|
|
# definitions are just a place to put chunks of conf you want to reuse in another place
|
|
|
|
# they're not readed by reaction
|
2023-03-23 21:14:53 +01:00
|
|
|
definitions:
|
2023-04-27 12:38:57 +02:00
|
|
|
- &iptablesban [ "iptables" "-w" "-A" "reaction" "1" "-s" "<ip>" "-j" "DROP" ]
|
|
|
|
- &iptablesunban [ "iptables" "-w" "-D" "reaction" "1" "-s" "<ip>" "-j" "DROP" ]
|
2023-03-23 21:14:53 +01:00
|
|
|
|
2023-04-12 10:29:29 +02:00
|
|
|
# patterns are substitued in regexes.
|
|
|
|
# when a filter performs an action, it replaces the found pattern
|
2023-03-24 17:36:41 +01:00
|
|
|
patterns:
|
2023-08-21 23:33:56 +02:00
|
|
|
ip:
|
|
|
|
regex: '(?:(?:[0-9]{1,3}\.){3}[0-9]{1,3})|(?:[0-9a-fA-F:]{2,90})'
|
|
|
|
ignore:
|
|
|
|
- 127.0.0.1
|
|
|
|
- ::1
|
2023-03-23 21:14:53 +01:00
|
|
|
|
2023-04-12 10:29:29 +02:00
|
|
|
# streams are command that are run
|
|
|
|
# their output will be used by one or more filters
|
2023-03-23 21:14:53 +01:00
|
|
|
streams:
|
2023-04-12 10:29:29 +02:00
|
|
|
# streams have a user-defined name
|
2023-04-11 13:01:02 +02:00
|
|
|
ssh:
|
2023-04-11 13:14:46 +02:00
|
|
|
# note that if the command is not in environment's `PATH`
|
|
|
|
# its full path must be given.
|
2023-04-11 13:01:02 +02:00
|
|
|
cmd: [ "journalctl" "-fu" "sshd.service" ]
|
2023-04-12 10:29:29 +02:00
|
|
|
# filters are a set of regexes on a stream
|
|
|
|
# when a regex matches, it will trigger the filter's actions
|
2023-03-23 21:14:53 +01:00
|
|
|
filters:
|
2023-04-12 10:29:29 +02:00
|
|
|
# filters have a user-defined name
|
2023-04-11 13:01:02 +02:00
|
|
|
failedlogin:
|
2023-03-24 00:27:51 +01:00
|
|
|
regex:
|
2023-04-11 13:01:02 +02:00
|
|
|
- authentication failure;.*rhost=<ip>
|
2023-04-12 10:29:29 +02:00
|
|
|
# if retry and retry-period are defined,
|
|
|
|
# the actions will only take place if a same pattern is
|
|
|
|
# found `retry` times in a `retry-period` interval
|
2023-04-11 13:01:02 +02:00
|
|
|
retry: 3
|
2023-04-12 10:29:29 +02:00
|
|
|
# format is defined here: https://pkg.go.dev/time#ParseDuration
|
2023-04-11 13:01:02 +02:00
|
|
|
retry-period: 6h
|
2023-03-23 21:14:53 +01:00
|
|
|
actions:
|
2023-04-12 10:29:29 +02:00
|
|
|
# actions have a user-defined name
|
2023-04-11 13:01:02 +02:00
|
|
|
ban:
|
2023-04-12 10:29:29 +02:00
|
|
|
# YAML substitutes *reference by the value at &reference
|
2023-04-11 13:01:02 +02:00
|
|
|
cmd: *iptablesban
|
|
|
|
unban:
|
|
|
|
cmd: *iptablesunban
|
2023-04-12 10:29:29 +02:00
|
|
|
# if after is defined, the action will not take place immediately, but after a specified duration.
|
|
|
|
# same format as retry-period
|
2023-05-05 15:12:24 +02:00
|
|
|
after: 48h
|
2023-07-12 17:45:16 +02:00
|
|
|
# let's say reaction is quitting. does it run all those pending commands which had an `after` duration set?
|
|
|
|
# if you want reaction to run those pending commands before exiting, you can set this:
|
|
|
|
# onexit: true
|
|
|
|
# (defaults to false)
|
|
|
|
# here it is not useful because we will flush the chain containing the bans anyway (see ./reaction.service)
|