Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Regular Expressions
  4. fail2ban regex matching on testing sites but not fail2ban itself

fail2ban regex matching on testing sites but not fail2ban itself

Scheduled Pinned Locked Moved Regular Expressions
phpcomsecuritytestingbeta-testing
7 Posts 3 Posters 21 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    murdocklawless
    wrote on last edited by
    #1

    I've a weird situation. I created a regex expression for one of the service. I've tested this expression at regexr.com and regex101.com and there are no problems at all. when I used this regex expression in fail2ban, it missed all the lines. here is the log output;

    [05-Oct-2021 17:09:39 +0300]: IMAP Error: Login failed for xyz@xyz.com against localhost from 95.65.143.88. AUTHENTICATE PLAIN: Authentication failed. in /usr/share/roundcube/program/lib/Roundcube/rcube_imap.php on line 204 (POST /webmail/?_task=login&_action=login)

    here is the regex;

    (IMAP Error: Login failed for)\s([a-zA-Z0-9_.-]+\@[a-zA-Z0-9_.-]+)\s(against localhost from)\s

    is fail2ban using a different regex structure?

    L P 2 Replies Last reply
    0
    • M murdocklawless

      I've a weird situation. I created a regex expression for one of the service. I've tested this expression at regexr.com and regex101.com and there are no problems at all. when I used this regex expression in fail2ban, it missed all the lines. here is the log output;

      [05-Oct-2021 17:09:39 +0300]: IMAP Error: Login failed for xyz@xyz.com against localhost from 95.65.143.88. AUTHENTICATE PLAIN: Authentication failed. in /usr/share/roundcube/program/lib/Roundcube/rcube_imap.php on line 204 (POST /webmail/?_task=login&_action=login)

      here is the regex;

      (IMAP Error: Login failed for)\s([a-zA-Z0-9_.-]+\@[a-zA-Z0-9_.-]+)\s(against localhost from)\s

      is fail2ban using a different regex structure?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      What is fail2ban?

      M 1 Reply Last reply
      0
      • L Lost User

        What is fail2ban?

        M Offline
        M Offline
        murdocklawless
        wrote on last edited by
        #3

        fail2ban is checking application logs and prevent intruders.

        1 Reply Last reply
        0
        • M murdocklawless

          I've a weird situation. I created a regex expression for one of the service. I've tested this expression at regexr.com and regex101.com and there are no problems at all. when I used this regex expression in fail2ban, it missed all the lines. here is the log output;

          [05-Oct-2021 17:09:39 +0300]: IMAP Error: Login failed for xyz@xyz.com against localhost from 95.65.143.88. AUTHENTICATE PLAIN: Authentication failed. in /usr/share/roundcube/program/lib/Roundcube/rcube_imap.php on line 204 (POST /webmail/?_task=login&_action=login)

          here is the regex;

          (IMAP Error: Login failed for)\s([a-zA-Z0-9_.-]+\@[a-zA-Z0-9_.-]+)\s(against localhost from)\s

          is fail2ban using a different regex structure?

          P Offline
          P Offline
          Peter_in_2780
          wrote on last edited by
          #4

          fail2ban regexes are a bit "different", particularly with the new(ish) prefixes and interpolations. Your best bet is to use "fail2ban-regex". Somewhere around the fail2ban site there is a tutorial about iincremental development of regexes. It's a bit outdated, but the process works.

          Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

          M 1 Reply Last reply
          0
          • P Peter_in_2780

            fail2ban regexes are a bit "different", particularly with the new(ish) prefixes and interpolations. Your best bet is to use "fail2ban-regex". Somewhere around the fail2ban site there is a tutorial about iincremental development of regexes. It's a bit outdated, but the process works.

            Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

            M Offline
            M Offline
            murdocklawless
            wrote on last edited by
            #5

            yep I'm using fail2ban-regex but before that I'm preparing my expressions at regexr.com.

            P 1 Reply Last reply
            0
            • M murdocklawless

              yep I'm using fail2ban-regex but before that I'm preparing my expressions at regexr.com.

              P Offline
              P Offline
              Peter_in_2780
              wrote on last edited by
              #6

              My experience with fail2ban regexes is that they are sufficiently different from the "standard" ones that the regular development/test tools don't help. I think you're stuck with fail2ban-regex, a dummy log file with examples of good and bad entries, and a whole lot of panel-beating, depending on how complex your requirements are. It's worth looking at the various filter files provided with fail2ban. I found some helpful constructs in ones I don't actually use.

              Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

              M 1 Reply Last reply
              0
              • P Peter_in_2780

                My experience with fail2ban regexes is that they are sufficiently different from the "standard" ones that the regular development/test tools don't help. I think you're stuck with fail2ban-regex, a dummy log file with examples of good and bad entries, and a whole lot of panel-beating, depending on how complex your requirements are. It's worth looking at the various filter files provided with fail2ban. I found some helpful constructs in ones I don't actually use.

                Software rusts. Simon Stephenson, ca 1994. So does this signature. me, 2012

                M Offline
                M Offline
                murdocklawless
                wrote on last edited by
                #7

                f2b should have provided standard regex expressions, so people wouldn't need to learn something else.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups