install.fairie/home/.chezmoiscripts/universal/run_onchange_after_18-configure-firewall.sh.tmpl
2023-11-05 03:56:58 +00:00

19 lines
707 B
Bash

#!/usr/bin/env bash
# @file Firewall Configuration
# @brief Configures the firewall (built-in for macOS and firewall-cmd / ufw for Linux)
# @description
# This script configures the firewall for macOS / Linux.
{{- includeTemplate "universal/profile" }}
{{- includeTemplate "universal/logg" }}
if [ -d /Applications ] && [ -d /System ]; then
# System is macOS
logg info 'Enabling macOS firewall'
elif command -v firewall-cmd > /dev/null; then
# System is Linux and has firewall-cmd present in PATH
logg info 'Setting up firewall using firewall-cmd'
elif command -v ufw > /dev/null; then
# System is Linux and has ufw present in PATH
logg info 'Setting up firewall using ufw'
fi