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