Files
debian-web-server/bin/firewall.sh
T
bachirandClaude Sonnet 5 2e3ec7883f Replace echo -e with printf for portable ANSI banners
dash (Debian's /bin/sh) doesn't support echo's -e flag: it prints "-e"
literally as text before processing the rest of the string's backslash
escapes. Every script's colored banner was affected. printf's escape
handling is POSIX-mandated and behaves identically under dash and bash,
so swap all 90 echo -e calls for printf, appending the trailing \n that
echo used to add implicitly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-04 09:35:02 +02:00

30 lines
700 B
Bash
Executable File

#!/bin/sh
# TODO check if root
printf '\033[35m
______________ _______ _____ __ __
/ ____/ _/ __ \/ ____/ | / / | / / / /
/ /_ / // /_/ / __/ | | /| / / /| | / / / /
/ __/ _/ // _, _/ /___ | |/ |/ / ___ |/ /___/ /___
/_/ /___/_/ |_/_____/ |__/|__/_/ |_/_____/_____/
\033[0m\n'
printf "\033[35;1mInstalling ufw and setup firewall (allowing only ssh and http) \033[0m\n"
if [ "$(id -u)" -ne 0 ]; then
echo "Please run as root"
exit
fi
sleep 2
apt-get --yes install ufw
ufw allow ssh
ufw allow http
ufw allow https
# TODO ask for allowing ssh for some ip
ufw enable
ufw status verbose
printf "\033[92;1mufw installed and firwall configured\033[Om\n"