Skip to content

Commit 6b4ee79

Browse files
authored
Merge pull request hestiacp#594 from Lupul/dev-0926
Dev 0926
2 parents 058755e + 3528688 commit 6b4ee79

File tree

8 files changed

+53
-38
lines changed

8 files changed

+53
-38
lines changed

bin/v-add-letsencrypt-domain

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,6 @@ query_le_v2() {
5353
curl -s -i -d "$post_data" "$1" -H "$content"
5454
}
5555

56-
# Set DNS CAA record retrieval commands
57-
if [ ! -z "$DNS_SYSTEM" ]; then
58-
dns_domain=$($BIN/v-list-dns-domains $user | grep $domain | cut -d' ' -f1)
59-
caa_record=$($BIN/v-list-dns-records $user $domain | grep -i "CAA" | cut -d' ' -f1)
60-
fi
6156

6257
#----------------------------------------------------------#
6358
# Verifications #
@@ -71,6 +66,12 @@ if [ ! -z "$mail" ]; then
7166
is_boolean_format_valid "$mail" 'mail'
7267
fi
7368

69+
# Set DNS CAA record retrieval commands
70+
if [ ! -z "$DNS_SYSTEM" ]; then
71+
dns_domain=$($BIN/v-list-dns-domains $user | grep $domain | cut -d' ' -f1)
72+
caa_record=$($BIN/v-list-dns-records $user $domain | grep -i "CAA" | cut -d' ' -f1)
73+
fi
74+
7475
if [ -z "$mail" ] || [ "$mail" = 'no' ]; then
7576
mail=''
7677
is_system_enabled "$WEB_SYSTEM" 'WEB_SYSTEM'

bin/v-restart-mail

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ source $HESTIA/conf/hestia.conf
1515
PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
1616

1717
send_email_report() {
18+
local mail_service="$1"
19+
journalctl --no-pager --reverse --since=-1m --unit "$mail_service" >> "$tmpfile" 2>&1
1820
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf)
1921
email=$(echo "$email" | cut -f 2 -d "'")
20-
tmpfile=$(mktemp)
21-
subj="$(hostname): $MAIL_SYSTEM restart failed"
22-
service $MAIL_SYSTEM configtest >> $tmpfile 2>&1
23-
service $MAIL_SYSTEM restart >> $tmpfile 2>&1
24-
cat $tmpfile |$SENDMAIL -s "$subj" $email
25-
rm -f $tmpfile
22+
subj="$(hostname): $mail_service restart failed"
23+
cat "$tmpfile" |$SENDMAIL -s "$subj" $email
24+
[[ -f "$tmpfile" ]] && rm -f $tmpfile
2625
}
2726

2827

@@ -46,19 +45,20 @@ if [ -z "$MAIL_SYSTEM" ] || [ "$MAIL_SYSTEM" = 'remote' ]; then
4645
exit
4746
fi
4847

48+
tmpfile=$(mktemp)
4949
# Restart IMAP system if present
5050
if [ ! -z "$IMAP_SYSTEM" ]; then
51-
$BIN/v-restart-service $IMAP_SYSTEM > /dev/null 2>&1
51+
$BIN/v-restart-service $IMAP_SYSTEM >> $tmpfile 2>&1
5252
if [ $? -ne 0 ]; then
53-
send_email_report
53+
send_email_report "$IMAP_SYSTEM"
5454
check_result $E_RESTART "$IMAP_SYSTEM restart failed"
5555
fi
5656
fi
5757

5858
# Restart mail system
59-
$BIN/v-restart-service $MAIL_SYSTEM > /dev/null 2>&1
59+
$BIN/v-restart-service $MAIL_SYSTEM >> $tmpfile 2>&1
6060
if [ $? -ne 0 ]; then
61-
send_email_report
61+
send_email_report "$MAIL_SYSTEM"
6262
check_result $E_RESTART "$MAIL_SYSTEM restart failed"
6363
fi
6464

@@ -72,4 +72,5 @@ fi
7272
# Hestia #
7373
#----------------------------------------------------------#
7474

75+
[[ -f "$tmpfile" ]] && rm -f $tmpfile
7576
exit

bin/v-restart-web-backend

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,9 @@ PATH="$PATH:/usr/local/sbin:/sbin:/usr/sbin:/root/bin"
1717
send_email_report() {
1818
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf)
1919
email=$(echo "$email" | cut -f 2 -d "'")
20-
tmpfile=$(mktemp)
2120
subj="$(hostname): $WEB_BACKEND restart failed"
22-
service $WEB_BACKEND configtest >> $tmpfile 2>&1
23-
service $WEB_BACKEND restart >> $tmpfile 2>&1
2421
cat $tmpfile |$SENDMAIL -s "$subj" $email
25-
rm -f $tmpfile
22+
[[ -f "$tmpfile" ]] && rm -f $tmpfile
2623
}
2724

2825

@@ -46,20 +43,24 @@ if [ -z "$WEB_BACKEND" ] || [ "$WEB_BACKEND" = 'remote' ]; then
4643
exit
4744
fi
4845

