From b27040f0fce18215bdb6edba3fb50a7176c58a07 Mon Sep 17 00:00:00 2001 From: ymir1v <77013986+ymir1v@users.noreply.github.com> Date: Fri, 25 Jun 2021 15:43:47 +0200 Subject: [PATCH] Update 12_install_ufw_rules.sh --- setup/12_install_ufw_rules.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup/12_install_ufw_rules.sh b/setup/12_install_ufw_rules.sh index ad3b08a1..845a6527 100755 --- a/setup/12_install_ufw_rules.sh +++ b/setup/12_install_ufw_rules.sh @@ -4,9 +4,14 @@ OURNAME=12_install_ufw_rules.sh echo -e "\n-- Executing ${ORANGE}${OURNAME}${NC} subscript --" -#### UFW #### +# get sshd port from /etc/ssh/sshd_config +_var_sshd_port="$(cat /etc/ssh/sshd_config|grep -i -E ^port|cut -f2 -d' ')" +if [[ $_var_sshd_port == "" ]]; then + _var_sshd_port=22 +fi -ufw allow 22/tcp +#### UFW #### +ufw allow $_var_sshd_port/tcp ufw allow 80/tcp ufw allow 443/tcp ufw allow 25/tcp