Skip to content

Commit 5339750

Browse files
Minor enhancements to installer (hestiacp#4467)
* Minor enhancements to installer * Run format * Apply changes to upgrade script --------- Co-authored-by: Jaap Marcus <9754650+jaapmarcus@users.noreply.github.com>
1 parent 4a2788f commit 5339750

File tree

3 files changed

+52
-51
lines changed

3 files changed

+52
-51
lines changed

install/hst-install-debian.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ multiphp_required=("7.3" "7.4" "8.0" "8.1" "8.2","8.3")
4040
fpm_v="8.3"
4141
# MariaDB version
4242
mariadb_v="11.4"
43+
# Node.js version
44+
node_v="20"
4345

4446
# Defining software pack for all distros
4547
software="acl apache2 apache2-suexec-custom apache2-suexec-pristine apache2-utils awstats bc bind9 bsdmainutils bsdutils
@@ -690,7 +692,7 @@ if [ "$interactive" = 'yes' ]; then
690692
fi
691693
fi
692694

693-
#Validate Username / Password / Email / Hostname even when interactive = no
695+
# Validate Username / Password / Email / Hostname even when interactive = no
694696
if [ -z "$username" ]; then
695697
while validate_username; do
696698
read -p 'Please enter administrator username: ' username
@@ -701,7 +703,7 @@ else
701703
fi
702704
fi
703705

704-
#Ask for the password
706+
# Ask for password
705707
if [ -z "$vpass" ]; then
706708
while validate_password; do
707709
read -p 'Please enter administrator password: ' vpass
@@ -791,7 +793,7 @@ echo
791793
# Checking swap #
792794
#----------------------------------------------------------#
793795

794-
# Checking swap on small instances
796+
# Add swap for low memory servers
795797
if [ -z "$(swapon -s)" ] && [ "$memory" -lt 1000000 ]; then
796798
fallocate -l 1G /swapfile
797799
chmod 600 /swapfile
@@ -807,15 +809,14 @@ fi
807809
# Define apt conf location
808810
apt=/etc/apt/sources.list.d
809811

810-
# Create new folder if not all-ready exists
812+
# Create new folder if it doesn't exist
811813
mkdir -p /root/.gnupg/ && chmod 700 /root/.gnupg/
812814

813815
# Updating system
814816
echo "Adding required repositories to proceed with installation:"
815817
echo
816818

817819
# Installing Nginx repo
818-
819820
echo "[ * ] NGINX"
820821
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
821822
curl -s https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-keyring.gpg > /dev/null 2>&1
@@ -834,12 +835,11 @@ fi
834835

835836
# Installing MariaDB repo
836837
if [ "$mysql" = 'yes' ]; then
838+
echo "[ * ] MariaDB $mariadb_v"
837839
if [ "$release" != '12' ]; then
838-
echo "[ * ] MariaDB"
839840
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/$mariadb_v/repo/$VERSION $codename main" > $apt/mariadb.list
840841
curl -s https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | tee /usr/share/keyrings/mariadb-keyring.gpg > /dev/null 2>&1
841842
else
842-
echo "[ * ] MariaDB"
843843
echo "#deb [arch=$ARCH signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/$mariadb_v/repo/$VERSION $codename main" > $apt/mariadb.list
844844
curl -s https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | tee /usr/share/keyrings/mariadb-keyring.gpg > /dev/null 2>&1
845845
fi
@@ -866,12 +866,12 @@ echo "[ * ] Hestia Control Panel"
866866
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/hestia-keyring.gpg] https://$RHOST/ $codename main" > $apt/hestia.list
867867
gpg --no-default-keyring --keyring /usr/share/keyrings/hestia-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
868868

