diff --git a/scripts/cml-exporter/cml-exporter-installer.sh b/scripts/cml-exporter/cml-exporter-installer.sh index 8b71333..9b23e2c 100755 --- a/scripts/cml-exporter/cml-exporter-installer.sh +++ b/scripts/cml-exporter/cml-exporter-installer.sh @@ -294,6 +294,7 @@ After=virl2.target [Service] EnvironmentFile=/etc/default/cml-exporter +ExecPreStart=/usr/bin/firewall-cmd --zone public --permanent --add-port="${EXPORTER_PORT}/tcp" && /usr/bin/firewall-cmd --reload ExecStart=/usr/local/bin/cml-exporter.sh User=virl2 Restart=on-failure @@ -322,17 +323,6 @@ create_venv() { fi } -add_firewall_rule() { - local port="9100" - if ! firewall-cmd --list-ports | grep -q "${port}/tcp"; then - echo "Adding firewall rule for port $port" - firewall-cmd --zone public --permanent --add-port="${port}/tcp" - firewall-cmd --reload - else - echo "Firewall rule for port $port already exists" - fi -} - if [[ $EUID -ne 0 ]]; then echo "This script must be run as root." >&2 exit 1 @@ -350,28 +340,12 @@ echo -e "\t✅" echo -n "installing service unit" install_service_unit echo -e "\t✅" -echo -n "adding firewall rule" -add_firewall_rule -echo -e "\t✅" cat <&2 exit 1 @@ -91,28 +80,12 @@ echo -e "\t✅" echo -n "installing service unit" install_service_unit echo -e "\t✅" -echo -n "adding firewall rule" -add_firewall_rule -echo -e "\t✅" cat <