Debian 11 - Fail2ban journal config nach 23.2 Upgrade?  [GELÖST]

Diskussionen zur Installation von KeyHelp.
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Habe vorhin mal eine Test Installation auf Debian 11 durchgeführt.
Was mir hier aufgefallen ist, das die KH Fail2banconfigs auf journal ausgelegt sind und F2B nicht per default läuft, auch Roundcube schreibt nicht mehr weiter die logs via config log type "file".
ERROR Backend 'systemd' failed to initialize due to No module named 'systemd'
Hab dann die Pfade & Jails angepasst wie vorher bei v 23.1, dann lief es wieder ...

Wie verhält es sich bei einem Upgrade (Debian 11) KH 23.1 auf KH 23.2, wird dann bei einem Debian 11 System die F2B configs auch auf systemd (jounal) umgestellt oder geschieht dies jetzt nur bei einer Neu Installation mit Debian 11?
User avatar
Alexander
Keyweb AG
Posts: 3842
Joined: Wed 20. Jan 2016, 02:23

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Alexander »

Wie verhält es sich bei einem Upgrade (Debian 11) KH 23.1 auf KH 23.2, wird dann bei einem Debian 11 System die F2B configs auch auf systemd (jounal) umgestellt oder geschieht dies jetzt nur bei einer Neu Installation mit Debian 11?
Nein, es wird im Zuge des Updates nicht umgestellt - nur bei Neuinstallation und Dist-Upgrade.
Steht aber auch so im Changelog.

---

Ungeachtet dessen sollte bei Debian 11 aber alles out of the box laufen.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Alexander wrote: Thu 5. Oct 2023, 16:15
Wie verhält es sich bei einem Upgrade (Debian 11) KH 23.1 auf KH 23.2, wird dann bei einem Debian 11 System die F2B configs auch auf systemd (jounal) umgestellt oder geschieht dies jetzt nur bei einer Neu Installation mit Debian 11?
Nein, es wird im Zuge des Updates nicht umgestellt - nur bei Neuinstallation und Dist-Upgrade.
Steht aber auch so im Changelog.
Ungeachtet dessen sollte bei Debian 11 aber alles out of the box laufen.
Danke Alex!
Könnte sein dass ich aus alter Gewohnheit die jail.conf als jail.local kopiert habe, ist eine jeweilige jail.local als OS config im installer hinterlegt?
Ich teste es gleich nochmal ;-)
User avatar
Alexander
Keyweb AG
Posts: 3842
Joined: Wed 20. Jan 2016, 02:23

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Alexander »

Ralph wrote: Thu 5. Oct 2023, 16:31 ist eine jeweilige jail.local als OS config im installer hinterlegt?
Nur die beiden kommen von KeyHelp - darüber hinaus erfolgt keine Änderung im Fail2Ban Ordner.

/etc/fail2ban/jail.d/keyhelp.local
/etc/fail2ban/filter.d/keyhelp-phpmyadmin.conf
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Alexander wrote: Thu 5. Oct 2023, 16:42 Nur die beiden kommen von KeyHelp - darüber hinaus erfolgt keine Änderung im Fail2Ban Ordner.
/etc/fail2ban/jail.d/keyhelp.local
/etc/fail2ban/filter.d/keyhelp-phpmyadmin.conf
OK, ich lasse es mal offen und installiere alles mal ganz sauber ohne etwas an den F2B configs zu ändern.
Werde mall schauen warum dieses No module named 'systemd' hier aufgetaucht ist
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Bei der KH 23.2 Neu Installation (Debian11) stimmt etwas nicht, da scheint ein package oder ein service enable zu fehlen.
Ich teste im Anschluss auch noch mit Debian 12.
Ich dachte erst es wird durch eigene F2B configs verursacht oder weil ich die KH Firewall deaktiviert habe, daran liegt es aber nicht, hier der Output vom fail2ban.log nach einer NEU Installation (standard) von KH 23.2 auf Debian 11.

Code: Select all

