Files

Linux Hardening

Work in progress.

Goal

  • System Level: Protect critical files from being accessed by untrusted applications.
    1. Such as browser cookies, SSH keys, etc.
  • Per-App Level: Prevent untrusted applications(such as closed-source apps) from:
    1. Accessing files they shouldn't.
      • Such as a malicious application accessing your browser's cookies, SSH Keys, etc.
    2. Accessing the network when they don't need to.
    3. Accessing hardware devices they don't need.

Current Structure

1. System Level

  • AppArmor (apparmor/): AppArmor profiles and configuration
  • Kernel & System Hardening (profiles/): System-wide hardening profiles

2. Per-App Level

  • Nixpak (nixpaks/): Bubblewrap-based sandboxing for applications
    • Firefox configuration
    • QQ (Chinese messaging app) configuration
    • Modular system with reusable components
  • Firejail (legacy): SUID-based sandboxing (not used)
  • Bubblewrap (bwraps/): Direct bubblewrap configurations
    • WeChat sandboxing configuration

Current Implementation Status

Component Status Notes
AppArmor Profiles 🚧 WIP Basic structure in place
Nixpak Firefox Active Firefox sandboxing via nixpak
Nixpak QQ Active QQ application sandboxing
Bubblewrap WeChat Active WeChat specific sandboxing
System Profiles 🚧 WIP Hardened system configurations

Directory Structure

hardening/
├── README.md
├── apparmor/           # AppArmor security profiles
│   └── default.nix
├── bwraps/            # Direct bubblewrap configurations
│   ├── default.nix
│   └── wechat.nix
├── nixpaks/           # Nixpak application sandboxing
│   ├── default.nix
│   ├── firefox.nix
│   ├── qq.nix
│   └── modules/       # Reusable nixpak modules
│       ├── gui-base.nix
│       └── network.nix
└── profiles/          # System hardening profiles
    └── default.nix

Kernel Hardening

System Hardening

Application Sandboxing

NOTE

Running untrusted code is never safe, kernel hardening & sandboxing cannot change this.

If you want to run untrusted code, please use a VM & an isolated network environment, which will provide a much higher level of security.

References