Logo-amall

Parser failure on dovecot login attempts

Last active a month ago

25 replies

9 views

  • JW

    Hi, here is an example from my maillog (dovecot on a RHEL8 machine):

    Feb 13 11:10:52 mailhub dovecot[1436]: auth: passwd-file(user@wildeboer.net,122.170.99.81): Password mismatch

    which doesn't get parsed as a hit by the dovecot parser. Is this considered a bug?

    Thx!

    Jan

  • II

    We dont have a parser for passwd-file https://hub.crowdsec.net/author/crowdsecurity/configurations/dovecot-logs

  • II

    We make one though

  • JW

    Nice ๐Ÿ™‚ Thx! Happy to test on my machine (I get some 50 per day when one of those pesky scripts hits my server)

  • JW

    I guess it would look sth like:

  • JW

    pattern: "auth: passwd-file\(%{DATA:dovecotuser},%{IP:dovecotremoteip}\): %{DATA:dovecotlogin_message}$"

  • JW

    OK.

  • JW
    • grok:
            pattern: "auth: passwd-file\(%{DATA:dovecotuser},%{IP:dovecotremoteip}\): (%{DATA}: )?%{DATA:dovecotloginmessage}$"       applyon: message
  • JW

    With double backslashes of course delivers

  • II

    You can drop the $ at the end

  • JW

    Gives me

  • JW

    So I guess I now have to add it to the scenario somehow.

  • II

    The scenario is done with doveloginresult

  • JW

    Yep. And I had to add 'Password mismatch' with a capital P ๐Ÿ™‚

  • JW

    Now it triggers:

  • JW
  • II

    To save it you could also do "any(['authentication failure', 'password mismatch', 'auth failed', 'unknown user'], {Lower(evt.Parsed.dovecot_login_message) contains #}) ? 'auth_failed' : ''"

  • JW

    Works at keast for me ๐Ÿ™‚

  • JW

    I could also use 'assword mismatch' to catch both cases, but I guess that would trigger a profanity filter โ€ฆ

  • II

    ๐Ÿ‘€

  • II

    ๐Ÿ˜† it works

  • JW

    Feel free to add that grok to the dovecot parser ๐Ÿ™‚ No credits needed or expected. It's just playing with regexes ๐Ÿ™‚

  • II

    Thank you, will do!

  • JW

    Ah, to save you the work, I created PR 654 https://github.com/crowdsecurity/hub/pull/654

  • JW

    Damn you, typo. Sorry. New PR to fix is done.

Last active a month ago

25 replies

9 views