mirror of https://github.com/fail2ban/fail2ban
ENH: <HOST> must end with alphanumeric \w (not a dot or a dash etc)
Otherwise <HOST> regexp might swallow period in the sentence right after the address. I have decided to enforce alphanumeric instead of switching to non-greedy +? ... because I think it is closer to what we actually want herepull/283/head
parent
8add63c733
commit
0a02cfe9e8
|
@ -41,7 +41,7 @@ class Regex:
|
||||||
self._matchCache = None
|
self._matchCache = None
|
||||||
# Perform shortcuts expansions.
|
# Perform shortcuts expansions.
|
||||||
# Replace "<HOST>" with default regular expression for host.
|
# Replace "<HOST>" with default regular expression for host.
|
||||||
regex = regex.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>[\w\-.^_]+)")
|
regex = regex.replace("<HOST>", "(?:::f{4,6}:)?(?P<host>[\w\-.^_]*\w)")
|
||||||
if regex.lstrip() == '':
|
if regex.lstrip() == '':
|
||||||
raise RegexException("Cannot add empty regex")
|
raise RegexException("Cannot add empty regex")
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -334,9 +334,9 @@ class Transmitter(TransmitterBase):
|
||||||
"failed attempt from <HOST> again",
|
"failed attempt from <HOST> again",
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"user john at (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)",
|
"user john at (?:::f{4,6}:)?(?P<host>[\w\-.^_]*\\w)",
|
||||||
"Admin user login from (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)",
|
"Admin user login from (?:::f{4,6}:)?(?P<host>[\w\-.^_]*\\w)",
|
||||||
"failed attempt from (?:::f{4,6}:)?(?P<host>[\w\-.^_]+) again",
|
"failed attempt from (?:::f{4,6}:)?(?P<host>[\w\-.^_]*\\w) again",
|
||||||
],
|
],
|
||||||
self.jailName
|
self.jailName
|
||||||
)
|
)
|
||||||
|
@ -359,7 +359,7 @@ class Transmitter(TransmitterBase):
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"user john",
|
"user john",
|
||||||
"Admin user login from (?:::f{4,6}:)?(?P<host>[\w\-.^_]+)",
|
"Admin user login from (?:::f{4,6}:)?(?P<host>[\w\-.^_]*\\w)",
|
||||||
"Dont match me!",
|
"Dont match me!",
|
||||||
],
|
],
|
||||||
self.jailName
|
self.jailName
|
||||||
|
|
Loading…
Reference in New Issue