setup_firewall

Function setup_firewall 

Source
pub fn setup_firewall(config: &Config) -> Result<(), Box<dyn Error>>
Expand description

Sets up the firewall with basic rules and any custom rules specified in the configuration.

This function configures either UFW (for Ubuntu) or firewalld (for CentOS/Fedora) with default deny incoming, allow outgoing policy, and opens ports for SSH and any custom rules.

§Arguments

  • config - A reference to the Config struct containing firewall configuration and Linux distribution information

§Returns

Returns Ok(()) if the firewall is set up successfully, or an error if setup fails.