Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: py-fail2ban turned silent after syslogd rollout (r335059,

1 view
Skip to first unread message

Marek Zarychta

unread,
Jun 22, 2018, 12:03:45 PM6/22/18
to
On Fri, Jun 22, 2018 at 03:12:05PM +0200, Michael Grimm wrote:
> Hi,
>
> this is 11.2-STABLE (r335532), and I am referring to the recent MFC of syslogd modifications [1].
>
> Because I cannot judge whether fail2ban lacks support for the renewed syslogd or syslogd has an issue in receiving fail2ban messages I do crosspost this mail to ports and stable.
>
> I do have fail2ban configured to report to SYSLOG:
>
> logtarget = SYSLOG
> syslogsocket = auto
>
> But now, after upgrading to the new syslogd fail2ban refuses to report to syslogd; no single message gets recorded [2].
>
> I did try to modify the syslogsocket setting to /var/run/log without success. Pointing logtarget to a regular files tells me that fail2ban is running as expected, it only lacks reporting to SYSLOG.
>
> #) Does anyone else has running py-fail2ban at >= r335059 and can confirm my observations?
> #) Any ideas how to debug this issue?
>
> Thank you in advance and regards,
> Michael
>
>
> [1] https://svnweb.freebsd.org/base/stable/11/usr.sbin/syslogd/Makefile?revision=335059&view=markup&sortby=file
> [2] both syslogd and fail2ban are running at the host, thus another issue with syslogd fixed in
> https://svnweb.freebsd.org/base?view=revision&sortby=file&revision=335314 does not apply
>

This is probably connected with the lack of handling of non-RFC
compliant timestamps.

My syslog server also suffers from this issue. It stopped logging
messages from old Cisco equipment and some newer Netgear switches.
Running it in debug mode gives some clue:

Failed to parse TIMESTAMP from x.x.x.x: 12403: Jun 22 17:31:38 CEST:
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/17,
changed state to down

Could you please give any advice or workaround for this issue?


--
Marek Zarychta
signature.asc

Marek Zarychta

unread,
Jun 22, 2018, 2:07:00 PM6/22/18
to


W dniu 2018.06.22 o 19:14, Michael Grimm pisze:
> On 22. Jun 2018, at 17:59, Marek Zarychta <zary...@plan-b.pwste.edu.pl> wrote:
>
>> Could you please give any advice or workaround for this issue?
> I switched to a workaround for the time being which you might use as well in a similar way:
>
> #) configure fail2ban to use /var/log/faillog
> #) run something like that in the background:
>
> nohup tail -q -F /var/log/fail2ban.log | logger -t fail2ban.filter -p daemon.notice &
>
> #) to let this workaround survive a reboot you need to use a script fired up from /etc/rc.d
>
>

I have rolled back to r334835. The issue has gone. Should a PR be
created about this regression ?

BTW a few decent syslog daemons are available in /usr/ports/sysutils.
--

Marek Zarychta


signature.asc

Kurt Jaeger

unread,
Jun 22, 2018, 2:18:27 PM6/22/18
to
Hi!

> >> Could you please give any advice or workaround for this issue?
> > I switched to a workaround for the time being which you might use as well in a similar way:
> >
> > #) configure fail2ban to use /var/log/faillog
> > #) run something like that in the background:
> >
> > nohup tail -q -F /var/log/fail2ban.log | logger -t fail2ban.filter -p daemon.notice &
> >
> > #) to let this workaround survive a reboot you need to use a script fired up from /etc/rc.d
> >
> >
>
> I have rolled back to r334835. The issue has gone. Should a PR be
> created about this regression ?

Yes, please.

> BTW a few decent syslog daemons are available in /usr/ports/sysutils.

--
p...@opsec.eu +49 171 3101372 2 years to go !
_______________________________________________
freebsd...@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-stable
To unsubscribe, send any mail to "freebsd-stabl...@freebsd.org"

Marek Zarychta

unread,
Jun 22, 2018, 2:38:57 PM6/22/18
to
On Fri, Jun 22, 2018 at 08:13:59PM +0200, Kurt Jaeger wrote:
> > I have rolled back to r334835. The issue has gone. Should a PR be
> > created about this regression ?
>
> Yes, please.
>
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=229236

--
Marek Zarychta
signature.asc

Ed Schouten

unread,
Jun 22, 2018, 3:15:46 PM6/22/18
to
Hi Marek,

[ +glebius ]

Thanks for reporting this!

2018-06-22 18:54 GMT+02:00 Michael Grimm <tras...@ellael.org>:
>> Failed to parse TIMESTAMP from x.x.x.x: 12403: Jun 22 17:31:38 CEST:
>> %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/17,
>> changed state to down
>
> Ah, yes! Haven't thought about running syslogd in debugging mode:
>
> Failed to parse TIMESTAMP from x.x.x.x: fail2ban.filter [79598]: INFO […]

This is interesting. As fail2ban uses Python's logging framework, I
managed to reproduce this with the following script:

#!/usr/bin/env python3
import logging.handlers
logging.basicConfig(handlers=[
logging.handlers.SysLogHandler(
'/var/run/log', facility=logging.handlers.SysLogHandler.LOG_LOCAL7)
])
logging.warning('Hi')

This will write the following message to syslogd:

sendto(3,"<188>WARNING:root:Hi\0",21,0,NULL,0) = 21 (0x15)

This message gets rejected by syslogd, due to the change made in
r326573, which later got adjusted by me and subsequently MFCed:

https://svnweb.freebsd.org/base?view=revision&revision=326573

Gleb, what are your thoughts on the attached patch? It alters syslogd
to let the 'legacy' RFC 3164 parser also accept messages without a
timestamp. The time on the syslogd server will be used instead.

Michael, Marek, could you please give this patch a try? Thanks!

--
Ed Schouten <e...@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
syslogd-optional-timestamp.diff

Gleb Smirnoff

unread,
Jun 22, 2018, 4:15:03 PM6/22/18
to
Hi Ed,

On Fri, Jun 22, 2018 at 09:11:06PM +0200, Ed Schouten wrote:
E> > Ah, yes! Haven't thought about running syslogd in debugging mode:
E> >
E> > Failed to parse TIMESTAMP from x.x.x.x: fail2ban.filter [79598]: INFO […]
E>
E> This is interesting. As fail2ban uses Python's logging framework, I
E> managed to reproduce this with the following script:
E>
E> #!/usr/bin/env python3
E> import logging.handlers
E> logging.basicConfig(handlers=[
E> logging.handlers.SysLogHandler(
E> '/var/run/log', facility=logging.handlers.SysLogHandler.LOG_LOCAL7)
E> ])
E> logging.warning('Hi')
E>
E> This will write the following message to syslogd:
E>
E> sendto(3,"<188>WARNING:root:Hi\0",21,0,NULL,0) = 21 (0x15)
E>
E> This message gets rejected by syslogd, due to the change made in
E> r326573, which later got adjusted by me and subsequently MFCed:
E>
E> https://svnweb.freebsd.org/base?view=revision&revision=326573
E>
E> Gleb, what are your thoughts on the attached patch? It alters syslogd
E> to let the 'legacy' RFC 3164 parser also accept messages without a
E> timestamp. The time on the syslogd server will be used instead.
E>
E> Michael, Marek, could you please give this patch a try? Thanks!

I didn't examine the patch thoroughly, but I agree that looks like
we have no other choice as to support the legacy and normal messages
at the same time.

--
Gleb Smirnoff

Marek Zarychta

unread,
Jun 22, 2018, 4:53:03 PM6/22/18
to
On Fri, Jun 22, 2018 at 09:11:06PM +0200, Ed Schouten wrote:
Hi Ed,

Thank you for expedited effort.
Patch compiles fine and I can confirm, that it resolves the issue.

--
Marek Zarychta
signature.asc

Ed Schouten

unread,
Jun 22, 2018, 5:02:46 PM6/22/18
to
Hi Michael, Marek,

2018-06-22 22:48 GMT+02:00 Marek Zarychta <zary...@plan-b.pwste.edu.pl>:
> Patch compiles fine and I can confirm, that it resolves the issue.

Thanks for testing to both of you. Really appreciated.

I've just committed this patch as r335565. As it is a bit more
intrusive than the previous patch I wrote, let's give this a week to
settle in HEAD before merging it to 11-STABLE. I'll close PR 229236
once it's been merged.

--
Ed Schouten <e...@nuxi.nl>
Nuxi, 's-Hertogenbosch, the Netherlands
0 new messages