Merge pull request #873 from sacrednetwork/fix-httpauth

Fix httpauth permission server error and secure template
This commit is contained in:
Made I.T 2017-03-02 11:14:16 +01:00 committed by GitHub
commit 8f8f257d3d
2 changed files with 14 additions and 3 deletions

View file

@ -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 #
#----------------------------------------------------------#

View file

@ -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