Skip to main content

AEGIS โ€” Stackable Linux Security Module

An in-tree Linux Security Module (LSM) that boots from upstream torvalds/linux. Process protection, SHA-256 file integrity, syscall auditing, and kernel module control โ€” stacked with the existing LSMs, configurable per subsystem. Booted end-to-end in QEMU with a one-command reproduce script.

What It Doesโ€‹

AEGIS (Advanced Guardian for Integrated System Security) is C code that lives inside the Linux kernel's security/ tree. It registers a hook table through the LSM framework, so instead of replacing the kernel's own security model it stacks on top of it โ€” alongside capability, Yama, and AppArmor. Every subsystem is independent and compiled behind its own Kconfig flag.

Key Featuresโ€‹

๐Ÿ›ก๏ธ Process Protectionโ€‹

Restricts ptrace(PTRACE_ATTACH) and PTRACE_TRACEME per process โ€” makes debugger-aided privilege escalation attackers work much harder.

๐Ÿ” SHA-256 File Integrityโ€‹

Digest tracking and write-protection for critical system files, enforced from file_open / file_permission / inode_permission hooks.

๐Ÿ“Š Syscall Auditโ€‹

Blocking and logging of dangerous syscalls per process policy, driven from the bprm_check_security hook.

๐Ÿ”Œ Module Controlโ€‹

Restricts kernel_load_data and kernel_read_file โ€” runtime tightening of kernel module loading.

โš™๏ธ Runtime Interfacesโ€‹

/proc/sys/kernel/aegis (sysctl) and /sys/kernel/security/aegis (securityfs) โ€” toggle features live, list protected procs/files, dump blocked syscalls.

๐Ÿ–ฅ๏ธ Bootable DevKitโ€‹

Static PID 1 initramfs + aegisctl control tool + QEMU launcher. CI compiles the module in-tree and builds the userspace. No mocking โ€” a real built kernel.

Architectureโ€‹

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ user space (aegisctl) โ”‚
โ”‚ status ยท enable ยท stats ยท procs โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ โ–ผ
/proc/sys/kernel/aegis /sys/kernel/security/aegis
โ”‚ โ”‚
โ–ผ โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ aegis_sysctl.c aegis_โ€ฆfs.c โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ aegis_lsm.c โ€” hook table โ”‚
โ”‚ LSM_HOOK_INIT(task_alloc, โ€ฆ) โ”‚
โ”‚ LSM_HOOK_INIT(ptrace_*, โ€ฆ) โ”‚
โ”‚ LSM_HOOK_INIT(file_*, inode_*, โ€ฆ) โ”‚
โ”‚ LSM_HOOK_INIT(bprm_check_security) โ”‚
โ”‚ LSM_HOOK_INIT(kernel_load_data, โ€ฆ) โ”‚
โ””โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
โ–ผ โ–ผ โ–ผ
file.c audit.c module.c
process.c

Every hook is registered through LSM_HOOK_INIT, so AEGIS behaves exactly like any other mainline LSM and composes with the rest of the stack.

Tech Stackโ€‹

ComponentTechnology
LanguageC (six source files, ~1,900 lines)
KernelLinux 7.3-rc1 (upstream torvalds/linux)
FrameworkLSM (security/, LSM_HOOK_INIT)
IntegritySHA-256
Interfacessysctl + securityfs
Userspace toolaegisctl (C, static)
RuntimeQEMU (nographic / GUI / GDB)
ConfigCONFIG_LOCALVERSION="-aegis"
CIGitHub Actions โ€” in-tree module build + devkit build

Reproduce Itโ€‹

$ ./apply.sh
==> Cloning upstream kernel...
==> Installing AEGIS module source
==> Applying integration patches
==> Building kernel (this takes a while)...
==> Done.
Kernel : /tmp/aegis-build/linux/arch/x86/boot/bzImage

Then boot it:

$ cd devkit && make initramfs && make qemu
/ # uname -r
7.3.0-1-aegis
/ # aegisctl status
AEGIS LSM status: enabled
Feature flags: process-protect file-integrity syscall-audit module-control

Links: GitHub