Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ignoreip does not handle multiline values #1432

Closed
szepeviktor opened this issue May 19, 2016 · 8 comments
Closed

ignoreip does not handle multiline values #1432

szepeviktor opened this issue May 19, 2016 · 8 comments
Milestone

Comments

@szepeviktor
Copy link
Member

szepeviktor commented May 19, 2016

==> /var/log/fail2ban.log <==
2016-05-19 02:00:29,517 fail2ban.filterpyinotify[28253]: DEBUG   Default Callback for Event: <Event dir=False mask=0x2 maskname=IN_MODIFY name='' path=/var/log/mail.log pathname=/var/log/mail.log wd=2 >
2016-05-19 02:00:29,518 fail2ban.datedetector   [28253]: DEBUG   Matched time template (?:DAY )?MON Day 24hour:Minute:Second(?:\.Microseconds)?(?: Year)?
2016-05-19 02:00:29,518 fail2ban.datedetector   [28253]: DEBUG   Got time 1463623229.000000 for "'May 19 02:00:29'" using template (?:DAY )?MON Day 24hour:Minute:Second(?:\.Microseconds)?(?: Year)?
2016-05-19 02:00:29,518 fail2ban.filter         [28253]: DEBUG   Processing line with time:1463623229.0 and ip:81.2.237.54
2016-05-19 02:00:29,518 fail2ban.filter         [28253]: INFO    [courier-smtp] Ignore 81.2.237.54 by ip
2016-05-19 02:00:29,521 fail2ban.datedetector   [28253]: DEBUG   Sorting the template list
2016-05-19 02:00:29,522 fail2ban.datedetector   [28253]: DEBUG   Winning template: (?:DAY )?MON Day 24hour:Minute:Second(?:\.Microseconds)?(?: Year)? with 2678 hits

# fail2ban-client get courier-smtp ignoreip
These IP addresses/networks are ignored:
`- 127.0.0.0/8
89.40.125.242
66.249.64.0/19

v0.9.4 backported to Debian jessie.

Could you help?

@szepeviktor
Copy link
Member Author

Is there a way to debug the ignore procedure?

@szepeviktor
Copy link
Member Author

szepeviktor commented May 19, 2016

Both a and b are zero:
https://github.com/fail2ban/fail2ban/blob/master/fail2ban/server/filter.py#L374-L375
IP-s are 81.2.237.54 and 127.0.0.0

@szepeviktor szepeviktor changed the title Every IP is ignored ignoreip does not handle multiline values May 19, 2016
@szepeviktor
Copy link
Member Author

szepeviktor commented May 19, 2016

Now it is OK:

# fail2ban-client get courier-smtp ignoreip
These IP addresses/networks are ignored:
|- 127.0.0.0/8
|- 89.40.125.242
`- 66.249.64.0/19

Previously the 3 addresses were in separate lines and they were handled as one address.

Please support multi-line values for ignoreip.

@szepeviktor
Copy link
Member Author

szepeviktor commented May 19, 2016

I usually separate it like this

#          localhost
#          own IP
#          Googlebot
ignoreip = 127.0.0.0/8
           89.40.125.242
           66.249.64.0/19

@yarikoptic
Copy link
Member

On Wed, 18 May 2016, Viktor Szépe wrote:

Both a and b are zero:
https://github.com/fail2ban/fail2ban/blob/master/fail2ban/server/filter.py#L374-L375

and the values of i, ip, s?

@szepeviktor
Copy link
Member Author

szepeviktor commented May 19, 2016

I've found out that in case of a multiline value ignoreip gets this one value: (not 3)

ignoreip="127.0.0.0/8
89.40.125.242
66.249.64.0/19"

I think it is a bug.

@yarikoptic
Copy link
Member

On Wed, 18 May 2016, Viktor Szépe wrote:

Now it is OK:

fail2ban-client get courier-smtp ignoreip

These IP addresses/networks are ignored:
|- 127.0.0.0/8
|- 89.40.125.242
`- 66.249.64.0/19

Previously the 3 addresses were in separate lines and they were handled as
one address.

Please support multiline value for ignoreip.

I would say we better add support to crash if 'ignoreip' value
doesn't look like an IP address/mask at all, and then add support for
multiline ;)

@szepeviktor
Copy link
Member Author

Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants