|
| 1 | +// SPDX-License-Identifier: AGPL-3.0-or-later |
| 2 | +// Copyright (c) 2026 Jonathan D.A. Jewell |
| 3 | +// |
| 4 | +// CloudGuardModule.affine — capability-driven registration for the |
| 5 | +// Cloudflare domain security management panel. |
| 6 | +// |
| 7 | +// Translation of src/modules/CloudGuardModule.res (93 LoC). Same shape |
| 8 | +// as the other module files plus an extra `capabilityDescription` |
| 9 | +// helper (CloudGuard tooltips include longer prose). |
| 10 | +// |
| 11 | +// Refs: standards#279, standards#252. |
| 12 | + |
| 13 | +module CloudGuardModule; |
| 14 | + |
| 15 | +use prelude::{Option, Some, None, contains}; |
| 16 | + |
| 17 | +type CloudguardCapability = |
| 18 | + | DomainInventory |
| 19 | + | SecurityHardening |
| 20 | + | DnsManagement |
| 21 | + | ComplianceAudit |
| 22 | + | OfflineConfig |
| 23 | + | BulkOperations |
| 24 | + | PagesIntegration |
| 25 | + | DnssecManagement |
| 26 | + |
| 27 | +type CloudguardModuleConfig = { |
| 28 | + id: String, |
| 29 | + name: String, |
| 30 | + version: String, |
| 31 | + description: String, |
| 32 | + apiEndpoint: String, |
| 33 | + capabilities: [CloudguardCapability], |
| 34 | + icon: Option<String>, |
| 35 | +} |
| 36 | + |
| 37 | +const config: CloudguardModuleConfig = #{ |
| 38 | + id: "cloudguard", |
| 39 | + name: "CloudGuard", |
| 40 | + version: "0.1.0", |
| 41 | + description: "Cloudflare domain security management. Automates SSL/TLS hardening, DNS security records, WAF configuration, DNSSEC, and compliance auditing across all domains.", |
| 42 | + apiEndpoint: "https://api.cloudflare.com/client/v4", |
| 43 | + capabilities: [ |
| 44 | + DomainInventory, |
| 45 | + SecurityHardening, |
| 46 | + DnsManagement, |
| 47 | + ComplianceAudit, |
| 48 | + OfflineConfig, |
| 49 | + BulkOperations, |
| 50 | + PagesIntegration, |
| 51 | + DnssecManagement, |
| 52 | + ], |
| 53 | + icon: Some("shield"), |
| 54 | +}; |
| 55 | + |
| 56 | +fn hasCapability(cap: CloudguardCapability) -> Bool { |
| 57 | + contains(config.capabilities, cap) |
| 58 | +} |
| 59 | + |
| 60 | +fn capabilityLabel(cap: CloudguardCapability) -> String { |
| 61 | + match cap { |
| 62 | + DomainInventory => "Domain Inventory", |
| 63 | + SecurityHardening => "Security Hardening", |
| 64 | + DnsManagement => "DNS Management", |
| 65 | + ComplianceAudit => "Compliance Audit", |
| 66 | + OfflineConfig => "Offline Config", |
| 67 | + BulkOperations => "Bulk Operations", |
| 68 | + PagesIntegration => "Pages Integration", |
| 69 | + DnssecManagement => "DNSSEC Management", |
| 70 | + } |
| 71 | +} |
| 72 | + |
| 73 | +fn capabilityDescription(cap: CloudguardCapability) -> String { |
| 74 | + match cap { |
| 75 | + DomainInventory => "List and monitor all Cloudflare zones with plan tier, status, and nameserver info", |
| 76 | + SecurityHardening => "Apply SSL Full (Strict), HSTS, min TLS 1.2, security headers, and other hardening defaults", |
| 77 | + DnsManagement => "Create, update, and delete DNS records with templates for SPF, DMARC, DKIM, CAA, and TLSRPT", |
| 78 | + ComplianceAudit => "Evaluate live Cloudflare settings against Trustfile/Nickel security policy constraints", |
| 79 | + OfflineConfig => "Download zone configs as JSON, edit offline, upload with three-way diff and dry-run preview", |
| 80 | + BulkOperations => "Apply hardening settings across all selected domains with real-time progress tracking", |
| 81 | + PagesIntegration => "Set up Cloudflare Pages projects from GitHub repos with auto-detected SSG framework", |
| 82 | + DnssecManagement => "Enable DNSSEC, verify DS records at registrar, monitor key rotation status", |
| 83 | + } |
| 84 | +} |
0 commit comments