brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: journalctl setup-keys seals your logs so tampering shows up

Journalctl
~/tips/tip-journalctl-setup-keys

sudo journalctl --setup-keys

Make later changes to stored journal files detectable with a key you keep elsewhere.

If someone breaks into a server, the logs are the first thing they would edit. Forward Secure Sealing in journald makes that kind of change detectable.

Persistent storage has to be on. Then generate a key pair:

sudo journalctl --setup-keys

This stores a sealing key on the machine in /var/log/journal/<machine-id>/fss and prints a verification key, which looks something like 681746-e361ee-5684d0-a2c0ff/1e735c-35a4e900. On a terminal it also shows a QR code. I’d write that verification key down somewhere off the server, in a password manager for example. journald seals the files at a regular interval, 15 minutes by default, and the sealing key moves forward each time so old seals can not be recreated.

To check the files later:

sudo journalctl --verify --verify-key='681746-e361ee-5684d0-a2c0ff/1e735c-35a4e900'

A healthy file comes back with PASS and a line saying from when to when the data was validated.

Sealing proves nothing about lines written after an attacker got root; they can write lies in real time. It also can not stop someone from deleting whole files. What it catches is changes to entries that were already sealed. And if the verification key only lives on the server, it is worthless, so keep it elsewhere.

Further reading: journalctl man page, journald.conf man page (Seal=)

More Journalctl tips journalctl -k -g 'killed process' --since "2 days ago" journalctl _PID=1 -b ls -lh /var/log/journal/*/*.journal~ Storage=volatile journalctl -F _KERNEL_SUBSYSTEM All Journalctl tips (81) All topics

Link