Skip to content

Commit 0175889

Browse files
authored
Fix: hestiacp#3004 Invalidate session after session timeout (hestiacp#3007)
* Fix: hestiacp#3004 Invalidate session after session timeout Also use precomplied version * Update versions openssl and php
1 parent 557a804 commit 0175889

File tree

5 files changed

+62
-46
lines changed

5 files changed

+62
-46
lines changed

bin/v-add-sys-filemanager

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ MODE=$1
2323
user="admin"
2424

2525
FM_INSTALL_DIR="$HESTIA/web/fm"
26-
FM_FILE="v${fm_v}.zip"
27-
FM_URL="https://github.com/filegator/filegator/archive/refs/tags/${FM_FILE}"
26+
FM_FILE="filegator_latest"
27+
FM_URL="https://github.com/filegator/static/raw/master/builds/filegator_latest.zip"
2828
COMPOSER_BIN="$HOMEDIR/$user/.composer/composer"
2929

3030
#----------------------------------------------------------#
@@ -69,18 +69,18 @@ rm --recursive --force "$FM_INSTALL_DIR"
6969
mkdir -p "$FM_INSTALL_DIR"
7070
cd "$FM_INSTALL_DIR"
7171

72-
[ ! -f "${FM_INSTALL_DIR}/${FM_FILE}" ] && wget "$FM_URL" --quiet -O "${FM_INSTALL_DIR}/${FM_FILE}"
72+
[ ! -f "${FM_INSTALL_DIR}/${FM_FILE}" ] && wget "$FM_URL" --quiet -O "${FM_INSTALL_DIR}/${FM_FILE}.zip"
7373

