Application Isolation Architecture
AppArmor MAC enforce profiles, Bubblewrap user namespaces, and Seccomp-BPF filters.
Snigdha OS Decentralized - Confinement & Application Isolation Architecture
Subsystem: Snigdha Isolation (Phase 5)
Author: Snigdha OS Distribution Architecture Core
Applicability: Snigdha OS Decentralized (Live System)
Status: COMPLETE & ENFORCED
1. Architectural Philosophy
Snigdha Isolation implements defense-in-depth confinement for all desktop applications and system background daemons. Rather than relying on a single monolithic sandbox tool, isolation is achieved through the layered orchestration of:
- Mandatory Access Control (AppArmor): Enforces mandatory kernel-level file, capability, network, and unix-socket rules regardless of process UID.
- Interactive Application Sandboxing (Bubblewrap): Constructs hermetic execution environments utilizing Linux unprivileged user, mount, PID, IPC, and UTS namespaces.
- Session D-Bus Filtering (
xdg-dbus-proxy): Intercepts and filters desktop IPC calls, blocking access to administrative daemons. - System Call Filtering (Seccomp-BPF): Attaches compiled Berkeley Packet Filters to disallow dangerous kernel interfaces (
ptrace, module loading, reboot, keyrings). - System Service Hardening (systemd drop-ins): Hardens all system services individually using declarative unit constraints (
ProtectSystem,PrivateTmp,RestrictSUIDSGID,CapabilityBoundingSet).
2. Multi-Layer Security Architecture
+-----------------------------------------------------------------------------------+
| SNIGDHA APPLICATION EXECUTION |
+-----------------------------------------------------------------------------------+
│
▼
[ 1. snigdha-sandbox Launcher ]
Validates ID, schema, and binary presence
│
┌─────────────────────────────┼─────────────────────────────┐
▼ ▼ ▼
[ 2. AppArmor MAC ] [ 3. xdg-dbus-proxy ] [ 4. Seccomp-BPF ]
Kernel LSM enforcement Filters D-Bus methods Blocks dangerous syscalls
Path / Capability denies Rejects privileged calls (ptrace, reboot, modules)
│ │ │
└─────────────────────────────┼─────────────────────────────┘
│
▼
[ 5. Bubblewrap Sandbox Engine ]
┌────────────────────────────────┴────────────────────────────────┐
│ * Namespaces: User, Mount, PID, IPC, UTS │
│ * Filesystem: Read-only /usr, private volatile /tmp, masked etc │
│ * Network Policy: host-enforced (NetGuard Tor) OR offline │
│ * Persistence: Masked with empty tmpfs when locked │
│ * Devices: Minimal /dev (null, zero, urandom, dri) │
└────────────────────────────────┬────────────────────────────────┘
│
▼
[ Target Unprivileged Execution ]
Confined execution inside disposable sandbox
3. Subsystem Components
3.1 AppArmor Kernel Foundation
- Kernel Parameter: Loaded at boot via
lsm=landlock,lockdown,yama,integrity,apparmor,bpf apparmor=1 security=apparmor. - Ordering: Preserves Landlock, Lockdown, Yama, Integrity, and BPF in standard Arch Linux ordering while activating AppArmor.
- Profiles: Located in
/etc/apparmor.d/on rootfs, including:- Daemons:
snigdha-netguardd,snigdha-persistenced,snigdha-amnesia-guard,snigdha-amnesia-shutdown,snigdha-media-watchdog,snigdha-firewall,snigdha-tor. - Applications:
snigdha-kitty,snigdha-thunar,snigdha-rofi,snigdha-feh,snigdha-desktop-utilities.
- Daemons:
- Enforcement: All profiles are in strict
ENFORCEmode (flags=(enforce)). Complain mode is never used for production confinement.
3.2 Bubblewrap (snigdha-sandbox)
- Namespace Isolation:
--unshare-user: Maps user namespace without setuid helpers.--unshare-pid: Masks host processes; sandbox only observes its own child processes.--unshare-ipc: Prevents shared memory and message queue snooping.--unshare-uts: Isolates hostname.--new-session: Prevents terminal ioctl (TIOCSTI) injection.--die-with-parent: Eliminates orphaned processes upon parent exit.
- Network Policies:
host-enforced: Retains host network namespace so all traffic is intercepted by NetGuard nftables rules and routed through Tor.offline: Employs--unshare-net(loopback only) with zero external network connectivity.
- Filesystem Construction:
- System: Strictly read-only
/usr, symlinked/lib,/lib64,/bin,/sbin. - Sensitive Paths:
/etc/shadow,/etc/gshadowmasked with/dev/null;/etc/tor,/etc/nftables.dmasked with emptytmpfs. - Private Home: Ephemeral
tmpfsover$HOME, exposing only approved config paths under~/.var/app/{id}.
- System: Strictly read-only
3.3 Session D-Bus Filtering (xdg-dbus-proxy)
- Started automatically by
snigdha-sandboxwhen policy specifiesdbus.policy != "none". - Provides an isolated proxy socket bound to
/run/user/{uid}/businside the sandbox. - Enforces
--filter, allowing only declared bus names (e.g.,org.freedesktop.Notifications). - Denies privileged services:
org.snigdha.NetGuard1,org.snigdha.Persistence1,org.freedesktop.systemd1. - Automatically terminates when parent file descriptor closes (
--fd=FD).
3.4 Seccomp System Call Filtering
- Declarative policies compiled into raw BPF bytecode using native
libseccompcompiler (snigdha-seccomp-compiler). - Filters passed directly to bubblewrap via file descriptor (
--seccomp <fd>). - Disallows:
init_module,finit_module,delete_module,reboot,kexec_load,ptrace,process_vm_readv,process_vm_writev,mount,umount2,pivot_root,chroot,syslog,perf_event_open,bpf,keyctl,swapon,swapoff,settimeofday. - Offline profiles additionally block socket creation (
socket(),connect(),bind()).
3.5 systemd Service Hardening
All 9 system background services are hardened using drop-in configurations (/etc/systemd/system/*.service.d/hardening.conf):
ProtectSystem=strictProtectHome=yes(or read-only where persistence mount is required)PrivateTmp=yesProtectKernelTunables=yesProtectKernelModules=yesProtectControlGroups=yesRestrictSUIDSGID=yesLockPersonality=yesSystemCallArchitectures=nativeCapabilityBoundingSetrestricted to essential capabilities only.
4. Confinement Diagnostics Tool (snigdha-isolation)
Provides an operator and testing interface:
snigdha-isolation status # Overall confinement health summary
snigdha-isolation list # List registered application profiles
snigdha-isolation inspect ID # Inspect specific policy details
snigdha-isolation verify # Execute deterministic invariant verification
snigdha-isolation apparmor # Audit AppArmor LSM modules and profiles
snigdha-isolation namespaces # Audit Linux namespace capabilities
snigdha-isolation seccomp # Audit Seccomp BPF filters
snigdha-isolation services # Audit systemd service hardening
snigdha-isolation diagnose # Complete diagnostic dump (supports --json)
5. Snigdha Security Center Integration (Phase 7)
Snigdha Isolation provides live confinement inspection over D-Bus system bus via interface org.snigdha.Isolation1 (/org/snigdha/Isolation1):
- LSM & AppArmor Metrics:
GetStatus()reports active AppArmor status, count of enforcing vs complaining profiles, active Bubblewrap container count, and seccomp filter support. - Profiles & Sandboxes Audit:
GetProfiles()andAuditSandboxes()feed real-time profile lists and live sandbox process metrics to the Snigdha Security Center Isolation page (snigdha-security-center). - Confinement of Security Center: Security Center itself is confined by AppArmor profile
/etc/apparmor.d/snigdha-security-center, ensuring it cannot bypass isolation or access raw hardware blocks.