Sfoglia il codice sorgente

Fix detection of SFTP configuration

Improved logic for detecting variations in sshd_config. Thanks to @lupul for this fix.
Kristan Kenney 6 anni fa
parent
commit
175c1dc10e

+ 2 - 2
install/hst-install-debian.sh

@@ -892,10 +892,10 @@ rm -f /usr/sbin/policy-rc.d
 sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
 sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
 
 
 # Enable SFTP subsystem for SSH
 # Enable SFTP subsystem for SSH
-sftp_subsys_enabled=$(grep "#Subsystem sftp-server" /etc/ssh/sshd_config)
+sftp_subsys_enabled=$(grep -iE "^#?.*subsystem.+(sftp )?sftp-server" /etc/ssh/sshd_config)
 if [ ! -z "$sftp_subsys_enabled" ]; then
 if [ ! -z "$sftp_subsys_enabled" ]; then
     echo "(*) Updating SFTP subsystem configuration..."
     echo "(*) Updating SFTP subsystem configuration..."
-    sed -i "s/#Subsystem sftp-server/Subsystem sftp internal-sftp/gI" /etc/ssh/sshd_config
+    sed -i -E "s/^#?.*Subsystem.+(sftp )?sftp-server/Subsystem sftp internal-sftp/g" /etc/ssh/sshd_config
 fi
 fi
 
 
 # Disable SSH suffix broadcast
 # Disable SSH suffix broadcast

+ 2 - 2
install/hst-install-ubuntu.sh

@@ -866,10 +866,10 @@ rm -f /usr/sbin/policy-rc.d
 sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
 sed -i "s/rdAuthentication no/rdAuthentication yes/g" /etc/ssh/sshd_config
 
 
 # Enable SFTP subsystem for SSH
 # Enable SFTP subsystem for SSH
-sftp_subsys_enabled=$(grep "#Subsystem sftp-server" /etc/ssh/sshd_config)
+sftp_subsys_enabled=$(grep -iE "^#?.*subsystem.+(sftp )?sftp-server" /etc/ssh/sshd_config)
 if [ ! -z "$sftp_subsys_enabled" ]; then
 if [ ! -z "$sftp_subsys_enabled" ]; then
     echo "(*) Updating SFTP subsystem configuration..."
     echo "(*) Updating SFTP subsystem configuration..."
-    sed -i "s/#Subsystem sftp-server/Subsystem sftp internal-sftp/gI" /etc/ssh/sshd_config
+    sed -i -E "s/^#?.*Subsystem.+(sftp )?sftp-server/Subsystem sftp internal-sftp/g" /etc/ssh/sshd_config
 fi
 fi
 
 
 # Disable SSH suffix broadcast
 # Disable SSH suffix broadcast

+ 2 - 2
install/upgrade/0.10.0-190430.sh

@@ -345,10 +345,10 @@ fi
 $HESTIA/bin/v-add-sys-sftp-jail
 $HESTIA/bin/v-add-sys-sftp-jail
 
 
 # Enable SFTP subsystem for SSH
 # Enable SFTP subsystem for SSH
-sftp_subsys_enabled=$(cat /etc/ssh/sshd_config | grep "#Subsystem sftp-server")
+sftp_subsys_enabled=$(grep -iE "^#?.*subsystem.+(sftp )?sftp-server" /etc/ssh/sshd_config)
 if [ ! -z "$sftp_subsys_enabled" ]; then
 if [ ! -z "$sftp_subsys_enabled" ]; then
     echo "(*) Updating SFTP subsystem configuration..."
     echo "(*) Updating SFTP subsystem configuration..."
-    sed -i "s/#Subsystem sftp-server/Subsystem sftp internal-sftp/gI" /etc/ssh/sshd_config
+    sed -i -E "s/^#?.*Subsystem.+(sftp )?sftp-server/Subsystem sftp internal-sftp/g" /etc/ssh/sshd_config
     service ssh restart
     service ssh restart
 fi
 fi