Skip to content

Commit 2fab31a

Browse files
author
Kristan Kenney
committed
Merge branch 'bugfix-sftp' into develop
2 parents ef36c8c + fc24b92 commit 2fab31a

File tree

3 files changed

+18
-11
lines changed

3 files changed

+18
-11
lines changed

bin/v-add-sys-sftp-jail

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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
1414
source $HESTIA/func/main.sh
1515
source $HESTIA/conf/hestia.conf
1616

17+
restart=$1
1718

1819
#----------------------------------------------------------#
1920
# Verifications #
@@ -45,11 +46,13 @@ if [ -z "$sftp_i" ]; then
4546
echo " X11Forwarding no" >> $config
4647
echo " AllowTCPForwarding no" >> $config
4748
echo " ForceCommand internal-sftp" >> $config
48-
restart='yes'
4949
fi
5050

5151
# Validating opensshd config
52-
if [ "$restart" = 'yes' ]; then
52+
if [ "$restart" = 'no' ]; then
53+
# Skipping SSH Restart
54+
echo "" > /dev/null 2>&1
55+
else
5356
subj="OpenSSH restart failed"
5457
email=$(grep CONTACT $HESTIA/data/users/admin/user.conf |cut -f 2 -d \')
5558
/usr/sbin/sshd -t >/dev/null 2>&1
@@ -59,7 +62,6 @@ if [ "$restart" = 'yes' ]; then
5962
echo -e "$mail_text" |$SENDMAIL -s "$subj" $email
6063
else
6164
service ssh restart >/dev/null 2>&1
62-
service sshd restart >/dev/null 2>&1
6365
fi
6466
fi
6567

bin/v-add-user-sftp-jail

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
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

@@ -11,6 +11,7 @@
1111

1212
# Argument definition
1313
user=$1
14+
restart=$2
1415

1516
# Includes
1617
source $HESTIA/func/main.sh
@@ -62,8 +63,12 @@ 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+
echo "" > /dev/null 2>&1
69+
else
70+
service ssh restart > /dev/null 2>&1
71+
fi
6772

6873
# Logging
6974
log_event "$OK" "$ARGUMENTS"

install/upgrade/1.00.0-190618.sh

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -322,14 +322,13 @@ if [ ! -z "$WEBALIZER_CHECK" ]; then
322322
fi
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
328328
sftp_subsys_enabled=$(grep -iE "^#?.*subsystem.+(sftp )?sftp-server" /etc/ssh/sshd_config)
329329
if [ ! -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
333332
fi
334333

335334
# Remove and migrate obsolete object keys
@@ -422,8 +421,9 @@ if [ ! -z $DNS_SYSTEM ]; then
422421
$BIN/v-restart-dns $restart
423422
fi
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

428428
echo ""
429429
echo " Upgrade complete! Please report any bugs or issues to"

0 commit comments

Comments
 (0)