"Update Harmony Opnsense Configuration"

Improved configuration handling for Harmony Opnsense setup. Implemented changes to opnsense-config module to support various settings, including load balancer configuration and DHCP server settings. This update enhances the overall stability and functionality of the Harmony Opnsense setup process.
This commit is contained in:
jeangab
2025-01-11 13:52:57 -05:00
parent 9e6f22d7ea
commit 1665198e66
9 changed files with 33 additions and 23 deletions

View File

@@ -68,7 +68,7 @@ impl Config {
pub async fn install_package(&mut self, package_name: &str) -> Result<(), Error> {
info!("Installing opnsense package {package_name}");
let output = self.shell
.exec(&format!("/usr/local/opnsense/scripts/firmware/install.sh {package_name}"))
.exec(&format!("/bin/sh -c \"export LOCKFILE=/dev/stdout && /usr/local/opnsense/scripts/firmware/install.sh {package_name}\""))
.await?;
info!("Installation output {output}");
self.reload_config().await?;
@@ -107,7 +107,7 @@ impl Config {
password: &str,
) -> Self {
let config = Arc::new(client::Config {
inactivity_timeout: Some(Duration::from_secs(5)),
inactivity_timeout: None,
..<_>::default()
});

View File

@@ -201,11 +201,13 @@ impl<'a> DhcpConfig<'a> {
pub fn set_next_server(&mut self, ip: Ipv4Addr) {
self.enable_netboot();
self.get_lan_dhcpd().nextserver = Some(ip.to_string());
self.get_lan_dhcpd().tftp = Some(ip.to_string());
}
pub fn set_boot_filename(&mut self, boot_filename: &str) {
self.enable_netboot();
self.get_lan_dhcpd().filename64 = Some(boot_filename.to_string());
self.get_lan_dhcpd().bootfilename = Some(boot_filename.to_string());
}
}

View File

@@ -61,6 +61,7 @@ impl<'a> LoadBalancerConfig<'a> {
self.opnsense_shell.exec("configctl haproxy stop").await?;
self.opnsense_shell.exec("configctl template reload OPNsense/HAProxy").await?;
self.opnsense_shell.exec("configctl template reload OPNsense/Syslog").await?;
self.opnsense_shell.exec("/usr/local/sbin/haproxy -c -f /usr/local/etc/haproxy.conf.staging").await?;
// This script copies the staging config to production config. I am not 100% sure it is
// required in the context