Quellcode durchsuchen

Merge pull request #873 from sacrednetwork/fix-httpauth

Fix httpauth permission server error and secure template
Made I.T vor 9 Jahren
Ursprung
Commit
8f8f257d3d
2 geänderte Dateien mit 14 neuen und 3 gelöschten Zeilen
  1. 11 1
      bin/v-add-web-domain-httpauth
  2. 3 2
      bin/v-delete-web-domain-httpauth

+ 11 - 1
bin/v-add-web-domain-httpauth

@@ -24,6 +24,8 @@ source $VESTA/conf/vesta.conf
 # Defining htpasswd file
 htaccess="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.conf_htaccess"
 htpasswd="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.htpasswd"
+shtaccess="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.conf_htaccess"
+shtpasswd="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.htpasswd"
 docroot="$HOMEDIR/$user/web/$domain/public_html"
 
 
@@ -71,15 +73,23 @@ fi
 auth_hash=$($BIN/v-generate-password-hash htpasswd htpasswd $password)
 touch $htpasswd
 chmod 640 $htpasswd $htaccess
+chgrp $user $htpasswd $htaccess
 sed -i "/^$auth_user:/d" $htpasswd
 echo "$auth_user:$auth_hash" >> $htpasswd
 
+# Symbolic link for secure web templates
+if [ ! -L $shtpasswd ]; then
+  ln -s $htpasswd $shtpasswd 
+fi
+if [ ! -L $shtaccess ]; then
+ln -s $htaccess $shtaccess
+fi
+
 # Restarting web server
 if [ "$restart" != 'no' ] && [ "$restart_required" = 'yes' ]; then
     $BIN/v-restart-web
 fi
 
-
 #----------------------------------------------------------#
 #                       Vesta                              #
 #----------------------------------------------------------#

+ 3 - 2
bin/v-delete-web-domain-httpauth

@@ -23,7 +23,8 @@ source $VESTA/conf/vesta.conf
 # Defining htpasswd file
 htaccess="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.conf_htaccess"
 htpasswd="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.htpasswd"
-
+shtaccess="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.conf_htaccess"
+shtpasswd="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.htpasswd"
 
 #----------------------------------------------------------#
 #                    Verifications                         #
@@ -54,7 +55,7 @@ sed -i "/^$auth_user:/d" $htpasswd
 
 # Deleting password protection
 if [ "$(echo "$AUTH_USER" |tr : '\n' |wc -l)" -le 1 ]; then
-    rm -f $htaccess $htpasswd
+    rm -f $htaccess $htpasswd $shtaccess $shtpasswd
     restart_required='yes'
 fi