Security Model & Workload Isolation
MicroFly enforces defense-in-depth isolation for all applications without embedding the overhead of an OCI runtime or Docker daemon. It achieves this by delegating execution to hardened systemd transient service units backed by Linux kernel security primitives.
Threat Model & Boundary Scope
IMPORTANT
MicroFly is designed for single-tenant or trusted multi-team environments (e.g., microservices within an engineering organization). It is not intended for adversarial public multi-tenancy where untrusted users can execute arbitrary malicious binaries.
The MicroFly daemon runs as root to configure transient units, adjust filesystem permissions, and bind unprivileged ports. Workloads run under an unprivileged system account (microfly-app).
Kernel & Systemd Isolation Primitives
Every application process, pre-deploy release command, and cron job is executed inside a transient systemd service unit (microfly-<app>-<kind>-<seq>.service) configured with the following hardening directives:
1. Identity & Capability Stripping
User=microfly-app/Group=microfly-app: Workloads execute under a non-root system identity.CapabilityBoundingSet=(Empty): Strips all POSIX capabilities (e.g.,CAP_NET_RAW,CAP_SYS_ADMIN,CAP_DAC_OVERRIDE).AmbientCapabilities=(Empty): Prevents inheriting or elevating ambient capabilities.NoNewPrivileges=yes: Prevents subprocesses from gaining new privileges via setuid/setgid binaries.
2. Filesystem & Path Restrictions
ProtectSystem=strict: Mounts the entire operating system filesystem hierarchy (/usr,/boot,/etc,/lib) as read-only.BindReadOnlyPaths=/var/lib/microfly/apps/<app>/releases/<release>: The application's own code and assets are strictly read-only. Applications cannot overwrite their binaries or tamper with release artifacts.InaccessiblePaths=/etc/microfly/master.key /var/lib/microfly/repos: Workloads are explicitly blocked from accessing the daemon's master encryption key or bare Git repositories.ReadWritePaths=/var/lib/microfly/apps/<app>/shared/storage: Workloads can only write to their own dedicated persistent volume directory. They cannot read or write to other applications' storage trees.PrivateTmp=yes: Allocates a dedicated, private/tmpand/var/tmpfilesystem namespace per unit. Temporary files cannot be viewed or hijacked by other processes.
3. Process & Kernel Isolation
ProtectProc=invisible&ProcSubset=pid: Limits/procvisibility so workloads can only see their own process threads. Host processes and other workloads are invisible.RestrictNamespaces=yes: Prevents workloads from creating user, network, mount, IPC, or UTS namespaces.ProtectKernelTunables=yes: Disallows modifying sysctl variables or kernel runtime parameters (/proc/sys,/sys).ProtectKernelModules=yes: Prevents loading or unloading kernel modules.ProtectControlGroups=yes: Mounts cgroup hierarchies read-only.SystemCallFilter=@system-service: Whitelists only standard system calls required for unprivileged network services.
4. Kernel eBPF Socket Filtering & Network Isolation
IPAddressDeny=any&IPAddressAllow=localhost(allow_outbound = false): Completely blocks all outbound internet and LAN traffic using kernel-level cgroup socket filtering. The service can only receive loopback ingress requests from the MicroFly reverse proxy.- RFC 1918 Private Network Isolation (
deny_private_networks = true): Injects kernel-level deny rules for private subnets (10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,169.254.0.0/16,fd00::/8,fe80::/10), preventing SSRF and internal network probing. - Explicit Destination Whitelisting (
allowed_egress = [...]): Whitelists only specific CIDRs at the kernel level while dropping all other egress.
Secrets Cryptography & Post-Quantum Hybrid Encryption
MicroFly protects sensitive credentials using hybrid post-quantum authenticated encryption:
- Post-Quantum Key Encapsulation: Implements NIST FIPS 203 ML-KEM-768 (Module-Lattice-Based Key Encapsulation) to protect secret keys against future quantum computer attacks (Shor's algorithm).
- Hybrid Key Derivation: Combines classical 256-bit entropy derived from the master key with quantum-resistant ML-KEM-768 shared secrets using HKDF-SHA256:
HybridKey_app = HKDF(classicalKey, pqSharedKey, "microfly-secrets-pq-hybrid:" + app_name) - Symmetric Authenticated Cipher: AES-256-GCM (Authenticated Encryption with Associated Data) with random 12-byte nonces and app-bound Additional Authenticated Data (
microfly-secrets-pq:<app>). - Tamper Resistance: GCM authentication tags verify ciphertext integrity. Modifying or tampering with encrypted storage files on disk causes decryption failure rather than corrupted execution.
- Online Rotation: Master key rotation re-encrypts all managed application secrets atomically with rollback safety on error.
- Memory Safety: Sensitive intermediate keying material is wiped from memory (
zeroBytes) after use.
Network Architecture & Trusted Proxies
- Loopback Enforcement: MicroFly ingress (
:8000), admin API (admin.sock), metrics (:9090), and webhooks (:8082) bind exclusively to loopback interfaces. - Reverse Proxy Header Validation: Ingress requests walk the
X-Forwarded-Forchain using configured CIDR ranges (trusted_proxies = ["127.0.0.1/32"]) to prevent IP spoofing attacks. - Request Identification: Ingress correlates every request with an
X-Request-IDheader, providing structured end-to-end tracing across reverse proxies, MicroFly logs, and backend applications. - Per-Application Kernel eBPF Network Filtering: Applications can configure declarative egress policies via
[network]inapp.toml. MicroFly translates these into systemdIPAddressAllow=andIPAddressDeny=directives, enforcing kernel-level cgroup socket filtering. Applications can disable all outbound internet connections (allow_outbound = false), block private LAN subnets (deny_private_networks = true), or whitelist specific egress destinations.