This commit is contained in:
parent
c805d7e018
commit
6c92dd24f7
@ -126,7 +126,9 @@ async fn main() {
|
||||
|
||||
let tftp_score = TftpScore::new(Url::LocalFolder("./data/watchguard/tftpboot".to_string()));
|
||||
let http_score = StaticFilesHttpScore {
|
||||
folder_to_serve: Some(Url::LocalFolder("./data/watchguard/pxe-http-files".to_string())),
|
||||
folder_to_serve: Some(Url::LocalFolder(
|
||||
"./data/watchguard/pxe-http-files".to_string(),
|
||||
)),
|
||||
files: vec![],
|
||||
};
|
||||
let ipxe_score = IpxeScore::new();
|
||||
|
@ -55,11 +55,16 @@ async fn main() {
|
||||
gateway_ip,
|
||||
harmony_inventory_agent,
|
||||
cluster_pubkey_filename,
|
||||
}.to_string(),
|
||||
}
|
||||
.to_string(),
|
||||
},
|
||||
FileContent {
|
||||
path: FilePath::Relative("fallback.ipxe".to_string()),
|
||||
content: FallbackIpxeTpl { gateway_ip, kickstart_filename}.to_string(),
|
||||
content: FallbackIpxeTpl {
|
||||
gateway_ip,
|
||||
kickstart_filename,
|
||||
}
|
||||
.to_string(),
|
||||
},
|
||||
],
|
||||
}),
|
||||
|
@ -1,6 +1,6 @@
|
||||
mod file;
|
||||
mod id;
|
||||
mod version;
|
||||
mod file;
|
||||
pub use file::*;
|
||||
pub use id::*;
|
||||
pub use version::*;
|
||||
pub use file::*;
|
||||
|
@ -64,7 +64,12 @@ impl<T: Topology + HttpServer> Interpret<T> for StaticFilesHttpInterpret {
|
||||
Ok(Outcome::success(format!(
|
||||
"Http Server running and serving files from folder {:?} and content for {}",
|
||||
self.score.folder_to_serve,
|
||||
self.score.files.iter().map(|f| f.path.to_string()).collect::<Vec<String>>().join(",")
|
||||
self.score
|
||||
.files
|
||||
.iter()
|
||||
.map(|f| f.path.to_string())
|
||||
.collect::<Vec<String>>()
|
||||
.join(",")
|
||||
)))
|
||||
}
|
||||
|
||||
|
@ -48,7 +48,7 @@ pub struct CaddyGeneral {
|
||||
#[yaserde(rename = "TlsDnsPropagationResolvers")]
|
||||
pub tls_dns_propagation_resolvers: MaybeString,
|
||||
#[yaserde(rename = "TlsDnsEchDomain")]
|
||||
pub tls_dns_ech_domain: MaybeString,
|
||||
pub tls_dns_ech_domain: Option<MaybeString>,
|
||||
pub accesslist: MaybeString,
|
||||
#[yaserde(rename = "DisableSuperuser")]
|
||||
pub disable_superuser: Option<i32>,
|
||||
|
@ -1,9 +1,9 @@
|
||||
mod caddy;
|
||||
mod dhcpd;
|
||||
pub mod dnsmasq;
|
||||
mod haproxy;
|
||||
mod interfaces;
|
||||
mod opnsense;
|
||||
pub mod dnsmasq;
|
||||
pub use caddy::*;
|
||||
pub use dhcpd::*;
|
||||
pub use haproxy::*;
|
||||
|
@ -4,7 +4,8 @@ use crate::{
|
||||
config::{SshConfigManager, SshCredentials, SshOPNSenseShell},
|
||||
error::Error,
|
||||
modules::{
|
||||
caddy::CaddyConfig, dhcp_legacy::DhcpConfigLegacyISC, dns::DnsConfig, dnsmasq::DhcpConfigDnsMasq, load_balancer::LoadBalancerConfig, tftp::TftpConfig
|
||||
caddy::CaddyConfig, dhcp_legacy::DhcpConfigLegacyISC, dns::DnsConfig,
|
||||
dnsmasq::DhcpConfigDnsMasq, load_balancer::LoadBalancerConfig, tftp::TftpConfig,
|
||||
},
|
||||
};
|
||||
use log::{debug, info, trace, warn};
|
||||
|
@ -159,11 +159,7 @@ impl SshOPNSenseShell {
|
||||
wait_for_completion(&mut channel).await
|
||||
}
|
||||
|
||||
async fn ensure_remote_dir_exists(
|
||||
&self,
|
||||
sftp: &SftpSession,
|
||||
path: &str,
|
||||
) -> Result<(), Error> {
|
||||
async fn ensure_remote_dir_exists(&self, sftp: &SftpSession, path: &str) -> Result<(), Error> {
|
||||
if !sftp.try_exists(path).await? {
|
||||
info!("Creating remote directory {path}");
|
||||
sftp.create_dir(path).await?;
|
||||
|
@ -187,12 +187,10 @@ dhcp-boot=tag:bios,{bios_filename}{tftp_str}
|
||||
})?;
|
||||
|
||||
info!("Restarting dnsmasq to apply changes");
|
||||
self.opnsense_shell.exec("configctl dnsmasq restart").await
|
||||
.map_err(|e| {
|
||||
DhcpError::Configuration(format!(
|
||||
"Restarting dnsmasq failed : {e}"
|
||||
))
|
||||
})?;
|
||||
self.opnsense_shell
|
||||
.exec("configctl dnsmasq restart")
|
||||
.await
|
||||
.map_err(|e| DhcpError::Configuration(format!("Restarting dnsmasq failed : {e}")))?;
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
pub mod caddy;
|
||||
pub mod dhcp;
|
||||
pub mod dhcp_legacy;
|
||||
pub mod dns;
|
||||
pub mod dnsmasq;
|
||||
pub mod load_balancer;
|
||||
pub mod tftp;
|
||||
pub mod dhcp;
|
||||
pub mod dnsmasq;
|
||||
|
Loading…
Reference in New Issue
Block a user