Skip to content

Commit f0eaa05

Browse files
author
Kristan Kenney
committed
Merge branch 'staging/fixes' into main
2 parents 601e27c + 3e03cd5 commit f0eaa05

Some content is hidden

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

44 files changed

+292
-364
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ All notable changes to this project will be documented in this file.
1616
- Fixed an issue where malformed JSON output was returned when custom theme files are present. (#967)
1717
- Fixed an error that would occur when running `v-change-user-php-cli` for the first time if .bash_aliases did not exist. (#960)
1818
- Corrected an issue where tooltips were not displayed when hovering over the top level menu items.
19+
- Improved handling of APT repository keys during installation.
20+
- Reworked the Let's Encrypt renew functionality to skip removed aliases.
1921

2022
## [1.2.1] - Service Release
2123
### Features

bin/v-update-letsencrypt-ssl

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,27 @@ for user in $($HESTIA/bin/v-list-sys-users plain); do
5858
aliases=$(echo "$aliases" |tr ' ' '\n' |sed "/^$/d")
5959
aliases=$(echo "$aliases" |egrep -v "^$domain,?$")
6060
aliases=$(echo "$aliases" |sed -e ':a;N;$!ba;s/\n/,/g')
61+
62+
# Source domain.conf
63+
source <(cat $HESTIA/data/users/$user/web.conf | grep "DOMAIN='$domain'")
64+
65+
# Split aliases into array
66+
IFS=',' read -r -a ALIASES <<< "$ALIAS"
67+
68+
# Loop through all crt aliases
69+
for alias in ${aliases//,/ } ; do
70+
# Validate if the alias still exists in web.conf
71+
if [[ " ${ALIASES[@]} " =~ " ${alias} " ]]; then
72+
f_aliases+="$alias,"
73+
fi
74+
done
75+
76+
# Remove leading comma
77+
if [[ ${f_aliases: -1} = ',' ]] ; then f_aliases=${f_aliases::-1}; fi
78+
79+
# Write the filtered alias list to the default var
80+
aliases=$f_aliases
81+
6182
msg=$($BIN/v-add-letsencrypt-domain $user $domain $aliases)
6283
if [ $? -ne 0 ]; then
6384
log_event $E_INVALID "$domain $msg"
@@ -114,4 +135,4 @@ done
114135
# No Logging
115136
#log_event "$OK" "$EVENT"
116137

117-
exit
138+
exit

func/main.sh

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,19 +165,14 @@ get_user_owner() {
165165
# Random password generator
166166
generate_password() {
167167
matrix=$1
168-
lenght=$2
168+
length=$2
169169
if [ -z "$matrix" ]; then
170-
matrix=0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
170+
matrix=[:alnum:]
171171
fi
172-
if [ -z "$lenght" ]; then
173-
lenght=10
172+
if [ -z "$length" ]; then
173+
length=10
174174
fi
175-
i=1
176-
while [ $i -le $lenght ]; do
177-
pass="$pass${matrix:$(($RANDOM%${#matrix})):1}"
178-
((i++))
179-
done
180-
echo "$pass"
175+
cat /dev/urandom | tr -dc $matrix | head -c$length
181176
}
182177

183178
# Package existence check

install/hst-install-debian.sh

Lines changed: 10 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,7 @@ download_file() {
107107

108108
# Defining password-gen function
109109
gen_pass() {
110-
MATRIX='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
111-
LENGTH=16
112-
while [ ${n:=1} -le $LENGTH ]; do
113-
PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
114-
let n+=1
115-
done
116-
echo "$PASS"
110+
cat /dev/urandom | tr -dc [:alnum:] | head -c16
117111
}
118112

119113
# Defining return code check function
@@ -586,53 +580,39 @@ echo
586580
# Installing Nginx repo
587581
if [ "$nginx" = 'yes' ]; then
588582
echo "[ * ] NGINX"
589-
echo "deb [arch=amd64] http://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
590-
wget --quiet http://nginx.org/keys/nginx_signing.key -O /tmp/nginx_signing.key
591-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/nginx_signing.key > /dev/null 2>&1
583+
echo "deb [arch=amd64] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
584+
apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1
592585
fi
593586

594587
# Installing sury PHP repo
595588
echo "[ * ] PHP"
596589
echo "deb https://packages.sury.org/php/ $codename main" > $apt/php.list
597-
wget --quiet https://packages.sury.org/php/apt.gpg -O /tmp/php_signing.key
598-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/php_signing.key > /dev/null 2>&1
590+
apt-key adv --fetch-keys 'https://packages.sury.org/php/apt.gpg' > /dev/null 2>&1
599591

600592
# Installing sury Apache2 repo
601593
if [ "$apache" = 'yes' ]; then
602594
echo "[ * ] Apache2"
603595
echo "deb https://packages.sury.org/apache2/ $codename main" > $apt/apache2.list
604-
wget --quiet https://packages.sury.org/apache2/apt.gpg -O /tmp/apache2_signing.key
605-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/apache2_signing.key > /dev/null 2>&1
596+
apt-key adv --fetch-keys 'https://packages.sury.org/apache2/apt.gpg' > /dev/null 2>&1
606597
fi
607598

608599
# Installing MariaDB repo
609600
if [ "$mysql" = 'yes' ]; then
610601
echo "[ * ] MariaDB"
611-
echo "deb [arch=amd64] http://ams2.mirrors.digitalocean.com/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
612-
if [ "$release" -eq 8 ]; then
613-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com CBCB082A1BB943DB > /dev/null 2>&1
614-
else
615-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com F1656F24C74CD1D8 > /dev/null 2>&1
616-
fi
617-
fi
618-
619-
# Installing Backport repo for Debian 8
620-
if [ "$release" -eq 8 ]; then
621-
echo "deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main" >> /etc/apt/sources.list
602+
echo "deb [arch=amd64] https://mirror.mva-n.net/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
603+
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
622604
fi
623605

624606
# Installing HestiaCP repo
625607
echo "[ * ] Hestia Control Panel"
626608
echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
627-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
609+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
628610

629611
# Installing PostgreSQL repo
630612
if [ "$postgresql" = 'yes' ]; then
631613
echo "[ * ] PostgreSQL"
632-
echo "deb http://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
633-
wget --quiet https://www.postgresql.org/media/keys/ACCC4CF8.asc -O /tmp/psql_signing.key
634-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/psql_signing.key > /dev/null 2>&1
635-
rm /tmp/psql_signing.key
614+
echo "deb https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
615+
apt-key adv --fetch-keys 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' > /dev/null 2>&1
636616
fi
637617

638618
# Echo for a new line
@@ -1587,31 +1567,6 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
15871567
sed -i "s/%des_key%/$rcDesKey/g" /etc/roundcube/config.inc.php
15881568
sed -i "s/localhost/$servername/g" /etc/roundcube/plugins/password/config.inc.php
15891569
mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql
1590-
1591-
if [ "$release" -eq 8 ]; then
1592-
# RoundCube tinyMCE fix
1593-
tinymceFixArchiveURL=$HESTIA_INSTALL_DIR/roundcube/roundcube-tinymce.tar.gz
1594-
tinymceParentFolder=/usr/share/roundcube/program/js
1595-
tinymceFolder=$tinymceParentFolder/tinymce
1596-
tinymceBadJS=$tinymceFolder/tiny_mce.js
1597-
tinymceFixArchive=$tinymceParentFolder/roundcube-tinymce.tar.gz
1598-
if [[ -L "$tinymceFolder" && -d "$tinymceFolder" ]]; then
1599-
if [ -f "$tinymceBadJS" ]; then
1600-
wget $tinymceFixArchiveURL -O $tinymceFixArchive
1601-
if [[ -f "$tinymceFixArchive" && -s "$tinymceFixArchive" ]]
1602-
then
1603-
rm $tinymceFolder
1604-
tar -xzf $tinymceFixArchive -C $tinymceParentFolder
1605-
rm $tinymceFixArchive
1606-
chown -R root:root $tinymceFolder
1607-
else
1608-
echo -n "File roundcube-tinymce.tar.gz is not downloaded,"
1609-
echo "RoundCube tinyMCE fix is not applied"
1610-
rm $tinymceFixArchive
1611-
fi
1612-
fi
1613-
fi
1614-
fi
16151570

16161571
# Enable Roundcube plugins
16171572
cp -f $HESTIA_INSTALL_DIR/roundcube/plugins/config_newmail_notifier.inc.php /etc/roundcube/plugins/newmail_notifier/config.inc.php

install/hst-install-ubuntu.sh

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -89,13 +89,7 @@ download_file() {
8989

9090
# Defining password-gen function
9191
gen_pass() {
92-
MATRIX='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'
93-
LENGTH=16
94-
while [ ${n:=1} -le $LENGTH ]; do
95-
PASS="$PASS${MATRIX:$(($RANDOM%${#MATRIX})):1}"
96-
let n+=1
97-
done
98-
echo "$PASS"
92+
cat /dev/urandom | tr -dc [:alnum:] | head -c16
9993
}
10094

10195
# Defining return code check function
@@ -561,10 +555,8 @@ echo
561555
# Installing Nginx repo
562556
if [ "$nginx" = 'yes' ]; then
563557
echo "[ * ] NGINX"
564-
echo "deb [arch=amd64] http://nginx.org/packages/mainline/$VERSION/ $codename nginx" \
565-
> $apt/nginx.list
566-
wget --quiet http://nginx.org/keys/nginx_signing.key -O /tmp/nginx_signing.key
567-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/nginx_signing.key > /dev/null 2>&1
558+
echo "deb [arch=amd64] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
559+
apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1
568560
fi
569561

570562
# Installing sury PHP repo
@@ -580,22 +572,20 @@ fi
580572
# Installing MariaDB repo
581573
if [ "$mysql" = 'yes' ]; then
582574
echo "[ * ] MariaDB"
583-
echo "deb [arch=amd64] http://ams2.mirrors.digitalocean.com/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
584-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8 > /dev/null 2>&1
575+
echo "deb [arch=amd64] https://mirror.mva-n.net/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
576+
apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
585577
fi
586578

587579
# Installing HestiaCP repo
588580
echo "[ * ] Hestia Control Panel"
589581
echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
590-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
582+
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
591583

592584
# Installing PostgreSQL repo
593585
if [ "$postgresql" = 'yes' ]; then
594586
echo "[ * ] PostgreSQL"
595-
echo "deb http://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
596-
wget --quiet https://www.postgresql.org/media/keys/ACCC4CF8.asc -O /tmp/psql_signing.key
597-
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/psql_signing.key > /dev/null 2>&1
598-
rm /tmp/psql_signing.key
587+
echo "deb https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
588+
apt-key adv --fetch-keys 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' > /dev/null 2>&1
599589
fi
600590

601591
# Echo for a new line

install/upgrade/versions/latest.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,35 @@ if [ "$FTP_SYSTEM" = "vsftpd" ]; then
2424
cp -f $HESTIA_INSTALL_DIR/vsftpd/vsftpd.conf /etc/
2525
chmod 644 /etc/vsftpd.conf
2626
fi
27+
28+
29+
# Rework apt repositories
30+
apt="/etc/apt/sources.list.d"
31+
echo "[ * ] Hardening APT repositories..."
32+
if [ -f "$apt/nginx.list" ]; then
33+
if grep -q "http://nginx.org/packages/mainline/" $apt/nginx.list; then
34+
echo " ----- NGINX"
35+
sed -i "s/http\:\/\/nginx.org/https\:\/\/nginx.org/g" $apt/nginx.list
36+
fi
37+
fi
38+
39+
if [ -f "$apt/php.list" ]; then
40+
if grep -q "http://packages.sury.org/" $apt/php.list; then
41+
echo " ----- PHP"
42+
sed -i "s/http\:\/\/packages.sury.org/https\:\/\/packages.sury.org/g" $apt/php.list
43+
fi
44+
fi
45+
46+
if [ -f "$apt/mariadb.list" ]; then
47+
if grep -q "http://ams2.mirrors.digitalocean.com" $apt/mariadb.list; then
48+
echo " ----- MariaDB"
49+
sed -i "s/http\:\/\/ams2.mirrors.digitalocean.com/https\:\/\/mirror.mva-n.net/g" $apt/mariadb.list
50+
fi
51+
fi
52+
53+
if [ -f "$apt/postgresql.list" ]; then
54+
if grep -q "http://apt.postgresql.org" $apt/postgresql.list; then
55+
echo " ----- PostgreSQL"
56+
sed -i "s/http\:\/\/apt.postgresql.org/https\:\/\/apt.postgresql.org/g" $apt/postgresql.list
57+
fi
58+
fi

test/test.bats

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@ load 'test_helper/bats-file/load'
66

77

88
function random() {
9-
MATRIX='0123456789'
10-
LENGTH=$1
11-
while [ ${n:=1} -le $LENGTH ]; do
12-
rand="$rand${MATRIX:$(($RANDOM%${#MATRIX})):1}"
13-
let n+=1
14-
done
15-
echo "$rand"
9+
cat /dev/urandom | tr -dc [:digit:] | head -c$1
1610
}
1711

1812
function setup() {

test/test_actions.sh

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,7 @@ V_TEST="$HESTIA/test"
77

88
# Define functions
99
random() {
10-
MATRIX='0123456789'
11-
LENGTH=$1
12-
while [ ${n:=1} -le $LENGTH ]; do
13-
rand="$rand${MATRIX:$(($RANDOM%${#MATRIX})):1}"
14-
let n+=1
15-
done
16-
echo "$rand"
10+
cat /dev/urandom | tr -dc [:digit:] | head -c$1
1711
}
1812

1913
echo_result() {

web/css/src/styles.css

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -639,6 +639,7 @@ a {
639639
.l-center {
640640
margin: 0 auto;
641641
max-width: 1020px;
642+
min-width: 1020px;
642643
}
643644

644645
.l-logo {

web/css/styles.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)