Giter Club home page Giter Club logo

Comments (2)

sebres avatar sebres commented on June 16, 2024 1

the error log can not be changed in nginx and it always adds a timestamp to the error message

Imho, it depends on how the log-forwarding to syslog in configured.

Changing the start of the expression from ^\s*[error] to ^.*[error] resolves this problem and the filter matches.

This is ugly workaround, since the RE becomes vulnerable due to broken anchor - because ^.* is quasi the same as if it were missing, so no anchor anymore and REs may match everywhere (also against a user input with an "injection" attempt), additionally it becomes very slow, especially on long messages, since it must search the whole message.

Anyway for people having that format here is interim workaround:

- mdre-auth = ^\s*\[error\] \d+#\d+: \*\d+ user "(?:[^"]+|.*?)":? (?:password mismatch|was not found in "[^\"]*"), client: <HOST>, server: \S*, request: "\S+ \S+ HTTP/\d+\.\d+", host: "\S+"(?:, referrer: "\S+")?\s*$
+ mdre-auth = ^\s*(?:(?!\[)\S+ nginx\[\d+\]: [^\[]*)?\[error\] \d+#\d+: \*\d+ user "(?:[^"]+|.*?)":? (?:password mismatch|was not found in "[^\"]*"), client: <HOST>, server: \S*, request: "\S+ \S+ HTTP/\d+\.\d+", host: "\S+"(?:, referrer: "\S+")?\s*$
- mdre-fallback = ^\s*\[crit\] \d+#\d+: \*\d+ SSL_do_handshake\(\) failed \(SSL: error:\S+(?: \S+){1,3} too (?:long|short)\)[^,]*, client: <HOST>
+ mdre-fallback = ^\s*(?:(?!\[)\S+ nginx\[\d+\]: [^\[]*)?\[crit\] \d+#\d+: \*\d+ SSL_do_handshake\(\) failed \(SSL: error:\S+(?: \S+){1,3} too (?:long|short)\)[^,]*, client: <HOST>

(part (?:(?!\[)\S+ nginx\[\d+\]: [^\[]*)? would optionally match systemd prefix with also optional additional timestamp)

from fail2ban.

PanCakeConnaisseur avatar PanCakeConnaisseur commented on June 16, 2024

Thanks a lot for the quick resolution. I suspected that my workaround is a dirty hack.

from fail2ban.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.