Skip to content

Commit 49e96d1

Browse files
authored
Merge pull request hestiacp#1947 from jaapmarcus/fix/limit-fm-access-when-ssh-access-enabled
Improve security FM
2 parents 5cb8249 + 444bee4 commit 49e96d1

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ All notable changes to this project will be documented in this file.
1818
- Set "default" when WEB_TEMPLATE and PROXY_TEMPLATE is missing in user.conf
1919
- Add BACKEND_TEMPLATE to default package
2020
- Fix possible error occur for v-rebuild-cron-jobs #1943 (thanks @clarkchentw)
21+
- Restrict access Filemanager when SSH is enabled for the user
2122

2223
## [1.4.3] - Service release
2324

install/deb/filemanager/filegator/configuration.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,20 @@
3434
}
3535
}
3636

37+
preg_match('/(Hestia SFTP Chroot\nMatch User)(.*)/i', file_get_contents('/etc/ssh/sshd_config'), $matches);
38+
$user_list = explode(',', $matches[2]);
39+
if(in_array($v_user,$user_list)){
40+
$root = '/';
41+
}else{
42+
$root = '/home/'.$v_user;
43+
}
44+
3745
return new \League\Flysystem\Sftp\SftpAdapter([
3846
'host' => '127.0.0.1',
3947
'port' => intval($_SESSION['SFTP_PORT']),
4048
'username' => basename($v_user),
4149
'privateKey' => '/home/'.basename($v_user).'/.ssh/hst-filemanager-key',
42-
'root' => '/',
50+
'root' => $root,
4351
'timeout' => 10,
4452
'directoryPerm' => 0755,
4553
]);

0 commit comments

Comments
 (0)