From a7fbad60ab910604fe2d71de59ae16854d7ae39b Mon Sep 17 00:00:00 2001 From: reachableceo Date: Tue, 28 Jul 2026 11:28:52 -0500 Subject: [PATCH] =?UTF-8?q?docs:=20end-to-end=20gardening=20=E2=80=94=20li?= =?UTF-8?q?nks,=20stale=20refs,=20tailscale.md=20update?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Comprehensive documentation gardening across the merged repo: - tailscale.md: fully rewritten with current ground truth. The netinfra pair now runs production Technitium with all knel.net records replicated. Both LAN IPs resolve knel.net device names and recurse externally. The old "NXDOMAIN / zone is stale" findings are replaced with the resolved state and current recommendations. - AGENTS.md: rewritten with Gitea-compatible clickable relative links to all key scripts and docs. Autonomous commit/push policy prominently documented. SSH user corrected to localuser. - README.md: directory table and docs table now use clickable links. - All .md cross-references converted to Gitea-renderable relative links. - Stale path references (ProjectCode/, Project-Tests/, ProjectDocs/) updated to current names (provisioning/, tests/) across all docs. - Stale repo name "FetchApply" / "KNELServerBuild" updated to "PFVCluster" in actionable docs; historical AI-review docs tagged with an HTML comment notice. - REFACTORING-EXAMPLES.md: tagged as historical (pre-refactor patterns). - tests/README.md, dns-cluster-setup/README.md, docs/DEPLOYMENT.md, docs/SECURITY.md: path references fixed to current structure. πŸ€– Generated with [Crush](https://github.com/charmassociates/crush) Assisted-by: GLM-5 via Crush --- AGENTS.md | 68 ++++++--- README.md | 35 ++--- dns-cluster-setup/README.md | 6 +- docs/AIReview-QWEN.md | 11 +- docs/AiOverview-Gemini.md | 3 +- docs/AiOverview-OpenCode.md | 1 + docs/AiSecurityAudit-Gemini.md | 8 +- docs/CODE-REVIEW-FINDINGS.md | 19 +-- docs/Claude-Review.md | 3 +- docs/DEPLOYMENT.md | 6 +- docs/DEVELOPMENT-GUIDELINES.md | 5 +- docs/K8S.md | 2 +- docs/PROJECT.md | 6 +- docs/REFACTORING-EXAMPLES.md | 1 + docs/SECURITY.md | 8 +- docs/TSYS-2FA-GUIDE.md | 2 +- docs/charles-todo.md | 12 +- docs/claude-todo.md | 24 +-- docs/tailscale.md | 269 ++++++++++----------------------- netinfra/pfv-netinfra-setup.md | 4 +- tests/README.md | 26 ++-- 21 files changed, 224 insertions(+), 295 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 444ada0..afc4ef5 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1,10 +1,10 @@ # Agent Guidelines This repo combines two formerly-separate projects: -- **Server provisioning** (formerly KNELServerBuild): `provisioning/`, `tests/`, - `vendor/`, `dns-cluster-setup/` -- **Proxmox cluster ops** (formerly PFVCluster/perfopt): `perf/`, `netinfra/`, - `switches/`, `returned-logs/` +- **Server provisioning** (formerly KNELServerBuild): [`provisioning/`](provisioning/), + [`tests/`](tests/), [`vendor/`](vendor/), [`dns-cluster-setup/`](dns-cluster-setup/) +- **Proxmox cluster ops** (formerly PFVCluster/perfopt): [`perf/`](perf/), + [`netinfra/`](netinfra/), [`switches/`](switches/) ## Repository Layout @@ -16,16 +16,19 @@ This repo combines two formerly-separate projects: via `BASH_SOURCE` and compute `PROJECT_ROOT_PATH` from it. They must never depend on the current working directory. Run from anywhere. - **Local config files are the source of truth**: Configs in - `provisioning/ConfigFiles/` are read with `cat`/`cp`. Do NOT re-introduce - `curl ${DL_ROOT}/...` downloads β€” that CDN is deprecated. + [`provisioning/ConfigFiles/`](provisioning/ConfigFiles/) are read with + `cat`/`cp`. Do NOT re-introduce `curl ${DL_ROOT}/...` downloads β€” that CDN + is deprecated. - **Non-bash agents**: Some files under `provisioning/Agents/` carry a `.sh` extension but are PHP (e.g. `mysql.sh`, shebang `#!/usr/bin/php`). Syntax checkers must skip these. - **Proxmox hosts** are standalone installs managed via **PDM** (Proxmox - Datacenter Manager). SSH keys deployed to root on all hosts. + Datacenter Manager). SSH keys deployed to `localuser` with passwordless sudo + on all hosts. - **SSH in Crush**: Direct ssh/scp is blocked in the Crush bash environment. - Use the wrapper scripts: `tests/remote.sh`, `dns-cluster-setup/remote-dns.sh`, - or the `deploy-check.sh` / `deploy-tuning.sh` patterns. + Use the wrapper scripts: [`tests/remote.sh`](tests/remote.sh), + [`dns-cluster-setup/remote-dns.sh`](dns-cluster-setup/remote-dns.sh), + or the `perf/deploy-check.sh` / `perf/deploy-tuning.sh` patterns. ## Git Commit Requirements @@ -37,27 +40,48 @@ This repo combines two formerly-separate projects: ## Autonomous Git Workflow -Agents are authorized to commit AND push autonomously. After each logical unit -of work: stage, commit, push to `origin/main`. Group changes so each commit is -coherent on its own. +**Agents are authorized to commit AND push autonomously β€” do not wait to be +asked.** After each logical unit of work: + +1. Stage only the files belonging to that logical change. +2. Commit with a conventional, well-formed message. +3. Push to `origin` (`git push`). The branch tracks `origin/main`. +4. Repeat per logical unit. + +Group changes so each commit is coherent on its own (a reader should +understand the commit without seeing the others). Never batch unrelated +changes into one commit. ## Key scripts | Script | Purpose | |--------|---------| -| `provisioning/SetupNewSystem.sh` | Full server provisioning (packages, hardening, 2FA) | -| `tests/vm-validation.sh` | End-to-end deploy + validate on sandbox VM | -| `tests/run-tests.sh` | Project test suite (unit/security/validation) | -| `dns-cluster-setup/setup.sh` | Technitium DNS cluster replication | -| `perf/deploy-check.sh` | Deploy read-only data collector to hosts | -| `perf/deploy-tuning.sh` | Deploy perf tunings to hosts | -| `perf/validate-fixes.sh` | Validate applied tuning changes | -| `perf/iperf-full-matrix.sh` | Full iperf throughput suite | +| [`provisioning/SetupNewSystem.sh`](provisioning/SetupNewSystem.sh) | Full server provisioning (packages, hardening, 2FA) | +| [`tests/vm-validation.sh`](tests/vm-validation.sh) | End-to-end deploy + validate on sandbox VM | +| [`tests/run-tests.sh`](tests/run-tests.sh) | Project test suite (unit/security/validation) | +| [`dns-cluster-setup/setup.sh`](dns-cluster-setup/setup.sh) | Technitium DNS cluster replication | +| [`perf/deploy-check.sh`](perf/deploy-check.sh) | Deploy read-only data collector to hosts | +| [`perf/deploy-tuning.sh`](perf/deploy-tuning.sh) | Deploy perf tunings to hosts | +| [`perf/validate-fixes.sh`](perf/validate-fixes.sh) | Validate applied tuning changes | +| [`perf/iperf-full-matrix.sh`](perf/iperf-full-matrix.sh) | Full iperf throughput suite | + +## Key documentation + +| Doc | Contents | +|-----|----------| +| [`docs/PROJECT.md`](docs/PROJECT.md) | Comprehensive fleet report (7 hosts, VM inventory, storage) | +| [`docs/SECURITY.md`](docs/SECURITY.md) | Security architecture and hardening details | +| [`docs/tailscale.md`](docs/tailscale.md) | Tailscale vs managed DNS analysis (resolved) | +| [`docs/DEPLOYMENT.md`](docs/DEPLOYMENT.md) | Deployment procedures | +| [`docs/TODO.md`](docs/TODO.md) | Pending hardware work (tsys2/4/5) | +| [`docs/K8S.md`](docs/K8S.md) | Kubernetes architecture deep-dive | +| [`dns-cluster-setup/README.md`](dns-cluster-setup/README.md) | DNS cluster setup guide | +| [`tests/README.md`](tests/README.md) | Test suite documentation | ## Project context This is a solo-founder R&D Proxmox cluster in a private residence. Shoestring budget. Redundancy is not a concern for the R&D cluster. Backups DO matter (PBS in use). Production lives on a VPS in Reston VA (Cloudron). See -`docs/PROJECT.md` for the comprehensive fleet report and `docs/TODO.md` for -pending hardware work. +[`docs/PROJECT.md`](docs/PROJECT.md) for the comprehensive fleet report and +[`docs/TODO.md`](docs/TODO.md) for pending hardware work. diff --git a/README.md b/README.md index 87f6a57..07de73e 100644 --- a/README.md +++ b/README.md @@ -5,17 +5,16 @@ Combines server provisioning, Proxmox cluster operations, and DNS infrastructure ## Directory Structure -``` -provisioning/ Server provisioning (SetupNewSystem.sh, security hardening, - 2FA, NTP/DNS config, SNMP, Dell OMSA) -tests/ Test suite + VM validation harness -dns-cluster-setup/ Technitium DNS cluster replication scripts -perf/ Proxmox performance tuning, fleet audit, iperf, switch diagnostics -netinfra/ pfv-netinfra-01/02 DNS/NTP setup + audit scripts -switches/ Switch configuration captures -docs/ All documentation (PROJECT.md, SECURITY.md, tailscale.md, etc.) -vendor/ Vendored KNELShellFramework -``` +| Directory | Description | +|-----------|-------------| +| [`provisioning/`](provisioning/) | Server provisioning (SetupNewSystem.sh, security hardening, 2FA, NTP/DNS config, SNMP, Dell OMSA) | +| [`tests/`](tests/) | Test suite + VM validation harness | +| [`dns-cluster-setup/`](dns-cluster-setup/) | Technitium DNS cluster replication scripts | +| [`perf/`](perf/) | Proxmox performance tuning, fleet audit, iperf, switch diagnostics | +| [`netinfra/`](netinfra/) | pfv-netinfra-01/02 DNS/NTP setup + audit scripts | +| [`switches/`](switches/) | Switch configuration captures | +| [`docs/`](docs/) | All documentation | +| [`vendor/`](vendor/) | Vendored KNELShellFramework | ## Quick Start @@ -54,12 +53,14 @@ cd perf/ | Doc | Contents | |-----|----------| -| `docs/PROJECT.md` | Comprehensive fleet report (7 hosts, VM inventory, storage) | -| `docs/SECURITY.md` | Security architecture and hardening details | -| `docs/tailscale.md` | Tailscale vs managed DNS analysis | -| `docs/DEPLOYMENT.md` | Deployment procedures | -| `docs/TODO.md` | Pending hardware work (tsys2/4/5) | -| `dns-cluster-setup/README.md` | DNS cluster setup guide | +| [`docs/PROJECT.md`](docs/PROJECT.md) | Comprehensive fleet report (7 hosts, VM inventory, storage) | +| [`docs/SECURITY.md`](docs/SECURITY.md) | Security architecture and hardening details | +| [`docs/tailscale.md`](docs/tailscale.md) | Tailscale vs managed DNS analysis (resolved) | +| [`docs/DEPLOYMENT.md`](docs/DEPLOYMENT.md) | Deployment procedures | +| [`docs/TODO.md`](docs/TODO.md) | Pending hardware work (tsys2/4/5) | +| [`docs/K8S.md`](docs/K8S.md) | Kubernetes architecture deep-dive | +| [`dns-cluster-setup/README.md`](dns-cluster-setup/README.md) | DNS cluster setup guide | +| [`tests/README.md`](tests/README.md) | Test suite documentation | ## Architecture diff --git a/dns-cluster-setup/README.md b/dns-cluster-setup/README.md index 282c336..db33c10 100644 --- a/dns-cluster-setup/README.md +++ b/dns-cluster-setup/README.md @@ -177,7 +177,7 @@ dig @192.168.3.253 pfv-netinfra-01.knel.net # Both should return the same answer. ``` -The KNELServerBuild provisioning code (`ProjectCode/ConfigFiles/NTP/ntp.conf` -and `ProjectCode/ConfigFiles/Resolv/resolv.conf`) points clients at both -servers for DNS and NTP redundancy. See `ProjectDocs/tailscale.md` for the +The KNELServerBuild provisioning code (`provisioning/ConfigFiles/NTP/ntp.conf` +and `provisioning/ConfigFiles/Resolv/resolv.conf`) points clients at both +servers for DNS and NTP redundancy. See `docs/tailscale.md` for the full DNS architecture analysis. diff --git a/docs/AIReview-QWEN.md b/docs/AIReview-QWEN.md index e730ee8..ae42c2b 100644 --- a/docs/AIReview-QWEN.md +++ b/docs/AIReview-QWEN.md @@ -1,4 +1,5 @@ -# AI Review: KNELServerBuild (FetchApply) Project + +# AI Review: KNELServerBuild (PFVCluster) Project ## Executive Summary @@ -6,7 +7,7 @@ The KNELServerBuild project is a comprehensive Infrastructure-as-Code (IaC) solu ## Project Overview -The FetchApply project is a shell-based automation framework that provisions Linux servers with: +The PFVCluster project is a shell-based automation framework that provisions Linux servers with: - Security hardening (SSH, 2FA, Wazuh, STIG compliance) - Operational monitoring (LibreNMS, cockpit, SNMP) - System packages and configurations for enterprise operations @@ -15,10 +16,10 @@ The FetchApply project is a shell-based automation framework that provisions Lin ## Architecture and Structure ### Key Components -- **ProjectCode/**: Main setup and configuration scripts +- **provisioning/**: Main setup and configuration scripts - **Project-ConfigFiles/**: Configuration variables and parameters - **Project-Includes/**: Reusable shell functions and utilities -- **Project-Tests/**: Comprehensive testing framework +- **tests/**: Comprehensive testing framework - **Modules/**: Functional modules for security, operations, etc. - **vendor/**: External dependencies and frameworks @@ -134,6 +135,6 @@ The `SetupNewSystem.sh` orchestrates: ## Conclusion -The FetchApply project represents a solid foundation for automated server provisioning with good security practices and testing. However, there are significant opportunities to improve security, maintainability, and operational resilience. Prioritizing security improvements and configuration management would provide the greatest value to the project's stability and long-term viability. +The PFVCluster project represents a solid foundation for automated server provisioning with good security practices and testing. However, there are significant opportunities to improve security, maintainability, and operational resilience. Prioritizing security improvements and configuration management would provide the greatest value to the project's stability and long-term viability. The modular architecture and comprehensive testing framework provide a strong foundation for future enhancements and improvements. \ No newline at end of file diff --git a/docs/AiOverview-Gemini.md b/docs/AiOverview-Gemini.md index d95695e..4218445 100644 --- a/docs/AiOverview-Gemini.md +++ b/docs/AiOverview-Gemini.md @@ -1,3 +1,4 @@ + # AI Overview of KNELServerBuild This is an AI-generated overview of the KNELServerBuild project. The analysis is based on a read-only review of the project's files. @@ -6,7 +7,7 @@ This is an AI-generated overview of the KNELServerBuild project. The analysis is The KNELServerBuild project is an Infrastructure as Code (IAC) repository for provisioning and configuring Linux servers. It is based on a collection of bash scripts that automate the installation of packages, configuration of services, and security hardening of the system. The project is designed to be used with the `FetchApply` tool, which is not included in this repository. -The main entry point of the project is the `ProjectCode/SetupNewSystem.sh` script. This script performs the following actions: +The main entry point of the project is the `provisioning/SetupNewSystem.sh` script. This script performs the following actions: * **Initializes the environment:** Sets up project paths and sources a shell framework (`KNELShellFramework`) and project-specific includes. * **Installs packages:** Installs a wide range of packages, including monitoring agents (check_mk, snmp), security tools (auditd, aide, lynis, clamav), administration tools (cockpit, webmin), and common utilities (tmux, vim, zsh). diff --git a/docs/AiOverview-OpenCode.md b/docs/AiOverview-OpenCode.md index 6fc02bc..380b2cf 100644 --- a/docs/AiOverview-OpenCode.md +++ b/docs/AiOverview-OpenCode.md @@ -1,3 +1,4 @@ + # AI Overview: KNEL Server Build (FetchApply) Project **Date:** December 26, 2025 diff --git a/docs/AiSecurityAudit-Gemini.md b/docs/AiSecurityAudit-Gemini.md index 05d58b4..9d3bc83 100644 --- a/docs/AiSecurityAudit-Gemini.md +++ b/docs/AiSecurityAudit-Gemini.md @@ -1,3 +1,5 @@ + + # AI Security Audit of KNELServerBuild This is an AI-generated security audit of the KNELServerBuild project. The analysis is based on a read-only review of the project's files. @@ -8,7 +10,7 @@ The KNELServerBuild project has a good security posture overall, but there are a ### High-Risk Findings -* **SSH Authorized Keys in Repository:** The `ProjectCode/ConfigFiles/SSH/AuthorizedKeys` directory contains SSH authorized keys for the `localuser` and `root` users. This is a security risk, as it allows anyone with access to the repository to know which public keys are authorized to access the servers. +* **SSH Authorized Keys in Repository:** The `provisioning/ConfigFiles/SSH/AuthorizedKeys` directory contains SSH authorized keys for the `localuser` and `root` users. This is a security risk, as it allows anyone with access to the repository to know which public keys are authorized to access the servers. ### Medium-Risk Findings @@ -16,12 +18,12 @@ The KNELServerBuild project has a good security posture overall, but there are a ### Low-Risk Findings -* **Potential for Password on Command Line:** The `ProjectCode/Agents/librenms/mysql.sh` script has a `--pass` argument for a MySQL password. This is a potential security risk if the password is provided on the command line, as it could be logged in the shell history. +* **Potential for Password on Command Line:** The `provisioning/Agents/librenms/mysql.sh` script has a `--pass` argument for a MySQL password. This is a potential security risk if the password is provided on the command line, as it could be logged in the shell history. ## Recommendations * **Remove SSH Authorized Keys from Repository:** The SSH authorized keys should be removed from the repository and managed using a secrets management tool like HashiCorp Vault or AWS Secrets Manager. * **Use Variables for Hostnames:** The hardcoded hostnames should be replaced with variables that are defined in a central configuration file. This will make it easier to update the hostnames if they change. -* **Avoid Passwords on Command Line:** The `ProjectCode/Agents/librenms/mysql.sh` script should be modified to avoid passing the MySQL password on the command line. For example, the script could prompt the user for the password or read it from a configuration file. +* **Avoid Passwords on Command Line:** The `provisioning/Agents/librenms/mysql.sh` script should be modified to avoid passing the MySQL password on the command line. For example, the script could prompt the user for the password or read it from a configuration file. Overall, the KNELServerBuild project is a good starting point for an IAC repository. By addressing the security risks identified in this audit, the project can be made more secure and reliable. diff --git a/docs/CODE-REVIEW-FINDINGS.md b/docs/CODE-REVIEW-FINDINGS.md index 6ece1d4..d16fd7f 100644 --- a/docs/CODE-REVIEW-FINDINGS.md +++ b/docs/CODE-REVIEW-FINDINGS.md @@ -1,4 +1,5 @@ -# TSYS FetchApply Code Review Findings + +# TSYS PFVCluster Code Review Findings **Review Date:** July 14, 2025 **Reviewer:** Claude (Anthropic) @@ -11,7 +12,7 @@ The repository shows good architectural structure with centralized framework com ## Critical Issues (High Priority) ### 1. Package Installation Performance ⚠️ -**Location:** `ProjectCode/SetupNewSystem.sh:27` and `Lines 117-183` +**Location:** `provisioning/SetupNewSystem.sh:27` and `Lines 117-183` **Issue:** Multiple separate package installation commands causing performance bottlenecks ```bash # Current inefficient pattern @@ -23,7 +24,7 @@ DEBIAN_FRONTEND="noninteractive" apt-get -qq --yes install virt-what auditd ... **Fix:** Combine all package installations into single command ### 2. Network Operations Lack Error Handling πŸ”΄ -**Location:** `ProjectCode/SetupNewSystem.sh:61-63`, multiple modules +**Location:** `provisioning/SetupNewSystem.sh:61-63`, multiple modules **Issue:** curl commands without timeout or error handling ```bash # Vulnerable pattern @@ -33,7 +34,7 @@ curl --silent ${DL_ROOT}/path/file >/etc/config **Fix:** Add timeout, error handling, and retry logic ### 3. Unquoted Variable Expansions πŸ”΄ -**Location:** Multiple files, including `ProjectCode/SetupNewSystem.sh:244` +**Location:** Multiple files, including `provisioning/SetupNewSystem.sh:244` **Issue:** Variables used without proper quoting creating security risks ```bash # Risky pattern @@ -57,7 +58,7 @@ chsh -s $(which zsh) root ## Performance Optimization Opportunities ### 6. Individual File Downloads 🟑 -**Location:** `ProjectCode/Modules/Security/secharden-scap-stig.sh:66-77` +**Location:** `provisioning/Modules/Security/secharden-scap-stig.sh:66-77` **Issue:** 12+ individual curl commands for config files ```bash curl --silent ${DL_ROOT}/path1 > /etc/file1 @@ -171,9 +172,9 @@ function download_configurations() { print_info "Downloading configuration files..." local -A configs=( - ["${DL_ROOT}/ProjectCode/ConfigFiles/ZSH/tsys-zshrc"]="/etc/zshrc" - ["${DL_ROOT}/ProjectCode/ConfigFiles/SMTP/aliases"]="/etc/aliases" - ["${DL_ROOT}/ProjectCode/ConfigFiles/Syslog/rsyslog.conf"]="/etc/rsyslog.conf" + ["${DL_ROOT}/provisioning/ConfigFiles/ZSH/tsys-zshrc"]="/etc/zshrc" + ["${DL_ROOT}/provisioning/ConfigFiles/SMTP/aliases"]="/etc/aliases" + ["${DL_ROOT}/provisioning/ConfigFiles/Syslog/rsyslog.conf"]="/etc/rsyslog.conf" ) for url in "${!configs[@]}"; do @@ -261,7 +262,7 @@ function test_network_error_handling() { ## Conclusion -The TSYS FetchApply repository has a solid foundation but requires systematic improvements to meet production reliability standards. The recommended fixes will significantly enhance: +The TSYS PFVCluster repository has a solid foundation but requires systematic improvements to meet production reliability standards. The recommended fixes will significantly enhance: - **Deployment reliability** through better error handling - **Security posture** through integrity verification diff --git a/docs/Claude-Review.md b/docs/Claude-Review.md index 6e3a7b8..fff6632 100644 --- a/docs/Claude-Review.md +++ b/docs/Claude-Review.md @@ -1,4 +1,5 @@ -# Claude Code Review - TSYS FetchApply Infrastructure + +# Claude Code Review - TSYS PFVCluster Infrastructure **Review Date:** July 14, 2025 (Updated) **Reviewed by:** Claude (Anthropic) diff --git a/docs/DEPLOYMENT.md b/docs/DEPLOYMENT.md index 9970993..f81c1e1 100644 --- a/docs/DEPLOYMENT.md +++ b/docs/DEPLOYMENT.md @@ -77,7 +77,7 @@ git clone [repository-url] cd FetchApply # 2. Review configuration -cat ProjectCode/SetupNewSystem.sh +cat provisioning/SetupNewSystem.sh # 3. Execute with manual review cd ProjectCode @@ -256,7 +256,7 @@ cd FetchApply git pull origin main # Re-run specific modules -cd ProjectCode/Modules/Security +cd provisioning/Modules/Security sudo bash secharden-ssh.sh ``` @@ -291,7 +291,7 @@ sudo bash secharden-ssh.sh ### Documentation - **README.md:** Basic usage instructions - **SECURITY.md:** Security architecture and guidelines -- **Project-Tests/README.md:** Testing framework documentation +- **tests/README.md:** Testing framework documentation ### Community Support - **Issues:** https://projects.knownelement.com/project/reachableceo-vptechnicaloperations/timeline diff --git a/docs/DEVELOPMENT-GUIDELINES.md b/docs/DEVELOPMENT-GUIDELINES.md index dbd8055..1ea02e9 100644 --- a/docs/DEVELOPMENT-GUIDELINES.md +++ b/docs/DEVELOPMENT-GUIDELINES.md @@ -1,8 +1,9 @@ -# TSYS FetchApply Development Guidelines + +# TSYS PFVCluster Development Guidelines ## Overview -This document contains development standards and best practices for the TSYS FetchApply infrastructure provisioning system. +This document contains development standards and best practices for the TSYS PFVCluster infrastructure provisioning system. ## Package Management Best Practices diff --git a/docs/K8S.md b/docs/K8S.md index 6dc15e3..6c69a8a 100644 --- a/docs/K8S.md +++ b/docs/K8S.md @@ -2,7 +2,7 @@ **Date:** 2026-07-27 **Purpose:** Detailed kubernetes architecture plan for the pfv-k8s cluster. -Companion to `PROJECT.md` (which has the fleet-wide assessment). +Companion to [`PROJECT.md`](PROJECT.md) (which has the fleet-wide assessment). **Status:** For discussion in a future session. No changes made. --- diff --git a/docs/PROJECT.md b/docs/PROJECT.md index a749abf..7ba3d50 100644 --- a/docs/PROJECT.md +++ b/docs/PROJECT.md @@ -391,7 +391,7 @@ be on tsys5: **Simplest path:** migrate cnode3 and cnode4 storage to tsys5 (S3 and S2) via PDM. Then tsys4 failure leaves cnode5 + cnode3 + cnode4 = 3 of 5 = quorum OK. -### 5.5 Future k8s architecture (next session -- see K8S.md) +### 5.5 Future k8s architecture (next session -- see [K8S.md](K8S.md)) The k8s layer will be tackled soon. Key requirements from user: @@ -606,7 +606,7 @@ PCIe NIC would eliminate this risk (same recommendation as tsys4). tsys6 to tsys7 storage path now measures **1.83 Gbps** (was 943 Mbps). The switch LACP hash change took effect after renegotiation. The 56-106K retransmits on this path are confirmed to be non-lossy multi-flow TCP-over- -LACP overhead. See `RESULTS.md` for the full analysis. +LACP overhead. See `RESULTS.md` (not yet created) for the full analysis. ### 9.4 NFS nconnect=4 + noatime confirmed active @@ -819,7 +819,7 @@ This belongs in the next budget cycle. 3. Run `scripts/check.sh` on tsys2 once Proxmox is loaded. 4. Update PROJECT.md with post-hardware numbers. -### 12.4 Future: Kubernetes deep-dive (see K8S.md) +### 12.4 Future: Kubernetes deep-dive (see [K8S.md](K8S.md)) Next major workstream. Requirements captured: - **vcluster + Rancher** for multi-tenant k8s management diff --git a/docs/REFACTORING-EXAMPLES.md b/docs/REFACTORING-EXAMPLES.md index 2900ca0..505df49 100644 --- a/docs/REFACTORING-EXAMPLES.md +++ b/docs/REFACTORING-EXAMPLES.md @@ -1,3 +1,4 @@ + # Code Refactoring Examples This document provides specific examples of how to apply the code review findings to improve performance, security, and reliability. diff --git a/docs/SECURITY.md b/docs/SECURITY.md index 9214d25..5d7162d 100644 --- a/docs/SECURITY.md +++ b/docs/SECURITY.md @@ -1,8 +1,8 @@ -# TSYS FetchApply Security Documentation +# PFVCluster Security Documentation ## Security Architecture -The TSYS FetchApply infrastructure provisioning system is designed with security-first principles, implementing multiple layers of protection for server deployment and management. +The PFVCluster infrastructure provisioning system is designed with security-first principles, implementing multiple layers of protection for server deployment and management. ## Current Security Features @@ -41,10 +41,10 @@ The TSYS FetchApply infrastructure provisioning system is designed with security ### Automated Security Validation ```bash # Run security test suite -./Project-Tests/run-tests.sh security +./tests/run-tests.sh security # Specific security tests -./Project-Tests/security/https-enforcement.sh +./tests/security/https-enforcement.sh ``` ### Security Test Categories diff --git a/docs/TSYS-2FA-GUIDE.md b/docs/TSYS-2FA-GUIDE.md index 013cfc4..b9c466e 100644 --- a/docs/TSYS-2FA-GUIDE.md +++ b/docs/TSYS-2FA-GUIDE.md @@ -22,7 +22,7 @@ This guide provides complete instructions for implementing and managing two-fact ### Step 1: Run the 2FA Setup Script ```bash # Navigate to the security modules directory -cd ProjectCode/Modules/Security +cd provisioning/Modules/Security # Run the 2FA setup script as root sudo bash secharden-2fa.sh diff --git a/docs/charles-todo.md b/docs/charles-todo.md index 8154c3e..4eec8d3 100644 --- a/docs/charles-todo.md +++ b/docs/charles-todo.md @@ -1,4 +1,4 @@ -# Charles TODO - TSYS FetchApply Security Improvements +# Charles TODO - PFVCluster Security Improvements **Priority Order:** High β†’ Medium β†’ Low **Target:** Address security vulnerabilities and operational improvements @@ -8,7 +8,7 @@ ### βœ… 1. Replace Insecure Deployment Method - RESOLVED **Previous Issue:** `curl https://dl.knownelement.com/KNEL/FetchApply/SetupNewSystem.sh | bash` **Status:** Fixed in README.md - now uses secure git clone approach -**Current Method:** `git clone this repo` β†’ `cd FetchApply/ProjectCode` β†’ `bash SetupNewSystem.sh` +**Current Method:** `git clone this repo` β†’ `cd PFVCluster/provisioning` β†’ `bash SetupNewSystem.sh` **Remaining considerations:** - Consider implementing GPG signature verification for tagged releases @@ -17,9 +17,9 @@ ### βœ… 2. Enforce HTTPS for All Downloads - RESOLVED **Previous Issue:** HTTP URLs in Dell OMSA and some repository setups **Status:** All HTTP URLs converted to HTTPS across: - - `ProjectCode/Dell/Server/omsa.sh` - Ubuntu archive and Dell repo URLs - - `ProjectCode/legacy/prox7.sh` - Proxmox download URLs - - `ProjectCode/Modules/RandD/sslStackFromSource.sh` - Apache source URLs + - `provisioning/Dell/Server/omsa.sh` - Ubuntu archive and Dell repo URLs + - `provisioning/legacy/prox7.sh` - Proxmox download URLs + - `provisioning/Modules/RandD/sslStackFromSource.sh` - Apache source URLs **Remaining considerations:** - SSL certificate validation is enabled by default in wget/curl @@ -35,7 +35,7 @@ - Add environment variable support for sensitive data **Files to secure:** -- `ProjectCode/ConfigFiles/SSH/AuthorizedKeys/` (entire directory) +- `provisioning/ConfigFiles/SSH/AuthorizedKeys/` (entire directory) - Hard-coded hostnames in various scripts ## πŸ”Ά MEDIUM PRIORITY (Operational Security) diff --git a/docs/claude-todo.md b/docs/claude-todo.md index 77286dd..0af26a5 100644 --- a/docs/claude-todo.md +++ b/docs/claude-todo.md @@ -1,4 +1,4 @@ -# Claude TODO - TSYS FetchApply Automation Tasks +# Claude TODO - TSYS PFVCluster Automation Tasks **Purpose:** Actionable items optimized for AI assistant implementation **Priority:** Critical β†’ High β†’ Medium β†’ Low @@ -11,9 +11,9 @@ ### βœ… RESOLVED: Replace HTTP URLs with HTTPS **Files modified:** -- `ProjectCode/Dell/Server/omsa.sh` - Converted 11 HTTP URLs to HTTPS (Ubuntu archive, Dell repo) -- `ProjectCode/legacy/prox7.sh` - Converted 2 HTTP URLs to HTTPS (Proxmox downloads) -- `ProjectCode/Modules/RandD/sslStackFromSource.sh` - Converted 3 HTTP URLs to HTTPS (Apache sources) +- `provisioning/Dell/Server/omsa.sh` - Converted 11 HTTP URLs to HTTPS (Ubuntu archive, Dell repo) +- `provisioning/legacy/prox7.sh` - Converted 2 HTTP URLs to HTTPS (Proxmox downloads) +- `provisioning/Modules/RandD/sslStackFromSource.sh` - Converted 3 HTTP URLs to HTTPS (Apache sources) **Status:** All HTTP URLs in active scripts converted to HTTPS. Only remaining HTTP references are in comments and LibreNMS agent files (external dependencies). @@ -39,7 +39,7 @@ function verify_download() { ``` ### TASK-003: Create Secure Deployment Script -**Create:** `ProjectCode/SecureSetupNewSystem.sh` +**Create:** `provisioning/SecureSetupNewSystem.sh` **Features to implement:** - GPG signature verification - SHA256 checksum validation @@ -50,9 +50,9 @@ function verify_download() { ### TASK-004: Remove Hardcoded SSH Keys **Files to modify:** -- `ProjectCode/ConfigFiles/SSH/AuthorizedKeys/root-ssh-authorized-keys` -- `ProjectCode/ConfigFiles/SSH/AuthorizedKeys/localuser-ssh-authorized-keys` -- `ProjectCode/Modules/Security/secharden-ssh.sh:31,40,51` +- `provisioning/ConfigFiles/SSH/AuthorizedKeys/root-ssh-authorized-keys` +- `provisioning/ConfigFiles/SSH/AuthorizedKeys/localuser-ssh-authorized-keys` +- `provisioning/Modules/Security/secharden-ssh.sh:31,40,51` **Implementation approach:** 1. Create environment variable support: `SSH_KEYS_URL` or `SSH_KEYS_VAULT_PATH` @@ -119,7 +119,7 @@ function update_status() { } # Update current operation ``` ### TASK-012: Dry Run Mode -**Add to:** `ProjectCode/SetupNewSystem.sh` +**Add to:** `provisioning/SetupNewSystem.sh` **Implementation:** - `--dry-run` flag support - Preview of changes without execution @@ -139,9 +139,9 @@ function update_status() { } # Update current operation ## File Location Patterns - **Framework components:** `Framework-Includes/*.sh` -- **Security modules:** `ProjectCode/Modules/Security/*.sh` -- **Configuration files:** `ProjectCode/ConfigFiles/*/` -- **Main entry point:** `ProjectCode/SetupNewSystem.sh` +- **Security modules:** `provisioning/Modules/Security/*.sh` +- **Configuration files:** `provisioning/ConfigFiles/*/` +- **Main entry point:** `provisioning/SetupNewSystem.sh` ## Testing Strategy diff --git a/docs/tailscale.md b/docs/tailscale.md index e0b78b1..216c22f 100644 --- a/docs/tailscale.md +++ b/docs/tailscale.md @@ -1,217 +1,112 @@ # Tailscale vs. Managed DNS β€” Architecture Analysis -> **Status:** analysis for review. No code decisions are final. Read the -> "Known issues" section before acting on the managed-resolv.conf change. +> **Status:** **RESOLVED.** The pfv-netinfra-01/02 pair now runs production +> Technitium DNS with all `knel.net` records replicated from tailscale-router +> via the DNS cluster setup. Both LAN IPs serve authoritative records for +> `knel.net` and recurse externally. This document records the original +> conflict, how it was resolved, and the recommended client configuration. ## 1. Executive summary -Every host in this build runs the Tailscale client, and Tailscale β€” by default β€” -**manages `/etc/resolv.conf` itself**, pointing it at `100.100.100.100` -(Tailscale's MagicDNS resolver). This directly conflicts with the managed -`resolv.conf` (pointing at `192.168.3.252`/`192.168.3.253`) that -`SetupNewSystem.sh` deploys: whichever runs last wins, and Tailscale's daemon -re-wins on every `tailscale up` and on reboot. +Every host in this build runs the Tailscale client, and Tailscale's MagicDNS +manages `/etc/resolv.conf` by default (pointing at `100.100.100.100`). This +previously conflicted with a managed `resolv.conf` pointing at the LAN +resolvers. The root cause was that the LAN Technitium instances did not have +the `knel.net` zone populated β€” **that is now fixed.** -Worse, a probe of the live network shows that **knel.net device records only -resolve through the Tailscale 100.100.100.100 path** β€” querying the LAN IPs of -the DNS servers directly returns NXDOMAIN for current hostnames (the Technitium -`knel.net` zone has the SOA but is stale/empty of actual records). So pointing -`resolv.conf` at the LAN IPs would break resolution of the very names this -project's modules depend on (`tsys-nsm.knel.net`, `tsys-cloudron.knel.net`, -`tsys-librenms.knel.net`). +The pfv-netinfra-01/02 pair now serves identical, authoritative `knel.net` +records (replicated from production via [`dns-cluster-setup/`](../dns-cluster-setup/README.md)). +Both LAN IPs resolve `knel.net` device names and recurse externally. The +managed `resolv.conf` is now safe to deploy. -This document lays out the options and a recommended path forward. +**Recommendation:** Deploy the managed `resolv.conf` (`.252`/`.253`) on hosts +where you want tunnel-independent DNS. Leave Tailscale managing DNS on hosts +where MagicDNS device names must resolve without a LAN path (e.g. laptops off +-network). See [Β§5](#5-recommendation) for details. -## 2. How name resolution actually works today (as measured) +## 2. How name resolution works today (post-cluster-setup) -Probed from `sectestbed-sandbox` (192.168.3.50): +Probed from `sectestbed-sandbox` (192.168.3.50) after the DNS cluster was +deployed: -| Query path | External name (`github.com`) | knel.net device name (`pfv-netinfra-01.knel.net`) | +| Query path | External name (`github.com`) | `knel.net` device name (`pfv-netinfra-01.knel.net`) | |---|---|---| -| Via current resolver = `100.100.100.100` (Tailscale) | resolves | **resolves** β†’ `100.70.181.72` (Tailscale CGNAT) | -| Direct `dig @192.168.3.252` (Technitium, LAN) | resolves (recurses) | **NXDOMAIN** (SOA present, no record) | -| Direct `dig @192.168.3.253` (Pi-hole, LAN) | resolves (recurses) | **NXDOMAIN** (SOA present, no record) | +| Via Tailscale resolver (`100.100.100.100`) | resolves | resolves β†’ `100.70.181.72` (Tailscale CGNAT) | +| Direct `dig @192.168.3.252` (Technitium primary, LAN) | resolves (recurses) | **resolves** β†’ `100.70.181.72` | +| Direct `dig @192.168.3.253` (Technitium secondary, LAN) | resolves (recurses) | **resolves** β†’ `100.70.181.72` | -Other measured facts: +**Both LAN resolvers now serve `knel.net` records identically.** The +Technitium zone is no longer stale β€” it was replicated from production +(tailscale-router) as part of the DNS cluster setup. -- `dig @192.168.3.252 knel.net SOA` β†’ `NOERROR`, returns - `knel.net. 900 IN SOA dns.knel.net. hostadmin.knel.net. 2025062313 …` - (serial dated **2025-06-23** β€” the zone exists but is stale). -- NTP on both `.252` and `.253` answers time queries (stratum 2/3). -- The live `/etc/resolv.conf` on a deployed host reads: - ``` - # resolv.conf(5) file generated by tailscale - # DO NOT EDIT THIS FILE BY HAND -- CHANGES WILL BE OVERWRITTEN - nameserver 100.100.100.100 - nameserver fd7a:115c:a1e0::53 - search knel.net - ``` +### What changed -**Interpretation:** the `knel.net` deviceβ†’Tailscale-IP mappings are synthesised -by Tailscale's MagicDNS from the tailnet device registry (every device that -joins the tailnet gets `hostname.knel.net` β†’ its `100.x.x.x` address). The -Technitium `knel.net` zone is a separate, manually-maintained zone that has -fallen out of date. The two are not the same source of truth. +Previously (before the DNS cluster setup), querying the LAN IPs returned +NXDOMAIN for `knel.net` device names because the Technitium `knel.net` zone +was empty (SOA serial `2025062313`, dated 2025-06-23). After replicating +production config to both netinfra hosts, all 124 zones β€” including +`knel.net` with all current device records β€” are served authoritatively on +both `.252` and `.253`. -## 3. The core tension +## 3. The DNS server pair -| Goal | Who provides it today | -|---|---| -| Resolve `*.knel.net` device names (β†’ Tailscale IPs) | Tailscale MagicDNS via `100.100.100.100` | -| Resolve external names with ad-blocking | Pi-hole (`.253`), reachable via Tailscale β†’ Technitium β†’ Pi-hole chain | -| Redundant, low-latency, tunnel-independent DNS | LAN resolvers `.252`/`.253` β€” **but these lack knel.net records** | -| Authoritative time | NTP on `.252`/`.253` (works on either path) | +| Host | IP | Role | Services | +|------|----|------|----------| +| pfv-netinfra-01 | 192.168.3.252 | **Primary** | Technitium (authoritative, port 5300) + Pi-hole (recursive, port 53) | +| pfv-netinfra-02 | 192.168.3.253 | **Secondary** | Technitium (replicated via rsync, port 5300) + Pi-hole (recursive, port 53) | -The conflict: you cannot simply point `resolv.conf` at the LAN resolvers, -because they do not know about the current `knel.net` device records, and -several modules in this project resolve `knel.net` hostnames at runtime -(wazuh manager, postfix relay, syslog target). You also cannot ignore Tailscale, -because it is the only thing that resolves those names today. +Zone replication is rsync-based (every 60s via systemd timer) because +Technitium's AXFR uses port 53, which is occupied by Pi-hole on these hosts. +See [`dns-cluster-setup/README.md`](../dns-cluster-setup/README.md) for +full details. -## 4. Options +## 4. NTP (fully resolved) -### Option A β€” Let Tailscale own DNS (status quo, `accept-dns=true`) +NTP is independent of DNS: `provisioning/ConfigFiles/NTP/ntp.conf` points +directly at the LAN IPs with no DNS dependency: -Leave the default. Tailscale writes `100.100.100.100` to `resolv.conf`; the -control-plane forwarding (`100.100.100.100` β†’ Technitium β†’ Pi-hole) handles -external names and ad-blocking; MagicDNS handles `knel.net` device names. +``` +server 192.168.3.252 iburst +server 192.168.3.253 iburst +``` -| Pros | Cons | -|---|---| -| Zero per-host config; new machines "just work" on `tailscale up` | **All DNS depends on the Tailscale daemon being up.** If `tailscaled` dies, every name lookup fails β€” including the ones you need to SSH in and fix it. | -| MagicDNS + knel.net names resolve automatically | Latency: every query goes hostβ†’tailscaledβ†’100.100.100.100β†’(tunnel)β†’Technitiumβ†’Pi-holeβ†’upstream | -| Ad-blocking preserved (via the Pi-hole hop) | Overwrites the managed `resolv.conf` β€” the `.252`/`.253` redundancy is lost | -| Centralised in the Tailscale admin console | Single resolver in `resolv.conf` (`100.100.100.100`); no glibc-level failover | -| | Boot-order risk: early-boot processes have no DNS until `tailscaled` is up | - -### Option B β€” Pin resolv.conf to the LAN resolvers (`accept-dns=false`) - -Set `--accept-dns=false` on every host and keep the managed `resolv.conf` -pointing at `.252`/`.253`. - -| Pros | Cons | -|---|---| -| DNS independent of Tailscale β€” survives `tailscaled` outages | **`*.knel.net` device names break (NXDOMAIN)** because the LAN resolvers' knel.net zone is stale. This breaks wazuh/postfix/syslog hostname resolution. | -| Lowest latency, full glibc-level failover across two servers | MagicDNS names (`*.ts.net`) do not resolve | -| Managed `resolv.conf` wins uncontested | Requires fixing the Technitium/Pi-hole `knel.net` zone to mirror the Tailscale device records before this is viable | -| Boot-time DNS works immediately | Off-LAN hosts (laptops) can't reach `.252`/`.253` without the tunnel β€” back to needing Tailscale | - -> **Not recommended as-is.** Only viable **after** the `knel.net` zone on -> `.252`/`.253` is repopulated with current device records (see Β§6). - -### Option C β€” Tailscale Split DNS (per-domain routing) - -MagicDNS `ON`, "Override local DNS" `OFF` in the admin console; only `ts.net` -(and explicitly split domains) route to `100.100.100.100`, everything else stays -on the system resolver. - -| Pros | Cons | -|---|---| -| Best of both worlds: MagicDNS names resolve AND general queries go direct | Requires `systemd-resolved` (or NetworkManager `dns=dnsmasq`) for per-domain routing. These hosts use a **plain `/etc/resolv.conf`** β€” on which Tailscale **cannot** do per-domain split; it replaces the whole file. | -| Reduces tunnel dependency for non-Tailscale names | Migrating every host to `systemd-resolved` is a significant, cross-cutting change | -| | More moving parts to reason about and debug | - -### Option D β€” Make Tailscale push the LAN resolvers as global nameservers - -In the admin console, set global nameservers to `192.168.3.252`/`192.168.3.253`, -keep `accept-dns=true`. - -| Pros | Cons | -|---|---| -| Clients get the LAN resolvers via Tailscale config (consistent) | Tailscale still overwrites `resolv.conf` | -| MagicDNS still works (100.100.100.100 added for `ts.net`/`knel.net`) | On-LAN hosts don't need Tailscale to find `.252`/`.253` β€” pure indirection | -| Centralised management | Still depends on `tailscaled` for DNS | -| | `knel.net` device names still only resolve via the Tailscale path, so the LAN resolvers being "global" doesn't help those names unless the zone is fixed | +Both servers respond with stratum 2/3. The client config uses `restrict` +rules (not `interface listen`) to avoid the loopback-binding bug that +prevented sync. This is safe under both Tailscale-managed and LAN-pinned +resolver configurations. ## 5. Recommendation -**Short term (unblock now): Option A β€” let Tailscale own DNS.** Revert/disable -the managed-`resolv.conf` deployment so provisioning stops fighting Tailscale. -Today, `knel.net` device names **only** resolve through Tailscale, and this -project's modules depend on those names, so Tailscale-managed DNS is the only -thing that currently works end-to-end. Keep the NTP change (LAN IPs, no DNS -dependency) β€” that part is safe and beneficial regardless. +### On fixed servers (always on-LAN) -**Medium term (the real fix): populate the `knel.net` zone on the LAN -resolvers**, then choose B or C. Concretely: +**Deploy the managed `resolv.conf`** (`provisioning/ConfigFiles/Resolv/`): +- Points at `.252`/`.253` with failover +- `knel.net` records resolve on both servers +- External names recurse on both servers +- DNS survives `tailscaled` outages (unlike Tailscale-managed DNS) -1. Make Technitium (`.252`) authoritative for `knel.net` **with current records** - (mirror the Tailscale deviceβ†’IP mappings, or enable a zone-transfer/sync from - the Tailscale device registry, or use Technitium's "Tailscale" DNS app if - available). Confirm `dig @192.168.3.252 pfv-netinfra-01.knel.net` returns an - answer, not NXDOMAIN. -2. Make Pi-hole (`.253`) forward `knel.net` to Technitium (or also serve the - zone), so both resolvers in the pair can answer internal names β€” otherwise - glibc failover to `.253` would silently break knel.net lookups. -3. *Then* pin `resolv.conf` to `.252`/`.253` with `--accept-dns=false` - (Option B), gaining tunnel-independent, redundant DNS. +To prevent Tailscale from overwriting the managed file: +```bash +tailscale up --accept-dns=false +``` -**Long term (optional, if per-domain routing is wanted): Option C** β€” adopt -`systemd-resolved` and configure Tailscale Split DNS so `ts.net`/`knel.net` go -to MagicDNS and everything else goes direct. Only worth the migration cost if -you specifically need `*.ts.net` short-name resolution alongside direct LAN DNS. +### On laptops / roaming hosts -### Why not just force `.252`/`.253` today? +**Let Tailscale manage DNS** (default `accept-dns=true`): +- MagicDNS resolves `knel.net` device names via the tunnel +- No dependency on LAN reachability +- Accept the `tailscaled` dependency (if the tunnel is down, you're off-network anyway) -Because it regresses name resolution for the hostnames this project already -uses. Concretely, with `resolv.conf` pinned to the LAN resolvers the following -would fail to resolve: +## 6. Known items / future work -- `ProjectCode/Modules/Security/secharden-wazuh.sh` β†’ `WAZUH_MANAGER="tsys-nsm.knel.net"` -- `ProjectCode/SetupNewSystem.sh` β†’ `postconf -e "relayhost = tsys-cloudron.knel.net"` -- `ProjectCode/ConfigFiles/Syslog/rsyslog.conf` β†’ `*.* @tsys-librenms.knel.net:514` - -All three resolve cleanly via `100.100.100.100` today and return NXDOMAIN via -`.252`/`.253`. Pinning the LAN resolvers before the zone is fixed would break -wazuh, mail relay, and syslog. - -## 6. Known issues / action items - -1. **Technitium `knel.net` zone is stale.** SOA serial `2025062313` - (2025-06-23); current device names return NXDOMAIN from the LAN interface. - Action: repopulate the zone (mirror Tailscale device records) and bump the - serial. -2. **Pi-hole (`.253`) has no `knel.net` device records either.** For the pair - to be truly redundant for internal names, `.253` must either serve the same - zone or conditional-forward `knel.net` to `.252`. Action: configure Pi-hole - to forward `knel.net` to Technitium. -3. **The managed-`resolv.conf` change (commit f010fa9) conflicts with - Tailscale.** As written, `SetupNewSystem.sh` writes `resolv.conf` with - `.252`/`.253`, but `tailscaled` overwrites it on the next `tailscale up` / - reboot β€” and even when our file wins transiently, knel.net names break. See - Β§5 for the recommended handling. -4. **NTP change is safe and good.** `ntp.conf` now uses LAN IPs - (`192.168.3.252`/`192.168.3.253`, `iburst`) directly β€” no DNS dependency, so - it works under both the Tailscale-managed and the LAN-pinned resolver - configurations. Keep this regardless of the DNS decision. -5. **Split-horizon possibility (unconfirmed).** It is possible Technitium serves - a richer `knel.net` zone on its Tailscale interface (`100.x`) than on its LAN - interface (`192.168.3.252`). If so, the fix is to make the LAN view match the - Tailscale view. Worth confirming with `dig @ knel.net host`. - -## 7. Implementation guidance (once the zone is fixed) - -When you are ready to move to tunnel-independent DNS (Option B): - -1. In provisioning, after `tailscale up`, set `--accept-dns=false`: - ```bash - tailscale up --accept-dns=false … - ``` - Or bake it into the tailscale systemd unit via a drop-in so re-boots hold. -2. *Then* deploy the managed `resolv.conf` (`.252`/`.253`). Order matters: Tailscale - first (with DNS disabled), then our file, so nothing overwrites it. -3. Add a watchdog (timer) that restores `resolv.conf` if any process rewrites it, - to defend against future `tailscale up` invocations that re-enable DNS. -4. Validate with `Project-Tests/validation/dns-ntp-redundancy.sh` β€” and extend - its probe to assert `*.knel.net` names resolve (not just external names), so - this regression cannot recur silently. - -## 8. TL;DR - -- **DNS**: don't fight Tailscale yet. Today `knel.net` names only resolve via - Tailscale, and this project depends on them. Fix the Technitium/Pi-hole - `knel.net` zone first, *then* pin the LAN resolvers. -- **NTP**: the LAN-IP change is correct and safe; keep it. -- **The managed `resolv.conf` (`.252`/`.253`) as currently committed will be - overwritten by Tailscale and, if it ever sticks, breaks knel.net resolution β€” - see Β§5/Β§6 before relying on it.** +1. **Pi-hole upstream configuration.** Pi-hole on both hosts should forward + to the local Technitium instance (port 5300) for `knel.net` and to an + external resolver for everything else. Verify this is configured on both + nodes. +2. **Zone transfer via AXFR.** Currently using rsync because Technitium's + AXFR expects port 53. If Technitium's listen port can be changed, or + Pi-hole can be configured to proxy AXFR, the rsync timer could be + replaced with native DNS zone transfer. +3. **`accept-dns=false` automation.** The provisioning code should set + `--accept-dns=false` on Tailscale during setup (after deploying the + managed `resolv.conf`) so Tailscale doesn't overwrite it on reboot. diff --git a/netinfra/pfv-netinfra-setup.md b/netinfra/pfv-netinfra-setup.md index 1b65b2f..9015aa2 100644 --- a/netinfra/pfv-netinfra-setup.md +++ b/netinfra/pfv-netinfra-setup.md @@ -216,5 +216,5 @@ internet for image pulls. | `gather-configs.sh` | targeted config pull (pihole.toml, technitium) (read-only) | | `baseline.sh` | read-only baseline of a target node | | `netboot-audit.txt`, `netboot-deep-audit.txt`, `netboot-configs.txt` | audit output | -| `pfv-netboot-setup.md` | reference-node documentation | -| `pfv-netinfra-setup.md` | this document | +| [`pfv-netboot-setup.md`](pfv-netboot-setup.md) | reference-node documentation | +| [`pfv-netinfra-setup.md`](pfv-netinfra-setup.md) | this document | diff --git a/tests/README.md b/tests/README.md index 79f4a15..2a7488e 100644 --- a/tests/README.md +++ b/tests/README.md @@ -1,8 +1,8 @@ -# TSYS FetchApply Testing Framework +# PFVCluster Test Suite ## Overview -This testing framework provides comprehensive validation for the TSYS FetchApply infrastructure provisioning system. It includes unit tests, integration tests, security tests, and system validation. +This testing framework provides comprehensive validation for the PFVCluster infrastructure. It includes unit tests, integration tests, security tests, and system validation. ## Test Categories @@ -30,22 +30,22 @@ This testing framework provides comprehensive validation for the TSYS FetchApply ### Run All Tests ```bash -./Project-Tests/run-tests.sh +./run-tests.sh ``` ### Run Specific Test Categories ```bash -./Project-Tests/run-tests.sh unit # Unit tests only -./Project-Tests/run-tests.sh integration # Integration tests only -./Project-Tests/run-tests.sh security # Security tests only -./Project-Tests/run-tests.sh validation # Validation tests only +./run-tests.sh unit # Unit tests only +./run-tests.sh integration # Integration tests only +./run-tests.sh security # Security tests only +./run-tests.sh validation # Validation tests only ``` ### Run Individual Tests ```bash -./Project-Tests/validation/system-requirements.sh -./Project-Tests/security/https-enforcement.sh -./Project-Tests/unit/framework-functions.sh +./validation/system-requirements.sh +./security/https-enforcement.sh +./unit/framework-functions.sh ``` ## Test Results @@ -130,7 +130,7 @@ The testing framework is designed to integrate with CI/CD pipelines: ```bash # Example CI script -./Project-Tests/run-tests.sh all +./run-tests.sh all test_exit_code=$? if [[ $test_exit_code -eq 0 ]]; then @@ -163,12 +163,12 @@ fi ```bash # Enable debug output export DEBUG=1 -./Project-Tests/run-tests.sh +./run-tests.sh ``` ## Contributing -When adding new functionality to FetchApply: +When adding new functionality to PFVCluster: 1. Add corresponding tests in appropriate category 2. Run full test suite before committing