# tail -n 500 /var/log/fail2ban.log
2023-10-06 09:41:30,716 fail2ban.server         [834]: INFO    --------------------------------------------------
2023-10-06 09:41:30,716 fail2ban.server         [834]: INFO    Starting Fail2ban v0.11.2
2023-10-06 09:41:30,721 fail2ban.observer       [834]: INFO    Observer start...
2023-10-06 09:41:30,731 fail2ban.database       [834]: INFO    Connected to fail2ban persistent database '/var/lib/fail2ban/fail2ban.sqlite3'
2023-10-06 09:41:30,732 fail2ban.jail           [834]: INFO    Creating new jail 'sshd'
2023-10-06 09:41:30,734 fail2ban.jail           [834]: ERROR   Backend 'systemd' failed to initialize due to No module named 'systemd'
2023-10-06 09:41:30,734 fail2ban.jail           [834]: ERROR   Failed to initialize any backend for Jail 'sshd'
2023-10-06 09:41:30,734 fail2ban.transmitter    [834]: WARNING Command ['server-stream', [['set', 'syslogsocket', 'auto'], ['set', 'loglevel', 'INFO'], ['set', 'logtarget', '/var/log/fail2ban.log'], ['set', 'dbfile', '/var/lib/fail2ban/fail2ban.sqlite3'], ['set', 'dbmaxmatches', 10], ['set', 'dbpurgeage', '1d'], ['add', 'sshd', 'systemd'], ['set', 'sshd', 'usedns', 'warn'], ['set', 'sshd', 'prefregex', '^<F-MLFID>\\s*(?:\\S+\\s+)?(?:sshd(?:\\[\\d+\\])?:?\\s+)?(?:kernel:\\s?\\[ *\\d+\\.\\d+\\]:?\\s+)?</F-MLFID>(?:(?:error|fatal): (?:PAM: )?)?<F-CONTENT>.+</F-CONTENT>$'], ['set', 'sshd', 'maxlines', 1], ['multi-set', 'sshd', 'addfailregex', ['^[aA]uthentication (?:failure|error|failed) for <F-USER>.*</F-USER> from <HOST>( via \\S+)?(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^User not known to the underlying authentication module for <F-USER>.*</F-USER> from <HOST>(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^Failed publickey for invalid user <F-USER>(?P<cond_user>\\S+)|(?:(?! from ).)*?</F-USER> from <HOST>(?: (?:port \\d+|on \\S+)){0,2}(?: ssh\\d*)?(?(cond_user): |(?:(?:(?! from ).)*)$)', '^Failed (?:<F-NOFAIL>publickey</F-NOFAIL>|\\S+) for (?P<cond_inv>invalid user )?<F-USER>(?P<cond_user>\\S+)|(?(cond_inv)(?:(?! from ).)*?|[^:]+)</F-USER> from <HOST>(?: (?:port \\d+|on \\S+)){0,2}(?: ssh\\d*)?(?(cond_user): |(?:(?:(?! from ).)*)$)', '^<F-USER>ROOT</F-USER> LOGIN REFUSED FROM <HOST>', '^[iI](?:llegal|nvalid) user <F-USER>.*?</F-USER> from <HOST>(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^User <F-USER>\\S+|.*?</F-USER> from <HOST> not allowed because not listed in AllowUsers(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^User <F-USER>\\S+|.*?</F-USER> from <HOST> not allowed because listed in DenyUsers(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^User <F-USER>\\S+|.*?</F-USER> from <HOST> not allowed because not in any group(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^refused connect from \\S+ \\(<HOST>\\)', '^Received <F-MLFFORGET>disconnect</F-MLFFORGET> from <HOST>(?: (?:port \\d+|on \\S+)){0,2}:\\s*3: .*: Auth fail(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^User <F-USER>\\S+|.*?</F-USER> from <HOST> not allowed because a group is listed in DenyGroups(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', "^User <F-USER>\\S+|.*?</F-USER> from <HOST> not allowed because none of user's groups are listed in AllowGroups(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$", '^<F-NOFAIL>pam_[a-z]+\\(sshd:auth\\):\\s+authentication failure;</F-NOFAIL>(?:\\s+(?:(?:logname|e?uid|tty)=\\S*)){0,4}\\s+ruser=<F-ALT_USER>\\S*</F-ALT_USER>\\s+rhost=<HOST>(?:\\s+user=<F-USER>\\S*</F-USER>)?(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^maximum authentication attempts exceeded for <F-USER>.*</F-USER> from <HOST>(?: (?:port \\d+|on \\S+)){0,2}(?: ssh\\d*)?(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^User <F-USER>\\S+|.*?</F-USER> not allowed because account is locked(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*', '^<F-MLFFORGET>Disconnecting</F-MLFFORGET>(?: from)?(?: (?:invalid|authenticating)) user <F-USER>\\S+</F-USER> <HOST>(?: (?:port \\d+|on \\S+)){0,2}:\\s*Change of username or service not allowed:\\s*.*\\[preauth\\]\\s*$', '^Disconnecting: Too many authentication failures(?: for <F-USER>\\S+|.*?</F-USER>)?(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*$', '^<F-NOFAIL>Received <F-MLFFORGET>disconnect</F-MLFFORGET></F-NOFAIL> from <HOST>(?: (?:port \\d+|on \\S+)){0,2}:\\s*11:', '^<F-NOFAIL><F-MLFFORGET>(Connection closed|Disconnected)</F-MLFFORGET></F-NOFAIL> (?:by|from)(?: (?:invalid|authenticating) user <F-USER>\\S+|.*?</F-USER>)? <HOST>(?:(?: (?:port \\d+|on \\S+|\\[preauth\\])){0,3}\\s*|\\s*)$', '^<F-MLFFORGET><F-MLFGAINED>Accepted \\w+</F-MLFGAINED></F-MLFFORGET> for <F-USER>\\S+</F-USER> from <HOST>(?:\\s|$)', '^<F-NOFAIL>Connection from</F-NOFAIL> <HOST>']], ['set', 'sshd', 'datepattern', '{^LN-BEG}'], ['set', 'sshd', 'addjournalmatch', '_SYSTEMD_UNIT=sshd.service', '+', '_COMM=sshd'], ['set', 'sshd', 'maxretry', 5], ['set', 'sshd', 'maxmatches', 5], ['set', 'sshd', 'findtime', '10m'], ['set', 'sshd', 'bantime', '10m'], ['set', 'sshd', 'ignorecommand', ''], ['set', 'sshd', 'logencoding', 'auto'], ['set', 'sshd', 'addaction', 'iptables-multiport'], ['multi-set', 'sshd', 'action', 'iptables-multiport', [['actionstart', '<iptables> -N f2b-sshd\n<iptables> -A f2b-sshd -j RETURN\n<iptables> -I INPUT -p tcp -m multiport --dports ssh -j f2b-sshd'], ['actionstop', '<iptables> -D INPUT -p tcp -m multiport --dports ssh -j f2b-sshd\n<iptables> -F f2b-sshd\n<iptables> -X f2b-sshd'], ['actionflush', '<iptables> -F f2b-sshd'], ['actioncheck', "<iptables> -n -L INPUT | grep -q 'f2b-sshd[ \\t]'"], ['actionban', '<iptables> -I f2b-sshd 1 -s <ip> -j <blocktype>'], ['actionunban', '<iptables> -D f2b-sshd -s <ip> -j <blocktype>'], ['port', 'ssh'], ['protocol', 'tcp'], ['chain', '<known/chain>'], ['name', 'sshd'], ['actname', 'iptables-multiport'], ['blocktype', 'REJECT --reject-with icmp-port-unreachable'], ['returntype', 'RETURN'], ['lockingopt', '-w'], ['iptables', 'iptables <lockingopt>'], ['blocktype?family=inet6', 'REJECT --reject-with icmp6-port-unreachable'], ['iptables?family=inet6', 'ip6tables <lockingopt>']]], ['add', 'keyhelp-postfix', 'systemd'], ['set', 'keyhelp-postfix', 'usedns', 'warn'], ['set', 'keyhelp-postfix', 'prefregex', '^\\s*(?:\\S+\\s+)?(?:postfix(-\\w+)?/\\w+(?:/smtp[ds])?(?:\\[\\d+\\])?:?\\s+)?(?:kernel:\\s?\\[ *\\d+\\.\\d+\\]:?\\s+)?(?:\\w+: reject:|(?:improper command pipelining|too many errors) after \\S+) <F-CONTENT>.+</F-CONTENT>$'], ['multi-set', 'keyhelp-postfix', 'addfailregex', ['^RCPT from [^[]*\\[<HOST>\\](?::\\d+)?: 55[04] 5\\.7\\.1\\s', '^RCPT from [^[]*\\[<HOST>\\](?::\\d+)?: 45[04] 4\\.7\\.\\d+ (?:Service unavailable\\b|Client host rejected: cannot find your (reverse )?hostname\\b)', '^RCPT from [^[]*\\[<HOST>\\](?::\\d+)?: 450 4\\.7\\.\\d+ (<[^>]*>)?: Helo command rejected: Host not found\\b', '^EHLO from [^[]*\\[<HOST>\\](?::\\d+)?: 504 5\\.5\\.\\d+ (<[^>]*>)?: Helo command rejected: need fully-qualified hostname\\b', '^(RCPT|VRFY) from [^[]*\\[<HOST>\\](?::\\d+)?: 550 5\\.1\\.1\\s', '^RCPT from [^[]*\\[<HOST>\\](?::\\d+)?: 450 4\\.1\\.\\d+ (<[^>]*>)?: Sender address rejected: Domain not found\\b', '^from [^[]*\\[<HOST>\\](?::\\d+)?:?']], ['set', 'keyhelp-postfix', 'datepattern', '{^LN-BEG}'], ['set', 'keyhelp-postfix', 'addjournalmatch', '_SYSTEMD_UNIT=postfix.service'], ['set', 'keyhelp-postfix', 'maxretry', 6], ['set', 'keyhelp-postfix', 'maxmatches', 6], ['set', 'keyhelp-postfix', 'findtime', '10m'], ['set', 'keyhelp-postfix', 'bantime', '10m'], ['set', 'keyhelp-postfix', 'ignorecommand', ''], ['set', 'keyhelp-postfix', 'logencoding', 'auto'], ['set', 'keyhelp-postfix', 'addaction', 'iptables-multiport'], ['multi-set', 'keyhelp-postfix', 'action', 'iptables-multiport', [['actionstart', '<iptables> -N f2b-keyhelp-postfix\n<iptables> -A f2b-keyhelp-postfix -j RETURN\n<iptables> -I INPUT -p tcp -m multiport --dports smtp,ssmtp,smtps,submission,submissions -j f2b-keyhelp-postfix'], ['actionstop', '<iptables> -D INPUT -p tcp -m multiport --dports smtp,ssmtp,smtps,submission,submissions -j f2b-keyhelp-postfix\n<iptables> -F f2b-keyhelp-postfix\n<iptables> -X f2b-keyhelp-postfix'], ['actionflush', '<iptables> -F f2b-keyhelp-postfix'], ['actioncheck', "<iptables> -n -L INPUT | grep -q 'f2b-keyhelp-postfix[ \\t]'"], ['actionban', '<iptables> -I f2b-keyhelp-postfix 1 -s <ip> -j <blocktype>'], ['actionunban', '<iptables> -D f2b-keyhelp-postfix -s <ip> -j <blocktype>'], ['port', 'smtp,ssmtp,smtps,submission,submissions'], ['protocol', 'tcp'], ['chain', '<known/chain>'], ['name', 'keyhelp-postfix'], ['actname', 'iptables-multiport'], ['blocktype', 'REJECT --reject-with icmp-port-unreachable'], ['returntype', 'RETURN'], ['lockingopt', '-w'], ['iptables', 'iptables <lockingopt>'], ['blocktype?family=inet6', 'REJECT --reject-with icmp6-port-unreachable'], ['iptables?family=inet6', 'ip6tables <lockingopt>']]], ['add', 'keyhelp-dovecot', 'systemd'], ['set', 'keyhelp-dovecot', 'usedns', 'warn'], ['set', 'keyhelp-dovecot', 'prefregex', '^\\s*(?:\\S+\\s+)?(?:(?:dovecot(?:-auth)?|auth)(?:\\[\\d+\\])?:?\\s+)?(?:kernel:\\s?\\[ *\\d+\\.\\d+\\]:?\\s+)?(?:(?:dovecot: )?auth(?:-worker)?(?:\\([^\\)]+\\))?: )?(?:pam_unix(?:\\(dovecot:auth\\))?: |(?:pop3|imap|managesieve|submission)-login: )?(?:Info: )?<F-CONTENT>.+</F-CONTENT>$'], ['multi-set', 'keyhelp-dovecot', 'addfailregex', ['^authentication failure; logname=<F-ALT_USER1>\\S*</F-ALT_USER1> uid=\\S* euid=\\S* tty=dovecot ruser=<F-USER>\\S*</F-USER> rhost=<HOST>(?:\\s+user=<F-ALT_USER>\\S*</F-ALT_USER>)?\\s*$', '^(?:Aborted login|Disconnected|Remote closed connection|Client has quit the connection)(?::(?: [^ \\(]+)+)? \\((?:auth failed, \\d+ attempts(?: in \\d+ secs)?|tried to use (?:disabled|disallowed) \\S+ auth|proxy dest auth failed)\\):(?: user=<<F-USER>[^>]*</F-USER>>,)?(?: method=\\S+,)? rip=<HOST>(?:[^>]*(?:, session=<\\S+>)?)\\s*$', '^pam\\(\\S+,<HOST>(?:,\\S*)?\\): pam_authenticate\\(\\) failed: (?:User not known to the underlying authentication module: \\d+ Time\\(s\\)|Authentication failure \\(password mismatch\\?\\)|Permission denied)\\s*$', '^[a-z\\-]{3,15}\\(\\S*,<HOST>(?:,\\S*)?\\): (?:unknown user|invalid credentials|Password mismatch)']], ['set', 'keyhelp-dovecot', 'datepattern', '{^LN-BEG}TAI64N\n{^LN-BEG}'], ['set', 'keyhelp-dovecot', 'addjournalmatch', '_SYSTEMD_UNIT=dovecot.service'], ['set', 'keyhelp-dovecot', 'maxretry', 10], ['set', 'keyhelp-dovecot', 'maxmatches', 10], ['set', 'keyhelp-dovecot', 'findtime', '10m'], ['set', 'keyhelp-dovecot', 'bantime', '10m'], ['set', 'keyhelp-dovecot', 'ignorecommand', ''], ['set', 'keyhelp-dovecot', 'logencoding', 'auto'], ['set', 'keyhelp-dovecot', 'addaction', 'iptables-multiport'], ['multi-set', 'keyhelp-dovecot', 'action', 'iptables-multiport', [['actionstart', '<iptables> -N f2b-keyhelp-dovecot\n<iptables> -A f2b-keyhelp-dovecot -j RETURN\n<iptables> -I INPUT -p tcp -m multiport --dports pop3,pop3s,imap,imaps,submission,submissions,sieve -j f2b-keyhelp-dovecot'], ['actionstop', '<iptables> -D INPUT -p tcp -m multiport --dports pop3,pop3s,imap,imaps,submission,submissions,sieve -j f2b-keyhelp-dovecot\n<iptables> -F f2b-keyhelp-dovecot\n<iptables> -X f2b-keyhelp-dovecot'], ['actionflush', '<iptables> -F f2b-keyhelp-dovecot'], ['actioncheck', "<iptables> -n -L INPUT | grep -q 'f2b-keyhelp-dovecot[ \\t]'"], ['actionban', '<iptables> -I f2b-keyhelp-dovecot 1 -s <ip> -j <blocktype>'], ['actionunban', '<iptables> -D f2b-keyhelp-dovecot -s <ip> -j <blocktype>'], ['port', 'pop3,pop3s,imap,imaps,submission,submissions,sieve'], ['protocol', 'tcp'], ['chain', '<known/chain>'], ['name', 'keyhelp-dovecot'], ['actname', 'iptables-multiport'], ['blocktype', 'REJECT --reject-with icmp-port-unreachable'], ['returntype', 'RETURN'], ['lockingopt', '-w'], ['iptables', 'iptables <lockingopt>'], ['blocktype?family=inet6', 'REJECT --reject-with icmp6-port-unreachable'], ['iptables?family=inet6', 'ip6tables <lockingopt>']]], ['add', 'keyhelp-proftpd', 'systemd'], ['set', 'keyhelp-proftpd', 'usedns', 'warn'], ['set', 'keyhelp-proftpd', 'prefregex', '^\\s*(?:\\S+\\s+)?(?:proftpd(?:\\[\\d+\\])?:?\\s+)?(?:kernel:\\s?\\[ *\\d+\\.\\d+\\]:?\\s+)?\\S+ \\(\\S+\\[<HOST>\\]\\)[: -]+ <F-CONTENT>(?:USER|SECURITY|Maximum) .+</F-CONTENT>$'], ['multi-set', 'keyhelp-proftpd', 'addfailregex', ["^USER <F-USER>\\S+|.*?</F-USER>(?: \\(Login failed\\))?: ([uU]ser not authorized for login|[nN]o such user found|[iI]ncorrect password|[pP]assword expired|[aA]ccount disabled|[iI]nvalid shell: '\\S+'|[uU]ser in \\S+|[lL]imit (access|configuration) denies login|[nN]ot a UserAlias|[mM]aximum login length exceeded)", '^SECURITY VIOLATION: <F-USER>\\S+|.*?</F-USER> login attempted', '^Maximum login attempts \\(\\d+\\) exceeded']], ['set', 'keyhelp-proftpd', 'datepattern', '{^LN-BEG}'], ['set', 'keyhelp-proftpd', 'addjournalmatch', '_SYSTEMD_UNIT=proftpd.service'], ['set', 'keyhelp-proftpd', 'maxretry', 6], ['set', 'keyhelp-proftpd', 'maxmatches', 6], ['set', 'keyhelp-proftpd', 'findtime', '10m'], ['set', 'keyhelp-proftpd', 'bantime', '10m'], ['set', 'keyhelp-proftpd', 'ignorecommand', ''], ['set', 'keyhelp-proftpd', 'logencoding', 'auto'], ['set', 'keyhelp-proftpd', 'addaction', 'iptables-multiport'], ['multi-set', 'keyhelp-proftpd', 'action', 'iptables-multiport', [['actionstart', '<iptables> -N f2b-keyhelp-proftpd\n<iptables> -A f2b-keyhelp-proftpd -j RETURN\n<iptables> -I INPUT -p tcp -m multiport --dports ftp,ftp-data,ftps,ftps-data -j f2b-keyhelp-proftpd'], ['actionstop', '<iptables> -D INPUT -p tcp -m multiport --dports ftp,ftp-data,ftps,ftps-data -j f2b-keyhelp-proftpd\n<iptables> -F f2b-keyhelp-proftpd\n<iptables> -X f2b-keyhelp-proftpd'], ['actionflush', '<iptables> -F f2b-keyhelp-proftpd'], ['actioncheck', "<iptables> -n -L INPUT | grep -q 'f2b-keyhelp-proftpd[ \\t]'"], ['actionban', '<iptables> -I f2b-keyhelp-proftpd 1 -s <ip> -j <blocktype>'], ['actionunban', '<iptables> -D f2b-keyhelp-proftpd -s <ip> -j <blocktype>'], ['port', 'ftp,ftp-data,ftps,ftps-data'], ['protocol', 'tcp'], ['chain', '<known/chain>'], ['name', 'keyhelp-proftpd'], ['actname', 'iptables-multiport'], ['blocktype', 'REJECT --reject-with icmp-port-unreachable'], ['returntype', 'RETURN'], ['lockingopt', '-w'], ['iptables', 'iptables <lockingopt>'], ['blocktype?family=inet6', 'REJECT --reject-with icmp6-port-unreachable'], ['iptables?family=inet6', 'ip6tables <lockingopt>']]], ['add', 'keyhelp-phpmyadmin', 'systemd[journalflags=1]'], ['set', 'keyhelp-phpmyadmin', 'usedns', 'warn'], ['multi-set', 'keyhelp-phpmyadmin', 'addfailregex', ['^.* phpMyAdmin\\[.*\\]: user denied: .* \\((mysql-denied|allow-denied|root-denied|empty-denied)\\) from <HOST>$', '^.* phpMyAdmin\\[.*\\]: message repeated \\d* times: \\[ user denied: .* \\((mysql-denied|allow-denied|root-denied|empty-denied)\\) from <HOST>\\]$']], ['set', 'keyhelp-phpmyadmin', 'addjournalmatch', 'SYSLOG_IDENTIFIER=phpMyAdmin'], ['set', 'keyhelp-phpmyadmin', 'maxretry', 6], ['set', 'keyhelp-phpmyadmin', 'maxmatches', 6], ['set', 'keyhelp-phpmyadmin', 'findtime', '10m'], ['set', 'keyhelp-phpmyadmin', 'bantime', '10m'], ['set', 'keyhelp-phpmyadmin', 'ignorecommand', ''], ['set', 'keyhelp-phpmyadmin', 'logencoding', 'auto'], ['set', 'keyhelp-phpmyadmin', 'addaction', 'iptables-multiport'], ['multi-set', 'keyhelp-phpmyadmin', 'action', 'iptables-multiport', [['actionstart', '<iptables> -N f2b-keyhelp-phpmyadmin\n<iptables> -A f2b-keyhelp-phpmyadmin -j RETURN\n<iptables> -I INPUT -p tcp -m multiport --dports http,https -j f2b-keyhelp-phpmyadmin'], ['actionstop', '<iptables> -D INPUT -p tcp -m multiport --dports http,https -j f2b-keyhelp-phpmyadmin\n<iptables> -F f2b-keyhelp-phpmyadmin\n<iptables> -X f2b-keyhelp-phpmyadmin'], ['actionflush', '<iptables> -F f2b-keyhelp-phpmyadmin'], ['actioncheck', "<iptables> -n -L INPUT | grep -q 'f2b-keyhelp-phpmyadmin[ \\t]'"], ['actionban', '<iptables> -I f2b-keyhelp-phpmyadmin 1 -s <ip> -j <blocktype>'], ['actionunban', '<iptables> -D f2b-keyhelp-phpmyadmin -s <ip> -j <blocktype>'], ['port', 'http,https'], ['protocol', 'tcp'], ['chain', '<known/chain>'], ['name', 'keyhelp-phpmyadmin'], ['actname', 'iptables-multiport'], ['blocktype', 'REJECT --reject-with icmp-port-unreachable'], ['returntype', 'RETURN'], ['lockingopt', '-w'], ['iptables', 'iptables <lockingopt>'], ['blocktype?family=inet6', 'REJECT --reject-with icmp6-port-unreachable'], ['iptables?family=inet6', 'ip6tables <lockingopt>']]], ['add', 'keyhelp-roundcube', 'systemd[journalflags=1]'], ['set', 'keyhelp-roundcube', 'usedns', 'warn'], ['set', 'keyhelp-roundcube', 'prefregex', '^\\s*(\\[\\])?(\\S+\\s*(?:roundcube(?:\\[(\\d*)\\])?:)?\\s*(<[\\w]+>)? IMAP Error)?: <F-CONTENT>.+</F-CONTENT>$'], ['set', 'keyhelp-roundcube', 'addignoreregex', 'Could not connect to .* Connection refused'], ['multi-set', 'keyhelp-roundcube', 'addfailregex', ['^(?:FAILED login|Login failed) for <F-USER>.*</F-USER> from <HOST>(?:(?:\\([^\\)]*\\))?\\. (?:(?! from ).)*(?: user=(?P=user))? in \\S+\\.php on line \\d+ \\(\\S+ \\S+\\))?$', '^(?:<[\\w]+> )?Failed login for <F-USER>.*</F-USER> from <HOST> in session \\w+( \\(error: \\d\\))?$']], ['set', 'keyhelp-roundcube', 'datepattern', '{^LN-BEG}'], ['set', 'keyhelp-roundcube', 'addjournalmatch', 'SYSLOG_IDENTIFIER=roundcube'], ['set', 'keyhelp-roundcube', 'maxretry', 10], ['set', 'keyhelp-roundcube', 'maxmatches', 10], ['set', 'keyhelp-roundcube', 'findtime', '10m'], ['set', 'keyhelp-roundcube', 'bantime', '10m'], ['set', 'keyhelp-roundcube', 'ignorecommand', ''], ['set', 'keyhelp-roundcube', 'logencoding', 'auto'], ['set', 'keyhelp-roundcube', 'addaction', 'iptables-multiport'], ['multi-set', 'keyhelp-roundcube', 'action', 'iptables-multiport', [['actionstart', '<iptables> -N f2b-keyhelp-roundcube\n<iptables> -A f2b-keyhelp-roundcube -j RETURN\n<iptables> -I INPUT -p tcp -m multiport --dports http,https -j f2b-keyhelp-roundcube'], ['actionstop', '<iptables> -D INPUT -p tcp -m multiport --dports http,https -j f2b-keyhelp-roundcube\n<iptables> -F f2b-keyhelp-roundcube\n<iptables> -X f2b-keyhelp-roundcube'], ['actionflush', '<iptables> -F f2b-keyhelp-roundcube'], ['actioncheck', "<iptables> -n -L INPUT | grep -q 'f2b-keyhelp-roundcube[ \\t]'"], ['actionban', '<iptables> -I f2b-keyhelp-roundcube 1 -s <ip> -j <blocktype>'], ['actionunban', '<iptables> -D f2b-keyhelp-roundcube -s <ip> -j <blocktype>'], ['port', 'http,https'], ['protocol', 'tcp'], ['chain', '<known/chain>'], ['name', 'keyhelp-roundcube'], ['actname', 'iptables-multiport'], ['blocktype', 'REJECT --reject-with icmp-port-unreachable'], ['returntype', 'RETURN'], ['lockingopt', '-w'], ['iptables', 'iptables <lockingopt>'], ['blocktype?family=inet6', 'REJECT --reject-with icmp6-port-unreachable'], ['iptables?family=inet6', 'ip6tables <lockingopt>']]], ['start', 'sshd'], ['start', 'keyhelp-postfix'], ['start', 'keyhelp-dovecot'], ['start', 'keyhelp-proftpd'], ['start', 'keyhelp-phpmyadmin'], ['start', 'keyhelp-roundcube']]] has failed. Received RuntimeError("Failed to initialize any backend for Jail 'sshd'")
2023-10-06 09:41:30,734 fail2ban                [834]: ERROR   NOK: ("Failed to initialize any backend for Jail 'sshd'",)
Image
User avatar
Jolinar
Community Moderator
Posts: 3608
Joined: Sat 30. Jan 2016, 07:11
Location: Weimar (Thüringen)
Contact:

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Jolinar »