74-
unzip -qq "${FM_INSTALL_DIR}/${FM_FILE}"
75-
mv --force ${FM_INSTALL_DIR}/filegator-${fm_v}/* "${FM_INSTALL_DIR}"
76-
rm --recursive --force ${FM_INSTALL_DIR}/filegator-${fm_v}
74+
unzip -qq "${FM_INSTALL_DIR}/${FM_FILE}.zip"
75+
mv --force ${FM_INSTALL_DIR}/filegator/* "${FM_INSTALL_DIR}"
76+
rm --recursive --force ${FM_INSTALL_DIR}/${FM_FILE}
7777
[[ -f "${FM_INSTALL_DIR}/${FM_FILE}" ]] && rm "${FM_INSTALL_DIR}/${FM_FILE}"
7878

7979
cp --recursive --force ${HESTIA_INSTALL_DIR}/filemanager/filegator/* "${FM_INSTALL_DIR}"
8080

8181
chown $user: -R "${FM_INSTALL_DIR}"
8282

83-
if [ -z "$openssl_installed" ]; then
83+
if [ -z "$openssl_installed" ]; then
8484
COMPOSER_HOME="$HOMEDIR/$user/.config/composer" user_exec /usr/bin/php $COMPOSER_BIN --quiet --no-dev install
8585
else
8686
COMPOSER_HOME="$HOMEDIR/$user/.config/composer" user_exec /usr/local/hestia/php/bin/php $COMPOSER_BIN --quiet --no-dev install

install/deb/filemanager/filegator/configuration.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,23 @@
1212
$dist_config['frontend_config']['upload_max_size'] = 1024 * 1024 * 1024;
1313

1414
$dist_config['services']['Filegator\Services\Storage\Filesystem']['config']['adapter'] = function () {
15+
if (!empty($_SESSION['INACTIVE_SESSION_TIMEOUT'])){
16+
if ($_SESSION['INACTIVE_SESSION_TIMEOUT'] * 60 + $_SESSION['LAST_ACTIVITY'] < time()) {
17+
$v_user = quoteshellarg($_SESSION['user']);
18+
$v_session_id = quoteshellarg($_SESSION['token']);
19+
exec('/usr/local/hestia/bin/v-log-user-logout ' . $v_user . ' ' . $v_session_id, $output, $return_var);
20+
unset($_SESSION);
21+
session_unset();
22+
session_destroy();
23+
session_start();
24+
echo '<meta http-equiv="refresh" content="0; url=/">';
25+
exit;
26+
} else {
27+
$_SESSION['LAST_ACTIVITY'] = time();
28+
}
29+
}else{
30+
echo '<meta http-equiv="refresh" content="0; url=/">';
31+
}
1532
if (isset($_SESSION['user'])) {
1633
$v_user = $_SESSION['user'];
1734
}
@@ -105,7 +122,7 @@
105122
}
106123
observer = new MutationObserver(callback);
107124
observer.observe(div,config);
108-
}
125+
}
109126
}, 200);
110127
</script>',
111128
];

install/deb/filemanager/install-fm.sh

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ fi
2222

2323
FM_INSTALL_DIR="$HESTIA/web/fm"
2424

25-
FM_FILE="v${fm_v}.zip"
26-
FM_URL="https://github.com/filegator/filegator/archive/refs/tags/${FM_FILE}"
25+
FM_FILE="filegator_latest"
26+
FM_URL="https://github.com/filegator/static/raw/master/builds/filegator_latest.zip"
2727

2828

2929
COMPOSER_BIN="$HOMEDIR/$user/.composer/composer"
@@ -40,12 +40,11 @@ if [ "$fm_error" != "yes" ]; then
4040
mkdir -p "$FM_INSTALL_DIR"
4141
cd "$FM_INSTALL_DIR"
4242

43-
[ ! -f "${FM_INSTALL_DIR}/${FM_FILE}" ] &&
44-
wget "$FM_URL" --quiet -O "${FM_INSTALL_DIR}/${FM_FILE}"
43+
[ ! -f "${FM_INSTALL_DIR}/${FM_FILE}" ] && wget "$FM_URL" --quiet -O "${FM_INSTALL_DIR}/${FM_FILE}.zip"
4544

46-
unzip -qq "${FM_INSTALL_DIR}/${FM_FILE}"
47-
mv --force ${FM_INSTALL_DIR}/filegator-${fm_v}/* "${FM_INSTALL_DIR}"
48-
rm --recursive --force ${FM_INSTALL_DIR}/filegator-${fm_v}
45+
unzip -qq "${FM_INSTALL_DIR}/${FM_FILE}.zip"
46+
mv --force ${FM_INSTALL_DIR}/filegator/* "${FM_INSTALL_DIR}"
47+
rm --recursive --force ${FM_INSTALL_DIR}/${FM_FILE}
4948
[[ -f "${FM_INSTALL_DIR}/${FM_FILE}" ]] && rm "${FM_INSTALL_DIR}/${FM_FILE}"
5049

5150
cp --recursive --force ${HESTIA_INSTALL_DIR}/filemanager/filegator/* "${FM_INSTALL_DIR}"

src/deb/php/control

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Source: hestia-php
22
Package: hestia-php
33
Priority: optional
4-
Version: 8.1.11
4+
Version: 8.1.12
55
Section: admin
66
Maintainer: HestaCP <info@hestiacp.com>
77
Homepage: https://www.hestiacp.com

src/hst_autocompile.sh

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
# set -e
44
# Autocompile Script for HestiaCP package Files.
55
# For building from local source folder use "~localsrc" keyword as hesia branch name,
6-
# and the script will not try to download the arhive from github, since '~' char is
6+
# and the script will not try to download the arhive from github, since '~' char is
77
# not accepted in branch name.
88
# Compile but dont install -> ./hst_autocompile.sh --hestia --noinstall --keepbuild '~localsrc'
9-
# Compile and install -> ./hst_autocompile.sh --hestia --install '~localsrc'
9+
# Compile and install -> ./hst_autocompile.sh --hestia --install '~localsrc'
1010

1111
# Clear previous screen output
1212
clear
@@ -131,7 +131,7 @@ else
131131
fi
132132

133133
# Set packages to compile
134-
for i in $*; do
134+
for i in $*; do
135135
case "$i" in
136136
--all)
137137
NGINX_B='true'
@@ -190,7 +190,7 @@ if [ -z $branch ]; then
190190
fi
191191

192192
if [ $(echo "$branch" | grep '^~localsrc') ]; then
193-
branch=$(echo "$branch" | sed 's/^~//');
193+
branch=$(echo "$branch" | sed 's/^~//');
194194
use_src_folder='true'
195195
else
196196
use_src_folder='false'
@@ -224,7 +224,7 @@ if [ -e "/etc/redhat-release" ]; then
224224
else
225225
HESTIA_V="${BUILD_VER}_${BUILD_ARCH}"
226226
fi
227-
OPENSSL_V='3.0.5'
227+
OPENSSL_V='3.0.7'
228228
PCRE_V='10.40'
229229
ZLIB_V='1.2.13'
230230

@@ -324,7 +324,7 @@ branch_dash=$(echo "$branch" |sed 's/\//-/g');
324324

325325
if [ "$NGINX_B" = true ] ; then
326326
echo "Building hestia-nginx package..."
327-
if [ "$CROSS" = "true" ]; then
327+
if [ "$CROSS" = "true" ]; then
328328
echo "Cross compile not supported for hestia-nginx or hestia-php"
329329
exit 1;
330330
fi
@@ -334,10 +334,10 @@ if [ "$NGINX_B" = true ] ; then
334334
BUILD_DIR_HESTIANGINX=$BUILD_DIR/hestia-nginx_$NGINX_V
335335
if [[ $NGINX_V =~ - ]]; then
336336
BUILD_DIR_NGINX=$BUILD_DIR/nginx-$(echo $NGINX_V |cut -d"-" -f1)
337-
else
337+
else
338338
BUILD_DIR_NGINX=$BUILD_DIR/nginx-$(echo $NGINX_V |cut -d"~" -f1)
339339
fi
340-
340+
341341
if [ "$KEEPBUILD" != 'true' ] || [ ! -d "$BUILD_DIR_HESTIANGINX" ]; then
342342
# Check if target directory exist
343343
if [ -d "$BUILD_DIR_HESTIANGINX" ]; then
@@ -471,23 +471,23 @@ fi
471471
#################################################################################
472472

473473
if [ "$PHP_B" = true ] ; then
474-
if [ "$CROSS" = "true" ]; then
474+
if [ "$CROSS" = "true" ]; then
475475
echo "Cross compile not supported for hestia-nginx or hestia-php"
476476
exit 1;
477477
fi
478-
478+
479479
echo "Building hestia-php package..."
480480

481481
BUILD_DIR_HESTIAPHP=$BUILD_DIR/hestia-php_$PHP_V
482-
482+
483483
BUILD_DIR_PHP=$BUILD_DIR/php-$(echo $PHP_V |cut -d"~" -f1)
484-
484+
485485
if [[ $PHP_V =~ - ]]; then
486486
BUILD_DIR_PHP=$BUILD_DIR/php-$(echo $PHP_V |cut -d"-" -f1)
487487
else
488488
BUILD_DIR_PHP=$BUILD_DIR/php-$(echo $PHP_V |cut -d"~" -f1)
489489
fi
490-
490+
491491
if [ "$KEEPBUILD" != 'true' ] || [ ! -d "$BUILD_DIR_HESTIAPHP" ]; then
492492
# Check if target directory exist
493493
if [ -d $BUILD_DIR_HESTIAPHP ]; then
@@ -532,7 +532,7 @@ if [ "$PHP_B" = true ] ; then
532532
# Move php directory
533533
[ "$HESTIA_DEBUG" ] && echo DEBUG: mkdir -p $BUILD_DIR_HESTIAPHP/usr/local/hestia
534534
mkdir -p $BUILD_DIR_HESTIAPHP/usr/local/hestia
535-
535+
536536
[ "$HESTIA_DEBUG" ] && echo DEBUG: rm -r $BUILD_DIR_HESTIAPHP/usr/local/hestia/php
537537
if [ -d $BUILD_DIR_HESTIAPHP/usr/local/hestia/php ]; then
538538
rm -r $BUILD_DIR_HESTIAPHP/usr/local/hestia/php
@@ -610,27 +610,27 @@ fi
610610
arch="$BUILD_ARCH"
611611

612612
if [ "$HESTIA_B" = true ]; then
613-
if [ "$CROSS" = "true" ]; then
613+
if [ "$CROSS" = "true" ]; then
614614
arch="amd64 arm64"
615615
fi
616-
for BUILD_ARCH in $arch; do
616+
for BUILD_ARCH in $arch; do
617617
echo "Building Hestia Control Panel package..."
618-
618+
619619
BUILD_DIR_HESTIA=$BUILD_DIR/hestia_$HESTIA_V
620-
620+
621621
# Change to build directory
622622
cd $BUILD_DIR
623-
623+
624624
if [ "$KEEPBUILD" != 'true' ] || [ ! -d "$BUILD_DIR_HESTIA" ]; then
625625
# Check if target directory exist
626626
if [ -d $BUILD_DIR_HESTIA ]; then
627627
rm -r $BUILD_DIR_HESTIA
628628
fi
629-
629+
630630
# Create directory
631631
mkdir -p $BUILD_DIR_HESTIA
632632
fi
633-
633+
634634
cd $BUILD_DIR
635635
rm -rf $BUILD_DIR/hestiacp-$branch_dash
636636
# Download and unpack source files
@@ -640,24 +640,24 @@ if [ "$HESTIA_B" = true ]; then
640640
elif [ -d $SRC_DIR ]; then
641641
download_file $HESTIA_ARCHIVE_LINK '-' 'fresh' | tar xz
642642
fi
643-
643+
644644
mkdir -p $BUILD_DIR_HESTIA/usr/local/hestia
645-
645+
646646
# Move needed directories
647647
cd $BUILD_DIR/hestiacp-$branch_dash
648648
cp -rf bin func install web $BUILD_DIR_HESTIA/usr/local/hestia/
649-
649+
650650
# Set permissions
651651
find $BUILD_DIR_HESTIA/usr/local/hestia/ -type f -exec chmod -x {} \;
652-
652+
653653
# Allow send email via /usr/local/hestia/web/inc/mail-wrapper.php via cli
654654
chmod +x $BUILD_DIR_HESTIA/usr/local/hestia/web/inc/mail-wrapper.php
655655
# Allow the executable to be executed
656656
chmod +x $BUILD_DIR_HESTIA/usr/local/hestia/bin/*
657657
find $BUILD_DIR_HESTIA/usr/local/hestia/install/ \( -name '*.sh' \) -exec chmod +x {} \;
658658
chmod -x $BUILD_DIR_HESTIA/usr/local/hestia/install/*.sh
659659
chown -R root:root $BUILD_DIR_HESTIA
660-
660+
661661
if [ "$BUILD_DEB" = true ]; then
662662
# Get Debian package files
663663
mkdir -p $BUILD_DIR_HESTIA/DEBIAN
@@ -670,17 +670,17 @@ if [ "$HESTIA_B" = true ]; then
670670
get_branch_file 'src/deb/hestia/postinst' "$BUILD_DIR_HESTIA/DEBIAN/postinst"
671671
chmod +x $BUILD_DIR_HESTIA/DEBIAN/postinst
672672
chmod +x $BUILD_DIR_HESTIA/DEBIAN/preinst
673-
673+
674674
echo Building Hestia DEB
675675
dpkg-deb -Zxz --build $BUILD_DIR_HESTIA $DEB_DIR
676676
fi
677-
677+
678678
if [ "$BUILD_RPM" = true ]; then
679679
# Get RHEL package files
680680
get_branch_file 'src/rpm/hestia/hestia.spec' "${BUILD_DIR_HESTIA}/hestia.spec"
681681
sed -i "s/%HESTIA-VERSION%/${HESTIA_V}/g" "${BUILD_DIR_HESTIA}/hestia.spec"
682682
get_branch_file 'src/rpm/hestia/hestia.service' "${BUILD_DIR_HESTIA}/hestia.service"
683-
683+
684684
# Build RPM package
685685
mkdir -p $BUILD_DIR/rpmbuild
686686
echo Building Hestia RPM
@@ -689,7 +689,7 @@ if [ "$HESTIA_B" = true ]; then
689689
rm ~/rpmbuild/RPMS/$(arch)/hestia-*.rpm
690690
rm -rf $BUILD_DIR/rpmbuild
691691
fi
692-
692+
693693
# clear up the source folder
694694
if [ "$KEEPBUILD" != 'true' ]; then
695695
rm -r $BUILD_DIR_HESTIA

0 commit comments

Comments
 (0)