feat: add bds core, locale updates and safety fixes
This commit is contained in:
30
lib/firewall.sh
Normal file
30
lib/firewall.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
open_firewall_port() {
|
||||
local port="$1"
|
||||
local proto="$2"
|
||||
|
||||
if [[ "$FIREWALL" != "yes" ]]; then
|
||||
info "$(t firewall_skip)"
|
||||
return 0
|
||||
fi
|
||||
|
||||
emit_step "firewall_start" "$port/$proto"
|
||||
|
||||
if command -v ufw >/dev/null 2>&1; then
|
||||
run_cmd ufw allow "$port/$proto" || true
|
||||
run_cmd ufw --force enable || true
|
||||
emit_step "firewall_done" "ufw"
|
||||
return 0
|
||||
fi
|
||||
|
||||
if command -v firewall-cmd >/dev/null 2>&1; then
|
||||
run_cmd firewall-cmd --permanent --add-port="$port/$proto"
|
||||
run_cmd firewall-cmd --reload
|
||||
emit_step "firewall_done" "firewalld"
|
||||
return 0
|
||||
fi
|
||||
|
||||
warn "$(t firewall_manual_open "$port" "$proto")"
|
||||
emit_step "firewall_manual" "$port/$proto"
|
||||
}
|
||||
Reference in New Issue
Block a user