Ralph wrote: Fri 6. Oct 2023, 09:54 da scheint ein package oder ein service enable zu fehlen
Ist python-systemd installiert?
Wenn jemand inkompetent ist, dann kann er nicht wissen, daß er inkompetent ist. (David Dunning)

Data Collector für Community Support
___
Ich verwende zwei verschiedene Schriftfarben in meinen Beiträgen /
I use two different font colors in my posts:
  • In dieser Farbe schreibe ich als Moderator und gebe moderative Hinweise oder begründe moderative Eingriffe /
    In this color, I write as a moderator and provide moderative guidance or justify moderative interventions
  • In dieser Farbe schreibe ich als Community Mitglied und teile meine private Meinung und persönlichen Ansichten mit /
    In this color, I write as a community member and share my personal opinions and views
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Jolinar wrote: Fri 6. Oct 2023, 10:07
Ralph wrote: Fri 6. Oct 2023, 09:54 da scheint ein package oder ein service enable zu fehlen
Ist python-systemd installiert?

das müsste dann python3-systemd sein, damit scheint es zu klappen bis auf die warnings:
2023-10-06 10:21:00,443 fail2ban.jail [1646]: INFO Jail 'sshd' started
2023-10-06 10:21:00,443 fail2ban.jail [1646]: INFO Jail 'keyhelp-postfix' started
2023-10-06 10:21:00,444 fail2ban.jail [1646]: INFO Jail 'keyhelp-dovecot' started
2023-10-06 10:21:00,445 fail2ban.jail [1646]: INFO Jail 'keyhelp-proftpd' started
2023-10-06 10:21:00,447 fail2ban.jail [1646]: INFO Jail 'keyhelp-phpmyadmin' started
2023-10-06 10:21:00,448 fail2ban.filter [1646]: WARNING [keyhelp-dovecot] Simulate NOW in operation since found time has too large deviation 1696580348.36271 ~ 1696580460.4489021 +/- 60
2023-10-06 10:21:00,449 fail2ban.filter [1646]: WARNING [keyhelp-proftpd] Simulate NOW in operation since found time has too large deviation 1696580348.489164 ~ 1696580460.4493618 +/- 60
2023-10-06 10:21:00,449 fail2ban.filter [1646]: WARNING [keyhelp-dovecot] Please check jail has possibly a timezone issue. Line with odd timestamp: ('', '2023-10-06T10:19:08.362710', 'myserver.tld dovecot[782]: master: Dovecot v2.3.13 (89f716dc2) starting up for imap, pop3, lmtp, sieve (core dumps disabled)')
2023-10-06 10:21:00,449 fail2ban.filter [1646]: WARNING [keyhelp-proftpd] Please check jail has possibly a timezone issue. Line with odd timestamp: ('', '2023-10-06T10:19:08.489164', 'myserver.tld proftpd[799]: Checking syntax of configuration file')
2023-10-06 10:21:00,450 fail2ban.filter [1646]: WARNING [sshd] Simulate NOW in operation since found time has too large deviation 1696580348.627115 ~ 1696580460.4507663 +/- 60
2023-10-06 10:21:00,450 fail2ban.filter [1646]: WARNING [sshd] Please check jail has possibly a timezone issue. Line with odd timestamp: ('', '2023-10-06T10:19:08.627115', 'myserver.tld sshd[841]: Server listening on 0.0.0.0 port 22.')
2023-10-06 10:21:00,451 fail2ban.jail [1646]: INFO Jail 'keyhelp-roundcube' started
Last edited by Ralph on Fri 6. Oct 2023, 10:33, edited 1 time in total.
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

