[
  {
    "id": "aws",
    "name": "AWS (ALB / CloudFront)",
    "category": "cloud",
    "lang": "hcl",
    "filename": "aws-pqc-tls.tf",
    "minVersion": "AWS PQ Policies (2025-09+)",
    "support": "Opt-In ALB · Default CF",
    "supportTone": "emerald",
    "tags": ["aws", "alb", "nlb", "cloudfront", "terraform", "ELBSecurityPolicy", "fips"],
    "summary": "Terraform configuration pinning AWS hybrid ML-KEM policies on Application Load Balancers and CloudFront distributions.",
    "note": "CRITICAL IaC GOTCHA: Terraform, CDK, and CloudFormation still default ALB listeners to legacy ELBSecurityPolicy-2016-08 unless ssl_policy is explicitly set.",
    "verify": {
      "hybrid": "aws elbv2 describe-listeners --load-balancer-arn <ALB_ARN> --query 'Listeners[*].SslPolicy'",
      "cnsa2": "aws elbv2 describe-listeners --load-balancer-arn <ALB_ARN> --query 'Listeners[*].SslPolicy'",
      "compat": "aws elbv2 describe-listeners --load-balancer-arn <ALB_ARN> --query 'Listeners[*].SslPolicy'"
    },
    "templates": {
      "hybrid": [
        "# aws-pqc-tls.tf — AWS ALB + CloudFront (Hybrid Modern)",
        "resource \"aws_lb_listener\" \"https_pqc\" {",
        "  load_balancer_arn = aws_lb.main.arn",
        "  port              = 443",
        "  protocol          = \"HTTPS\"",
        "  certificate_arn   = aws_acm_certificate.main.arn",
        "",
        "  # Supports X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024",
        "  ssl_policy = \"ELBSecurityPolicy-TLS13-1-2-Res-PQ-2025-09\"",
        "",
        "  default_action {",
        "    type             = \"forward\"",
        "    target_group_arn = aws_lb_target_group.app.arn",
        "  }",
        "}",
        "",
        "resource \"aws_cloudfront_distribution\" \"edge\" {",
        "  enabled = true",
        "  aliases = [\"{{domain}}\"]",
        "",
        "  viewer_certificate {",
        "    acm_certificate_arn      = aws_acm_certificate.us_east_1.arn",
        "    ssl_support_method       = \"sni-only\"",
        "    minimum_protocol_version = \"TLS1.3_2025\"",
        "  }",
        "}"
      ],
      "cnsa2": [
        "# aws-pqc-tls.tf — AWS ALB + CloudFront (CNSA 2.0 / FIPS PQ)",
        "resource \"aws_lb_listener\" \"https_pqc\" {",
        "  load_balancer_arn = aws_lb.main.arn",
        "  port              = 443",
        "  protocol          = \"HTTPS\"",
        "  certificate_arn   = aws_acm_certificate.main.arn",
        "",
        "  # FIPS-validated hybrid ML-KEM policy",
        "  ssl_policy = \"ELBSecurityPolicy-TLS13-1-2-Res-FIPS-PQ-2025-09\"",
        "",
        "  default_action {",
        "    type             = \"forward\"",
        "    target_group_arn = aws_lb_target_group.app.arn",
        "  }",
        "}",
        "",
        "resource \"aws_cloudfront_distribution\" \"edge\" {",
        "  enabled = true",
        "  aliases = [\"{{domain}}\"]",
        "",
        "  viewer_certificate {",
        "    acm_certificate_arn      = aws_acm_certificate.us_east_1.arn",
        "    ssl_support_method       = \"sni-only\"",
        "    minimum_protocol_version = \"TLS1.3_2025\"",
        "  }",
        "}"
      ],
      "compat": [
        "# aws-pqc-tls.tf — AWS ALB + CloudFront (Transitional PQ)",
        "resource \"aws_lb_listener\" \"https_pqc\" {",
        "  load_balancer_arn = aws_lb.main.arn",
        "  port              = 443",
        "  protocol          = \"HTTPS\"",
        "  certificate_arn   = aws_acm_certificate.main.arn",
        "",
        "  ssl_policy = \"ELBSecurityPolicy-TLS13-1-2-PQ-2025-09\"",
        "",
        "  default_action {",
        "    type             = \"forward\"",
        "    target_group_arn = aws_lb_target_group.app.arn",
        "  }",
        "}",
        "",
        "resource \"aws_cloudfront_distribution\" \"edge\" {",
        "  enabled = true",
        "  aliases = [\"{{domain}}\"]",
        "",
        "  viewer_certificate {",
        "    acm_certificate_arn      = aws_acm_certificate.us_east_1.arn",
        "    ssl_support_method       = \"sni-only\"",
        "    minimum_protocol_version = \"TLSv1.2_2021\"",
        "  }",
        "}"
      ]
    }
  },
  {
    "id": "aws-vpn-transfer-audit",
    "name": "AWS Site-to-Site VPN, SFTP & CloudTrail Audit",
    "category": "cloud",
    "lang": "bash",
    "filename": "aws-vpn-sftp-pqc.sh",
    "minVersion": "AWS CLI v2.34.54+ (OpenSSL 3.5+)",
    "support": "ML-KEM GA (VPN & SFTP)",
    "supportTone": "emerald",
    "tags": ["aws", "site-to-site vpn", "transfer family", "sftp", "cloudtrail", "ml-kem", "rfc 9370"],
    "summary": "Enables RFC 9370 ML-KEM-768/1024 on AWS Site-to-Site VPN tunnels, configures ML-KEM SFTP security policies on AWS Transfer Family, and audits non-PQ API callers via CloudTrail.",
    "note": "Site-to-Site VPN uses IANA Method 35 (ML-KEM-512), Method 36 (ML-KEM-768), and Method 37 (ML-KEM-1024) on IKEv2 tunnels. CloudTrail logs negotiated key exchange in `tlsDetails.keyExchange`.",
    "verify": {
      "hybrid": "aws ec2 describe-vpn-connections --vpn-connection-ids <VPN_ID> --query 'VpnConnections[*].Options.TunnelOptions[*].{InsideCidr:TunnelInsideCidr,IKE:IkeVersions}'",
      "cnsa2": "aws transfer describe-server --server-id <SFTP_ID> --query 'Server.SecurityPolicyName'",
      "compat": "aws --version"
    },
    "templates": {
      "hybrid": [
        "# aws-vpn-sftp-pqc.sh — Hybrid Modern (ML-KEM-768 VPN + SFTP + CloudTrail Audit)",
        "# 1. Enable RFC 9370 ML-KEM-768 (Method 36) on an AWS Site-to-Site VPN IKEv2 tunnel",
        "aws ec2 modify-vpn-tunnel-options \\",
        "  --vpn-connection-id <VPN_CONNECTION_ID> \\",
        "  --vpn-tunnel-outside-ip-address <TUNNEL_OUTSIDE_IP> \\",
        "  --tunnel-options '{",
        "    \"IKEVersions\": [{\"Value\": \"ikev2\"}],",
        "    \"Phase1EncryptionAlgorithms\": [{\"Value\": \"AES256-GCM-16\"}],",
        "    \"Phase2EncryptionAlgorithms\": [{\"Value\": \"AES256-GCM-16\"}],",
        "    \"Phase1DHGroupNumbers\": [{\"Value\": 20}, {\"Value\": 36}],",
        "    \"Phase2DHGroupNumbers\": [{\"Value\": 20}, {\"Value\": 36}]",
        "  }'",
        "",
        "# 2. Enable standardized ML-KEM SSH KEX on AWS Transfer Family (SFTP)",
        "aws transfer update-server \\",
        "  --server-id <TRANSFER_SERVER_ID> \\",
        "  --security-policy-name TransferSecurityPolicy-2025-03",
        "",
        "# 3. Athena SQL: Find non-PQ API clients hitting S3/KMS in AWS CloudTrail",
        "# SELECT useragent, eventSource, tlsDetails.keyExchange, count(*) AS calls",
        "# FROM cloudtrail_logs",
        "# WHERE tlsDetails.keyExchange IS NOT NULL",
        "#   AND tlsDetails.keyExchange NOT LIKE '%MLKEM%'",
        "# GROUP BY 1, 2, 3 ORDER BY calls DESC LIMIT 50;"
      ],
      "cnsa2": [
        "# aws-vpn-sftp-pqc.sh — CNSA 2.0 Level 5 (ML-KEM-1024 Method 37 + FIPS SFTP)",
        "# 1. Enforce ML-KEM-1024 (Method 37) + P-384 (DH Group 20) + AES256-GCM-16 on IKEv2",
        "aws ec2 modify-vpn-tunnel-options \\",
        "  --vpn-connection-id <VPN_CONNECTION_ID> \\",
        "  --vpn-tunnel-outside-ip-address <TUNNEL_OUTSIDE_IP> \\",
        "  --tunnel-options '{",
        "    \"IKEVersions\": [{\"Value\": \"ikev2\"}],",
        "    \"Phase1EncryptionAlgorithms\": [{\"Value\": \"AES256-GCM-16\"}],",
        "    \"Phase2EncryptionAlgorithms\": [{\"Value\": \"AES256-GCM-16\"}],",
        "    \"Phase1IntegrityAlgorithms\": [{\"Value\": \"SHA2-384\"}],",
        "    \"Phase2IntegrityAlgorithms\": [{\"Value\": \"SHA2-384\"}],",
        "    \"Phase1DHGroupNumbers\": [{\"Value\": 20}, {\"Value\": 37}],",
        "    \"Phase2DHGroupNumbers\": [{\"Value\": 20}, {\"Value\": 37}]",
        "  }'",
        "",
        "# 2. Enforce FIPS 140-3 ML-KEM SSH policy on AWS Transfer Family",
        "aws transfer update-server \\",
        "  --server-id <TRANSFER_SERVER_ID> \\",
        "  --security-policy-name TransferSecurityPolicy-FIPS-2025-03"
      ],
      "compat": [
        "# aws-vpn-sftp-pqc.sh — Transitional Rollout (SFTP PQ + Amazon Linux 2023 PQ Policy)",
        "aws transfer update-server \\",
        "  --server-id <TRANSFER_SERVER_ID> \\",
        "  --security-policy-name TransferSecurityPolicy-2025-03",
        "",
        "# Enable system-wide PQ crypto policy on Amazon Linux 2023 EC2 instances:",
        "sudo update-crypto-policies --set DEFAULT:PQ",
        "update-crypto-policies --show"
      ]
    }
  },
  {
    "id": "aws-kms-pca-cloudhsm",
    "name": "AWS KMS ML-KEM, Private CA & CloudHSM",
    "category": "cloud",
    "lang": "bash",
    "filename": "aws-kms-pca-hsm-pqc.sh",
    "minVersion": "AWS CLI v2.34+ · CloudHSM hsm2m.medium",
    "support": "FIPS 140-3 L3 GA",
    "supportTone": "emerald",
    "tags": ["aws", "kms", "ml-kem", "private ca", "acm-pca", "cloudhsm", "hsm2m", "ml-dsa"],
    "summary": "Provisions FIPS 203 ML-KEM keys in AWS KMS (`Encapsulate`/`Decapsulate`), creates an ML-DSA root/subordinate CA in AWS Private CA, and generates FIPS-mode ML-DSA keys in AWS CloudHSM `hsm2m.medium`.",
    "note": "AWS Private CA requires matching `KeyAlgorithm` and `SigningAlgorithm` (`ML_DSA_65`/`ML_DSA_87`). AWS CloudHSM `ML-DSA` requires `hsm2m.medium` clusters (available Sept 1, 2026+).",
    "verify": {
      "hybrid": "aws kms describe-key --key-id alias/pqc-kem-768 --query 'KeyMetadata.{KeySpec:KeySpec,KeyUsage:KeyUsage}'",
      "cnsa2": "aws kms describe-key --key-id alias/pqc-kem-1024 --query 'KeyMetadata.{KeySpec:KeySpec,KeyUsage:KeyUsage}'",
      "compat": "aws acm-pca list-certificate-authorities --query 'CertificateAuthorities[*].{Arn:Arn,KeyAlg:CertificateAuthorityConfiguration.KeyAlgorithm,Status:Status}'"
    },
    "templates": {
      "hybrid": [
        "# aws-kms-pca-hsm-pqc.sh — Hybrid Modern (ML-KEM-768 + Private CA ML-DSA-65)",
        "# 1. Provision FIPS 203 ML-KEM-768 key in AWS KMS (FIPS 140-3 L3 HSM)",
        "KEM_ID=$(aws kms create-key \\",
        "  --key-spec ML_KEM_768 \\",
        "  --key-usage ENCAPSULATE_DECAPSULATE \\",
        "  --description \"FIPS 203 ML-KEM-768 key encapsulation for {{domain}}\" \\",
        "  --query 'KeyMetadata.KeyId' --output text)",
        "aws kms create-alias --alias-name alias/pqc-kem-768 --target-key-id \"$KEM_ID\"",
        "",
        "# Encapsulate & decapsulate a 32-byte shared secret:",
        "aws kms encapsulate --key-id alias/pqc-kem-768 --key-encapsulation-algorithm ML_KEM_768",
        "",
        "# 2. Create ML-DSA-65 Subordinate CA in AWS Private CA",
        "aws acm-pca create-certificate-authority \\",
        "  --certificate-authority-type SUBORDINATE \\",
        "  --certificate-authority-configuration '{",
        "    \"KeyAlgorithm\": \"ML_DSA_65\",",
        "    \"SigningAlgorithm\": \"ML_DSA_65\",",
        "    \"Subject\": {\"CommonName\": \"PQC Issuing CA ({{domain}})\", \"Country\": \"US\"}",
        "  }'"
      ],
      "cnsa2": [
        "# aws-kms-pca-hsm-pqc.sh — CNSA 2.0 Level 5 (ML-KEM-1024 + ML-DSA-87 + CloudHSM hsm2m)",
        "# 1. Provision CNSA 2.0 ML-KEM-1024 key in AWS KMS",
        "KEM_ID=$(aws kms create-key \\",
        "  --key-spec ML_KEM_1024 \\",
        "  --key-usage ENCAPSULATE_DECAPSULATE \\",
        "  --description \"CNSA 2.0 ML-KEM-1024 key for {{domain}}\" \\",
        "  --query 'KeyMetadata.KeyId' --output text)",
        "aws kms create-alias --alias-name alias/pqc-kem-1024 --target-key-id \"$KEM_ID\"",
        "",
        "# 2. Create CNSA 2.0 ML-DSA-87 Root CA in AWS Private CA",
        "aws acm-pca create-certificate-authority \\",
        "  --certificate-authority-type ROOT \\",
        "  --certificate-authority-configuration '{",
        "    \"KeyAlgorithm\": \"ML_DSA_87\",",
        "    \"SigningAlgorithm\": \"ML_DSA_87\",",
        "    \"Subject\": {\"CommonName\": \"CNSA 2.0 Root CA ({{domain}})\", \"Country\": \"US\"}",
        "  }'",
        "",
        "# 3. Generate FIPS-mode ML-DSA-87 key pair inside AWS CloudHSM (hsm2m.medium CLI):",
        "# aws-cloudhsm > key generate-asymmetric-pair ml-dsa --mldsa-algorithm ML-DSA-87 --public-label pqc-pub --private-label pqc-priv"
      ],
      "compat": [
        "# aws-kms-pca-hsm-pqc.sh — Export KMS ML-KEM Public Key for Hybrid Client Encapsulation",
        "# Clients encapsulate locally using AWS-LC / OpenSSL 3.5+ and call kms:Decapsulate server-side",
        "aws kms get-public-key --key-id alias/pqc-kem-768 --output text --query PublicKey | base64 --decode > mlkem768.pub.der"
      ]
    }
  },
  {
    "id": "gcp",
    "name": "Google Cloud (Load Balancing)",
    "category": "cloud",
    "lang": "bash",
    "filename": "gcp-pqc-ssl-policy.sh",
    "minVersion": "GCP Global / Regional App LB",
    "support": "X25519MLKEM768 Native",
    "supportTone": "emerald",
    "tags": ["gcp", "google cloud", "load balancer", "ssl-policy", "gcloud"],
    "summary": "Creates and attaches a hardened TLS 1.3 SSL policy on Google Cloud Load Balancers using hybrid X25519MLKEM768.",
    "note": "Google Front Ends (GFEs) negotiate X25519MLKEM768 automatically on TLS 1.3. Avoid the COMPATIBLE profile.",
    "verify": {
      "hybrid": "gcloud compute ssl-policies describe pqc-tls-policy && openssl s_client -connect {{domain}}:443 -tls1_3 -groups X25519MLKEM768 -brief",
      "cnsa2": "gcloud compute ssl-policies describe pqc-tls-policy && openssl s_client -connect {{domain}}:443 -tls1_3 -groups X25519MLKEM768 -brief",
      "compat": "gcloud compute ssl-policies describe pqc-tls-policy"
    },
    "templates": {
      "hybrid": [
        "# gcp-pqc-ssl-policy.sh — GCP Cloud Load Balancing (Hybrid Modern)",
        "gcloud compute ssl-policies create pqc-tls-policy \\",
        "  --profile=RESTRICTED \\",
        "  --min-tls-version=TLS_1_3 \\",
        "  --global",
        "",
        "gcloud compute target-https-proxies update my-https-proxy \\",
        "  --ssl-policy=pqc-tls-policy \\",
        "  --global",
        "",
        "# Terraform equivalent:",
        "# resource \"google_compute_ssl_policy\" \"pqc\" {",
        "#   name            = \"pqc-tls-policy\"",
        "#   profile         = \"RESTRICTED\"",
        "#   min_tls_version = \"TLS_1_3\"",
        "# }"
      ],
      "cnsa2": [
        "# gcp-pqc-ssl-policy.sh — GCP Cloud Load Balancing (Strict TLS 1.3)",
        "gcloud compute ssl-policies create pqc-tls-cnsa2 \\",
        "  --profile=RESTRICTED \\",
        "  --min-tls-version=TLS_1_3 \\",
        "  --global",
        "",
        "gcloud compute target-https-proxies update my-https-proxy \\",
        "  --ssl-policy=pqc-tls-cnsa2 \\",
        "  --global"
      ],
      "compat": [
        "# gcp-pqc-ssl-policy.sh — GCP Cloud Load Balancing (Transitional)",
        "gcloud compute ssl-policies create pqc-tls-compat \\",
        "  --profile=MODERN \\",
        "  --min-tls-version=TLS_1_2 \\",
        "  --global",
        "",
        "gcloud compute target-https-proxies update my-https-proxy \\",
        "  --ssl-policy=pqc-tls-compat \\",
        "  --global"
      ]
    }
  },
  {
    "id": "azure",
    "name": "Microsoft Azure (Front Door)",
    "category": "cloud",
    "lang": "bash",
    "filename": "azure-frontdoor-pqc.sh",
    "minVersion": "Azure Front Door Standard / Premium",
    "support": "Default on TLS 1.3",
    "supportTone": "emerald",
    "tags": ["azure", "front door", "microsoft", "bicep", "SecP384r1MLKEM1024"],
    "summary": "Enforces TLS 1.3 with hybrid ML-KEM (X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024) on Azure Front Door.",
    "note": "Front Door PQC protects client-to-edge; harden your origin TLS separately to protect edge-to-origin traffic.",
    "verify": {
      "hybrid": "openssl s_client -connect {{domain}}:443 -servername {{domain}} -tls1_3 -groups X25519MLKEM768 -brief",
      "cnsa2": "openssl s_client -connect {{domain}}:443 -servername {{domain}} -tls1_3 -groups SecP384r1MLKEM1024 -brief",
      "compat": "openssl s_client -connect {{domain}}:443 -servername {{domain}} -tls1_3 -groups X25519MLKEM768 -brief"
    },
    "templates": {
      "hybrid": [
        "# azure-frontdoor-pqc.sh — Azure Front Door (Hybrid Modern)",
        "# TLS 1.3 Standard negotiates X25519MLKEM768, SecP256r1MLKEM768, SecP384r1MLKEM1024",
        "az afd custom-domain update \\",
        "  --resource-group my-security-rg \\",
        "  --profile-name my-frontdoor-profile \\",
        "  --custom-domain-name \"{{domain_slug}}\" \\",
        "  --minimum-tls-version TLS13 \\",
        "  --certificate-type ManagedCertificate"
      ],
      "cnsa2": [
        "# azure-frontdoor-pqc.sh — Azure Front Door (CNSA 2.0 Strict)",
        "az afd custom-domain update \\",
        "  --resource-group my-security-rg \\",
        "  --profile-name my-frontdoor-profile \\",
        "  --custom-domain-name \"{{domain_slug}}\" \\",
        "  --minimum-tls-version TLS13 \\",
        "  --certificate-type ManagedCertificate",
        "",
        "# Bicep tlsSettings (Custom AES-256-GCM-SHA384):",
        "# tlsSettings: {",
        "#   minimumTlsVersion: 'TLS13'",
        "#   cipherSuiteSetType: 'Customized'",
        "#   customizedCipherSuiteSet: { cipherSuiteSetForTls13: ['TLS_AES_256_GCM_SHA384'] }",
        "# }"
      ],
      "compat": [
        "# azure-frontdoor-pqc.sh — Azure Front Door (Transitional)",
        "az afd custom-domain update \\",
        "  --resource-group my-security-rg \\",
        "  --profile-name my-frontdoor-profile \\",
        "  --custom-domain-name \"{{domain_slug}}\" \\",
        "  --minimum-tls-version TLS12 \\",
        "  --certificate-type ManagedCertificate"
      ]
    }
  },
  {
    "id": "cloudflare",
    "name": "Cloudflare",
    "category": "cloud",
    "lang": "hcl",
    "filename": "cloudflare-pqc.tf",
    "minVersion": "All Cloudflare Plans",
    "support": "Default Edge + Origin PQ",
    "supportTone": "emerald",
    "tags": ["cloudflare", "cdn", "waf", "terraform", "X25519MLKEM768"],
    "summary": "Enforces TLS 1.3, Full (Strict) origin validation, and end-to-end hybrid post-quantum key agreement.",
    "note": "Cloudflare negotiates X25519MLKEM768 on >70% of browser traffic by default and offers hybrid ML-KEM to OpenSSL 3.5+ origins.",
    "verify": {
      "hybrid": "curl -s https://{{domain}}/cdn-cgi/trace | grep -E 'tls=|kex='",
      "cnsa2": "curl -s https://{{domain}}/cdn-cgi/trace | grep -E 'tls=|kex='",
      "compat": "curl -s https://{{domain}}/cdn-cgi/trace | grep -E 'tls=|kex='"
    },
    "templates": {
      "hybrid": [
        "# cloudflare-pqc.tf — Cloudflare Zone Hardening (Hybrid Modern)",
        "resource \"cloudflare_zone_settings_override\" \"pqc_hardening\" {",
        "  zone_id = var.cloudflare_zone_id",
        "",
        "  settings {",
        "    ssl                      = \"strict\"",
        "    tls_1_3                  = \"on\"",
        "    min_tls_version          = \"1.3\"",
        "    always_use_https         = \"on\"",
        "    automatic_https_rewrites = \"on\"",
        "  }",
        "}",
        "",
        "# Verify: curl -s https://{{domain}}/cdn-cgi/trace | grep -E 'tls=|kex='",
        "# Expected: tls=TLSv1.3  kex=X25519MLKEM768"
      ],
      "cnsa2": [
        "# cloudflare-pqc.tf — Cloudflare Zone Hardening (Strict TLS 1.3 + HSTS)",
        "resource \"cloudflare_zone_settings_override\" \"pqc_hardening\" {",
        "  zone_id = var.cloudflare_zone_id",
        "",
        "  settings {",
        "    ssl                      = \"strict\"",
        "    tls_1_3                  = \"on\"",
        "    min_tls_version          = \"1.3\"",
        "    always_use_https         = \"on\"",
        "    security_header {",
        "      strict_transport_security {",
        "        enabled            = true",
        "        max_age            = 63072000",
        "        include_subdomains = true",
        "        preload            = true",
        "      }",
        "    }",
        "  }",
        "}"
      ],
      "compat": [
        "# cloudflare-pqc.tf — Cloudflare Zone Hardening (Transitional)",
        "resource \"cloudflare_zone_settings_override\" \"pqc_hardening\" {",
        "  zone_id = var.cloudflare_zone_id",
        "",
        "  settings {",
        "    ssl              = \"strict\"",
        "    tls_1_3          = \"on\"",
        "    min_tls_version  = \"1.2\"",
        "    always_use_https = \"on\"",
        "  }",
        "}"
      ]
    }
  }
]
