Skip to content

Commit 906f49b

Browse files
authored
Fix bug in v-add-sys-sftp-jail when ssh jail is active (hestiacp#4873)
* Fix bug in v-add-sys-sftp-jail where -server get appended hen ssh jail is active * Add update script * Fix regex * Fix sed * Update sed
1 parent 62bdc57 commit 906f49b

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

bin/v-add-sys-sftp-jail

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@ check_hestia_demo_mode
3333

3434
# Checking sshd directives
3535
config='/etc/ssh/sshd_config'
36-
sftp_n=$(grep -n "Subsystem.*sftp" $config | grep -v internal | grep -v ":#")
36+
sftp_n=$(grep -n "Subsystem.*sftp" $config | grep -v internal | grep -v /usr/lib/sftp-server | grep -v ":#")
3737
sftp_i=$(grep -n "^# Hestia SFTP Chroot" $config)
3838

3939
# Disabling normal sftp
4040
if [ -n "$sftp_n" ]; then
4141
fline=$(echo $sftp_n | cut -f 1 -d :)
42-
sed -i "${fline}s/Subsystem.*sftp/Subsystem sftp internal-sftp/" $config
42+
sed -i "${fline}s/Subsystem.*sftp.*/Subsystem sftp internal-sftp/" $config
4343
restart='yes'
4444
fi
4545

install/upgrade/versions/1.9.4.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.9.3
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
####### upgrade_config_set_value only accepts true or false. #######
9+
####### #######
10+
####### Pass through information to the end user in case of a issue or problem #######
11+
####### #######
12+
####### Use add_upgrade_message "My message here" to include a message #######
13+
####### in the upgrade notification email. Example: #######
14+
####### #######
15+
####### add_upgrade_message "My message here" #######
16+
####### #######
17+
####### You can use \n within the string to create new lines. #######
18+
#######################################################################################
19+
20+
upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'false'
21+
upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'false'
22+
upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'false'
23+
upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'no'
24+
upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'true'
25+
26+
if grep -q "internal-sftp-server" /etc/ssh/sshd_config; then
27+
sed -i 's/Subsystem sftp internal-sftp-.*/Subsystem sftp internal-sftp/' /etc/ssh/sshd_config
28+
fi
29+
30+
if grep -q "Subsystem sftp /usr/lib/sftp-server-" /etc/ssh/sshd_config; then
31+
sed -i 's/Subsystem sftp \/usr\/lib\/sftp-server-.*/Subsystem sftp \/usr\/lib\/sftp-server/' /etc/ssh/sshd_config
32+
fi

0 commit comments

Comments
 (0)