@Alexander
da scheint noch ein weiteres package Problem zu sein mit den sieve packages, eventl. braucht es ein apt -y install bei diesen ...
Details:
viewtopic.php?p=44254#p44254
User avatar
Jolinar
Community Moderator
Posts: 3608
Joined: Sat 30. Jan 2016, 07:11
Location: Weimar (Thüringen)
Contact:

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Jolinar »

Ralph wrote: Fri 6. Oct 2023, 10:23 das müsste dann python3-systemd sein, damit scheint es zu klappen
Upss...hast Recht, die 3 vergessen :mrgreen:

Was die Warnings angeht...Schau mal, ob in den Jails der Parameterwert von:

Code: Select all

timezone = 
mit

Code: Select all

timedatectl
übereinstimmt.
Da scheint es irgendwo eine Zeitdifferenz zu geben...
Wenn jemand inkompetent ist, dann kann er nicht wissen, daß er inkompetent ist. (David Dunning)

Data Collector für Community Support
___
Ich verwende zwei verschiedene Schriftfarben in meinen Beiträgen /
I use two different font colors in my posts:
  • In dieser Farbe schreibe ich als Moderator und gebe moderative Hinweise oder begründe moderative Eingriffe /
    In this color, I write as a moderator and provide moderative guidance or justify moderative interventions
  • In dieser Farbe schreibe ich als Community Mitglied und teile meine private Meinung und persönlichen Ansichten mit /
    In this color, I write as a community member and share my personal opinions and views
