diff --git a/bin/v-add-web-domain-httpauth b/bin/v-add-web-domain-httpauth index 42dd269e..04ed8354 100755 --- a/bin/v-add-web-domain-httpauth +++ b/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 # #----------------------------------------------------------# diff --git a/bin/v-delete-web-domain-httpauth b/bin/v-delete-web-domain-httpauth index 84f9767a..3fbc85da 100755 --- a/bin/v-delete-web-domain-httpauth +++ b/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