Akash Bahl

All projects

Fedora hardening

Going through my everyday laptop, one area at a time

  • In progress, 5 of 8 parts published
  • Started October 2026

This is the Fedora laptop I use every day. I'm working through it in eight parts, and for each one I write down what I found, what I changed, how I checked it and how to undo it.

View on GitHub

Machine
Fedora with Hyprland, btrfs on LUKS2
Method
Findings, changes, verification, rollback
Publish
Outputs redacted and scanned for secrets by script
Latest
05 users and sudo, 2 Nov 2026
  1. 01 disk layoutpublished
  2. 02 packages and repospublished
  3. 03 journalctlpublished
  4. 04 systemdpublished
  5. 05 users and sudopublished
  6. 06 firewalldto do
  7. 07 SELinuxto do
  8. 08 powerto do

Why I did it this way

Drop-in files for every change

I put changes in small drop-in files like journald.conf.d/50-size.conf and leave the defaults alone. Deleting the file undoes the change, package updates don't overwrite it, and it's easy to see exactly what I touched.

A script checks everything before it's published

This is my real machine, so every output file is redacted and scanned for secrets by a script before it goes in the public repo. The LUKS header backup is on a USB stick and stays out of the repo.

How I know it worked

Two checks from the parts published so far.

Part 05, users and sudo

One sudo rule, tested with a throwaway user

I gave a test user exactly one root command. That command ran, dnf with different arguments was refused, and reading /etc/shadow was denied. Then I deleted the rule and the user.

labuser ALL=(root) /usr/bin/dnf check-update
Terminal as labuser: dnf check-update is allowed, dnf install nano is refused with a not allowed message, and cat /etc/shadow returns permission denied
05-users-sudo/screenshots/05-labuser.png View on GitHub

Part 04, systemd

The daily backup runs from a timer

A user-level systemd timer makes a dated, compressed copy of my notes vault every day and keeps the newest 14. I also extracted the newest one to make sure it restores.

$ journalctl --user -u obsidian-backup.service
journalctl output for obsidian-backup.service showing the service starting, the script reporting backup done, and the service finishing
04-systemd/screenshots/04-backup-ran.png View on GitHub

What went wrong

Two problems so far.

  • The first backup run failed

    What I saw
    The backup service failed the first time it ran.
    Cause
    I'd left a placeholder in the script where the vault folder name goes, so tar couldn't find it.
    Fix
    I put in the real folder name. The script starts with set -euo pipefail, so it stopped at the error and didn't report a successful backup of nothing.
  • sudo rejected my new rules file

    What I saw
    visudo -c complained about the permissions on /etc/sudoers.d/10-hardening and asked for mode 0440.
    Cause
    sudo won't load a rules file that looks writable, because anyone who can write to it can give themselves root.
    Fix
    I set the owner to root and the mode to 0440, then checked the new defaults with sudo -l.

What's left

Three parts to go: firewalld, SELinux and power. I'll update this page as each one is published.

Tools so far: LUKS2 and cryptsetup, btrfs, dnf, journald, systemd units and timers, sudoers, Bash.