Skip to content

Commit 493d06e

Browse files
vadikabrianmcgillion
authored andcommitted
docs: add architecture notes on inter-VM channels, memory wipe, and secret handling
Signed-off-by: vadik likholetov <[email protected]>
1 parent 48410a7 commit 493d06e

File tree

4 files changed

+168
-0
lines changed

4 files changed

+168
-0
lines changed

docs/astro.config.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,11 @@ export default defineConfig({
4444
items: [
4545
"ghaf/overview/arch",
4646
"ghaf/overview/arch/system-architecture",
47+
"ghaf/overview/arch/inter-vm-communication-control",
4748
"ghaf/overview/arch/variants",
4849
"ghaf/overview/arch/hardening",
50+
"ghaf/overview/arch/vm-memory-wipe",
51+
"ghaf/overview/arch/prohibited-hardcoded-secrets",
4952
"ghaf/overview/arch/critical-services-privilege-escalation",
5053
"ghaf/overview/arch/system-logs-encryption",
5154
"ghaf/overview/arch/vm-network-separation",
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Controlled, Auditable Inter-VM Communication
3+
description: Why Ghaf restricts inter-VM communication to tightly controlled, auditable channels
4+
---
5+
6+
# Controlled, Auditable Inter-VM Communication
7+
8+
Ghaf isolates workloads into MicroVMs and then deliberately constrains how those VMs can talk to each other. Inter-VM communication is allowed only through explicitly designed, controlled channels because the VM boundary is the primary security barrier. If that boundary is pierced by arbitrary or hidden links, the isolation model collapses. This document explains the security, operational, and auditability reasons for keeping inter-VM communication narrow and observable.
9+
10+
## Why unrestricted inter-VM links are unacceptable
11+
12+
### Preserve isolation and limit lateral movement
13+
Ghaf treats each VM as a distinct trust domain. High-risk or network-facing components run in isolated VMs, and the architecture relies on minimal, audited inter-VM interfaces to prevent lateral movement if one VM is compromised. Allowing ad-hoc or implicit communication paths would create invisible trust bridges that bypass the isolation model and increase the blast radius of a compromise.
14+
15+
### Enforce least privilege across domains
16+
Ghaf applies least privilege at the VM boundary, not just within a single OS instance. A VM should only have the minimal rights and interfaces required to do its job. A controlled inter-VM channel allows Ghaf to restrict what a VM can request, who it can talk to, and what data can traverse the boundary. This fits the platform-wide principle of least privilege and maintains clear trust levels between untrusted, trusted, and system roles.
17+
18+
### Reduce attack surface and ambiguity
19+
Every additional communication path is a new attack surface and a new source of ambiguity during incident response. A small, well-defined set of inter-VM channels reduces the number of protocols to defend and makes it possible to reason about cross-VM dependencies. This is especially important in a zero-trust architecture where all cross-domain flows must be explicit and justified.
20+
21+
## How Ghaf enforces controlled communication
22+
23+
### GIVC as the primary control channel
24+
Ghaf uses GIVC (Guest Inter-VM Communication) as the secure, structured control plane for VM-to-VM and host-to-VM interactions. GIVC provides authenticated message passing, VM identity verification, and resource access control, which keeps cross-VM interactions explicit and policy-driven. It also uses a registry-based model where services and applications must be registered, and only whitelisted operations are exposed.
25+
26+
### Default-deny networking and interface separation
27+
Inter-VM traffic is constrained by network segmentation and strict firewalling. Production services bind on the production interface and use TLS for inter-VM or external communications, while debug tooling is confined to a separate interface and admin plane. This separation avoids mixing trust levels and prevents debug or administrative pathways from leaking into production networks.
28+
29+
### Minimal, auditable interfaces by design
30+
Ghaf avoids broad cross-VM APIs in favor of narrow, auditable interfaces. For example, GIVC provides a controlled control plane, while other specialized components (such as memory-based sockets for inter-VM messaging) are scoped to their specific use cases. This limits the amount of cross-domain functionality and keeps each interface reviewable.
31+
32+
### TLS and identity-bound channels
33+
GIVC supports TLS for gRPC communication and defaults to secure transport. Encrypting and authenticating inter-VM traffic prevents unauthenticated or spoofed connections and ensures the integrity of commands and data that cross VM boundaries.
34+
35+
## Why auditability matters
36+
37+
### Verifiable security posture
38+
Controlled channels enable meaningful auditing because all cross-VM actions pass through known components with explicit policies. This supports the broader Ghaf practice of auditable configuration and declarative security, enabling reviewers to validate what communication paths exist and why.
39+
40+
### Monitoring and incident response
41+
When communication is centralized and constrained, monitoring tools and audit rules can focus on specific channels and events. This makes it feasible to detect anomalous behavior, reconstruct cross-VM activity during investigations, and apply targeted mitigations without blanket restrictions.
42+
43+
### Alignment with platform hardening
44+
Auditable inter-VM communication complements Ghaf hardening measures such as systemd sandboxing, AppArmor confinement, and strict firewalling. These layers reinforce each other by ensuring that even if a VM or service is compromised, its ability to affect other domains is limited and visible.
45+
46+
## Practical implications for system design
47+
48+
- Inter-VM communication should go through GIVC or other explicitly approved channels, not ad-hoc sockets or raw networking paths.
49+
- Services and applications must be registered and whitelisted before they can be invoked across VM boundaries.
50+
- Debug or maintenance traffic must remain isolated from production traffic through dedicated interfaces and policies.
51+
- Security reviews should treat any new inter-VM interface as a high-risk change that requires justification, authentication, and auditability.
52+
53+
## Summary
54+
55+
Ghaf’s isolation model is only as strong as the boundaries between VMs. By restricting inter-VM communication to controlled, auditable channels, Ghaf preserves isolation, enforces least privilege, reduces attack surface, and enables reliable monitoring and response. GIVC and network plane separation provide the foundation for this approach, while secure transport and strict registration ensure that cross-VM interactions are explicit, minimal, and verifiable.
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
---
2+
title: Prohibited Hardcoded Credentials and Cryptographic Secrets
3+
description: Why secrets must never be hardcoded in Ghaf code and how the policy is implemented in infrastructure
4+
---
5+
6+
# Prohibited Hardcoded Credentials and Cryptographic Secrets
7+
8+
Ghaf forbids hardcoded credentials and cryptographic secrets in code, configuration defaults, or build artifacts. Secrets must be supplied through controlled secret-management mechanisms rather than embedded in source files. This protects the integrity of the platform, the confidentiality of infrastructure credentials, and the ability to rotate keys safely.
9+
10+
## Why hardcoded secrets are prohibited
11+
12+
### Git history is forever
13+
Hardcoded credentials leak easily and persist in version control history, forks, caches, and mirrors. Even if removed later, prior commits can still expose sensitive data. This makes revocation and incident response far more difficult and risky.
14+
15+
### Secrets must be scoped and rotated
16+
Hardcoded values tend to become shared and long-lived. They cannot be scoped to a host, service, or environment, and rotation becomes disruptive. Centralized secret management enables per-host scoping and controlled rotation without editing source code.
17+
18+
### Reproducible builds should not embed private data
19+
Ghaf relies on reproducible, declarative configuration. Embedding secrets in Nix expressions or source code breaks that model by baking private data into build outputs and undermines auditability.
20+
21+
### Infrastructure is a high‑value target
22+
CI/CD and deployment systems hold signing keys, host SSH keys, and admin credentials. Hardcoded secrets in these paths materially increase the risk of supply-chain compromise.
23+
24+
## How the policy is implemented (ghaf‑infra)
25+
26+
Ghaf’s infrastructure repository uses an explicit secret‑management workflow designed to keep credentials out of code:
27+
28+
### Encrypted secrets in version control
29+
- Secrets are stored in `secrets.yaml` files per host and encrypted using `sops`.
30+
- The repository documents that all configuration, including secrets, is version controlled and that secrets are encrypted rather than stored in plaintext.
31+
32+
### SOPS + age key management
33+
- `.sops.yaml` defines which age keys can decrypt specific secrets files and establishes creation rules per host.
34+
- Admin users manage secrets with the `sops` CLI, ensuring edits are always encrypted before committing.
35+
36+
### Secure deployment and activation
37+
- During deployment or system activation, `sops-nix` decrypts secrets and places them at the configured filesystem paths for services to consume.
38+
- Host SSH private keys and other credentials are stored as encrypted secrets and deployed during installation, avoiding hardcoded values in host configurations.
39+
40+
### Controlled updates and rotation
41+
- The `update-sops-files` task re-encrypts secrets according to `.sops.yaml` rules when hosts or admins change, which enables rotation without exposing secrets in code.
42+
43+
## Repository checks and hooks (ghaf-infra)
44+
45+
The ghaf-infra repository includes security-oriented CI workflows that help reduce exposure risk, even though they are not dedicated secret scanners:
46+
47+
- **GitHub Actions security analysis** (`.github/workflows/actions-security-analysis.yml`): runs `zizmor` to audit GitHub Actions workflows and uploads SARIF results.
48+
- **CodeQL** (`.github/workflows/codeql.yml`): static analysis of repository code (Python) with results published to code scanning.
49+
- **OpenSSF Scorecard** (`.github/workflows/scorecards.yml`): supply-chain security posture checks, reported to code scanning.
50+
- **Dependency Review** (`.github/workflows/dependency-review.yml`): blocks known-vulnerable dependency changes in PRs.
51+
- **Workflow change warning** (`.github/workflows/warn-on-workflow-changes.yml`): alerts on workflow modifications to reduce CI abuse risk.
52+
- **Build/test pipeline** (`.github/workflows/test-ghaf-infra.yml`): enforces authorization gates and hardened runner settings before executing builds.
53+
54+
## Practical guidance for contributors
55+
56+
- Never place passwords, private keys, tokens, or signing keys directly in source files or Nix configs.
57+
- Use per‑host `secrets.yaml` encrypted with `sops` and governed by `.sops.yaml` rules.
58+
- Treat any new secret as a security‑review item: it must be scoped, encrypted, and deployable without code changes.
59+
60+
## Summary
61+
62+
Hardcoded credentials and cryptographic secrets create permanent, high‑impact exposure in a Git‑based workflow. Ghaf avoids this by using encrypted secrets managed with `sops-nix` and age keys, with controlled decryption at deployment time. This keeps secrets out of code, preserves auditability, and enables safe rotation across the infrastructure.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
title: VM Memory Zeroing and Wipe on Shutdown
3+
description: Why Ghaf clears VM memory on shutdown and how it prevents cross-VM data leakage
4+
---
5+
6+
# VM Memory Zeroing and Wipe on Shutdown
7+
8+
Ghaf treats VM memory as sensitive because it often contains secrets (keys, tokens, decrypted content, session state). When a VM shuts down, the memory pages it used return to the host. If those pages are not cleared, a later VM or host process could observe residual data. To prevent this class of data remanence issues, Ghaf ensures that VM memory is wiped as it is freed and zeroed before it is reused.
9+
10+
## Why memory must be cleared on shutdown
11+
12+
### Prevent cross-VM data leakage
13+
MicroVMs are strict trust boundaries. Reusing physical pages without clearing can expose one VM’s data to another VM or to the host after shutdown. Wiping memory on free and zeroing on allocation removes residual data from prior tenants and preserves the confidentiality of VM state across lifecycle events.
14+
15+
### Reduce the blast radius after compromise
16+
A compromised VM should not be able to recover data from previously terminated VMs by scavenging uninitialized memory. Zeroing on allocation is a direct defense against this class of information disclosure bugs and helps maintain isolation even under adverse conditions.
17+
18+
### Protect secrets at rest in RAM
19+
Many high-value secrets live only in RAM: TLS keys, authentication tokens, and decrypted files. On shutdown, these secrets should not persist in physical memory. Clearing memory on free ensures they do not remain available to a later VM or process.
20+
21+
### Support auditable, repeatable security posture
22+
Ghaf’s security model depends on explicit, verifiable controls. Memory wipe on free/alloc is a build-time kernel configuration that is easy to audit and deterministic across builds, making the behavior reliable and reviewable.
23+
24+
## How Ghaf implements memory clearing
25+
26+
### Kernel-level zero-on-free and zero-on-alloc
27+
Ghaf configures the host kernel with built-in protections:
28+
29+
- `INIT_ON_FREE_DEFAULT_ON` wipes pages when they are released back to the allocator.
30+
- `INIT_ON_ALLOC_DEFAULT_ON` zeroes pages before they are handed to a new consumer.
31+
- `PAGE_POISONING` provides additional overwrite protection for freed pages.
32+
33+
These options are compiled into the host kernel, so they are always active during runtime. When a VM shuts down and its memory is freed, the host kernel wipes those pages. When another VM (or the host) later allocates memory, the pages are zeroed again. This double-layered approach helps prevent memory remanence across VM lifecycles.
34+
35+
### Default enablement on x86_64 hosts
36+
Memory wipe is enabled by default for the host kernel on x86_64 platforms via the `ghaf.host.kernel.memory-wipe.enable` option. This focuses on the system component that owns and recycles VM memory, which is where shutdown wiping is enforced.
37+
38+
For implementation details and configuration knobs, see [Memory Wipe on Boot and Free](/ghaf/dev/ref/memory-wipe).
39+
40+
## Operational considerations
41+
42+
- **Performance trade-off**: Zeroing on free/alloc adds a modest overhead, but the security benefits outweigh the cost for a hardened platform.
43+
- **Defense in depth**: Memory wiping complements other controls (VM isolation, least privilege, audited inter-VM channels) by ensuring that even after shutdown, no residual data crosses trust boundaries.
44+
- **Scope**: The wipe happens in the host kernel where VM pages are managed, so it applies consistently to VM shutdown events regardless of the guest OS.
45+
46+
## Summary
47+
48+
VM shutdown is a sensitive moment because memory pages leave one trust domain and return to the host allocator. Ghaf eliminates the risk of residual data reuse by enabling kernel features that wipe memory on free and zero memory on allocation. This protects secrets, prevents cross-VM leakage, and keeps the VM boundary trustworthy throughout the VM lifecycle.

0 commit comments

Comments
 (0)