[
  {
    "id": "openssh",
    "name": "OpenSSH (Server & Client)",
    "category": "infra",
    "lang": "ini",
    "filename": "99-pqc-sshd.conf",
    "minVersion": "OpenSSH 10.0+",
    "support": "Default in OpenSSH 10.0+",
    "supportTone": "emerald",
    "tags": ["ssh", "openssh", "sshd_config", "mlkem768x25519-sha256", "sntrup761x25519"],
    "summary": "Enforces FIPS 203 mlkem768x25519-sha256 hybrid KEX (with sntrup761x25519 fallback) and warns on non-PQ sessions.",
    "note": "Legacy hardening baselines that pin `KexAlgorithms curve25519-sha256` silently DISABLE OpenSSH 10’s built-in PQC! Audit /etc/ssh/sshd_config.d/.",
    "verify": {
      "hybrid": "sudo sshd -T | grep -i kexalgorithms && ssh -vv {{domain}} 2>&1 | grep 'kex: algorithm:'",
      "cnsa2": "sudo sshd -T | grep -i kexalgorithms && ssh -vv {{domain}} 2>&1 | grep 'kex: algorithm:'",
      "compat": "sudo sshd -T | grep -i kexalgorithms"
    },
    "templates": {
      "hybrid": [
        "# /etc/ssh/sshd_config.d/99-pqc.conf — Hybrid Modern (Recommended)",
        "KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,curve25519-sha256",
        "",
        "Ciphers aes256-gcm@openssh.com,chacha20-poly1305@openssh.com",
        "MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com",
        "HostKeyAlgorithms ssh-ed25519,ecdsa-sha2-nistp384",
        "",
        "# Client (~/.ssh/config):",
        "# Host *",
        "#     KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,curve25519-sha256",
        "#     WarnWeakCrypto yes"
      ],
      "cnsa2": [
        "# /etc/ssh/sshd_config.d/99-pqc.conf — Strict Post-Quantum SSH Only",
        "# Rejects any client that cannot negotiate hybrid post-quantum KEX",
        "KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com",
        "",
        "Ciphers aes256-gcm@openssh.com,chacha20-poly1305@openssh.com",
        "MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com",
        "HostKeyAlgorithms ssh-ed25519,rsa-sha2-512",
        "PasswordAuthentication no",
        "PermitRootLogin prohibit-password"
      ],
      "compat": [
        "# /etc/ssh/sshd_config.d/99-pqc.conf — Transitional",
        "KexAlgorithms mlkem768x25519-sha256,sntrup761x25519-sha512,sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@libssh.org",
        "",
        "Ciphers chacha20-poly1305@openssh.com,aes256-gcm@openssh.com,aes128-gcm@openssh.com",
        "MACs hmac-sha2-512-etm@openssh.com,hmac-sha2-256-etm@openssh.com"
      ]
    }
  },
  {
    "id": "tailscale",
    "name": "Tailscale (v1.106.3+)",
    "category": "infra",
    "lang": "bash",
    "filename": "tailscale-pqc-audit.sh",
    "minVersion": "Tailscale v1.106.3+ (Dec 2, 2026)",
    "support": "Default On (Noise IKhfs)",
    "supportTone": "emerald",
    "tags": ["tailscale", "wireguard", "vpn", "ml-kem-768", "noise ikhfs", "mesh"],
    "summary": "Upgrades nodes to Tailscale v1.106.3+ for automatic ML-KEM-768 (Noise IKhfs) WireGuard handshakes and audits your tailnet for stale peers that force classical fallback.",
    "note": "Both peers MUST run Tailscale v1.106.3+ to negotiate ML-KEM-768. A single outdated exit node, subnet router, or NAS appliance silently falls back to classical Noise IK.",
    "verify": {
      "hybrid": "tailscale version && tailscale status --json | jq -r '.Peer[] | [.HostName, .OS, .Online] | @tsv'",
      "cnsa2": "tailscale version",
      "compat": "tailscale version && tailscale status"
    },
    "templates": {
      "hybrid": [
        "# tailscale-pqc-audit.sh — Tailscale v1.106.3+ ML-KEM-768 (Noise IKhfs)",
        "# Released Dec 2, 2026: hybrid ML-KEM-768 is enabled automatically when both peers >= v1.106.3",
        "",
        "# 1. Upgrade local node (Linux / macOS / Windows CLI)",
        "sudo tailscale update --yes",
        "tailscale version",
        "",
        "# 2. Enable automatic updates on Linux servers & exit nodes",
        "sudo tailscale set --auto-update",
        "",
        "# 3. Audit tailnet via Tailscale API for any nodes below 1.106.3 (silent Noise IK fallback!)",
        "curl -s -u \"$TS_API_KEY:\" \"https://api.tailscale.com/api/v2/tailnet/-/devices\" | \\",
        "  jq -r '.devices[] | select(.clientVersion | split(\"-\")[0] | split(\".\") | map(tonumber) < [1,106,3]) | \"STALE: \\(.hostname) (\\(.clientVersion)) - \\(.os)\"'"
      ],
      "cnsa2": [
        "# Note: Tailscale v1.106.3 uses ML-KEM-768 (NIST Level 3) inside Noise IKhfs.",
        "# For strict NSA CNSA 2.0 Level 5 (ML-KEM-1024), use strongSwan IKEv2 (RFC 9370).",
        "",
        "# Upgrade all Tailscale nodes & enforce auto-updates to avoid classical Noise IK fallback:",
        "sudo tailscale update --yes",
        "sudo tailscale set --auto-update",
        "",
        "# Audit stale nodes < 1.106.3 via API:",
        "curl -s -u \"$TS_API_KEY:\" \"https://api.tailscale.com/api/v2/tailnet/-/devices\" | \\",
        "  jq -r '.devices[] | select(.clientVersion | split(\"-\")[0] | split(\".\") | map(tonumber) < [1,106,3]) | \"STALE: \\(.hostname) (\\(.clientVersion))\"'"
      ],
      "compat": [
        "# tailscale-pqc-audit.sh — Transitional Rollout",
        "# Tailscale v1.106.3+ interoperates transparently with older peers (falling back to Noise IK)",
        "# Prioritize upgrading Exit Nodes and Subnet Routers first:",
        "sudo tailscale update --yes",
        "tailscale status"
      ]
    }
  },
  {
    "id": "wireguard",
    "name": "WireGuard + Rosenpass",
    "category": "infra",
    "lang": "bash",
    "filename": "rosenpass-wg-pqc.sh",
    "minVersion": "WireGuard + Rosenpass 0.2.2+",
    "support": "Hybrid PQ-PSK Sidecar",
    "supportTone": "amber",
    "tags": ["wireguard", "rosenpass", "vpn", "mceliece", "ml-kem"],
    "summary": "Pairs WireGuard’s X25519 Noise handshake with Rosenpass (Classic McEliece + ML-KEM) rotating fresh PQ preshared keys every ~2 minutes.",
    "note": "Allow UDP 9999 alongside WireGuard UDP 51820. Lower wg0 MTU to 1380 across restrictive WAN links.",
    "verify": {
      "hybrid": "sudo wg show wg0 preshared-keys && systemctl status rosenpass",
      "cnsa2": "sudo wg show wg0 preshared-keys && systemctl status rosenpass",
      "compat": "sudo wg show wg0 preshared-keys && systemctl status rosenpass"
    },
    "templates": {
      "hybrid": [
        "# rosenpass-wg-pqc.sh — Post-Quantum WireGuard via Rosenpass",
        "# 1. Generate Classic McEliece + ML-KEM keypair",
        "rp genkey /etc/rosenpass/server.rosenpass-secret",
        "rp pubkey /etc/rosenpass/server.rosenpass-secret /etc/rosenpass/server.rosenpass-public",
        "",
        "# 2. Rotate PQ PresharedKeys into WireGuard interface wg0",
        "rosenpass exchange \\",
        "  public-key /etc/rosenpass/server.rosenpass-public \\",
        "  secret-key /etc/rosenpass/server.rosenpass-secret \\",
        "  listen 0.0.0.0:9999 \\",
        "  peer public-key /etc/rosenpass/client.rosenpass-public \\",
        "       endpoint {{domain}}:9999 \\",
        "       outfile /run/rosenpass/wg0-peer.psk \\",
        "       wg wg0 <CLIENT_WG_PUBLIC_KEY>",
        "",
        "# 3. In /etc/wireguard/wg0.conf set: MTU = 1380"
      ],
      "cnsa2": [
        "# Note: For strict CNSA 2.0 VPN compliance, prefer strongSwan IKEv2 with ML-KEM-1024.",
        "# Rosenpass provides defense-in-depth (Classic McEliece + ML-KEM) for WireGuard:",
        "rp genkey /etc/rosenpass/server.rosenpass-secret",
        "rp pubkey /etc/rosenpass/server.rosenpass-secret /etc/rosenpass/server.rosenpass-public",
        "",
        "rosenpass exchange \\",
        "  public-key /etc/rosenpass/server.rosenpass-public \\",
        "  secret-key /etc/rosenpass/server.rosenpass-secret \\",
        "  listen 0.0.0.0:9999 \\",
        "  peer public-key /etc/rosenpass/client.rosenpass-public \\",
        "       endpoint {{domain}}:9999 \\",
        "       outfile /run/rosenpass/wg0-peer.psk \\",
        "       wg wg0 <CLIENT_WG_PUBLIC_KEY>"
      ],
      "compat": [
        "# rosenpass-wg-pqc.sh — Post-Quantum WireGuard Sidecar",
        "rp genkey /etc/rosenpass/server.rosenpass-secret",
        "rp pubkey /etc/rosenpass/server.rosenpass-secret /etc/rosenpass/server.rosenpass-public",
        "",
        "rosenpass exchange \\",
        "  public-key /etc/rosenpass/server.rosenpass-public \\",
        "  secret-key /etc/rosenpass/server.rosenpass-secret \\",
        "  listen 0.0.0.0:9999 \\",
        "  peer public-key /etc/rosenpass/client.rosenpass-public \\",
        "       endpoint {{domain}}:9999 \\",
        "       outfile /run/rosenpass/wg0-peer.psk \\",
        "       wg wg0 <CLIENT_WG_PUBLIC_KEY>"
      ]
    }
  },
  {
    "id": "strongswan",
    "name": "strongSwan (IKEv2 IPsec)",
    "category": "infra",
    "lang": "ini",
    "filename": "swanctl-pqc.conf",
    "minVersion": "strongSwan 6.0+ · ml plugin",
    "support": "Native RFC 9370 ML-KEM",
    "supportTone": "emerald",
    "tags": ["strongswan", "ipsec", "ikev2", "vpn", "mlkem1024", "rfc 9370"],
    "summary": "Configures RFC 9370 Multiple Key Exchanges in IKEv2 combining classical ECDH with ML-KEM-768 or CNSA 2.0 ML-KEM-1024.",
    "note": "Always set `fragmentation = yes` because ML-KEM-1024 IKE_INTERMEDIATE payloads exceed 1500-byte Ethernet MTU.",
    "verify": {
      "hybrid": "swanctl --list-algs | grep -i ml_kem && swanctl --list-sas",
      "cnsa2": "swanctl --list-algs | grep -i ml_kem && swanctl --list-sas",
      "compat": "swanctl --list-algs | grep -i ml_kem"
    },
    "templates": {
      "hybrid": [
        "# /etc/swanctl/conf.d/pqc-vpn.conf — strongSwan 6.0+ RFC 9370 (Hybrid Modern)",
        "connections {",
        "  pqc-tunnel {",
        "    version = 2",
        "    fragmentation = yes",
        "    proposals = aes256gcm16-prfsha384-x25519-ke1_mlkem768,aes256gcm16-prfsha384-ecp384-ke1_mlkem1024",
        "",
        "    local {",
        "      auth = pubkey",
        "      certs = {{domain}}.pem",
        "      id = {{domain}}",
        "    }",
        "    remote { auth = pubkey }",
        "    children {",
        "      net-pqc {",
        "        esp_proposals = aes256gcm16-x25519-ke1_mlkem768",
        "        rekey_time = 1h",
        "      }",
        "    }",
        "  }",
        "}"
      ],
      "cnsa2": [
        "# /etc/swanctl/conf.d/pqc-vpn.conf — strongSwan 6.0+ (CNSA 2.0 Level 5)",
        "connections {",
        "  pqc-tunnel {",
        "    version = 2",
        "    fragmentation = yes",
        "    proposals = aes256gcm16-prfsha384-ecp384-ke1_mlkem1024",
        "",
        "    local {",
        "      auth = pubkey",
        "      certs = {{domain}}.pem",
        "      id = {{domain}}",
        "    }",
        "    remote { auth = pubkey }",
        "    children {",
        "      net-pqc {",
        "        esp_proposals = aes256gcm16-ecp384-ke1_mlkem1024",
        "        rekey_time = 1h",
        "      }",
        "    }",
        "  }",
        "}"
      ],
      "compat": [
        "# /etc/swanctl/conf.d/pqc-vpn.conf — strongSwan 6.0+ (Transitional)",
        "connections {",
        "  pqc-tunnel {",
        "    version = 2",
        "    fragmentation = yes",
        "    proposals = aes256gcm16-prfsha384-x25519-ke1_mlkem768,aes256gcm16-prfsha384-ecp384",
        "",
        "    local {",
        "      auth = pubkey",
        "      certs = {{domain}}.pem",
        "      id = {{domain}}",
        "    }",
        "    remote { auth = pubkey }",
        "    children {",
        "      net-pqc {",
        "        esp_proposals = aes256gcm16-x25519-ke1_mlkem768,aes256gcm16-ecp384",
        "        rekey_time = 1h",
        "      }",
        "    }",
        "  }",
        "}"
      ]
    }
  },
  {
    "id": "postfix",
    "name": "Postfix 3.10+ & Dovecot",
    "category": "infra",
    "lang": "ini",
    "filename": "postfix-dovecot-pqc.cf",
    "minVersion": "Postfix 3.10+ · Dovecot 2.4+ · OpenSSL 3.5+",
    "support": "Native OpenSSL 3.5+",
    "supportTone": "emerald",
    "tags": ["postfix", "dovecot", "smtp", "imap", "mail", "tls_eecdh_auto_curves"],
    "summary": "Enables hybrid X25519MLKEM768 key exchange for SMTP STARTTLS and IMAPS via Postfix 3.10+ tls_eecdh_auto_curves.",
    "note": "Keep inbound Port 25 SMTP opportunistic (`may`) so legacy MTAs do not bounce mail; enforce TLS 1.3 on Submission (587/465) and IMAPS (993).",
    "verify": {
      "hybrid": "openssl s_client -tls1_3 -groups X25519MLKEM768 -starttls smtp -connect mail.{{domain}}:25 -brief",
      "cnsa2": "openssl s_client -tls1_3 -groups SecP384r1MLKEM1024 -starttls smtp -connect mail.{{domain}}:25 -brief",
      "compat": "openssl s_client -tls1_3 -groups X25519MLKEM768 -starttls smtp -connect mail.{{domain}}:25 -brief"
    },
    "templates": {
      "hybrid": [
        "# /etc/postfix/main.cf — Postfix 3.10+ with OpenSSL 3.5+ (Hybrid Modern)",
        "tls_eecdh_auto_curves = X25519MLKEM768 X25519 prime256v1 secp384r1",
        "",
        "smtpd_tls_security_level      = may",
        "smtp_tls_security_level       = dane",
        "smtp_dns_support_level        = dnssec",
        "smtpd_tls_protocols           = >=TLSv1.2",
        "smtpd_tls_mandatory_protocols = >=TLSv1.3",
        "smtpd_tls_ciphers             = high",
        "smtpd_tls_exclude_ciphers     = aNULL, MD5, RC4, 3DES, DES, SEED, IDEA",
        "",
        "# /etc/dovecot/conf.d/10-ssl.conf (IMAPS 993 / Submission):",
        "# ssl = required",
        "# ssl_min_protocol = TLSv1.3",
        "# ssl_curve_list = X25519MLKEM768:X25519:prime256v1"
      ],
      "cnsa2": [
        "# /etc/postfix/main.cf — Postfix 3.10+ (CNSA 2.0 Curves)",
        "tls_eecdh_auto_curves = SecP384r1MLKEM1024 X25519MLKEM768 secp384r1",
        "",
        "smtpd_tls_security_level      = encrypt",
        "smtp_tls_security_level       = dane-only",
        "smtp_dns_support_level        = dnssec",
        "smtpd_tls_protocols           = >=TLSv1.3",
        "smtpd_tls_mandatory_protocols = >=TLSv1.3",
        "",
        "# /etc/dovecot/conf.d/10-ssl.conf:",
        "# ssl = required",
        "# ssl_min_protocol = TLSv1.3",
        "# ssl_curve_list = SecP384r1MLKEM1024:MLKEM1024"
      ],
      "compat": [
        "# /etc/postfix/main.cf — Postfix 3.10+ (Transitional)",
        "tls_eecdh_auto_curves = X25519MLKEM768 X25519 prime256v1 secp384r1",
        "",
        "smtpd_tls_security_level      = may",
        "smtp_tls_security_level       = may",
        "smtpd_tls_protocols           = >=TLSv1.2",
        "smtpd_tls_mandatory_protocols = >=TLSv1.2",
        "smtpd_tls_ciphers             = high"
      ]
    }
  },
  {
    "id": "gitlab-omnibus",
    "name": "Self-Hosted GitLab (gitlab.rb)",
    "category": "infra",
    "lang": "ruby",
    "filename": "gitlab-pqc.rb",
    "minVersion": "GitLab 18.2.4+ · OpenSSL 3.5+ (or External Proxy)",
    "support": "ML-KEM SSH + Bundled/External TLS",
    "supportTone": "emerald",
    "tags": ["gitlab", "omnibus", "gitlab.rb", "gitlab-sshd", "ruby", "mlkem768x25519-sha256", "X25519MLKEM768"],
    "summary": "Configures hybrid post-quantum TLS 1.3 (`ssl_ecdh_curve`) for Omnibus GitLab web, Container Registry, and Pages alongside `gitlab-sshd` hybrid `mlkem768x25519-sha256` SSH key exchange.",
    "note": "Check bundled NGINX OpenSSL first (`/opt/gitlab/embedded/sbin/gitlab-nginx -V 2>&1 | grep -i openssl`). If < 3.5, terminate PQ-TLS on an external OpenSSL 3.5+ NGINX/HAProxy/ALB and set `nginx['listen_https'] = false`. Apply changes with `sudo gitlab-ctl reconfigure`.",
    "verify": {
      "hybrid": "openssl s_client -connect {{domain}}:443 -servername {{domain}} -tls1_3 -groups X25519MLKEM768 -brief && ssh -vv -T git@{{domain}} 2>&1 | grep 'kex: algorithm:'",
      "cnsa2": "openssl s_client -connect {{domain}}:443 -servername {{domain}} -tls1_3 -groups SecP384r1MLKEM1024 -brief && ssh -vv -T git@{{domain}} 2>&1 | grep 'kex: algorithm:'",
      "compat": "/opt/gitlab/embedded/sbin/gitlab-nginx -V 2>&1 | grep -i openssl"
    },
    "templates": {
      "hybrid": [
        "# /etc/gitlab/gitlab.rb — Self-Hosted GitLab Omnibus (Hybrid Modern)",
        "# Apply with: sudo gitlab-ctl reconfigure",
        "",
        "external_url 'https://{{domain}}'",
        "",
        "# 1. Bundled NGINX TLS 1.3 + Hybrid ML-KEM (requires OpenSSL 3.5+)",
        "nginx['ssl_protocols'] = \"TLSv1.3\"",
        "nginx['ssl_ecdh_curve'] = \"X25519MLKEM768:SecP256r1MLKEM768:X25519:prime256v1\"",
        "nginx['ssl_prefer_server_ciphers'] = \"off\"",
        "nginx['hsts_max_age'] = 63072000",
        "nginx['hsts_include_subdomains'] = true",
        "",
        "# Container Registry & GitLab Pages NGINX blocks",
        "registry_nginx['ssl_protocols'] = \"TLSv1.3\"",
        "registry_nginx['ssl_ecdh_curve'] = \"X25519MLKEM768:SecP256r1MLKEM768:X25519:prime256v1\"",
        "pages_nginx['ssl_protocols'] = \"TLSv1.3\"",
        "pages_nginx['ssl_ecdh_curve'] = \"X25519MLKEM768:SecP256r1MLKEM768:X25519:prime256v1\"",
        "",
        "# 2. GitLab Shell SSH (gitlab-sshd — Go 1.24+ ML-KEM KEX in GitLab 18.2.4+)",
        "# Note: gitlab-sshd does NOT read /etc/ssh/sshd_config!",
        "gitlab_sshd['enable'] = true",
        "gitlab_sshd['kex_algorithms'] = %w(",
        "  mlkem768x25519-sha256",
        "  curve25519-sha256",
        "  ecdh-sha2-nistp384",
        ")",
        "gitlab_sshd['ciphers'] = %w(",
        "  aes256-gcm@openssh.com",
        "  chacha20-poly1305@openssh.com",
        ")"
      ],
      "cnsa2": [
        "# /etc/gitlab/gitlab.rb — Self-Hosted GitLab Omnibus (CNSA 2.0 Strict)",
        "# Apply with: sudo gitlab-ctl reconfigure",
        "external_url 'https://{{domain}}'",
        "",
        "nginx['ssl_protocols'] = \"TLSv1.3\"",
        "nginx['ssl_ecdh_curve'] = \"SecP384r1MLKEM1024:MLKEM1024\"",
        "nginx['ssl_ciphers'] = \"TLS_AES_256_GCM_SHA384\"",
        "nginx['hsts_max_age'] = 63072000",
        "nginx['hsts_include_subdomains'] = true",
        "",
        "registry_nginx['ssl_protocols'] = \"TLSv1.3\"",
        "registry_nginx['ssl_ecdh_curve'] = \"SecP384r1MLKEM1024:MLKEM1024\"",
        "",
        "# Enforce Post-Quantum SSH KEX exclusively on gitlab-sshd",
        "gitlab_sshd['enable'] = true",
        "gitlab_sshd['kex_algorithms'] = %w(mlkem768x25519-sha256)",
        "gitlab_sshd['ciphers'] = %w(aes256-gcm@openssh.com)",
        "gitlab_sshd['macs'] = %w(hmac-sha2-512-etm@openssh.com)"
      ],
      "compat": [
        "# /etc/gitlab/gitlab.rb — Transitional / External PQ-TLS Proxy Offload",
        "# Use this if Omnibus bundled OpenSSL is < 3.5 and an external OpenSSL 3.5+ NGINX/HAProxy/ALB",
        "# terminates HTTPS (X25519MLKEM768) in front of GitLab:",
        "external_url 'https://{{domain}}'",
        "nginx['listen_port'] = 80",
        "nginx['listen_https'] = false",
        "",
        "# Keep gitlab-sshd PQ-enabled with classical fallback for older Git clients:",
        "gitlab_sshd['enable'] = true",
        "gitlab_sshd['kex_algorithms'] = %w(",
        "  mlkem768x25519-sha256",
        "  curve25519-sha256",
        "  ecdh-sha2-nistp256",
        "  ecdh-sha2-nistp384",
        ")"
      ]
    }
  }
]
