22 lines
503 B
Bash
22 lines
503 B
Bash
#!/bin/bash
|
|
|
|
source "$(dirname "$0")/utils.sh"
|
|
|
|
require_root
|
|
|
|
# Check if UFW (Uncomplicated Firewall) is installed and display its status
|
|
if command -v ufw >/dev/null 2>&1; then
|
|
echo "UFW is installed."
|
|
ufw status verbose
|
|
else
|
|
echo "UFW is not installed. Installing..."
|
|
apt update && apt install -y ufw
|
|
|
|
ufw default deny incoming
|
|
ufw default allow outgoing
|
|
ufw allow 22/tcp comment 'SSH'
|
|
|
|
yes | ufw enable
|
|
echo "UFW installed and activated."
|
|
ufw status verbose
|
|
fi |