Update v-add-firewall-chain

Obtains the SSH port from the service configuration file (originally it was hardcoded). This allow the correct creation of ssh chain when this service has a custom port.
This commit is contained in:
pablobae 2019-02-07 16:49:43 +01:00 committed by GitHub
commit d334ddc501
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -47,7 +47,13 @@ is_system_enabled "$FIREWALL_SYSTEM" 'FIREWALL_SYSTEM'
# Checking known chains
case $chain in
SSH) port=22; protocol=TCP ;;
SSH) # Get ssh port by reading ssh config file.
sshport=$(grep '^Port ' /etc/ssh/sshd_config | head -1 | cut -d ' ' -f 2)
if [ -z "$sshport" ]; then
sshport=22
fi
port=$sshport;
protocol=TCP ;;
FTP) port=21; protocol=TCP ;;
MAIL) port='25,465,587,2525,110,995,143,993'; protocol=TCP ;;
DNS) port=53; protocol=UDP ;;