User avatar
Alexander
Keyweb AG
Posts: 3842
Joined: Wed 20. Jan 2016, 02:23

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Alexander »

Ralph wrote: Fri 6. Oct 2023, 10:29 @Alexander
da scheint noch ein weiteres package Problem zu sein mit den sieve packages, eventl. braucht es ein apt -y install bei diesen ...
Details:
viewtopic.php?p=44254#p44254
Die Pakete "dovecot-sieve" + "dovecot-managesieved" werden im Zuge der Dovecot Installation schon immer mit installiert (Siehe KeyHelp Install-Log).
Was bei verlinkten Beitrag zum Problem geführt hat bzw. der Grund, warum diese Pakete aus dem Tritt gekommen sind würde ich nicht bei KeyHelp suchen.

---

Warum fehlt bei dir python3-systemd? Bei meinen Test-Systemen wird das als Abhängigkeit bei der Fail2Ban-Installation installiert (Siehe KeyHelp Install-Log - Abschnitt Fail2Ban).
Bei welchem Hoster steht die Kiste denn?
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Alexander wrote: Fri 6. Oct 2023, 11:04
Ralph wrote: Fri 6. Oct 2023, 10:29 @Alexander
da scheint noch ein weiteres package Problem zu sein mit den sieve packages, eventl. braucht es ein apt -y install bei diesen ...
Details:
viewtopic.php?p=44254#p44254
Die Pakete "dovecot-sieve" + "dovecot-managesieved" werden im Zuge der Dovecot Installation schon immer mit installiert (Siehe KeyHelp Install-Log).
Was bei verlinkten Beitrag zum Problem geführt hat bzw. der Grund, warum diese Pakete aus dem Tritt gekommen sind würde ich nicht bei KeyHelp suchen.

