https://bugs.openldap.org/show_bug.cgi?id=10605
Issue ID: 10605 Summary: slapo-auditlog creates the log file with insecure permissions (0666) Product: OpenLDAP Version: unspecified Hardware: All OS: All Status: UNCONFIRMED Keywords: needs_review Severity: normal Priority: --- Component: overlays Assignee: bugs@openldap.org Reporter: dns.spiros@gmail.com Target Milestone: ---
Created attachment 1216 --> https://bugs.openldap.org/attachment.cgi?id=1216&action=edit patch implementing the described change
The auditlog overlay opens its log file with mode 0666:
fd = open(ad->ad_logfile, flags, 0666);
Combined with a typical process umask (e.g. 022), this commonly results in a file that is world-readable (0644) - and, with a permissive umask, can remain world-writable as literally requested.
This is a real concern for two independent reasons:
1. Confidentiality: the audit log records the full LDIF of every Add/ Modify/Delete/ModRDN operation, including attribute values. In our own testing, this included userPassword hashes (SSHA) appearing in clear LDIF form inside the log file. A world-readable audit log exposes this to any local user, regardless of the LDAP-level ACLs protecting the same data inside the directory itself.
2. Integrity: mode 0666 as requested permits world-write. An audit trail that any local user can modify does not reliably serve its purpose - tampering or truncation by an unprivileged user should not be possible.
Standard security guidance for audit logging (CIS Benchmarks, DISA STIG, PCI-DSS Requirement 10.5, ISO/IEC 27001 Annex A.12.4) consistently requires that audit logs be protected from unauthorized read and write access - not left to whatever the deploying administrator's umask happens to be.
Attached is a patch (plain git diff) changing the requested mode to 0640 (owner read/write, group read, no access for others), hardcoded rather than left to umask, consistent with how other security-sensitive files (e.g. private keys) are typically created.
Note: this is a behavior change for any existing deployment relying on broader access to the raw log file (e.g. a non-group member reading it directly) - such setups would need to adjust group membership or ACLs accordingly after upgrading.
https://bugs.openldap.org/show_bug.cgi?id=10605
Elia Pinto dns.spiros@gmail.com changed:
What |Removed |Added ---------------------------------------------------------------------------- Summary|slapo-auditlog creates the |slapo-auditlog uses an |log file with insecure |overly permissive default |permissions (0666) |file mode (0666) for the | |audit log file
https://bugs.openldap.org/show_bug.cgi?id=10605
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |RESOLVED Resolution|--- |INVALID
--- Comment #1 from Howard Chu hyc@openldap.org --- This is the case for all files created by slapd: you must set a proper umask already. There is no bug here.
https://bugs.openldap.org/show_bug.cgi?id=10605
Howard Chu hyc@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Resolution|INVALID |TEST Target Milestone|--- |2.6.16 Assignee|bugs@openldap.org |hyc@openldap.org
--- Comment #2 from Howard Chu hyc@openldap.org --- Actually you're right. Fixed in e94aacc4088083d8393bb0af6fd7b9b3d817a415
https://bugs.openldap.org/show_bug.cgi?id=10605
--- Comment #3 from Elia Pinto dns.spiros@gmail.com --- The audit file differs from other files. The Linux audit file, for instance, is created with 640 permissions; it is independent of the creating user's umask, although the umask can restrict the permissions further. International standards are explicit on this point. If a restrictive global umask were set for the `slapd` daemon, even files intended to be world-readable would become inaccessible. In any case, the audit file must never be world-readable.
https://bugs.openldap.org/show_bug.cgi?id=10605
--- Comment #4 from Howard Chu hyc@openldap.org ---
If a restrictive global umask were set for the `slapd` daemon, even files intended to be world-readable would become inaccessible.
Any files created by slapd may contain privileged info, as such all files created by slapd should be private to slapd. It's routine for DB files to contain user account info including secret credentials; clearly DB files must never be world readable. Moreover DB files must never be world accessible at all, otherwise that would present an avenue for bypassing slapd's ACLs. So in practice, slapd should always be run with a locked down umask.
https://bugs.openldap.org/show_bug.cgi?id=10605
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Keywords|needs_review |
--- Comment #5 from Quanah Gibson-Mount quanah@openldap.org --- head:
• e94aacc4 by Howard Chu at 2026-09-24T16:02:14+01:00 ITS#10605 slapo-auditlog: tighten privs on logfile
Should never have world access. Should not have group write access.
https://bugs.openldap.org/show_bug.cgi?id=10605
Quanah Gibson-Mount quanah@openldap.org changed:
What |Removed |Added ---------------------------------------------------------------------------- Target Milestone|2.6.16 |2.7.2
https://bugs.openldap.org/show_bug.cgi?id=10605
--- Comment #6 from Quanah Gibson-Mount quanah@openldap.org --- RE27:
b2b1b65f by Howard Chu at 2026-10-01T22:48:56+00:00
ITS#10605 slapo-auditlog: tighten privs on logfile
Should never have world access. Should not have group write access.