feat(opnsense-config): add caddy module with configuration management

Introduce a new Caddy module within opnsense-config to manage Caddy server configurations. This includes enabling/disabling Caddy, setting ports, and reloading/restarting the service via OPNsense shell commands. Additionally, provide a sample Caddy configuration file for PXE booting and a test file in the pxe-http-files directory.
This commit is contained in:
2025-01-07 17:12:39 -05:00
parent 925e84e4d2
commit 81d40ec163
17 changed files with 342 additions and 17 deletions

View File

@@ -9,7 +9,9 @@ use harmony::{
infra::opnsense::OPNSenseManagementInterface,
inventory::Inventory,
maestro::Maestro,
modules::{okd::{dhcp::OKDBootstrapDhcpScore, dns::OKDBootstrapDnsScore}, tftp::TftpScore},
modules::{
http::HttpScore, okd::{dhcp::OKDBootstrapDhcpScore, dns::OKDBootstrapDnsScore}, tftp::TftpScore
},
topology::{LogicalHost, UnmanagedRouter, Url},
};
use harmony_macros::ip;
@@ -24,14 +26,8 @@ async fn main() {
};
let opnsense = Arc::new(
harmony::infra::opnsense::OPNSenseFirewall::new(
firewall,
None,
"lan",
"root",
"opnsense",
)
.await,
harmony::infra::opnsense::OPNSenseFirewall::new(firewall, None, "lan", "root", "opnsense")
.await,
);
let lan_subnet = Ipv4Addr::new(10, 100, 8, 0);
let gateway_ipv4 = Ipv4Addr::new(10, 100, 8, 1);
@@ -45,6 +41,7 @@ async fn main() {
load_balancer: opnsense.clone(),
firewall: opnsense.clone(),
tftp_server: opnsense.clone(),
http_server: opnsense.clone(),
dhcp_server: opnsense.clone(),
dns_server: opnsense.clone(),
control_plane: vec![LogicalHost {
@@ -82,9 +79,13 @@ async fn main() {
// harmony::modules::okd::load_balancer::OKDLoadBalancerScore::new(&topology);
let tftp_score = TftpScore::new(Url::LocalFolder("../../../watchguard/tftpboot".to_string()));
let http_score = HttpScore::new(Url::LocalFolder(
"../../../watchguard/pxe-http-files".to_string(),
));
let maestro = Maestro::new(inventory, topology);
// maestro.interpret(dns_score).await.unwrap();
// maestro.interpret(dhcp_score).await.unwrap();
// maestro.interpret(load_balancer_score).await.unwrap();
maestro.interpret(tftp_score).await.unwrap();
// maestro.interpret(tftp_score).await.unwrap();
maestro.interpret(http_score).await.unwrap();
}