49-
# Restart system
50-
php_fpm=$(ls /etc/init.d/php*-fpm* 2>/dev/null |cut -f 4 -d /)
51-
for back in $php_fpm
52-
do
53-
if [ -z "$php_fpm" ]; then
54-
$BIN/v-restart-service $WEB_BACKEND > /dev/null 2>&1
55-
else
56-
$BIN/v-restart-service $back > /dev/null 2>&1
46+
tmpfile=$(mktemp)
47+
for php_folder in /etc/php/*; do
48+
[ ! -d "${php_folder}/fpm/pool.d/" ] && continue
49+
50+
v_php="$(basename $php_folder)"
51+
v_phpfpm="php${v_php}-fpm"
52+
53+
if [ ! -f "/etc/php/${v_php}/fpm/pool.d/dummy.conf" ]; then
54+
cp -f "$HESTIA_INSTALL_DIR/php-fpm/dummy.conf" "/etc/php/${v_php}/fpm/pool.d/"
55+
sed -i "s/9999/99${v_php//.}/g" "/etc/php/${v_php}/fpm/pool.d/dummy.conf"
56+
fi
57+
58+
$BIN/v-restart-service "$v_phpfpm" >> $tmpfile 2>&1
59+
if [ $? -ne 0 ]; then
60+
send_email_report
61+
check_result $E_RESTART "$v_phpfpm restart failed"
5762
fi
5863
done
59-
if [ $? -ne 0 ]; then
60-
send_email_report
61-
check_result $E_RESTART "$WEB_BACKEND restart failed"
62-
fi
6364

6465
# Update restart queue
6566
if [ -e "$HESTIA/data/queue/restart.pipe" ]; then
@@ -71,4 +72,5 @@ fi
7172
# Hestia #
7273
#----------------------------------------------------------#
7374

75+
[[ -f "$tmpfile" ]] && rm -f $tmpfile
7476
exit

install/deb/php-fpm/dummy.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
; origin-src: deb/php-fpm/dummy.conf
2+
13
[www]
24
listen = 127.0.0.1:9999
35
listen.allowed_clients = 127.0.0.1

install/deb/php-fpm/multiphp.tpl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
[%domain%]
1+
; origin-src: deb/php-fpm/multiphp.tpl
22

3+
[%domain%]
34
listen = /run/php/php%backend_version%-fpm-%domain%.sock
45
listen.owner = %user%
56
listen.group = www-data
@@ -17,7 +18,7 @@ pm.status_path = /status
1718
php_admin_value[upload_tmp_dir] = /home/%user%/tmp
1819
php_admin_value[session.save_path] = /home/%user%/tmp
1920
php_admin_value[open_basedir] = /home/%user%/web/%domain%/public_html:/home/%user%/web/%domain%/public_shtml:/home/%user%/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpMyAdmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcubemail
20-
php_admin_value[sendmail_path] = \"/usr/sbin/sendmail -t -i -f info@%domain%\"
21+
php_admin_value[sendmail_path] = \"/usr/sbin/sendmail -t -i -f admin@%domain%\"
2122

2223
env[PATH] = /usr/local/bin:/usr/bin:/bin
2324
env[TMP] = /home/%user%/tmp

install/deb/php-fpm/www.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
; origin-src: deb/php-fpm/www.conf
2+
13
[www]
24
listen = 127.0.0.1:9000
35
listen.allowed_clients = 127.0.0.1

install/deb/templates/web/php-fpm/default.tpl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1-
[%backend%]
1+
; origin-src: deb/templates/web/php-fpm/default.tpl
22

3+
[%backend%]
34
listen = /run/php/php%backend_version%-fpm-%domain%.sock
45
listen.owner = %user%
56
listen.group = www-data
@@ -16,6 +17,8 @@ pm.status_path = /status
1617

1718
php_admin_value[upload_tmp_dir] = /home/%user%/tmp
1819
php_admin_value[session.save_path] = /home/%user%/tmp
20+
php_admin_value[open_basedir] = /home/%user%/web/%domain%/public_html:/home/%user%/web/%domain%/public_shtml:/home/%user%/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpMyAdmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcubemail
21+
php_admin_value[sendmail_path] = \"/usr/sbin/sendmail -t -i -f admin@%domain%\"
1922

2023
env[HOSTNAME] = $HOSTNAME
2124
env[PATH] = /usr/local/bin:/usr/bin:/bin

install/deb/templates/web/php-fpm/socket.tpl

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1+
; origin-src: deb/templates/web/php-fpm/socket.tpl
2+
13
[%backend%]
24
listen = /var/run/php/%backend%.sock
3-
listen.allowed_clients = 127.0.0.1
5+
listen.owner = %user%
6+
listen.group = www-data
7+
listen.mode = 0660
48

59
user = %user%
610
group = %user%
711

8-
listen.owner = %user%
9-
listen.group = www-data
10-
1112
pm = ondemand
1213
pm.max_children = 8
1314
pm.max_requests = 4000
@@ -16,6 +17,8 @@ pm.status_path = /status
1617

1718
php_admin_value[upload_tmp_dir] = /home/%user%/tmp
1819
php_admin_value[session.save_path] = /home/%user%/tmp
20+
php_admin_value[open_basedir] = /home/%user%/web/%domain%/public_html:/home/%user%/web/%domain%/public_shtml:/home/%user%/tmp:/bin:/usr/bin:/usr/local/bin:/var/www/html:/tmp:/usr/share:/etc/phpMyAdmin:/etc/phpmyadmin:/var/lib/phpmyadmin:/etc/roundcubemail
21+
php_admin_value[sendmail_path] = \"/usr/sbin/sendmail -t -i -f admin@%domain%\"
1922

2023
env[HOSTNAME] = $HOSTNAME
2124
env[PATH] = /usr/local/bin:/usr/bin:/bin

0 commit comments

Comments
 (0)