Skip to content

fail2ban use for gogs! #3197

Answered by sebres
YeFei572 asked this question in Q&A
Discussion options

You must be logged in to vote

But it doesn't work
failregex = Invalid user <F-USER>\S*</F-USER> from <HOST>$

Your RE is anchored at end (due to $ token), so the address is being searched at end of the line, whereas in this message format (looks like a JSON) it is in the middle of string. You can remove the anchor and it will start to work, but better use something like this (that is anchored at start):

failregex = ^(?:\{"log":")?\s*sshd\[\d+\]: Invalid user <F-USER>\S*</F-USER> from <ADDR>

Another variant would be to reconfigure the container:

  • either to write sshd-logs to the file (which can be bound to host)
  • or to write them to hosts systemd journal (so you'd be able to monitor it with backend = systemd[journalfil…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sebres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants