forked from NationTech/harmony
"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:
@@ -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()
|
||||
});
|
||||
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user