Skip to content

Commit 8f8f257

Browse files
Merge pull request hestiacp#873 from sacrednetwork/fix-httpauth
Fix httpauth permission server error and secure template
2 parents aa9ed7e + 0a51da2 commit 8f8f257

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

bin/v-add-web-domain-httpauth

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ source $VESTA/conf/vesta.conf
2424
# Defining htpasswd file
2525
htaccess="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.conf_htaccess"
2626
htpasswd="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.htpasswd"
27+
shtaccess="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.conf_htaccess"
28+
shtpasswd="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.htpasswd"
2729
docroot="$HOMEDIR/$user/web/$domain/public_html"
2830

2931

@@ -71,15 +73,23 @@ fi
7173
auth_hash=$($BIN/v-generate-password-hash htpasswd htpasswd $password)
7274
touch $htpasswd
7375
chmod 640 $htpasswd $htaccess
76+
chgrp $user $htpasswd $htaccess
7477
sed -i "/^$auth_user:/d" $htpasswd
7578
echo "$auth_user:$auth_hash" >> $htpasswd
7679

80+
# Symbolic link for secure web templates
81+
if [ ! -L $shtpasswd ]; then
82+
ln -s $htpasswd $shtpasswd
83+
fi
84+
if [ ! -L $shtaccess ]; then
85+
ln -s $htaccess $shtaccess
86+
fi
87+
7788
# Restarting web server
7889
if [ "$restart" != 'no' ] && [ "$restart_required" = 'yes' ]; then
7990
$BIN/v-restart-web
8091
fi
8192

82-
8393
#----------------------------------------------------------#
8494
# Vesta #
8595
#----------------------------------------------------------#

bin/v-delete-web-domain-httpauth

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ source $VESTA/conf/vesta.conf
2323
# Defining htpasswd file
2424
htaccess="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.conf_htaccess"
2525
htpasswd="$HOMEDIR/$user/conf/web/$WEB_SYSTEM.$domain.htpasswd"
26-
26+
shtaccess="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.conf_htaccess"
27+
shtpasswd="$HOMEDIR/$user/conf/web/s$WEB_SYSTEM.$domain.htpasswd"
2728

2829
#----------------------------------------------------------#
2930
# Verifications #
@@ -54,7 +55,7 @@ sed -i "/^$auth_user:/d" $htpasswd
5455

5556
# Deleting password protection
5657
if [ "$(echo "$AUTH_USER" |tr : '\n' |wc -l)" -le 1 ]; then
57-
rm -f $htaccess $htpasswd
58+
rm -f $htaccess $htpasswd $shtaccess $shtpasswd
5859
restart_required='yes'
5960
fi
6061

0 commit comments

Comments
 (0)