add filter for xrdp

This commit is contained in:
Evan Linde 2022-04-07 21:34:33 -05:00
parent 2224b3db4a
commit 11768a97e9
4 changed files with 78 additions and 0 deletions

View file

@ -45,6 +45,7 @@ ver. 1.0.1-dev-1 (20??/??/??) - development nightly edition
- new options `kill-mode` and `kill` to drop established connections of intruder (see action for details, gh-3018)
* `filter.d/nginx-http-auth.conf` - extended with parameter mode, so additionally to `auth` (or `normal`)
mode `fallback` (or combined as `aggressive`) can find SSL errors while SSL handshaking, gh-2881
* `filter.d/xrdp.conf` - new filter for XRDP, an open source RDP server
ver. 0.11.2 (2020/11/23) - heal-the-world-with-security-tools

34
config/filter.d/xrdp.conf Normal file
View file

@ -0,0 +1,34 @@
#
# Fail2Ban filter for XRDP
#
# Detects login attempts with invalid credentials
#
# Requirements:
# - xrdp >= 0.9.19
# - The log level in sesman.ini should be set to `INFO` or higher
# to emit the log messages needed for this filter.
#
# Author: Evan Linde
#
[INCLUDES]
# Read common prefixes. If any customizations available -- read them from
# common.local
before = common.conf
[DEFAULT]
_daemon = xrdp-sesman
[Definition]
authfail_re = \[INFO \] AUTHFAIL: user=.+ ip=<HOST> time=\d+
failregex = ^%(__prefix_line)s%(authfail_re)s$
ignoreregex =

View file

@ -978,3 +978,9 @@ banaction = %(banaction_allports)s
[monitorix]
port = 8080
logpath = /var/log/monitorix-httpd
[xrdp]
port = 3389
logpath = /var/log/xrdp-sesman.log

View file

@ -0,0 +1,37 @@
#
# /var/log/xrdp-sesman.log -- should be about the same on any linux distro
#
# failJSON: { "time": "2022-04-07T12:11:06", "match": true, "host": "10.171.161.151"}
[20220407-12:11:06] [INFO ] AUTHFAIL: user=badtypist ip=::ffff:10.171.161.151 time=1649351466
# ip injection: 10.171.161.151 should be matched as the host; 192.168.0.1 is an innocent, injected address
# failJSON: { "time": "2022-04-07T12:11:24", "match": true, "host": "10.171.161.151", "desc": "specifying ip address as username"}
[20220407-12:11:24] [INFO ] AUTHFAIL: user=192.168.0.1 ip=::ffff:10.171.161.151 time=1649351484
# ip injection: 10.171.161.151 should be matched as the host; 192.168.0.4 is an innocent, injected address
# failJSON: { "time": "2022-04-07T12:22:02", "match": true, "host": "10.171.161.151", "desc": "more devious log injection"}
[20220407-12:22:02] [INFO ] AUTHFAIL: user=loginjector ip=192.168.0.4 time=123456789\n[20220407-12:16:59] [INFO ] AUTHFAIL: user=endinjection ip=::ffff:10.171.161.151 time=1649352122
#
# /var/log/messages -- RHEL/Fedora family
#
# failJSON: { "time": "2005-04-07T12:11:06", "match": true, "host": "10.171.161.151"}
Apr 7 12:11:06 servername xrdp-sesman[41441]: [INFO ] AUTHFAIL: user=badtypist ip=::ffff:10.171.161.151 time=1649351466
# ip injection: 10.171.161.151 should be matched as the host; 192.168.0.1 is an innocent, injected address
# failJSON: { "time": "2005-04-07T12:11:24", "match": true, "host": "10.171.161.151", "desc": "specifying ip address as username"}
Apr 7 12:11:24 servername xrdp-sesman[41441]: [INFO ] AUTHFAIL: user=192.168.0.1 ip=::ffff:10.171.161.151 time=1649351484
# ip injection: 10.171.161.151 should be matched as the host; 192.168.0.4 is an innocent, injected address
# failJSON: { "time": "2005-04-07T12:22:02", "match": true, "host": "10.171.161.151", "desc": "more devious log injection"}
Apr 7 12:22:02 servername xrdp-sesman[41441]: [INFO ] AUTHFAIL: user=loginjector ip=192.168.0.4 time=123456789\n[20220407-12:16:59] [INFO ] AUTHFAIL: user=endinjection ip=::ffff:10.171.161.151 time=1649352122
# ip injection: innocent, injected ip 192.168.0.4 in a line that shouldn't contain a host
# failJSON: { "match": false }
Apr 7 12:22:02 servername xrdp[52415]: [INFO ] xrdp_wm_log_msg: login failed for user loginjector ip=192.168.0.4 time=12345\n[20220407-12:16:59] [INFO ] AUTHFAIL: user=endinjection
# failJSON: { "match": false }
Apr 7 12:22:02 servername xrdp[52415]: [INFO ] n[20220407-12:16:59] [INFO ] AUTHFAIL: user=endinjection