Lion Cipher Lab

Make logs tamper-evident: append-only and immutable files even root can't quietly edit

Why it matters

An attacker who lands root almost always tries to erase their trail — delete the auth log, blank out a shell history, edit a line out of the middle of a file. Standard Unix permissions can't stop root from doing any of that. Linux ext filesystems have a second, separate layer of file attributes that CAN: the append-only flag lets new lines be added but blocks truncation, in-place edits, deletion, and renaming; the immutable flag freezes a file completely. Setting them on your logs and critical configs turns a silent wipe into a loud, failed operation — a speed bump and a tripwire. Knowing…

What you'll learn

Steps in this lab

  1. The idea: a second lock that even root obeys
  2. Confirm you're on ext4 and set up a target
  3. MEASURE the 'before': as root, you can wipe the log freely
  4. Set append-only on the log, immutable on the config
  5. Inspect with lsattr — see the flags
  6. MEASURE the 'after': prove the lock holds — even as root
  7. The logrotate gotcha — and how to handle it
  8. The honest limit: root can undo this — so this is a tripwire, not a vault
  9. Clean up

Open the full interactive lab →