New blog post: When Root Meets Immutable: OpenBSD chflags vs. Log Tampering

Started as curiosity about "dead" kernel code, ended up solving real-world log tampering problems. Sometimes the best security features are hiding in plain sight.

https://rsadowski.de/posts/2025/openbsd-immutable-system-logs/

#OpenBSD #InfoSec #BSD #Compliance

When Root Meets Immutable: OpenBSD chflags vs. Log Tampering

Rafael Sadowski

rsadowski.de

@sizeofvoid Awesome read, thank you so much!

I think there is a little copy paste error in the 2nd paragraph which is essentially two times the same text.

@js Thanks Jan for the feedback. Yes, I played with different versions and was puzzled.
@sizeofvoid Interesting, but it does mean you need to reboot to rotate logs and so need more space for live logs.
@sborrill @sizeofvoid Combined with regular updates that still seems manageable 😉
@sborrill Yes this is the trade off
@sizeofvoid I was just yesterday playing with chflags and I realised after «sysctl kern.securelevel» that I would need to restart the system to get rid of the files. I don't want to reboot, so there are some leftovers from that experiment now on my vps...
@sizeofvoid Hi. This is very interesting. Thank you for the blog post.
I might have missed a thing though : is log rotation done only at boot time? If so, how about servers that stay up for long periods of time? Thanks.

@sizeofvoid great post, thanks!

Makes me think I’d rather setup a dedicated syslog server running not syslogd but something like syslog-ng to be able to create append-only daily/monthly log files without the need to reboot 🤔

@sizeofvoid can root edit rc.securelevel to delete or edit logs? Or should it be set to immutable as well?

@jasper I would say it depends on whether you notice when your server has been rebooted. If this is the case, you don't need to set it. Because then you know that something is wrong and if the file has been modified, you know for sure.

The good thing and also the downside of this mechanism is that an attacker has to draw attention to himself via a reboot.