diff --git a/v2/deploy/Caddyfile b/v2/deploy/Caddyfile new file mode 100644 index 0000000..050dc1d --- /dev/null +++ b/v2/deploy/Caddyfile @@ -0,0 +1,11 @@ +:8080 { + root * /srv + encode zstd gzip + file_server + header { + X-Content-Type-Options "nosniff" + Referrer-Policy "no-referrer" + X-Robots-Tag "noindex, nofollow, noarchive" + Cache-Control "private, no-store" + } +} diff --git a/v2/deploy/README.md b/v2/deploy/README.md new file mode 100644 index 0000000..22caf2e --- /dev/null +++ b/v2/deploy/README.md @@ -0,0 +1,83 @@ +# Bytegeist Docs v2 — private, host-independent deployment + +The renderer has no credentials and the web container has **no GitHub access**. +Build the selected content on a trusted machine with read-only access to the +approved repositories; then serve only the generated static files. Never put +the private manifest, its source names, repository clone cache or generated +site in a public commit, GitHub Actions artifact or public registry image. + +## Required host (not VPS02) + +Choose a maintained Linux host with Docker Compose, a persistent volume, +independent backup/recovery, and an enrolled NetBird peer. This deployment is +**not** a Talos/cluster or VPS02 rollout by default. Check that the host +continues to serve recovery docs during the failure domains you care about. + +Before enabling: obtain the host's *actual* NetBird IPv4, decide the peer +groups allowed to read Docs, configure a **deny-by-default NetBird access +policy for the site port**, and verify access from both allowed and denied +peers. NetBird connectivity alone is not access control. Do not use public +DNS/tunnels, `0.0.0.0`, a host LAN IP, wildcard bind, or a shared VPS02 proxy. + +## Initial build (inside trusted checkout, on chosen host) + +```sh +# Requires python3, git, gh, Docker Compose and an authorized GitHub account. +# gh auth login is performed interactively by the operator, never in a CI log. +python3 -m venv .venv +. .venv/bin/activate +python -m pip install -r v2/requirements.txt +cd v2 + +# The approved manifest MUST be from a separate PRIVATE location. +# Do not copy it to the public repository, or set a public CI variable. +python scripts/curate.py --manifest /secure/private/sources.yml +zensical build --strict --clean -f .generated/mkdocs.yml +test -s .generated/site/index.html +test -s .generated/site/quellstand/index.html +``` + +Inspect the generated pages and scan for credentials, internal company/customer +material or unexpected source files **before** serving them. The source +collector intentionally skips `_archive` and `evidence` directories; it does +not replace human confidentiality review. Verify the included commit hashes +and date on the Quellstand page. A Git commit is not live system health. + +## Private serving + +```sh +cd v2 +# Export these in the shell or in a private ignored deployment environment. +export NETBIRD_IPV4=REPLACE_WITH_VERIFIED_HOST_NETBIRD_IPV4 +export DOCS_PORT=8085 +docker compose -f deploy/compose.yaml config +docker compose -f deploy/compose.yaml up -d +docker compose -f deploy/compose.yaml ps +``` + +The Compose host-port mapping binds **only to NETBIRD_IPV4**, not all host +interfaces; site files are mounted read-only into an unprivileged Caddy +container. NetBird policies and host/router firewall remain separate required +controls. Access is over the encrypted NetBird overlay (HTTP inside the VPN). + +## Acceptance and rollback gates + +1. Confirm the chosen host is not VPS02 and its static build succeeds from + only the explicitly approved sources. Check links, search, styling, + source provenance and absence of stale/archived operational content. +2. From a permitted enrolled peer, open `http://NETBIRD_IPV4:8085/`; from + a peer outside the authorized NetBird group, verify access is denied. + Probe the host's LAN and public interfaces and confirm the docs port + is **not** listening there. +3. Rebuild after a controlled source change and verify the new commit hash + appears. Preserve an offline export of critical recovery runbooks on + storage independent of the serving host. +4. Prove recovery on the chosen host before making the v1 URL disappear. + On failure, retain the last known-good static output and do not retire v1. +5. Only after owner-approved E2E acceptance, follow root + `v1-retirement.md` for a **dedicated-docs-only**, backed-up VPS02 + decommission. Never remove shared Traefik, NetBird, Termix or Vaultwarden. + +No scheduled publishing is enabled by this Compose file. Establish a separate +scoped refresh service/timer only **after** the first private live acceptance, +so failures cannot silently overwrite the last verified site. diff --git a/v2/deploy/compose.yaml b/v2/deploy/compose.yaml new file mode 100644 index 0000000..65671e2 --- /dev/null +++ b/v2/deploy/compose.yaml @@ -0,0 +1,26 @@ +# Static site only. Builds happen outside this container with an approved +# private manifest. The host port MUST bind to its NetBird overlay address. +services: + docs: + image: caddy:2.10.2-alpine + user: "10001:10001" + ports: + - "${NETBIRD_IPV4:?set_the_host_NetBird_IP}:${DOCS_PORT:-8085}:8080/tcp" + volumes: + - ../.generated/site:/srv:ro + - ./Caddyfile:/etc/caddy/Caddyfile:ro + read_only: true + cap_drop: + - ALL + security_opt: + - no-new-privileges:true + tmpfs: + - /tmp:rw,noexec,nosuid,size=16m,mode=1777 + - /config:rw,noexec,nosuid,size=4m,mode=1777 + - /data:rw,noexec,nosuid,size=4m,mode=1777 + restart: unless-stopped + healthcheck: + test: ["CMD-SHELL", "wget -q -O /dev/null http://127.0.0.1:8080/ || exit 1"] + interval: 30s + timeout: 5s + retries: 3 diff --git a/v2/docs/index.md b/v2/docs/index.md index 51e7b14..f892646 100644 --- a/v2/docs/index.md +++ b/v2/docs/index.md @@ -1,6 +1,6 @@ # Weniger Quellen. Mehr Orientierung. -
BYTEGEIST / PRIVATE TECHNICAL NOTES / V2 PREVIEW
+
BYTEGEIST / PRIVATE TECHNICAL NOTES
Die Dokumentation soll mir beim nächsten Problem **Zeit sparen** — nicht neue Arbeit machen. @@ -19,15 +19,15 @@ Die Dokumentation soll mir beim nächsten Problem **Zeit sparen** — nicht neue
-## Das hier ist noch kein produktives Handbuch +## Dein privater Lesekatalog -Diese Seite ist ein **isolierter Design-Prototyp**, ohne echte Homelab-Daten oder Zugriffe. Der aktuelle Fokus ist die einfache Benutzerführung: Starten, suchen, Quelle finden, aktualitätsbezogene Unsicherheit erkennen. +Diese Seite wird aus bewusst ausgewählten Quellen erzeugt. Ohne private Quellenauswahl zeigt sie nur die neutrale Vorschau. **Quellstand** dokumentiert den letzten Abruf und den Git-Commit; das bestätigt keinen Live-Zustand von Hosts und Anwendungen. !!! note "Keine zweite Quelle der Wahrheit" Änderungen gehören in das jeweilige Quell-Repository. Die persönliche Dokumentationsseite ist nur die ausgewählte, private Leseansicht. -## Was ich später hier sehen möchte +## Was hier hineingehört -Eine kleine Liste meiner **wirklich wichtigen** Projekte und Betriebssysteme — beispielsweise Netzwerk, Storage, Virtualisierung, Kubernetes und aktive Werkzeuge. Nicht alles, was ich irgendwann ausprobiert habe. +Die wichtigen Betriebs- und Projektdokumentationen, nicht ein ungeprüfter Spiegel aller Experimente. Bei fehlenden oder veralteten Informationen wird die kanonische Quelle korrigiert, nicht dieser generierte Katalog. Wenn ein Repository fehlt, wird es **nicht automatisch** aufgenommen. Wenn eine Betriebsanleitung seit Monaten ungeprüft ist, wird das sichtbar und nicht als aktuell verkauft. diff --git a/v2/scripts/curate.py b/v2/scripts/curate.py index 66c07c7..4204e60 100644 --- a/v2/scripts/curate.py +++ b/v2/scripts/curate.py @@ -55,7 +55,7 @@ def checkout(item, local_root, cache): raise ValueError("symlinked checkout target") if target.exists(): shutil.rmtree(target) - if (os.environ.get("GH_TOKEN") or os.environ.get("GITHUB_TOKEN")) and shutil.which("gh"): + if shutil.which("gh"): cmd = ["gh", "repo", "clone", repo, str(target), "--", "--depth=1"] else: cmd = ["git", "clone", "--depth=1", "https://github.com/" + repo + ".git", str(target)] @@ -71,6 +71,9 @@ def copy_docs(source, dest, paths): raise ValueError("declared README/docs path missing or symlinked") for file in ([start] if start.is_file() else sorted(start.rglob("*"))): rel = file.relative_to(source) + # Archived and evidence trees are never presented as current docs. + if any(part in {"_archive", "evidence"} for part in rel.parts): + continue if file.is_symlink(): raise ValueError("symlink in selected documentation") if any(x.startswith(".") for x in rel.parts) or not file.is_file() or file.suffix.lower() not in SAFE: diff --git a/v2/tests/test_curate.py b/v2/tests/test_curate.py index 7aee474..8787fef 100644 --- a/v2/tests/test_curate.py +++ b/v2/tests/test_curate.py @@ -64,6 +64,19 @@ def test_symlinked_docs_rejected(self): with self.assertRaises(ValueError): curate.copy_docs(base, base / "output", ["docs/"]) + def test_archive_and_evidence_trees_never_enter_current_site(self): + with tempfile.TemporaryDirectory() as temp: + base = Path(temp) + (base / "docs" / "_archive").mkdir(parents=True) + (base / "docs" / "evidence").mkdir(parents=True) + (base / "docs" / "current.md").write_text("# Current\n") + (base / "docs" / "_archive" / "retired.md").write_text("# Old\n") + (base / "docs" / "evidence" / "raw.md").write_text("# Evidence\n") + paths = curate.copy_docs(base, base / "out", ["docs/"]) + self.assertEqual([p.as_posix() for p in paths], ["docs/current.md"]) + self.assertFalse((base / "out/docs/_archive/retired.md").exists()) + self.assertFalse((base / "out/docs/evidence/raw.md").exists()) + if __name__ == "__main__": unittest.main()