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 @@ -323,14 +323,13 @@ if [ ! -z "$WEBALIZER_CHECK" ]; then
323323fi
324324
325325# Run sftp jail once
326- $HESTIA /bin/v-add-sys-sftp-jail
326+ $HESTIA /bin/v-add-sys-sftp-jail no
327327
328328# Enable SFTP subsystem for SSH
329329sftp_subsys_enabled=$( grep -iE " ^#?.*subsystem.+(sftp )?sftp-server" /etc/ssh/sshd_config)
330330if [ ! -z " $sftp_subsys_enabled " ]; then
331331 echo " (*) Updating SFTP subsystem configuration..."
332332 sed -i -E " s/^#?.*Subsystem.+(sftp )?sftp-server/Subsystem sftp internal-sftp/g" /etc/ssh/sshd_config
333- systemctl restart ssh
334333fi
335334
336335# Remove and migrate obsolete object keys
@@ -423,8 +422,9 @@ if [ ! -z $DNS_SYSTEM ]; then
423422 $BIN /v-restart-dns $restart
424423fi
425424
426- # restart Hestia services (nginx,php-fpm)
427- systemctl restart hestia
425+ $BIN /v-restart-service ssh $restart
426+ $BIN /v-restart-service hestia $restart
427+
428428
429429echo " "
430430echo " Upgrade complete! Please report any bugs or issues to"
You can’t perform that action at this time.
0 commit comments