To audit secure boot journal entries, you must use the `journalctl` command to filter the systemd journal for UEFI and kernel security messages, specifically looking for indicators that the "Chain of Trust" was successfully established during the boot process. This is primarily achieved by running `journalctl -b | grep -i secure` to inspect the current boot session or by using `journalctl -b -1` to examine the logs from the previous boot. This process allows you to verify that your UEFI firmware, bootloader, and kernel have all passed signature verification, ensuring that no unauthorized code was executed during the startup sequence.
What You'll Need
- A Linux-based operating system using the systemd init system (such as Ubuntu, Fedora, Debian, or Arch).
- A system configured with UEFI (Unified Extensible Firmware Interface) rather than legacy BIOS.
- Sudo or root privileges to access protected system logs.
- The `mokutil` package installed (common on most distributions) to verify the current hardware state.
- The `systemd-journal` service running (standard on most modern Linux distributions).
Step-by-Step
- Verify the current Secure Boot hardware state. Before diving into the logs, you should confirm what the hardware itself reports. Open your terminal and execute `sudo mokutil --sb-state`. This command communicates with the Machine Owner Key (MOK) management system to tell you if Secure Boot is currently "Enabled" or "Disabled" at the firmware level. If this returns "Disabled," your journal entries will likely show that the kernel was loaded without security restrictions, regardless of what the logs say about signature checks.
- Identify the boot sessions available in your journal. To audit specific entries, you need to know which boot sessions are stored in your persistent logs. Use the command `journalctl --list-boots`. This will display a list of all recorded boot sessions, providing a unique index number for each (e.g., 0 for the current boot, -1 for the previous boot, -2 for the one before that). This is essential for auditing a boot that occurred before a suspected security incident.
- Filter the current boot journal for Secure Boot messages. Once you know the session index, you can search for specific security keywords. To see all entries from your current session related to Secure Boot, run `journalctl -b 0 | grep -i secure`. This command looks through the current boot (index 0) and uses `grep` to find any line containing the word "secure," ignoring case sensitivity. You are looking for strings like "EFI: Secure Boot enabled" or "Secure Boot: enabled".
- Audit a previous boot session. If you are investigating a system crash or a potential unauthorized change, you must look at the logs from the session that preceded the current one. Use the command `journalctl -b -1 | grep -i secure`. Replace `-1` with the specific index number you identified in step two if you need to look further back in time. This is the most effective way to confirm that the Chain of Trust was intact during a specific historical event.
- Inspect the Kernel Ring Buffer for signature verification. The kernel provides its own set of security logs that are often more granular than the general system journal. Use `journalctl -k | grep -i secure` to isolate kernel-level messages. In these logs, pay close attention to messages regarding "IMA" (Integrity Measurement Architecture) or "Lockdown" mode. If Secure Boot is active, the kernel often enters a "lockdown" state to prevent user-space processes from modifying the running kernel image. Seeing "Kernel is locked down" in these logs is a strong indicator that Secure Boot is functioning as intended.
- Verify the bootloader status via bootctl. If your system uses `systemd-boot` instead of GRUB, you can get a high-level summary of the boot security state by running `bootctl status`. This command will explicitly state whether the system is booted in UEFI mode and whether Secure Boot is active. This provides a secondary confirmation to the text-based journal entries you found in the previous steps.
Common Mistakes
One of the most frequent errors is assuming that because the BIOS/UEFI menu says "Secure Boot: Enabled," the operating system is actually utilizing it. There is a handoff process between the firmware and the OS; if the bootloader (like a custom-compiled GRUB) is not signed correctly, the system might fall back to a non-secure state or fail to boot entirely. Always verify the state from within the OS using `mokutil` or the journal entries themselves.
Another mistake is failing to use `sudo`. System logs, especially those containing sensitive boot information and kernel messages, are restricted to administrative users. If you run `journalctl` without `sudo`, you may see an empty result or a truncated list that does not include the critical security handoff messages you are looking for. Additionally, many users forget to check for the "Lockdown" status. Secure Boot is not just about the boot process; it changes how the kernel behaves once it is running. If you see Secure Boot is enabled but the kernel is not in lockdown mode, your security chain may be incomplete.
Tips
When searching through large amounts of log data, use the `less` command to make navigation easier. For example, `sudo journalctl -b | grep -i secure | less` allows you to scroll through the results using your arrow keys and search for specific terms by typing `/` followed by your search term. This is much more manageable than having a wall of text dump into your terminal.
If you want to save your audit results to a file for later review or for sharing with a security professional, you can pipe the output to a text file using the `tee` command: `sudo journalctl -b -1 | grep -i secure | tee boot_audit.txt`. This will both display the output on your screen and save it to `boot_audit.txt`. Finally, always check the `efivarfs` filesystem if you suspect the UEFI variables are being tampered with; this is the interface through which the kernel interacts with the UEFI firmware variables.
Troubleshooting
If `journalctl --list-boots` only shows the current boot (index 0) and no previous entries, your system is likely configured to use volatile logging. This means logs are stored in RAM and wiped upon every restart. To fix this, you must enable persistent logging. Edit the journald configuration file located at `/etc/systemd/journald.conf` and ensure the line `Storage=persistent` is present and not commented out. After saving the file, restart the service with `sudo systemctl restart systemd-journald`.
If `mokutil` returns a "command not found" error, you simply need to install the package. On Debian-based systems like Ubuntu, use `sudo apt install mokutil`. On Fedora, use `sudo dnf install mokutil`. If you are seeing "Signature verification failed" errors in your journal entries, this typically means a driver or a kernel module is attempting to load without a valid signature. This is common when using third-party NVIDIA drivers or VirtualBox modules. You will need to sign these modules using your own Machine Owner Key (MOK) to allow them to load under Secure Boot.
Frequently Asked Questions
What is the difference between Shim and Secure Boot?
Shim is a small, highly trusted bootloader signed by Microsoft that acts as an intermediary. It is designed to bridge the gap between the UEFI firmware and more complex bootloaders like GRUB, allowing Linux distributions to boot securely without requiring every single update to be signed by Microsoft.
Can I see Secure Boot journal entries on Windows?
No, this specific method of auditing via `journalctl` is exclusive to Linux systems using systemd. While Windows has its own security logging via the Event Viewer, the command-line tools and log structures described here are specific to the Linux kernel and systemd ecosystem.
Why does my journal say Secure Boot is enabled, but my drivers won't load?
This happens because Secure Boot enforces strict signature requirements. While the boot process itself was secure, any third-party kernel modules (like proprietary graphics drivers) must also be signed by a key that the system trusts. If they aren't, the kernel will block them to maintain the integrity of the system.
Does Secure Boot protect my files from being read?
No. Secure Boot is designed to ensure that only trusted code is executed during the startup process. It protects the integrity of the operating system and the boot chain, but it does not provide data encryption. For file protection, you should use tools like LUKS (Linux Unified Key Setup).
How often should I audit my boot logs?
For a standard home user, auditing logs is generally only necessary if you notice unusual system behavior, such as unexpected crashes or performance issues. For high-security environments or servers, automated log monitoring that flags signature failures is recommended.