869-
# Detect if nodejs is allready installed if not add the repo
870-
echo "[ * ] Node.js 20.x"
871-
if [ -z $(which "node") ]; then
872-
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
873-
else
874-
echo "- Node.js is already installed"
869+
# Installing Node.js repo
870+
if [ "$webterminal" = 'yes' ]; then
871+
echo "[ * ] Node.js $node_v"
872+
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/nodejs.gpg] https://deb.nodesource.com/node_$node_v.x nodistro main" > $apt/nodejs.list
873+
curl -s https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodejs.gpg > /dev/null 2>&1
874+
curl -fsSL https://deb.nodesource.com/setup_$node_v.x | bash -
875875
fi
876876

877877
# Installing PostgreSQL repo
@@ -1220,7 +1220,7 @@ if [ ! -f "/etc/default/ntpsec-ntpdate " ]; then
12201220
systemctl start systemd-timesyncd
12211221
fi
12221222
# Restrict access to /proc fs
1223-
# - Prevent unpriv users from seeing each other running processes
1223+
# Prevent unpriv users from seeing each other running processes
12241224
mount -o remount,defaults,hidepid=2 /proc > /dev/null 2>&1
12251225
if [ $? -ne 0 ]; then
12261226
echo "Info: Cannot remount /proc (LXC containers require additional perm added to host apparmor profile)"
@@ -1278,7 +1278,7 @@ touch $HESTIA/conf/hestia.conf
12781278
chmod 660 $HESTIA/conf/hestia.conf
12791279

12801280
# Write default port value to hestia.conf
1281-
# If a custom port is specified it will be set at the end of the installation process.
1281+
# If a custom port is specified it will be set at the end of the installation process
12821282
write_config_value "BACKEND_PORT" "8083"
12831283

12841284
# Web stack
@@ -1389,7 +1389,7 @@ write_config_value "BACKUP_MODE" "zstd"
13891389
# Language
13901390
write_config_value "LANGUAGE" "$lang"
13911391

1392-
# Login in screen
1392+
# Login screen style
13931393
write_config_value "LOGIN_STYLE" "default"
13941394

13951395
# Theme
@@ -1454,7 +1454,7 @@ if [ "$named" = "no" ]; then
14541454
sed -i "/COMMENT='DNS'/d" $HESTIA/data/firewall/rules.conf
14551455
fi
14561456

1457-
# Installing apis
1457+
# Installing API
14581458
cp -rf $HESTIA_COMMON_DIR/api $HESTIA/data/
14591459

14601460
# Configuring server hostname
@@ -1502,12 +1502,12 @@ rm /tmp/hst.pem
15021502
# Install dhparam.pem
15031503
cp -f $HESTIA_INSTALL_DIR/ssl/dhparam.pem /etc/ssl
15041504

1505-
# Enable sftp jail
1505+
# Enable SFTP jail
15061506
echo "[ * ] Enabling SFTP jail..."
15071507
$HESTIA/bin/v-add-sys-sftp-jail > /dev/null 2>&1
15081508
check_result $? "can't enable sftp jail"
15091509

1510-
# Enable ssh jail
1510+
# Enable SSH jail
15111511
echo "[ * ] Enabling SSH jail..."
15121512
$HESTIA/bin/v-add-sys-ssh-jail > /dev/null 2>&1
15131513
check_result $? "can't enable ssh jail"
@@ -1868,7 +1868,7 @@ if [ "$mysql" = 'yes' ] || [ "$mysql8" = 'yes' ]; then
18681868
# shellcheck source=/usr/local/hestia/install/deb/phpmyadmin/pma.sh
18691869
source $HESTIA_INSTALL_DIR/phpmyadmin/pma.sh > /dev/null 2>&1
18701870