---

Warum fehlt bei dir python3-systemd? Bei meinen Test-Systemen wird das als Abhängigkeit bei der Fail2Ban-Installation installiert (Siehe KeyHelp Install-Log - Abschnitt Fail2Ban).
Bei welchem Hoster steht die Kiste denn?
Keine Ahnung warum python3-systemd fehlt, ich habe 23.2 gestern auf einem linode und heute auf einem hetzner system installiert.
Die Original Debian Sourcen wurden verwendet, genanntes sieve Problem habe ich noch nicht selbst überprüft, sollte nur ein Hinweis und kein Vorwurf sein.
User avatar
Alexander
Keyweb AG
Posts: 3842
Joined: Wed 20. Jan 2016, 02:23

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Alexander »

Ralph wrote: Fri 6. Oct 2023, 11:21 Keine Ahnung warum python3-systemd fehlt
Deswegen der Hinweis bzgl. KeyHelp Install-Log.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Alexander wrote: Fri 6. Oct 2023, 11:55 Deswegen der Hinweis bzgl. KeyHelp Install-Log.
Danke Alex!
python3-pyinotify wird hier (Debain11) nur unter "Recommended packages" angezeigt und müsste vermutlich explizit mit in die debian11 Paket Liste (eventl. auch python3-pyinotify):
Hier die Details:

