Skip to content

Ghaf Architecture Overview

Ghaf implements a comprehensive security framework for edge devices through compartmentalization, virtualization, and zero-trust principles. This document provides detailed architectural insights into the system design and implementation.

Purpose: Provide unified interface across diverse hardware platforms Components:

  • Hardware detection and configuration
  • Driver management and isolation
  • Platform-specific optimizations
  • Secure boot and attestation

Supported Platforms:

  • x86_64: Intel/AMD processors with VT-x/AMD-V
  • AArch64: ARM Cortex-A processors with virtualization extensions
  • RISC-V: PolarFire and compatible RISC-V processors

Purpose: Secure isolation and resource management Technology: NixOS + MicroVM framework Features:

  • Type-1 hypervisor capabilities through NixOS
  • MicroVM for lightweight guest execution
  • Hardware-assisted virtualization
  • GPU passthrough and sharing

Purpose: Isolated execution environments Guest Types:

  • Application VMs: Browser, office, development tools
  • Service VMs: Network services, system utilities
  • Windows VMs: Legacy application compatibility
  • Specialty VMs: Hardware-specific or security-focused

Purpose: Secure, controlled communication between isolated environments Technology: GIVC (Guest Inter-VM Communication) Features:

  • Authenticated message passing
  • Resource sharing protocols
  • File transfer with security scanning
  • Display and input redirection

Purpose: System-wide services and management Services:

  • VM lifecycle management
  • Network configuration and isolation
  • Storage management and encryption
  • System monitoring and logging
  1. Never Trust, Always Verify: All components must authenticate
  2. Least Privilege Access: Minimal permissions for each component
  3. Assume Breach: Design for containment and recovery
  4. Continuous Monitoring: Real-time security state assessment
┌─────────────────────────────────────────────────────┐
│ Host System │
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
│ │ Browser VM │ │ Office VM │ │ Dev VM │ │
│ │ (Untrusted) │ │ (Trusted) │ │ (Trusted) │ │
│ └─────────────┘ └─────────────┘ └─────────────┘ │
│ │ │ │ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ GIVC Communication Layer │ │
│ └─────────────────────────────────────────────────┘ │
│ ┌─────────────────────────────────────────────────┐ │
│ │ Host Security Services │ │
│ └─────────────────────────────────────────────────┘ │
└─────────────────────────────────────────────────────┘
  • Untrusted: Internet-facing applications (browser, email)
  • Trusted: Business applications (office, development)
  • System: Core system services and management
  • Hardware: TPM, secure elements, hardware attestation

Each VM operates in isolated network segments with controlled routing:

Internet ← NAT Gateway ← Firewall ← Network Bridge ← VM Network
├── Browser VM (DMZ)
├── Office VM (Work)
├── Dev VM (Development)
└── Management (System)
  • Default Deny: All traffic blocked by default
  • Explicit Allow: Each connection requires explicit policy
  • Traffic Inspection: Deep packet inspection at boundaries
  • VPN Integration: Site-to-site and client VPN support
Application Data
VM Filesystem (ext4/btrfs)
dm-crypt Encryption
LVM Volume Management
Physical Storage (NVMe/eMMC)
  • Per-VM Storage: Isolated filesystem containers
  • Shared Storage: Controlled shared volumes with access controls
  • Encrypted Swap: Memory encryption for sensitive data
  • Secure Deletion: Cryptographic erasure capabilities

Technology: Nix flakes with flake-parts organization Benefits:

  • Reproducible builds across environments
  • Hermetic build isolation
  • Cross-platform compilation support
  • Dependency management and caching

Ghaf uses a hierarchical module system:

ghaf.nix (root)
├── common/ (base system)
├── profiles/ (system profiles)
├── hardware/ (platform support)
├── reference/ (examples)
├── development/ (dev tools)
└── virtualization/ (VM management)
  • Declarative Configuration: All system state in Nix expressions
  • Version Control Integration: Configuration versioning and rollback
  • Staged Deployment: Gradual rollout with automated testing
  • A/B Updates: Atomic system updates with fallback
  • CPU Isolation: Dedicated cores for critical VMs
  • Memory Management: NUMA-aware allocation
  • I/O Prioritization: QoS for storage and network
  • GPU Scheduling: Time-slice GPU sharing between VMs
  • Paravirtualization: Optimized guest drivers
  • Memory Ballooning: Dynamic memory allocation
  • Copy-on-Write: Efficient storage utilization
  • Kernel Bypass: DPDK and SPDK for high-performance I/O
  • Container Integration: Kubernetes and OCI compatibility
  • Cluster Management: Multi-node deployment support
  • Load Balancing: Traffic distribution across instances
  • Auto-scaling: Dynamic resource allocation
  • Resource Elasticity: Dynamic CPU/memory allocation
  • Storage Expansion: Hot-pluggable storage devices
  • Network Scaling: Multi-gigabit network support
  • GPU Scaling: Multi-GPU support and sharing

Technology: RESTful APIs with gRPC for high-performance Authentication: mTLS with certificate-based identity Authorization: RBAC with fine-grained permissions

  • Identity Providers: LDAP, Active Directory, SAML, OIDC
  • Monitoring Systems: Prometheus, Grafana, ELK stack
  • Backup Solutions: Restic, Borg, cloud storage
  • Management Platforms: Ansible, Terraform, Kubernetes

Multiple deployment formats from single configuration:

  • ISO Images: Bootable installation media
  • VM Images: QEMU, VMware, VirtualBox
  • Container Images: OCI-compatible containers
  • Flash Images: Raw images for embedded devices
  • Atomic Updates: All-or-nothing system updates
  • Rollback Capability: Instant rollback to previous state
  • Staged Rollout: Gradual deployment with health checks
  • Emergency Recovery: Secure boot fallback mechanisms
  • System Metrics: CPU, memory, storage, network utilization
  • Security Metrics: Failed authentications, policy violations
  • Performance Metrics: VM startup times, I/O latency
  • Business Metrics: Application usage, user activities
Application Logs → VM Syslog → Host Aggregator → Central Logging
Security Events → Audit Daemon → SIEM Integration → Alert Manager
Performance Data → Metrics Collector → Time Series DB → Dashboard
  • Real-time Alerts: Security incidents, system failures
  • Predictive Alerts: Resource exhaustion, performance degradation
  • Compliance Alerts: Policy violations, audit failures
  • Recovery Alerts: Automated remediation status