FS#42954 - [linux] 4.2.x Reenable CONFIG_AUDITSYSCALL
Attached to Project:
Arch Linux
Opened by Jan Alexander Steffens (heftig) - Saturday, 29 November 2014, 15:20 GMT
Last edited by Eli Schwartz (eschwartz) - Sunday, 19 August 2018, 23:03 GMT
Opened by Jan Alexander Steffens (heftig) - Saturday, 29 November 2014, 15:20 GMT
Last edited by Eli Schwartz (eschwartz) - Sunday, 19 August 2018, 23:03 GMT
|
Details
Can we reenable CONFIG_AUDITSYSCALL? This would restore
/proc/self/loginuid, which is needed for getlogin() to work
for processes that have no terminal, such as in
display-managed sessions.
As I understand, it was originally disabled because of an incompatibility with containers, but as of kernel 3.14 this can be solved and at least systemd-nspawn is patched since http://cgit.freedesktop.org/systemd/systemd/commit/?id=db999e0f923ca6c2c1b919d0f1c916472f209e62 . |
This task depends upon
Closed by Eli Schwartz (eschwartz)
Sunday, 19 August 2018, 23:03 GMT
Reason for closing: Implemented
Additional comments about closing: linux 4.18.arch1-1
Sunday, 19 August 2018, 23:03 GMT
Reason for closing: Implemented
Additional comments about closing: linux 4.18.arch1-1
Fedora is disabling it by default at runtime due to the performance hit:
https://fedorahosted.org/fesco/ticket/1311
I delved a bit into the kernel code and I think that's right. In the case that neither audit=0 nor audit=1 is given, the audit subsystem remains dormant (audit_ever_enabled remains 0) and no task is syscall-audited until there's a request from userspace (auditd) to enable auditing.
Since, unlike Fedora, we do not install auditd by default, I think we're in the clear.
1. Leave AUDITSYSCALL disabled.
getlogin() and other users of the loginuid/sessionid interface remain broken.
People wanting to use the audit subsystem need to build their own kernel.
Simple and uncomplicated, but if I were satisfied with the status quo, I wouldn't have opened a bug.
2. Enable syscall auditing and take the performance hit.
How expensive is it really? The referenced ticket only provides microbenchmarks.
3. Include parts of audit userspace in base and disable syscall auditing.
An "audit-minimal" package could include just auditctl and libaudit and a static service calling "auditctl -a task,never" at boot.
Enabling libaudit support in systemd could then pull this in.
Probably rightly called bloat, even though we don't need to include auditd and most of the other stuff.
4. Patch the kernel so audit=0 becomes the default.
People wanting to use the audit subsystem need to set audit=1.
A rather small and simple patch, but goes against our principles.
5. Patch journald and remove the audit logging feature.
Not a complicated patch, but goes against our principles.
What about people who actually want this feature?
6. Patch journald to disable syscall auditing at boot.
Probably a pretty daunting task fraught with unforeseen consequences and a dependency on libaudit.
7. Patch the kernel so syscall auditing can be disabled by default.
Likely a complex task and a permanent derivation from upstream.
8. Patch the kernel and disentangle loginuid/sessionid from the rest of auditing.
This would be wonderful, but who is going to do it?
It moves all system calls from the fast path to the slow path even if they don't block. The cost for niches like an event-based server where a large portion of the time is spent paying for system calls is huge.
> Patch the kernel so audit=0 becomes the default.
Upstream would probably accept a flag for changing the default, so that seems like a good option.
[0] https://github.com/anthraxx/linux-hardened/commit/deb24e7c223793c96e167acc9aff169748742a38
# CONFIG_CMDLINE_BOOL is not set
instead of
CONFIG_CMDLINE_BOOL=y
CONFIG_CMDLINE="audit=0"
is that intentional?
@spinka so linux-hardened could remove the flag?
@loqs yes, I don't think there are reasons for keeping audit=0 anymore.
Just stumbled upon this problem after upgrading to 4.18.1.
Probably worth noting that one can stop journald retrieving the audit logs:
`systemctl mask systemd-journald-audit.socket`
Took me a while to find this, maybe it is worth adding this to the wiki.
Are we sure there's no performance impact of this? Historically, CentOS was slower than other distributions, and CONFIG_AUDIT might be a reason.
https://www.phoronix.com/scan.php?page=article&item=5distros-post-spectre&num=1