Skip to content

Commit 1c4434b

Browse files
unicode characters in shell arguments (composer solution) (hestiacp#2720)
* unicode characters in shell arguments (composer solution) a composer-based alternative to PR hestiacp#2717 * linter fix Fatal error: Namespace declaration statement has to be the very first statement or after any declare call in the script in ./web/src/app/System/HestiaApp.php on line 6 Errors parsing ./web/src/app/System/HestiaApp.php * Move to Hestia controlled repo + Fix 1 missing escapeshellargs Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
1 parent a89500f commit 1c4434b

File tree

117 files changed

+881
-644
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

117 files changed

+881
-644
lines changed

CHANGELOG.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,26 +6,26 @@ All notable changes to this project will be documented in this file.
66
### Bugfixes
77

88
- Fixed an issue with downloading log files ()
9-
- Fixed an issue with installing Quick Installers (#2762, #2760, @divinity76)
9+
- Fixed an issue with installing Quick Installers (#2762, #2760, @Hestiacp)
1010
- Fixed an issue with Apache Access / Awstats logs IP after using v-update-sys-ip (#2759 @adion-gorani)
1111

1212
## [1.6.3] - Service release
1313

1414
### Features
1515

16-
- Add additional support for bcrypt for mail passwords (#2752 @divinity76)
16+
- Add additional support for bcrypt for mail passwords (#2752 @Hestiacp)
1717

1818
### Enhancements
1919

20-
- Simplify md5crypt on reset form email (#2751 @divinity76)
20+
- Simplify md5crypt on reset form email (#2751 @Hestiacp)
2121
- Use secure RNG to generate passwords (#2726)
2222
- Add twig support filemanger (#2714, @anvme)
2323

2424
### Bugfixes
2525

2626
- Fixed an issue with restart Apache2 and Nginx after v-update-letsencrypt (#2748, #2563, #2744, #2677)
2727
- Prevent transversing path in Quick installer apps (#2742)
28-
- Avoid out of memory serving large logfiles (#2741, #2736, @divinity76
28+
- Avoid out of memory serving large logfiles (#2741, #2736, @Hestiacp
2929
- Improve passwords loading in password_valid (#2739)
3030
- Use secure RNG to generate passwords (#2726)
3131
- Utilise entire alphabet for random string (#2735 @Shadowfied)

install/deb/filemanager/filegator/backend/Services/Archiver/Adapters/HestiaZipArchiver.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Filegator\Services\Service;
88
use Filegator\Services\Storage\Filesystem as Storage;
99
use Filegator\Services\Tmpfs\TmpfsInterface;
10+
use function Hestiacp\quoteshellarg\quoteshellarg;
1011

1112

1213
class HestiaZipArchiver extends ZipArchiver implements Service, ArchiverInterface
@@ -39,9 +40,9 @@ public function uncompress(string $source, string $destination, Storage $storage
3940
}
4041

4142
exec ("sudo /usr/local/hestia/bin/v-extract-fs-archive " .
42-
escapeshellarg($v_user) . " " .
43-
escapeshellarg($source) . " " .
44-
escapeshellarg($destination)
43+
quoteshellarg($v_user) . " " .
44+
quoteshellarg($source) . " " .
45+
quoteshellarg($destination)
4546
,$output, $return_var);
4647

4748
}

install/deb/filemanager/filegator/backend/Services/Auth/Adapters/HestiaAuth.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Filegator\Services\Auth\User;
1515
use Filegator\Services\Auth\UsersCollection;
1616
use Filegator\Services\Service;
17+
use function Hestiacp\quoteshellarg\quoteshellarg;
1718

1819
/**
1920
* @codeCoverageIgnore
@@ -49,7 +50,7 @@ public function init(array $config = [])
4950
public function user(): ?User
5051
{
5152
$cmd="/usr/bin/sudo /usr/local/hestia/bin/v-list-user";
52-
exec($cmd." ".escapeshellarg($this->hestia_user)." json", $output, $return_var);
53+
exec($cmd." ".quoteshellarg($this->hestia_user)." json", $output, $return_var);
5354

5455
if ($return_var == 0) {
5556
$data = json_decode(implode('', $output), true);

install/deb/filemanager/filegator/composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@
1919
"rakit/validation": "^1.1",
2020
"league/flysystem": "^1.1",
2121
"league/flysystem-ziparchive": "^1.0",
22-
"league/flysystem-sftp": "^1.0"
22+
"league/flysystem-sftp": "^1.0",
23+
"hestiacp/phpquoteshellarg": "^1.0"
2324
},
2425
"authors": [
2526
{

install/deb/filemanager/filegator/composer.lock

Lines changed: 50 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

install/deb/filemanager/filegator/configuration.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
use function Hestiacp\quoteshellarg\quoteshellarg;
23

34
$dist_config = require __DIR__.'/configuration_sample.php';
45

@@ -24,10 +25,10 @@
2425
}
2526
# Create filemanager sftp key if missing and trash it after 30 min
2627
if (! file_exists('/home/'.basename($v_user).'/.ssh/hst-filemanager-key')) {
27-
exec("sudo /usr/local/hestia/bin/v-add-user-sftp-key " . escapeshellarg(basename($v_user)) . " 30", $output, $return_var);
28+
exec("sudo /usr/local/hestia/bin/v-add-user-sftp-key " . quoteshellarg(basename($v_user)) . " 30", $output, $return_var);
2829
// filemanager also requires .ssh chmod o+x ... hopefully we can improve it to g+x or u+x someday
2930
// current minimum for filemanager: chmod 0701 .ssh
30-
shell_exec("sudo chmod o+x " . escapeshellarg('/home/' . basename($v_user) . '/.ssh'));
31+
shell_exec("sudo chmod o+x " . quoteshellarg('/home/' . basename($v_user) . '/.ssh'));
3132
}
3233

3334
if (!isset($_SESSION['SFTP_PORT'])) {

install/hst-install-debian.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ HESTIA_INSTALL_DIR="$HESTIA/install/deb"
3131
VERBOSE='no'
3232

3333
# Define software versions
34-
HESTIA_INSTALL_VER='1.6.4'
34+
HESTIA_INSTALL_VER='1.6.5~alpha'
3535
# Dependencies
3636
multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1")
3737
fpm_v="8.0"

install/hst-install-ubuntu.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ HESTIA_INSTALL_DIR="$HESTIA/install/deb"
3131
VERBOSE='no'
3232

3333
# Define software versions
34-
HESTIA_INSTALL_VER='1.6.4'
34+
HESTIA_INSTALL_VER='1.6.5~alpha'
3535
# Dependencies
3636
multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1")
3737
fpm_v="8.0"

install/upgrade/versions/1.6.4.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.6.4
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
####### Pass through information to the end user in case of a issue or problem #######
9+
####### #######
10+
####### Use add_upgrade_message "My message here" to include a message #######
11+
####### in the upgrade notification email. Example: #######
12+
####### #######
13+
####### add_upgrade_message "My message here" #######
14+
####### #######
15+
####### You can use \n within the string to create new lines. #######
16+
#######################################################################################
17+
18+
upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'no'
19+
upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'no'
20+
upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'no'
21+
upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'no'
22+
upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'false'

install/upgrade/versions/1.6.5.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.6.4
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
####### Pass through information to the end user in case of a issue or problem #######
9+
####### #######
10+
####### Use add_upgrade_message "My message here" to include a message #######
11+
####### in the upgrade notification email. Example: #######
12+
####### #######
13+
####### add_upgrade_message "My message here" #######
14+
####### #######
15+
####### You can use \n within the string to create new lines. #######
16+
#######################################################################################
17+
18+
upgrade_config_set_value 'UPGRADE_UPDATE_WEB_TEMPLATES' 'no'
19+
upgrade_config_set_value 'UPGRADE_UPDATE_DNS_TEMPLATES' 'no'
20+
upgrade_config_set_value 'UPGRADE_UPDATE_MAIL_TEMPLATES' 'no'
21+
upgrade_config_set_value 'UPGRADE_REBUILD_USERS' 'no'
22+
upgrade_config_set_value 'UPGRADE_UPDATE_FILEMANAGER_CONFIG' 'false'
23+
24+
#Add phpquoteshellarg as dependency
25+
if [ "$FILE_MANAGER" = "true" ]; then
26+
$HESTIA/bin/v-delete-sys-filemanager quiet
27+
$HESTIA/bin/v-delete-sys-filemanager quiet
28+
fi
29+
30+
$HESTIA/bin/v-add-sys-phpmailer
31+

0 commit comments

Comments
 (0)