import directus db 3 modif ufw port ssh and ip

This commit is contained in:
Valentin 2024-04-17 17:16:02 +02:00
parent 244742a8a1
commit 3d76ae8811
1 changed files with 3 additions and 5 deletions

View File

@ -22,10 +22,7 @@ get_username() {
get_ip() { get_ip() {
if [[ -z "$ip" ]]; then if [[ -z "$ip" ]]; then
ip=$(hostname -I) ip=$(hostname -I | cut -d' ' -f1)
if [[ "${ip: -1}" == " " ]]; then
ip="${ip%?}"
fi
fi fi
} }
@ -104,7 +101,8 @@ if [[ "$answer" == "y" ]]; then
echo -e "${PURPLE}${BOLD}Setup Firewall and Fail2ban${RESET}" echo -e "${PURPLE}${BOLD}Setup Firewall and Fail2ban${RESET}"
apt install -y ufw fail2ban apt install -y ufw fail2ban
systemctl enable fail2ban systemctl enable fail2ban
ufw allow ssh get_ssh_port
ufw allow $ssh_port
ufw allow http ufw allow http
ufw allow https ufw allow https
fi fi