From 54fab10b525e900480e6e13d4d5a1a7518680589 Mon Sep 17 00:00:00 2001 From: myvesta <38690722+myvesta@users.noreply.github.com> Date: Tue, 27 Jul 2021 15:27:40 +0200 Subject: [PATCH] Checking custom OpenSSH port Taken from @HestiaCP --- bin/v-update-firewall | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bin/v-update-firewall b/bin/v-update-firewall index 183522a77..d3a46686f 100755 --- a/bin/v-update-firewall +++ b/bin/v-update-firewall @@ -52,6 +52,13 @@ if [ $? -ne 0 ]; then fi +# Checking custom OpenSSH port +# Taken from HestiaCP +sshport=$(grep '^Port ' /etc/ssh/sshd_config | head -1 | cut -d ' ' -f 2) +if [[ "$sshport" =~ ^[0-9]+$ ]] && [ "$sshport" -ne "22" ]; then + sed -i "s/PORT='22'/PORT=\'$sshport\'/" $rules +fi + # Creating temporary file tmp=$(mktemp)