[pfx] Re: SASL username logging for failed authentications

2023-10-08 Thread Wietse Venema via Postfix-users
Wietse Venema via Postfix-users: > Viktor Dukhovni via Postfix-users: > > On Fri, Oct 06, 2023 at 06:50:38PM -0400, Wietse Venema via Postfix-users > > wrote: > > > > > +} else { > > > + server->username = mystrdup(serverout); > > > + printable(server->username, '?'); > > > > I might note th

[pfx] Re: SASL username logging for failed authentications

2023-10-08 Thread Jozsef Kadlecsik via Postfix-users
On Fri, 6 Oct 2023, Wietse Venema via Postfix-users wrote: > Jozsef Kadlecsik via Postfix-users: > > +sasl_username = xsasl_server_get_username(state->sasl_server); > > +if (sasl_username != 0) { > > + state->sasl_username = mystrdup(sasl_username); > > + printable(stat

[pfx] Re: SASL username logging for failed authentications

2023-10-08 Thread Jozsef Kadlecsik via Postfix-users
Hello, On Fri, 6 Oct 2023, Wietse Venema via Postfix-users wrote: > Has this been tested: > > - With Cyrus SASL? > > - With Dovecot auth? It was tested with Cyrus SASL only. > - With malformed AUTH commands? No, I tested valid AUTH commands with successful and unsuccessful authentications

[pfx] Re: SASL username logging for failed authentications

2023-10-07 Thread Wietse Venema via Postfix-users
Viktor Dukhovni via Postfix-users: > On Fri, Oct 06, 2023 at 06:50:38PM -0400, Wietse Venema via Postfix-users > wrote: > > > +} else { > > + server->username = mystrdup(serverout); > > + printable(server->username, '?'); > > I might note that when UTF8 is enabled, this does correctly le

[pfx] Re: SASL username logging for failed authentications

2023-10-06 Thread Viktor Dukhovni via Postfix-users
On Fri, Oct 06, 2023 at 06:50:38PM -0400, Wietse Venema via Postfix-users wrote: > +} else { > + server->username = mystrdup(serverout); > + printable(server->username, '?'); I might note that when UTF8 is enabled, this does correctly leaves valid UTF8 characters undisturbed. However

[pfx] Re: SASL username logging for failed authentications

2023-10-06 Thread Wietse Venema via Postfix-users
Wietse Venema via Postfix-users: > I think I can take it from here. Wietse 20231006 Clenaup: attempt to log the SASL username after authentication failure. This appends ", sasl_username=xxx" to SASL authentication failure logging. Based on code by Jozsef Kadlecsik

[pfx] Re: SASL username logging for failed authentications

2023-10-06 Thread Wietse Venema via Postfix-users
Jozsef Kadlecsik via Postfix-users: > +sasl_username = xsasl_server_get_username(state->sasl_server); > +if (sasl_username != 0) { > + state->sasl_username = mystrdup(sasl_username); > + printable(state->sasl_username, '?'); 1) There is no corresponding myfree() call. 2) There is

[pfx] Re: SASL username logging for failed authentications

2023-10-06 Thread Wietse Venema via Postfix-users
Jozsef Kadlecsik: > If I increase the log_level to 4 in the sasl config for smtpd and add -v > to smtpd in master.cf, then the username is reported in the log: Of course the login name is sent via the AUTH command, and it will show up in the raw protocol logging. Your example is for the LOGIN mec

[pfx] Re: SASL username logging for failed authentications

2023-10-06 Thread Jozsef Kadlecsik via Postfix-users
On Fri, 6 Oct 2023, Jozsef Kadlecsik via Postfix-users wrote: > However it's a debug mode, cannot be used in production. It is clear that > SASL protocol is not implemented and thus the messages have no meaning, > just reported. However, it seems the data is there and available. > > Would you c

[pfx] Re: SASL username logging for failed authentications

2023-10-06 Thread Jozsef Kadlecsik via Postfix-users
Hi Wietse, On Fri, 6 Oct 2023, Wietse Venema via Postfix-users wrote: > Jozsef Kadlecsik via Postfix-users: > > Hi, > > > > Is there a way to get the SASL username logged for the failed > > authentications together with the client IP data? Postfix can log half of > > the information the connec

[pfx] Re: SASL username logging for failed authentications

2023-10-06 Thread Wietse Venema via Postfix-users
Jozsef Kadlecsik via Postfix-users: > Hi, > > Is there a way to get the SASL username logged for the failed > authentications together with the client IP data? Postfix can log half of > the information the connecting client IP address, while Cyrus saslauthd > the second one the username. Howeve