| From: | Ajit Awekar <ajitpostgres(at)gmail(dot)com> |
|---|---|
| To: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | [PATCH] Don't write ldapbindpasswd to the server log on authentication failure |
| Date: | 2026-12-04 09:03:07 |
| Message-ID: | CAER375MTuUUM5SSec5ZY3DFYOnJGk_FkxMvWH8FDa2kbYHQe2g@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi hackers,
When a login fails with LDAP search+bind authentication, the
ldapbindpasswd value from pg_hba.conf is written to the server log in
plaintext.
auth_failed() adds a detail line that quotes the matching pg_hba.conf
line verbatim. For a search+bind line, that includes the bind
password:
DETAIL: Connection matched file "/home/edb/edbdata/pg_hba.conf" line
119: "host all test1 127.0.0.1/32 ldap ldapserver=127.0.0.1
ldapport=3890 ldapbasedn="dc=example,dc=net"
ldapbinddn="cn=Manager,dc=example,dc=net" ldapbindpasswd=secret
ldapsearchattribute=uid"
(Wrapped here for readability; it is a single line in the log.)
The attached patch changes this narrowly. If the matched line uses
LDAP and has ldapbindpasswd set, the detail names only the file and
line number:
DETAIL: Connection matched file "/home/edb/edbdata/pg_hba.conf" line
119
All other lines, including LDAP lines without a bind password, are
logged exactly as before, so their messages and translations are
unchanged.
Successful LDAP logins do not have this problem: with log_connections
enabled they log only the file name and line number, for example:
LOG: connection authenticated: identity="uid=test1,dc=example,dc=net"
method=ldap (/home/edb/edbdata/pg_hba.conf:119)
So only the authentication-failure path is affected.
Shall we omit the line text, as this patch does, or log it with the
secret masked?
Thanks & Best Regards,
Ajit
| Attachment | Content-Type | Size |
|---|---|---|
| 0001-Don-t-log-ldapbindpasswd-in-the-Connection-matched-d.patch | application/octet-stream | 1.8 KB |
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Zsolt Parragi | 2026-12-04 09:06:57 | Re: DROP USER MAPPING doesn't acquire lock on its server |
| Previous Message | Suraj Kharage | 2026-12-04 09:02:57 | postgres_fdw: direct arguments of ordered-set aggregates are not checked for shippability |