matrix: Add fail2ban jail

Test:

- Setup Matrix on a VPS with a FQDN and a valid LE certificate, then add these
configs to fail2ban.

- On a production server apply the changes of MR !2296

- Setup the fail2ban filter and jail, then restart fail2ban

- Trying to log in unsuccessfully from FluffyChat leads to a 10 min ban

Result:

`sudo fail2ban-client status matrix-synapse-auth-freedombox` returns the
following output, but the server actually remains accessible in every way.

```
Status for the jail: matrix-synapse-auth-freedombox
|- Filter
|  |- Currently failed: 1
|  |- Total failed:     11
|  `- Journal matches:
`- Actions
   |- Currently banned: 1
   |- Total banned:     1
   `- Banned IP list:   MY IP
```
Signed-off-by: nbenedek <contact@nbenedek.me>
This commit is contained in:
nbenedek 2022-09-24 17:43:22 +02:00 committed by Sunil Mohan Adapa
parent ecb4ce0733
commit 95f2d372d8
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 11 additions and 0 deletions

View File

@ -0,0 +1,7 @@
[INCLUDES]
before = common.conf
[Definition]
_daemon = apache-access
prefregex = %(__prefix_line)s
failregex = \S+ <HOST> - \S+ \[[^\]]*\] "POST /_matrix/client/.*/login HTTP/\S+" 403

View File

@ -0,0 +1,4 @@
[matrix-auth-freedombox]
enabled = true
port = http,https
journalmatch = SYSLOG_IDENTIFIER=apache-access