Skip to content

Commit d8227d9

Browse files
authored
Fix issue with composer.json visible in domain.com/phpmyadmin/composer.json (hestiacp#2148)
* Limit access to composer.json for phpmyadmin * Give access to /phpmyadmin/doc/html/ * Add upgrade script for phpmailer + Fixed issue with update detection
1 parent 20468bb commit d8227d9

File tree

6 files changed

+69
-15
lines changed

6 files changed

+69
-15
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ All notable changes to this project will be documented in this file.
77

88
### Bugfixes
99

10+
- Limit access to files/folders that are not required on default /phpmyadmin (*.json, templates, locale, vendor) #2143
11+
1012
## [1.4.14] - Service release
1113

1214
### Bugfixes

func/upgrade.sh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -604,7 +604,7 @@ upgrade_roundcube(){
604604
if [ "UPGRADE_UPDATE_ROUNDCUBE" = "true" ]; then
605605
if [ ! -z "$(echo "$WEBMAIL_SYSTEM" | grep -w 'roundcube')" ]; then
606606
rc_version=$(cat /var/lib/roundcube/index.php | grep -o -E '[0-9].[0-9].[0-9]+' | head -1);
607-
if [ "$rc_version" == "$rc_v" ]; then
607+
if [ "$rc_version" != "$rc_v" ]; then
608608
echo "[ * ] Upgrading Roundcube to version v$rc_v..."
609609
$HESTIA/bin/v-add-sys-roundcube
610610
fi
@@ -616,14 +616,26 @@ upgrade_rainloop(){
616616
if [ "UPGRADE_UPDATE_RAINLOOP" = "true" ]; then
617617
if [ ! -z "$(echo "$WEBMAIL_SYSTEM" | grep -w 'rainloop')" ]; then
618618
rc_version=$(cat /var/lib/rainloop/data/VERSION);
619-
if [ "$rc_version" == "$rc_v" ]; then
619+
if [ "$rc_version" != "$rl_v" ]; then
620620
echo "[ * ] Upgrading Rainloop to version v$rl_v..."
621621
$HESTIA/bin/v-add-sys-rainloop
622622
fi
623623
fi
624624
fi
625625
}
626626

627+
upgrade_phpmailer(){
628+
if [ ! -d "$HESTIA/web/inc/vendor/" ]; then
629+
echo "[ ! ] Install PHPmailer";
630+
$HESTIA/bin/v-add-sys-phpmailer
631+
fi
632+
phpm_version=$(cat $HESTIA/web/inc/vendor/phpmailer/phpmailer/VERSION);
633+
if [ "$phpm_version" != "$pm_v" ]; then
634+
echo "[ * ] Upgrading Rainloop to version v$pm_v..."
635+
$HESTIA/bin/v-add-sys-phpmailer
636+
fi
637+
}
638+
627639
upgrade_rebuild_web_templates() {
628640
if [ "$UPGRADE_UPDATE_WEB_TEMPLATES" = "true" ]; then
629641
echo "[ ! ] Updating default web domain templates..."

install/deb/nginx/phpmyadmin.inc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
location /%pma_alias% {
22
alias /usr/share/phpmyadmin/;
33

4-
location ~ /(libraries|setup) {
4+
location ~ /(libraries|setup|vendor|templates|locale|sql) {
5+
deny all;
6+
return 404;
7+
}
8+
location ~ /(.+\.(json|lock|md)) {
59
deny all;
610
return 404;
711
}

install/deb/pma/apache.conf

Lines changed: 25 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,23 +25,36 @@ Alias /%pma_alias% /usr/share/phpmyadmin
2525
</IfModule>
2626
</Directory>
2727

28-
# Authorize for setup
29-
<Directory /usr/share/phpmyadmin/setup>
30-
<IfModule mod_authn_file.c>
31-
AuthType Basic
32-
AuthName "phpMyAdmin Setup"
33-
AuthUserFile /etc/phpmyadmin/htpasswd.setup
34-
</IfModule>
35-
Require valid-user
36-
</Directory>
37-
3828
# Disallow web access to directories that don't need it
3929
<Directory /usr/share/phpmyadmin/libraries>
4030
Order Deny,Allow
4131
Deny from All
4232
</Directory>
43-
<Directory /usr/share/phpmyadmin/setup/lib>
33+
<Directory /usr/share/phpmyadmin/setup>
34+
Order Deny,Allow
35+
Deny from All
36+
</Directory>
37+
<Directory /usr/share/phpmyadmin/sql>
4438
Order Deny,Allow
4539
Deny from All
4640
</Directory>
47-
41+
<Directory /usr/share/phpmyadmin/vendor>
42+
Order Deny,Allow
43+
Deny from All
44+
</Directory>
45+
<Directory /usr/share/phpmyadmin/templates>
46+
Order Deny,Allow
47+
Deny from All
48+
</Directory>
49+
<Directory /usr/share/phpmyadmin/locale>
50+
Order Deny,Allow
51+
Deny from All
52+
</Directory>
53+
<Files ~ "\.json$">
54+
Order Deny,Allow
55+
Deny from all
56+
</Files>
57+
<Files ~ "\.lock$">
58+
Order Deny,Allow
59+
Deny from all
60+
</Files>

install/upgrade/versions/1.4.15.sh

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
# Hestia Control Panel upgrade script for target version 1.4.14
4+
5+
#######################################################################################
6+
####### Place additional commands below. #######
7+
#######################################################################################
8+
####### Pass trough information to the end user incase of a issue or problem #######
9+
####### #######
10+
####### Use add_upgrade_message "My message here" to include a message #######
11+
####### to the upgrade email. Please add it using: #######
12+
####### #######
13+
####### add_upgrade_message "My message here" #######
14+
####### #######
15+
####### You can use \n within the string to create new lines. #######
16+
#######################################################################################
17+
18+
if [ ! -z "$DB_PMA_ALIAS" ]; then
19+
$HESTIA/bin/v-change-sys-db-alias 'pma' $DB_PMA_ALIAS
20+
fi

src/deb/hestia/postinst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,9 @@ upgrade_roundcube | tee -a $LOG
8484
# Upgrade Rainloop if applicable
8585
upgrade_rainloop | tee -a $LOG
8686

87+
# Upgrade PHPMailer if applicable
88+
upgrade_phpmailer | tee -a $LOG
89+
8790
# Set new version number in hestia.conf
8891
upgrade_set_version $new_version
8992
upgrade_set_branch $new_version

0 commit comments

Comments
 (0)