Skip to content

Commit 44be086

Browse files
committed
awstats/webalized fix for php-fpm systems
1 parent cda3cae commit 44be086

File tree

471 files changed

+2682
-115
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

471 files changed

+2682
-115
lines changed

bin/v-add-web-domain-stats-user

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
# Argument definition
1313
user=$1
14-
domain=$(idn -t --quiet -u "$2" )
14+
domain=$2
1515
stats_user=$3
1616
password=$4; HIDE=4
1717

@@ -43,23 +43,29 @@ is_password_valid
4343
stats_dir="$HOMEDIR/$user/web/$domain/stats"
4444

4545
# Adding htaccess file
46-
echo "AuthUserFile $stats_dir/.htpasswd
47-
AuthName \"Web Statistics\"
48-
AuthType Basic
49-
Require valid-user" > $stats_dir/.htaccess
46+
if [ "$WEB_SYSTEM" = 'nginx' ]; then
47+
echo "auth_basic \"Web Statistics\";" > $stats_dir/auth.conf
48+
echo "auth_basic_user_file $stats_dir/.htpasswd;" >> $stats_dir/auth.conf
49+
else
50+
echo "AuthUserFile $stats_dir/.htpasswd" > $stats_dir/.htaccess
51+
echo "AuthName \"Web Statistics\"" >> $stats_dir/.htaccess
52+
echo "AuthType Basic" >> $stats_dir/.htaccess
53+
echo "Require valid-user" >> $stats_dir/.htaccess
54+
fi
5055

5156
# Generating htaccess user and password
52-
rm -f $stats_dir/.htpasswd
53-
htpasswd -bc $stats_dir/.htpasswd "$stats_user" "$password" &>/dev/null
54-
stats_crypt=$(grep $stats_user: $stats_dir/.htpasswd |cut -f 2 -d :)
57+
salt=$(generate_password "$PW_MATRIX" "8")
58+
stats_pass=$($BIN/v-generate-password-hash md5 $salt $password)
59+
echo "$stats_user:$stats_pass" > $stats_dir/.htpasswd
60+
5561

5662
#----------------------------------------------------------#
5763
# Vesta #
5864
#----------------------------------------------------------#
5965

6066
# Adding stats user in config
6167
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_USER' "$stats_user"
62-
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_CRYPT' "$stats_crypt"
68+
update_object_value 'web' 'DOMAIN' "$domain" '$STATS_CRYPT' "$stats_pass"
6369

6470
# Logging
6571
log_history "added password protection for web stats on $domain"

