add firewalld open ports hook

This commit is contained in:
Manuel 2023-05-01 19:16:50 +00:00
parent 23fe96f1a4
commit 217c2094b6
2 changed files with 20 additions and 1 deletions

View File

@ -5,7 +5,7 @@
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me) # SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
# List of services to be enabled # List of services to be enabled
services=("nftables" "cockpit" "ssh" "sshguard" "apache2") services=("firewalld" "cockpit" "ssh" "sshguard" "apache2")
# Loop to enable each service # Loop to enable each service
for service in "${services[@]}"; do for service in "${services[@]}"; do

View File

@ -0,0 +1,19 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-3.0-or-later
#
# SPDX-FileCopyrightText: 2023 PeppemrintOS Team (peppermintosteam@proton.me)
# Define the ports you want to open
PORTS=("80/tcp" "22/tcp" "9090/tcp" "443/tcp")
# Check if firewalld is running
if systemctl is-active --quiet firewalld; then
# Add the specified ports
for PORT in "${PORTS[@]}"; do
firewall-cmd --add-port="$PORT" --permanent
done
# Reload the firewall rules to apply the changes
firewall-cmd --reload
fi