Skip to content

Commit 8da1924

Browse files
committed
Support firewalld alongside ufw then detect and display status for both ufw and firewalld.
1 parent a492ea5 commit 8da1924

File tree

1 file changed

+32
-7
lines changed

1 file changed

+32
-7
lines changed

bigbluebutton-config/bin/bbb-conf

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,19 @@ display_bigbluebutton_status () {
449449
printf "%s %s [✘ - $status]\n" $unit "${line:${#unit}}"
450450
fi
451451
done
452+
453+
# Display firewall status
454+
echo
455+
if which ufw > /dev/null 2>&1; then
456+
firewall_name="ufw"; firewall_status=$(ufw status | head -1 | sed 's/Status: //'); line_offset=18
457+
elif which firewall-cmd > /dev/null 2>&1; then
458+
firewall_name="firewalld"; firewall_status=$(firewall-cmd --state > /dev/null 2>&1 && echo "active" || echo "inactive"); line_offset=10
459+
else
460+
firewall_name="none"; firewall_status="inactive"; line_offset=10
461+
fi
462+
checkmark=$([ "$firewall_status" = "active" ] && echo "" || echo "")
463+
echo "Firewall: $firewall_name"
464+
echo "└─ Status: ${line:$line_offset} [$checkmark - $firewall_status]"
452465
}
453466

454467
if [ $# -eq 0 ]; then
@@ -784,13 +797,25 @@ check_configuration() {
784797
echo
785798
fi
786799

787-
if ! which ufw > /dev/null 2>&1; then
788-
echo
789-
echo "# Warning: No firewall detected. Recommend using setting up a firewall for your server"
790-
echo "#"
791-
echo "# https://docs.bigbluebutton.org/administration/firewall-configuration"
792-
echo "#"
793-
echo
800+
# Check for firewall presence (ufw or firewalld)
801+
FIREWALL_DETECTED=""
802+
FIREWALL_CMD=""
803+
804+
if which ufw > /dev/null 2>&1; then
805+
FIREWALL_DETECTED="ufw"
806+
FIREWALL_CMD="ufw status"
807+
elif which firewall-cmd > /dev/null 2>&1; then
808+
FIREWALL_DETECTED="firewalld"
809+
FIREWALL_CMD="firewall-cmd --state"
810+
fi
811+
812+
if [ -z "$FIREWALL_DETECTED" ]; then
813+
echo
814+
echo "# Warning: No firewall detected. Recommend using setting up a firewall for your server"
815+
echo "#"
816+
echo "# https://docs.bigbluebutton.org/administration/firewall-configuration"
817+
echo "#"
818+
echo
794819
fi
795820

796821
}

0 commit comments

Comments
 (0)