Bug 260607 - security/py-fail2ban: ^%(__prefix_line) regex does not match auth.log entries in bsd-sshd filter
Summary: security/py-fail2ban: ^%(__prefix_line) regex does not match auth.log entries...
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Many People
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords: needs-patch, needs-qa
Depends on:
Blocks:
 
Reported: 2021-12-22 13:50 UTC by Karrakis
Modified: 2022-04-28 14:51 UTC (History)
2 users (show)

See Also:
koobs: maintainer-feedback? (theis)
koobs: merge-quarterly+


Attachments
Patch (3.12 KB, patch)
2022-01-24 16:45 UTC, theis
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karrakis 2021-12-22 13:50:17 UTC
Hello,

The regex  ^%(__prefix_line)sDid not receive identification string from <HOST>$ will not match entry in /var/log/auth.log as the log entry contains tcp port number
Ex : Did not receive identification string from 51.159.67.165 port 59677

we should add this regex in the filter :  
^%(__prefix_line)sDid not receive identification string from <HOST>\s.*$

In the same spirit, 

^%(__prefix_line)sreverse mapping checking getaddrinfo for .* \[<HOST>\] .* POSSIBLE BREAK-IN ATTEMPT!$

in my log i only see 
^%(__prefix_line)sreverse mapping checking getaddrinfo for .* \[<HOST>\] failed\.$

We should add a regex accordingly

And at last, in my opinion, hitting the preauth timeout is suspicious, i think we should add a regex to match it

^%(__prefix_line)sConnection closed by <HOST> port \d+ \[preauth\]$


Regards
Comment 1 theis 2021-12-22 16:36:42 UTC
1) "Did not receive identification": perhaps just add " port \d" just as in other failregex.

2) OK

3) I think in upstream sshd.conf (which does not work with bsd's sshd) this failure would only be tracked with mode=ddos. So we should do it accordingly.

I'll do it over the holidays.
Comment 2 Karrakis 2021-12-22 17:08:29 UTC
(In reply to theis from comment #1)
1 : yes, that seems much better.

Thanks alot !
Comment 3 Kubilay Kocak freebsd_committer freebsd_triage 2021-12-22 21:28:09 UTC
^Triage: Leave maintainer-feedback open pending patch
Comment 4 theis 2022-01-24 16:45:29 UTC
Created attachment 231276 [details]
Patch

I hope the patch has the correct format, first time I created the diff with git.
Comment 5 theis 2022-01-24 16:50:45 UTC
I didn't had the time to follow the bug this month ...

Fixed the wrong regex (Point 1 and 2)

Added a regex for the "Connection closed by ..." failure. As upstream does in the similar case you have to enable it by setting "mode = ddos" in the [bsd-sshd] section in your jail.local file, like the examples for the plain [sshd] filter.
Comment 6 theis 2022-02-06 21:51:32 UTC
I submitted a patch, but still get a reminder. Did I miss something?
Comment 7 theis 2022-02-21 05:34:54 UTC
I submitted a patch but still receive warnings that my attention is required?
Did I miss to fill out / check a field?
Comment 8 theis 2022-04-28 14:51:40 UTC
I submitted a patch some time ago. But how and whom to tell about it?