Code: Select all

  exec  | apt-get install -y fail2ban
          Reading package lists...
          Building dependency tree...
          Reading state information...
          Suggested packages:
            mailx monit sqlite3
          Recommended packages:
            whois python3-pyinotify python3-systemd
          The following NEW packages will be installed:
            fail2ban
          0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
          Need to get 451 kB of archives.
          After this operation, 2,142 kB of additional disk space will be used.
          Get:1 http://deb.debian.org/debian bullseye/main amd64 fail2ban all 0.11.2-2 [451 kB]
          Fetched 451 kB in 0s (11.3 MB/s)
          Selecting previously unselected package fail2ban.
          (Reading database ... ^M(Reading database ... 5%^M(Reading database ... 10%^M(Reading database ... 15%^M(Reading database ... 20%^M(Reading database ... 25%^M(Reading database ..>
          Preparing to unpack .../fail2ban_0.11.2-2_all.deb ...
          Unpacking fail2ban (0.11.2-2) ...
          Setting up fail2ban (0.11.2-2) ...
          Created symlink /etc/systemd/system/multi-user.target.wants/fail2ban.service → /lib/systemd/system/fail2ban.service.
          Processing triggers for man-db (2.9.4-2) ...
  exec  | systemctl enable fail2ban
          Synchronizing state of fail2ban.service with SysV service script with /lib/systemd/systemd-sysv-install.
          Executing: /lib/systemd/systemd-sysv-install enable fail2ban

  files | fail2ban/jail.d/keyhelp.local => /etc/fail2ban/jail.d/keyhelp.local
  files | fail2ban/filter.d/keyhelp-phpmyadmin.conf => /etc/fail2ban/filter.d/keyhelp-phpmyadmin.conf

  exec  | chown keyhelp:keyhelp /etc/fail2ban/jail.d/keyhelp.local
  exec  | service fail2ban restart

Die sieve packages hingegen werden nach dem log alle richtig installiert:

Code: Select all

  exec  | /usr/share/debconf/fix_db.pl
  exec  | DEBIAN_FRONTEND=noninteractive apt-get install -y dovecot-core dovecot-common dovecot-mysql dovecot-sieve dovecot-managesieved dovecot-imapd dovecot-pop3d dovecot-lmtpd
          Reading package lists...
          Building dependency tree...
          Reading state information...
          The following additional packages will be installed:
            libexttextcat-2.0-0 libexttextcat-data libstemmer0d
          Suggested packages:
            dovecot-gssapi dovecot-ldap dovecot-lucene dovecot-pgsql dovecot-solr
            dovecot-sqlite dovecot-submissiond ntp ufw
          The following NEW packages will be installed:
            dovecot-core dovecot-imapd dovecot-lmtpd dovecot-managesieved dovecot-mysql
            dovecot-pop3d dovecot-sieve libexttextcat-2.0-0 libexttextcat-data
            libstemmer0d
Das hat dann wie Du bereits darauf hingeiesen hast eine andere Ursache.

So und nun schaue mir endlich mal die 23.2 auf Debian 12 an ;-)
User avatar
Ralph
Posts: 842
Joined: Mon 30. Mar 2020, 16:14

Re: Debian 11 - Fail2ban journal config nach 23.2 Upgrade?

Post by Ralph »

Keyhelp 23.2 für Debian 12 etc. ist sehr geil gemacht, Hut ab!

Das Fail2ban Problem tritt bei beiden Neu Installationen auf, python3-pyinotify und python3-systemd sind bei Debian 11/12 per Default nur empfohlene Packages, werden also nicht automatisch mit fail2ban installiert (per default).
https://packages.debian.org/bullseye/fail2ban
https://packages.debian.org/bookworm/fail2ban

ein nachträgliches:

Code: Select all

apt install python3-systemd python3-pyinotify
behebt das Problem
Post Reply