func/rebuild.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,16 @@ rebuild_web_domain_conf() {
252252

253253
if [ ! -z "$STATS_USER" ]; then
254254
stats_dir="$HOMEDIR/$user/web/$domain/stats"
255-
echo "AuthUserFile $stats_dir/.htpasswd" > $stats_dir/.htaccess
256-
echo "AuthName \"Web Statistics\"" >> $stats_dir/.htaccess
257-
echo "AuthType Basic" >> $stats_dir/.htaccess
258-
echo "Require valid-user" >> $stats_dir/.htaccess
255+
if [ "$WEB_SYSTEM" = 'nginx' ]; then
256+
echo "auth_basic \"Web Statistics\";" > $stats_dir/auth.conf
257+
echo "auth_basic_user_file $stats_dir/.htpasswd;" >> \
258+
$stats_dir/auth.conf
259+
else
260+
echo "AuthUserFile $stats_dir/.htpasswd" > $stats_dir/.htaccess
261+
echo "AuthName \"Web Statistics\"" >> $stats_dir/.htaccess
262+
echo "AuthType Basic" >> $stats_dir/.htaccess
263+
echo "Require valid-user" >> $stats_dir/.htaccess
264+
fi
259265
echo "$STATS_USER:$STATS_CRYPT" > $stats_dir/.htpasswd
260266
fi
261267
fi

install/debian/7/templates/web/nginx/php5-fpm/cms_made_simple.stpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ server {
4343
return 404;
4444
}
4545

46+
location /vstats/ {
47+
alias %home%/%user%/web/%domain%/stats/;
48+
include %home%/%user%/web/%domain%/stats/auth.conf*;
49+
}
50+
4651
include /etc/nginx/conf.d/phpmyadmin.inc*;
4752
include /etc/nginx/conf.d/phppgadmin.inc*;
4853
include /etc/nginx/conf.d/webmail.inc*;

install/debian/7/templates/web/nginx/php5-fpm/cms_made_simple.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ server {
3939
return 404;
4040
}
4141

42+
location /vstats/ {
43+
alias %home%/%user%/web/%domain%/stats/;
44+
include %home%/%user%/web/%domain%/stats/auth.conf*;
45+
}
46+
4247
include /etc/nginx/conf.d/phpmyadmin.inc*;
4348
include /etc/nginx/conf.d/phppgadmin.inc*;
4449
include /etc/nginx/conf.d/webmail.inc*;

install/debian/7/templates/web/nginx/php5-fpm/codeigniter2.stpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@ server {
4848
return 404;
4949
}
5050

51+
location /vstats/ {
52+
alias %home%/%user%/web/%domain%/stats/;
53+
include %home%/%user%/web/%domain%/stats/auth.conf*;
54+
}
55+
5156
include /etc/nginx/conf.d/phpmyadmin.inc*;
5257
include /etc/nginx/conf.d/phppgadmin.inc*;
5358
include /etc/nginx/conf.d/webmail.inc*;

install/debian/7/templates/web/nginx/php5-fpm/codeigniter2.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ server {
4444
return 404;
4545
}
4646

47+
location /vstats/ {
48+
alias %home%/%user%/web/%domain%/stats/;
49+
include %home%/%user%/web/%domain%/stats/auth.conf*;
50+
}
51+
4752
include /etc/nginx/conf.d/phpmyadmin.inc*;
4853
include /etc/nginx/conf.d/phppgadmin.inc*;
4954
include /etc/nginx/conf.d/webmail.inc*;

install/debian/7/templates/web/nginx/php5-fpm/codeigniter3.stpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@ server {
4343
return 404;
4444
}
4545

46+
location /vstats/ {
47+
alias %home%/%user%/web/%domain%/stats/;
48+
include %home%/%user%/web/%domain%/stats/auth.conf*;
49+
}
50+
4651
include /etc/nginx/conf.d/phpmyadmin.inc*;
4752
include /etc/nginx/conf.d/phppgadmin.inc*;
4853
include /etc/nginx/conf.d/webmail.inc*;

install/debian/7/templates/web/nginx/php5-fpm/codeigniter3.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ server {
3939
return 404;
4040
}
4141

42+
location /vstats/ {
43+
alias %home%/%user%/web/%domain%/stats/;
44+
include %home%/%user%/web/%domain%/stats/auth.conf*;
45+
}
46+
4247
include /etc/nginx/conf.d/phpmyadmin.inc*;
4348
include /etc/nginx/conf.d/phppgadmin.inc*;
4449
include /etc/nginx/conf.d/webmail.inc*;

install/debian/7/templates/web/nginx/php5-fpm/datalife_engine.stpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,11 @@ server {
114114
return 404;
115115
}
116116

117+
location /vstats/ {
118+
alias %home%/%user%/web/%domain%/stats/;
119+
include %home%/%user%/web/%domain%/stats/auth.conf*;
120+
}
121+
117122
include /etc/nginx/conf.d/phpmyadmin.inc*;
118123
include /etc/nginx/conf.d/phppgadmin.inc*;
119124
include /etc/nginx/conf.d/webmail.inc*;

install/debian/7/templates/web/nginx/php5-fpm/datalife_engine.tpl

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ server {
110110
return 404;
111111
}
112112

113+
location /vstats/ {
114+
alias %home%/%user%/web/%domain%/stats/;
115+
include %home%/%user%/web/%domain%/stats/auth.conf*;
116+
}
117+
113118
include /etc/nginx/conf.d/phpmyadmin.inc*;
114119
include /etc/nginx/conf.d/phppgadmin.inc*;
115120
include /etc/nginx/conf.d/webmail.inc*;

0 commit comments

Comments
 (0)