From e3f636cb3a35d9756189c3178d46edae2a6ffb09 Mon Sep 17 00:00:00 2001 From: Serghey Rodin Date: Thu, 22 Oct 2015 17:23:44 +0300 Subject: [PATCH] Fixes from Neilpang --- bin/v-add-firewall-rule | 2 +- bin/v-update-firewall | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/v-add-firewall-rule b/bin/v-add-firewall-rule index 126f62b4..56a6fcf4 100755 --- a/bin/v-add-firewall-rule +++ b/bin/v-add-firewall-rule @@ -52,7 +52,7 @@ is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM' get_next_fw_rule validate_format 'rule' is_object_new '../../data/firewall/rules' 'RULE' "$rule" -if [ ! -z "$comment"]; then +if [ ! -z "$comment" ]; then validate_format 'comment' fi diff --git a/bin/v-update-firewall b/bin/v-update-firewall index 65b9438d..04a15a5f 100755 --- a/bin/v-update-firewall +++ b/bin/v-update-firewall @@ -51,6 +51,12 @@ if [ $? -ne 0 ]; then conntrack_ftp='no' fi +# Checking custom OpenSSH port +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)