File tree Expand file tree Collapse file tree 3 files changed +16
-11
lines changed
Expand file tree Collapse file tree 3 files changed +16
-11
lines changed Original file line number Diff line number Diff line change 11#! /bin/bash
22# info: add system sftp jail
3- # options: NONE
3+ # options: [RESTART]
44#
55# The script enables sftp jailed environment
66
@@ -14,6 +14,7 @@ source /etc/profile
1414source $HESTIA /func/main.sh
1515source $HESTIA /conf/hestia.conf
1616
17+ restart=$1
1718
1819# ----------------------------------------------------------#
1920# Verifications #
@@ -45,11 +46,12 @@ if [ -z "$sftp_i" ]; then
4546 echo " X11Forwarding no" >> $config
4647 echo " AllowTCPForwarding no" >> $config
4748 echo " ForceCommand internal-sftp" >> $config
48- restart=' yes'
4949fi
5050
5151# Validating opensshd config
52- if [ " $restart " = ' yes' ]; then
52+ if [ " $restart " = ' no' ]; then
53+ # Skip restarting SSH daemon
54+ else
5355 subj=" OpenSSH restart failed"
5456 email=$( grep CONTACT $HESTIA /data/users/admin/user.conf | cut -f 2 -d \' )
5557 /usr/sbin/sshd -t > /dev/null 2>&1
@@ -59,7 +61,6 @@ if [ "$restart" = 'yes' ]; then
5961 echo -e " $mail_text " | $SENDMAIL -s " $subj " $email
6062 else
6163 service ssh restart > /dev/null 2>&1
62- service sshd restart > /dev/null 2>&1
6364 fi
6465fi
6566
Original file line number Diff line number Diff line change 11#! /bin/bash
22# info: add user sftp jail
3- # options: USER
3+ # options: USER [RESTART]
44#
55# The script enables sftp jailed environment
66
1111
1212# Argument definition
1313user=$1
14+ restart=$2
1415
1516# Includes
1617source $HESTIA /func/main.sh
@@ -62,8 +63,11 @@ chown root:root /home/$user
6263# ----------------------------------------------------------#
6364
6465# Restart ssh service
65- service ssh restart > /dev/null 2>&1
66- service sshd restart > /dev/null 2>&1
66+ if [ " $restart " = ' no' ]; then
67+ # Skip restart of SSH daemon
68+ else
69+ service ssh restart > /dev/null 2>&1
70+ fi
6771
6872# Logging
6973log_event " $OK " " $ARGUMENTS "
Original file line number Diff line number Diff line change @@ -322,14 +322,13 @@ if [ ! -z "$WEBALIZER_CHECK" ]; then
322322fi
323323
324324# Run sftp jail once
325- $HESTIA /bin/v-add-sys-sftp-jail
325+ $HESTIA /bin/v-add-sys-sftp-jail no
326326
327327# Enable SFTP subsystem for SSH
328328sftp_subsys_enabled=$( grep -iE " ^#?.*subsystem.+(sftp )?sftp-server" /etc/ssh/sshd_config)
329329if [ ! -z " $sftp_subsys_enabled " ]; then
330330 echo " (*) Updating SFTP subsystem configuration..."
331331 sed -i -E " s/^#?.*Subsystem.+(sftp )?sftp-server/Subsystem sftp internal-sftp/g" /etc/ssh/sshd_config
332- systemctl restart ssh
333332fi
334333
335334# Remove and migrate obsolete object keys
@@ -422,8 +421,9 @@ if [ ! -z $DNS_SYSTEM ]; then
422421 $BIN /v-restart-dns $restart
423422fi
424423
425- # restart Hestia services (nginx,php-fpm)
426- systemctl restart hestia
424+ $BIN /v-restart-service ssh $restart
425+ $BIN /v-restart-service hestia $restart
426+
427427
428428echo " "
429429echo " Upgrade complete! Please report any bugs or issues to"
You can’t perform that action at this time.
0 commit comments