Privacy Tools Guide

The Arch Linux hardened kernel provides enhanced security features for users who prioritize privacy and system integrity. This guide covers the complete installation process, from understanding the hardened kernel variants to configuring boot parameters for maximum protection. The hardened kernel builds upon the standard Linux kernel with additional security patches from the Linux Hardening Project and grsecurity, though many grsecurity features now require paid subscriptions.

Understanding Kernel Hardening Options

Arch Linux offers several kernel packages through the official repositories and the AUR. The primary options include:

For privacy-focused users, linux-hardened provides the most aggressive security defaults. The kernel includes features like kernel page table isolation (KPTI), randomize kernel memory offsets, and hardened user copy operations. These features protect against common privilege escalation attacks and memory corruption vulnerabilities.

The linux-hardened package also enables various compile-time security features that are disabled in the standard kernel for performance reasons. This includes stronger stack protection, fortify source functions, and readonly GOT (Global Offset Table) relocations.

Installation Prerequisites

Before installing the hardened kernel, ensure your system is fully updated:

sudo pacman -Syu

Verify your current kernel version:

uname -r

Check available kernel packages in the official repositories:

pacman -Ss ^linux-hardened$

Ensure you have adequate free space in /boot. The hardened kernel adds approximately 20-30MB to your boot partition. Check current usage:

df -h /boot

Backup your current kernel configuration if you’ve made custom modifications:

cp /boot/config-linux $(uname -r)-config-backup

Installing the Hardened Kernel

Install the hardened kernel and its dependencies:

sudo pacman -S linux-hardened linux-hardened-headers

The package includes the kernel image, initramfs, and modules. After installation, regenerate your GRUB configuration to include the new kernel:

sudo grub-mkconfig -o /boot/grub/grub.cfg

If you use a different bootloader such as systemd-boot, rEFInd, or Clover, consult its documentation for adding kernel entries. You may need to manually create a boot entry pointing to /boot/vmlinuz-linux-hardened and /boot/initramfs-linux-hardened.img.

Configuring Boot Parameters

Hardened kernel features require appropriate boot parameters. Edit your GRUB configuration at /etc/default/grub and add the following to GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT="quiet splash mitigations=auto nosmt"

Key parameters explained:

Additional parameters worth considering:

After editing, regenerate the GRUB config:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Verifying Hardening Features

After rebooting into the new kernel, verify the hardening features are active:

uname -r

This should display a version ending with -hardened-ARCH.

Check kernel hardening status:

cat /proc/sys/kernel/unprivileged_bpf_disabled

A value of 1 indicates BPF is restricted to privileged users only, preventing unprivileged users from executing eBPF programs that could leak sensitive information.

Verify memory randomization:

cat /proc/sys/kernel/randomize_va_space

Value 2 enables full address space layout randomization (ASLR), making memory corruption exploits significantly more difficult.

Check the current sysctl settings related to kernel hardening:

sysctl -a | grep -E 'kernel\.(randomize|unprivileged)'

Managing Kernel Modules

The hardened kernel provides additional module loading controls. To restrict module loading:

sudo sysctl kernel.modules_disabled=1

Make this permanent by adding to /etc/sysctl.d/99-hardening.conf:

kernel.modules_disabled=1

This setting prevents loading any additional kernel modules after boot, significantly reducing the kernel attack surface. However, this prevents loading proprietary drivers that install as modules.

Review currently loaded modules:

lsmod | head -20

For advanced users, consider creating a module blocklist in /etc/modprobe.d/blacklist.conf:

blacklist usb-storage
blacklist firewire-core
blacklist thunderbolt

These blocklists prevent specific hardware drivers from loading, which can protect against physical attacks through USB, FireWire, or Thunderbolt ports.

Systemd Hardening

Extend kernel hardening with systemd security options. Edit /etc/systemd/system.conf:

[Manager]
DefaultLimitNOFILE=65536
DefaultTasksMax=8192

Enable systemd sandboxing for services by creating drop-in files:

mkdir -p /etc/systemd/system/service-name.service.d

Create /etc/systemd/system/service-name.service.d/10-hardening.conf:

[Service]
ProtectSystem=strict
ProtectHome=true
PrivateTmp=true
NoNewPrivileges=true
ReadOnlyPaths=/bin /boot /dev /etc /lib /lib64 /opt /proc /root /sbin /sys /usr /var

These settings isolate services from the filesystem and prevent privilege escalation.

Boot Security with Secure Boot

For systems with UEFI Secure Boot, sign the hardened kernel:

sudo sbsign --key /path/to/MOK.key --cert /path/to/MOK.pem --output /boot/vmlinuz-hardened /boot/vmlinuz-hardened

Enroll your signing key in the UEFI database through the firmware settings. This ensures only signed kernels can execute, preventing bootkits and unauthorized operating system loading.

If you’re using sbctl from the AUR, enrollment is simplified:

sudo sbctl enroll-keys

Troubleshooting Common Issues

Some proprietary drivers may not work with the hardened kernel. If you encounter issues:

  1. Boot into the standard kernel from GRUB menu
  2. Remove linux-hardened and reinstall the standard kernel
  3. Check the AUR for hardware-specific hardened kernel builds

For NVIDIA users, ensure you have the appropriate drivers:

sudo pacman -S nvidia-dkms

The DKMS package works across kernel updates. However, NVIDIA’s closed-source driver may conflict with certain hardened kernel security features. If you experience stability issues, you may need to use the open-source nouveau driver instead.

Common issues include:

Maintenance and Updates

Keep your hardened kernel updated through regular system updates:

sudo pacman -Syu

Monitor kernel-related announcements:

pacman -Qlinux-hardened

Verify your system boots correctly after each update. Keep a fallback kernel available in your GRUB menu by ensuring the standard kernel remains installed.

Performance Considerations

Hardened kernels may introduce slight performance overhead from security features. Benchmark your typical workloads:

hyperfine --warmup 3 'your-workload-command'

Typical performance impact ranges from 1-5% for compute-heavy workloads. If performance degradation is unacceptable, consider the zen kernel as a balance between security and speed, or selectively disable certain boot parameters.

The hardened kernel provides substantial security improvements for privacy-conscious users. Combined with proper system configuration and security practices, it forms a foundation for a privacy-focused Arch Linux installation.

Built by theluckystrike — More at zovo.one