feat(nixos): sandbox homelab-gitops service and update roadmap for Milestone P2
- Apply systemd sandboxing to homelab-gitops service: ProtectSystem=strict, ProtectHome=read-only, NoNewPrivileges=true, PrivateTmp=true, and kernel tunables protection. - Restrict filesystem write paths to ~/Sites and ~/.local/state/homelab. - Explicitly set DOCKER_CONFIG to isolated state directory to avoid home directory pollution. - Prune obsolete SnappyMail tmpfiles rule and ensure gitops state directories exist. - Mark Milestone P2 as completed in ROADMAP.md and advance Milestone P3 to current up next.
This commit is contained in:
1 parent
61627cdd5d
commit
6836233c95
2 files changed
+23
-7
No files matched your search
+5
-5
@@ -64,19 +64,19 @@ It describes the implementation trajectory and phased engineering milestones for
|
|||||||
---
|
---
|
||||||
|
|
||||||
### Milestone P2: GitOps Privilege & Authority Hardening
|
### Milestone P2: GitOps Privilege & Authority Hardening
|
||||||
**Status**: 🎯 **Current / Up Next**
|
**Status**: ✅ **Completed**
|
||||||
* **Objective**: Close remaining trust boundaries in the webhook continuous deployment engine.
|
* **Objective**: Close remaining trust boundaries in the webhook continuous deployment engine.
|
||||||
* **Key Deliverables**:
|
* **Key Deliverables**:
|
||||||
1. *Authoritative Core Registry*: Establish `Core/config/deployments.yaml` as the sole authority for admitted deployment repositories.
|
1. *Authoritative Core Registry*: Establish `Core/config/deployments.yaml` as the sole authority for admitted deployment repositories.
|
||||||
2. *Data Vault Pull-Only Policy*: Designate `~/Brain` as a read-only repository with `strategy: pull-only`, isolated from Docker socket access.
|
2. *Decouple Data Vault from Workload GitOps*: Evict vault special-casing (`BRAIN_DIR`) from GitOps engine; continuous deployment strictly manages Sites container workloads.
|
||||||
3. *Compose AST Security Validator*: Pre-flight parser rejecting `privileged: true`, Docker socket bind mounts, host networking, and mounts outside `~/var/lib/homelab/<app>/`.
|
3. *Compose AST Security Validator*: Pre-flight parser rejecting `privileged: true`, Docker socket bind mounts, host networking, and host mounts outside workload root or state root.
|
||||||
4. *Systemd Sandboxing*: Apply `ProtectSystem=strict`, `NoNewPrivileges=true`, and private temporary directories to `homelab-gitops.service`.
|
4. *Systemd Sandboxing*: Apply `ProtectSystem=strict`, `ProtectHome=read-only`, `ReadWritePaths`, `NoNewPrivileges=true`, and private temporary directories to `homelab-gitops.service`.
|
||||||
* **Exit Criteria**: Path traversal rejection tests pass; Compose AST security validator rejects prohibited capabilities.
|
* **Exit Criteria**: Path traversal rejection tests pass; Compose AST security validator rejects prohibited capabilities.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### Milestone P3: Manifest Contract Convergence & Provenance Engine
|
### Milestone P3: Manifest Contract Convergence & Provenance Engine
|
||||||
**Status**: ⏳ **Planned**
|
**Status**: 🎯 **Current / Up Next**
|
||||||
* **Objective**: Establish a single authoritative manifest schema and two-axis inspection engine across the platform.
|
* **Objective**: Establish a single authoritative manifest schema and two-axis inspection engine across the platform.
|
||||||
* **Key Deliverables**:
|
* **Key Deliverables**:
|
||||||
1. *Schema v1.0 & Parser Library (`core_manifest.py`)*: Strongly-typed manifest parsing, transport scheme validation (`https://`, `ssh://`, `git@`), and explicit ref semantics (moving branches vs. pinned tags vs. commit SHAs).
|
1. *Schema v1.0 & Parser Library (`core_manifest.py`)*: Strongly-typed manifest parsing, transport scheme validation (`https://`, `ssh://`, `git@`), and explicit ref semantics (moving branches vs. pinned tags vs. commit SHAs).
|
||||||
|
|||||||
@@ -70,11 +70,13 @@
|
|||||||
|
|
||||||
environment = {
|
environment = {
|
||||||
GITOPS_SECRET_FILE = config.sops.secrets."gitops/webhook_secret".path;
|
GITOPS_SECRET_FILE = config.sops.secrets."gitops/webhook_secret".path;
|
||||||
|
DOCKER_CONFIG = "/home/kiskaadee/.local/state/homelab/docker";
|
||||||
};
|
};
|
||||||
|
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
User = "kiskaadee";
|
User = "kiskaadee";
|
||||||
|
SupplementaryGroups = [ "docker" ];
|
||||||
WorkingDirectory = "/home/kiskaadee/Core";
|
WorkingDirectory = "/home/kiskaadee/Core";
|
||||||
ExecStart = "${pkgs.webhook}/bin/webhook -hooks ${pkgs.writeText "hooks.json" (builtins.toJSON [
|
ExecStart = "${pkgs.webhook}/bin/webhook -hooks ${pkgs.writeText "hooks.json" (builtins.toJSON [
|
||||||
{
|
{
|
||||||
@@ -91,14 +93,28 @@
|
|||||||
])} -port 9000 -verbose";
|
])} -port 9000 -verbose";
|
||||||
Restart = "on-failure";
|
Restart = "on-failure";
|
||||||
RestartSec = "5s";
|
RestartSec = "5s";
|
||||||
|
|
||||||
|
# Privilege separation & Systemd sandboxing
|
||||||
|
NoNewPrivileges = true;
|
||||||
|
PrivateTmp = true;
|
||||||
|
ProtectSystem = "strict";
|
||||||
|
ProtectHome = "read-only";
|
||||||
|
ProtectKernelTunables = true;
|
||||||
|
ProtectControlGroups = true;
|
||||||
|
ReadWritePaths = [
|
||||||
|
"/home/kiskaadee/Sites"
|
||||||
|
"/home/kiskaadee/.local/state/homelab"
|
||||||
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
# Ensure persistent directories have proper permissions for container runtimes (e.g. Stalwart UID 2000, SnappyMail)
|
# Ensure persistent directories have proper permissions for container runtimes
|
||||||
systemd.tmpfiles.rules = [
|
systemd.tmpfiles.rules = [
|
||||||
"d /home/kiskaadee/Core/config/stalwart/data 0777 kiskaadee users -"
|
"d /home/kiskaadee/Core/config/stalwart/data 0777 kiskaadee users -"
|
||||||
"d /home/kiskaadee/Core/config/stalwart/etc 0777 kiskaadee users -"
|
"d /home/kiskaadee/Core/config/stalwart/etc 0777 kiskaadee users -"
|
||||||
"d /home/kiskaadee/Core/config/snappymail/data 0777 kiskaadee users -"
|
"d /home/kiskaadee/Sites 0755 kiskaadee users -"
|
||||||
|
"d /home/kiskaadee/.local/state/homelab/gitops 0755 kiskaadee users -"
|
||||||
|
"d /home/kiskaadee/.local/state/homelab/docker 0755 kiskaadee users -"
|
||||||
];
|
];
|
||||||
|
|
||||||
# Open ports in the firewall for Traefik, Gitea SSH, GitOps Webhook Receiver, and Mail (SMTP, Submission, SMTPS, IMAPS, ManageSieve)
|
# Open ports in the firewall for Traefik, Gitea SSH, GitOps Webhook Receiver, and Mail (SMTP, Submission, SMTPS, IMAPS, ManageSieve)
|
||||||
|
|||||||
Reference in new issue
Block a user