1871-
# limit access to /etc/phpmyadmin/
1871+
# Limit access to /etc/phpmyadmin/
18721872
chown -R root:www-data /etc/phpmyadmin/
18731873
chmod -R 640 /etc/phpmyadmin/*
18741874
chmod 750 /etc/phpmyadmin/conf.d/
@@ -2006,7 +2006,7 @@ if [ "$dovecot" = 'yes' ]; then
20062006
touch /var/log/dovecot.log
20072007
chown -R dovecot:mail /var/log/dovecot.log
20082008
chmod 660 /var/log/dovecot.log
2009-
#Alter config for 2.2
2009+
# Alter config for 2.2
20102010
version=$(dovecot --version | cut -f -2 -d .)
20112011
if [ "$version" = "2.2" ]; then
20122012
echo "[ * ] Downgrade dovecot config to sync with 2.2 settings"
@@ -2200,7 +2200,7 @@ if [ "$sieve" = 'yes' ]; then
22002200
chmod 640 $RC_CONFIG_DIR/config.inc.php
22012201
fi
22022202

2203-
# Restart Dovecot and exim4
2203+
# Restart Dovecot and Exim4
22042204
systemctl restart dovecot > /dev/null 2>&1
22052205
systemctl restart exim4 > /dev/null 2>&1
22062206
fi

install/hst-install-ubuntu.sh

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,12 @@ HESTIA_INSTALL_VER='1.9.0~alpha'
3636
multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0" "8.1" "8.2" "8.3")
3737
# One of the following PHP versions is required for Roundcube / phpmyadmin
3838
multiphp_required=("7.3" "7.4" "8.0" "8.1" "8.2" "8.3")
39-
4039
# Default PHP version if none supplied
4140
fpm_v="8.3"
4241
# MariaDB version
4342
mariadb_v="11.4"
43+
# Node.js version
44+
node_v="20"
4445

4546
# Defining software pack for all distros
4647
software="acl apache2 apache2.2-common apache2-suexec-custom apache2-utils apparmor-utils awstats bc bind9 bsdmainutils bsdutils
@@ -680,7 +681,7 @@ if [ "$interactive" = 'yes' ]; then
680681
fi
681682
fi
682683

683-
#Validate Username / Password / Email / Hostname even when interactive = no
684+
# Validate Username / Password / Email / Hostname even when interactive = no
684685
if [ -z "$username" ]; then
685686
while validate_username; do
686687
read -p 'Please enter administrator username: ' username
@@ -691,7 +692,7 @@ else
691692
fi
692693
fi
693694

694-
#Ask for the password
695+
# Ask for password
695696
if [ -z "$vpass" ]; then
696697
while validate_password; do
697698
read -p 'Please enter administrator password: ' vpass
@@ -780,7 +781,7 @@ echo
780781
# Checking swap #
781782
#----------------------------------------------------------#
782783

783-
# Checking swap on small instances
784+
# Add swap for low memory servers
784785
if [ -z "$(swapon -s)" ] && [ "$memory" -lt 1000000 ]; then
785786
fallocate -l 1G /swapfile
786787
chmod 600 /swapfile
@@ -796,15 +797,14 @@ fi
796797
# Define apt conf location
797798
apt=/etc/apt/sources.list.d
798799

799-
# Create new folder if not all-ready exists
800+
# Create new folder if it doesn't exist
800801
mkdir -p /root/.gnupg/ && chmod 700 /root/.gnupg/
801802

802803
# Updating system
803804
echo "Adding required repositories to proceed with installation:"
804805
echo
805806

806807
# Installing Nginx repo
807-
808808
echo "[ * ] NGINX"
809809
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/nginx-keyring.gpg] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
810810
curl -s https://nginx.org/keys/nginx_signing.key | gpg --dearmor | tee /usr/share/keyrings/nginx-keyring.gpg > /dev/null 2>&1
@@ -826,7 +826,7 @@ fi
826826

827827
# Installing MariaDB repo
828828
if [ "$mysql" = 'yes' ]; then
829-
echo "[ * ] MariaDB"
829+
echo "[ * ] MariaDB $mariadb_v"
830830
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/mariadb-keyring.gpg] https://dlm.mariadb.com/repo/mariadb-server/$mariadb_v/repo/$VERSION $codename main" > $apt/mariadb.list
831831
curl -s https://mariadb.org/mariadb_release_signing_key.asc | gpg --dearmor | tee /usr/share/keyrings/mariadb-keyring.gpg > /dev/null 2>&1
832832
fi
@@ -836,12 +836,12 @@ echo "[ * ] Hestia Control Panel"
836836
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/hestia-keyring.gpg] https://$RHOST/ $codename main" > $apt/hestia.list
837837
gpg --no-default-keyring --keyring /usr/share/keyrings/hestia-keyring.gpg --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
838838

839-
# Detect if nodejs is allready installed if not add the repo
840-
echo "[ * ] Node.js 20.x"
841-
if [ -z $(which "node") ]; then
842-
curl -fsSL https://deb.nodesource.com/setup_20.x | bash -
843-
else
844-
echo "- Node.js is already installed"
839+
# Installing Node.js repo
840+
if [ "$webterminal" = 'yes' ]; then
841+
echo "[ * ] Node.js $node_v"
842+
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/nodejs.gpg] https://deb.nodesource.com/node_$node_v.x nodistro main" > $apt/nodejs.list
843+
curl -s https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodejs.gpg > /dev/null 2>&1
844+
curl -fsSL https://deb.nodesource.com/setup_$node_v.x | bash -
845845
fi
846846

847847
# Installing PostgreSQL repo
@@ -1242,7 +1242,7 @@ if [ ! -e "/sbin/iptables-restore" ]; then
12421242
fi
12431243

12441244
# Restrict access to /proc fs
1245-
# - Prevent unpriv users from seeing each other running processes
1245+
# Prevent unpriv users from seeing each other running processes
12461246
mount -o remount,defaults,hidepid=2 /proc > /dev/null 2>&1
12471247
if [ $? -ne 0 ]; then
12481248
echo "Info: Cannot remount /proc (LXC containers require additional perm added to host apparmor profile)"
@@ -1300,7 +1300,7 @@ touch $HESTIA/conf/hestia.conf
13001300
chmod 660 $HESTIA/conf/hestia.conf
13011301

13021302
# Write default port value to hestia.conf
1303-
# If a custom port is specified it will be set at the end of the installation process.
1303+
# If a custom port is specified it will be set at the end of the installation process
13041304
write_config_value "BACKEND_PORT" "8083"
13051305

13061306
# Web stack
@@ -1407,7 +1407,7 @@ write_config_value "BACKUP_MODE" "zstd"
14071407
# Language
14081408
write_config_value "LANGUAGE" "$lang"
14091409

1410-
# Login in screen
1410+
# Login screen style
14111411
write_config_value "LOGIN_STYLE" "default"
14121412

14131413
# Theme
@@ -1472,7 +1472,7 @@ if [ "$named" = "no" ]; then
14721472
sed -i "/COMMENT='DNS'/d" $HESTIA/data/firewall/rules.conf
14731473
fi
14741474

1475-
# Installing apis
1475+
# Installing API
14761476
cp -rf $HESTIA_COMMON_DIR/api $HESTIA/data/
14771477

14781478
# Configuring server hostname
@@ -1530,12 +1530,12 @@ rm /tmp/hst.pem
15301530
# Install dhparam.pem
15311531
cp -f $HESTIA_INSTALL_DIR/ssl/dhparam.pem /etc/ssl
15321532

1533-
# Enable sftp jail
1533+
# Enable SFTP jail
15341534
echo "[ * ] Enabling SFTP jail..."
15351535
$HESTIA/bin/v-add-sys-sftp-jail > /dev/null 2>&1
15361536
check_result $? "can't enable sftp jail"
15371537

1538-
# Enable ssh jail
1538+
# Enable SSH jail
15391539
echo "[ * ] Enabling SSH jail..."
15401540
$HESTIA/bin/v-add-sys-ssh-jail > /dev/null 2>&1
15411541
check_result $? "can't enable ssh jail"
@@ -1891,7 +1891,7 @@ if [ "$mysql" = 'yes' ] || [ "$mysql8" = 'yes' ]; then
18911891
# shellcheck source=/usr/local/hestia/install/deb/phpmyadmin/pma.sh
18921892
source $HESTIA_INSTALL_DIR/phpmyadmin/pma.sh > /dev/null 2>&1
18931893

1894-
# limit access to /etc/phpmyadmin/
1894+
# Limit access to /etc/phpmyadmin/
18951895
chown -R root:www-data /etc/phpmyadmin/
18961896
chmod -R 640 /etc/phpmyadmin/*
18971897
chmod 750 /etc/phpmyadmin/conf.d/
@@ -2023,7 +2023,7 @@ if [ "$dovecot" = 'yes' ]; then
20232023
chown -R dovecot:mail /var/log/dovecot.log
20242024
chmod 660 /var/log/dovecot.log
20252025

2026-
#Alter config for 2.2
2026+
# Alter config for 2.2
20272027
version=$(dovecot --version | cut -f -2 -d .)
20282028
if [ "$version" = "2.2" ]; then
20292029
echo "[ * ] Downgrade dovecot config to sync with 2.2 settings"
@@ -2194,7 +2194,7 @@ if [ "$sieve" = 'yes' ]; then
21942194
chmod 640 $RC_CONFIG_DIR/config.inc.php
21952195
fi
21962196

2197-
# Restart Dovecot and exim4
2197+
# Restart Dovecot and Exim4
21982198
systemctl restart dovecot > /dev/null 2>&1
21992199
systemctl restart exim4 > /dev/null 2>&1
22002200
fi

install/upgrade/versions/1.9.0.sh

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ $BIN/v-add-sys-sftp-jail
3030
codename="$(lsb_release -s -c)"
3131
apt=/etc/apt/sources.list.d
3232

33-
# Installing Node.js 20.x repo
34-
if [ ! -f $apt/nodesource.list ] && [ ! -z $(which "node") ]; then
35-
echo "[ * ] Adding Node.js 20.x repo"
36-
echo "deb [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x $codename main" > $apt/nodesource.list
37-
echo "deb-src [signed-by=/usr/share/keyrings/nodesource.gpg] https://deb.nodesource.com/node_20.x $codename main" >> $apt/nodesource.list
38-
curl -s https://deb.nodesource.com/gpgkey/nodesource.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodesource.gpg > /dev/null 2>&1
33+
# Installing Node.js repo
34+
if [ "$webterminal" = 'yes' ]; then
35+
node_v="20"
36+
echo "[ * ] Adding Node.js $node_v repo and install"
37+
echo "deb [arch=$ARCH signed-by=/usr/share/keyrings/nodejs.gpg] https://deb.nodesource.com/node_$node_v.x nodistro main" > $apt/nodejs.list
38+
curl -s https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor | tee /usr/share/keyrings/nodejs.gpg > /dev/null 2>&1
39+
curl -fsSL https://deb.nodesource.com/setup_$node_v.x | bash -
3940
fi
4041

4142
# Check if hestiaweb exists
@@ -91,5 +92,5 @@ for package in $packages; do
9192
done
9293
done
9394

94-
$BIN/v-add-user-notification 'admin' 'Hestia securirty has been upgraded' ' A new user "hestiaweb" has been created and is used for login. Make sure other Hestia packages are updated as well otherwise the system may not work as expected.'
95+
$BIN/v-add-user-notification 'admin' 'Hestia security has been upgraded' ' A new user "hestiaweb" has been created and is used for login. Make sure other Hestia packages are updated as well otherwise the system may not work as expected.'
9596
add_upgrade_message 'Security has been upgraded, A new user "hestiaweb" has been created and is used for login. Make sure other Hestia packages are updated as well otherwise the system may not work as expected.'

0 commit comments

Comments
 (0)