Browse Source

Check for presence of SSH before modifying config

Kristan Kenney 6 years ago
parent
commit
3a9e8b0f89
1 changed files with 5 additions and 3 deletions
  1. 5 3
      install/upgrade/versions/latest.sh

+ 5 - 3
install/upgrade/versions/latest.sh

@@ -13,9 +13,11 @@ if [ -z $THEME ]; then
 fi
 fi
 
 
 # Reduce SSH login grace time
 # Reduce SSH login grace time
-echo "(*) Hardening SSH daemon configuration..."
-sed -i "s/LoginGraceTime 2m/LoginGraceTime 1m/g" /etc/ssh/sshd_config
-sed -i "s/#LoginGraceTime 2m/LoginGraceTime 1m/g" /etc/ssh/sshd_config
+if [ -e /etc/ssh/sshd_config ]; then
+    echo "(*) Hardening SSH daemon configuration..."
+    sed -i "s/LoginGraceTime 2m/LoginGraceTime 1m/g" /etc/ssh/sshd_config
+    sed -i "s/#LoginGraceTime 2m/LoginGraceTime 1m/g" /etc/ssh/sshd_config
+fi
 
 
 # Implement recidive jail for fail2ban
 # Implement recidive jail for fail2ban
 if [ ! -z "$FIREWALL_EXTENSION" ]; then
 if [ ! -z "$FIREWALL_EXTENSION" ]; then