Skip to content

Commit ae87b8c

Browse files
author
Kristan Kenney
committed
Merge branch 'main' into feature/user-roles
2 parents cbd72e5 + d394b1e commit ae87b8c

File tree

13 files changed

+76
-27
lines changed

13 files changed

+76
-27
lines changed

bin/v-add-letsencrypt-host

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,14 @@
1313
# Variable&Function #
1414
#----------------------------------------------------------#
1515

16+
# make sure path is always loaded
17+
source /etc/profile
18+
1619
# Argument definition
17-
domain=$HOSTNAME
20+
domain=$(hostname -f);
21+
if [ -z $domain ]; then
22+
domain=$HOSTNAME;
23+
fi
1824
user="$($HESTIA/bin/v-search-domain-owner "$domain" web)"
1925
[[ -z "$user" ]] && user="admin"
2026

bin/v-backup-user

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,14 @@ check_backup_conditions
5656
if [ -z "$BACKUP" ]; then
5757
BACKUP=/backup
5858
fi
59-
mkdir -p $BACKUP
59+
60+
# Check if backup folder exists and have the correct permission
61+
if [[ ! -d "$BACKUP" ]]; then
62+
mkdir -p $BACKUP
63+
fi
64+
if [ $(stat -c %a $BACKUP) != 755 ]; then
65+
chmod 755 $BACKUP
66+
fi
6067

6168
# Get current time
6269
start_time=$(date '+%s')

bin/v-change-sys-hostname

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
# Argument definition
1616
domain=$1
17+
helo=${2-yes}
1718

1819
# Includes
1920
# shellcheck source=/usr/local/hestia/func/main.sh
@@ -26,7 +27,7 @@ source $HESTIA/conf/hestia.conf
2627
# Verifications #
2728
#----------------------------------------------------------#
2829

29-
check_args '1' "$#" 'HOSTNAME'
30+
check_args '1' "$#" 'HOSTNAME [HELO]'
3031
is_format_valid 'domain'
3132

3233
# Perform verification if read-only mode is enabled
@@ -56,10 +57,13 @@ else
5657
if [ -d /etc/roundcube/ ]; then
5758
sed -i "/password_hestia_host/c\$rcmail_config['password_hestia_host'] = '$domain';" /etc/roundcube/plugins/password/config.inc.php
5859
fi
60+
if [ -d /etc/rainloop/ ]; then
61+
sed -i "/hestia_host/c\hestia_host = \"$domain\"" /etc/rainloop/data/_data_/_default_/configs/plugin-hestia-change-password.ini
62+
fi
5963
fi
6064

6165
# Update ip helo for exim
62-
if [ ! -z "$MAIL_SYSTEM" ]; then
66+
if [[] ! -z "$MAIL_SYSTEM" && "$helo" == "yes" ]]; then
6367
pub_ip=$(curl --ipv4 -s https://ip.hestiacp.com/)
6468
$BIN/v-change-sys-ip-helo $pub_ip $domain
6569
fi

bin/v-change-web-domain-docroot

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,11 +89,11 @@ else
8989
# Checking destination path
9090
real_target_directory="$(readlink -e "${target_domain_directory}/public_html/$target_directory/")"
9191
if [ -z "$(echo $real_target_directory | egrep "^$target_domain_directory\b")" ]; then
92-
check_result $E_FORBIDEN "Error: target dir outside of target domain dir"
92+
check_result $E_FORBIDEN "Target dir outside of target domain dir"
9393
fi
9494

9595
if [ ! -e "$real_target_directory" ]; then
96-
check_result $E_NOTEXIST "ERROR: Directory $target_directory does not exist under $HOMEDIR/$user/$target_domain/public_html/."
96+
check_result $E_NOTEXIST "Directory $target_directory does not exist under $HOMEDIR/$user/$target_domain/public_html/."
9797
else
9898
CUSTOM_DOCROOT="$real_target_directory"
9999
if [ ! -z "$php" ]; then

bin/v-restore-user

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ is_format_valid 'user' 'backup'
6464
# Action #
6565
#----------------------------------------------------------#
6666

67+
# Check if backup folder exists and have the correct permission
68+
if [[ ! -d "$BACKUP" ]]; then
69+
mkdir -p $BACKUP
70+
fi
71+
if [ $(stat -c %a $BACKUP) != 755 ]; then
72+
chmod 755 $BACKUP
73+
fi
74+
6775
# Checking local backup
6876
if [ ! -e "$BACKUP/$backup" ]; then
6977
if [[ "$BACKUP_SYSTEM" =~ "google" ]]; then

func/main.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ is_user_format_valid() {
638638
is_domain_format_valid() {
639639
object_name=${2-domain}
640640
exclude="[!|@|#|$|^|&|*|(|)|+|=|{|}|:|,|<|>|?|_|/|\|\"|'|;|%|\`| ]"
641-
if [[ $1 =~ $exclude ]] || [[ $1 =~ ^[0-9]+$ ]] || [[ $1 =~ "\.\." ]] || [[ $1 =~ "$(printf '\t')" ]]; then
641+
if [[ $1 =~ $exclude ]] || [[ $1 =~ ^[0-9]+$ ]] || [[ $1 =~ "\.\." ]] || [[ $1 =~ "$(printf '\t')" ]] || [[ "$1" = "www" ]]; then
642642
check_result $E_INVALID "invalid $object_name format :: $1"
643643
fi
644644
}

install/deb/nginx/nginx.conf

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ http {
4545
fastcgi_send_timeout 180s;
4646
fastcgi_cache_lock on;
4747
fastcgi_cache_lock_timeout 5s;
48+
fastcgi_cache_background_update on;
49+
fastcgi_cache_revalidate on;
4850

4951
# Proxy settings
5052
proxy_redirect off;

install/hst-install-debian.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,7 +1177,7 @@ cp -rf $HESTIA_INSTALL_DIR/templates/web/skel/document_errors/* /var/www/documen
11771177
cp -rf $HESTIA_INSTALL_DIR/firewall $HESTIA/data/
11781178

11791179
# Configuring server hostname
1180-
$HESTIA/bin/v-change-sys-hostname $servername > /dev/null 2>&1
1180+
$HESTIA/bin/v-change-sys-hostname $servername 'no' > /dev/null 2>&1
11811181

11821182
# Generating SSL certificate
11831183
echo "[ * ] Generating default self-signed SSL certificate..."
@@ -1711,6 +1711,7 @@ if [ ! -z "$(grep ^admin: /etc/group)" ] && [ "$force" = 'yes' ]; then
17111711
fi
17121712

17131713
# Enable sftp jail
1714+
echo "[ * ] Enable SFTP jail..."
17141715
$HESTIA/bin/v-add-sys-sftp-jail > /dev/null 2>&1
17151716
check_result $? "can't enable sftp jail"
17161717

@@ -1731,6 +1732,7 @@ if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
17311732
fi
17321733

17331734
# Configuring system IPs
1735+
echo "[ * ] Configure System IP..."
17341736
$HESTIA/bin/v-update-sys-ip > /dev/null 2>&1
17351737

17361738
# Get main IP
@@ -1750,6 +1752,11 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
17501752
ip=$pub_ip
17511753
fi
17521754

1755+
if [ "$exim" = 'yes' ]; then
1756+
# Set HELO for IP as it didn't set during v-change-sys-hostname
1757+
$HESTIA/bin/v-change-sys-ip-helo $pub_ip $servername
1758+
fi
1759+
17531760
# Configuring libapache2-mod-remoteip
17541761
if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
17551762
cd /etc/apache2/mods-available
@@ -1837,6 +1844,12 @@ systemctl start hestia
18371844
check_result $? "hestia start failed"
18381845
chown admin:admin $HESTIA/data/sessions
18391846

1847+
# Create backup folder and set correct permission
1848+
mkdir -p /backup/
1849+
chmod 755 /backup/
1850+
1851+
# create cronjob to generate ssl
1852+
echo "@reboot root sleep 10 && rm /etc/cron.d/hestia-ssl && /usr/local/hestia/bin/v-add-letsencrypt-host" > /etc/cron.d/hestia-ssl
18401853

18411854
#----------------------------------------------------------#
18421855
# Configure File Manager #
@@ -1903,21 +1916,18 @@ cat $tmpfile
19031916
rm -f $tmpfile
19041917

19051918
# Add welcome message to notification panel
1906-
$HESTIA/bin/v-add-user-notification admin 'Welcome to Hestia Control Panel!' '<br>You are now ready to begin <a href="/add/user/">adding user accounts</a> and <a href="/add/web/">domains</a>. For help and assistance, view the <a href="https://docs.hestiacp.com/" target="_new">documentation</a> or visit our <a href="https://forum.hestiacp.com/" target="_new">user forum</a>.<br><br>Please report any bugs or issues via <a href="https://github.com/hestiacp/hestiacp/issues" target="_new"><i class="fab fa-github"></i> GitHub</a> or e-mail <a href="mailto:info@hestiacp.com?Subject="['$new_version'] Bug Report: ">info@hestiacp.com</a>.<br><br><b>Have a wonderful day!</b><br><br><i class="fas fa-heart status-icon red"></i> The Hestia Control Panel development team'
1919+
$HESTIA/bin/v-add-user-notification admin 'Welcome to Hestia Control Panel!' '<br>You are now ready to begin <a href="/add/user/">adding user accounts</a> and <a href="/add/web/">domains</a>. For help and assistance, view the <a href="https://docs.hestiacp.com/" target="_new">documentation</a> or visit our <a href="https://forum.hestiacp.com/" target="_new">user forum</a>.<br><br>Please report any bugs or issues via <a href="https://github.com/hestiacp/hestiacp/issues" target="_new"><i class="fab fa-github"></i> GitHub</a>.<br><br><b>Have a wonderful day!</b><br><br><i class="fas fa-heart status-icon red"></i> The Hestia Control Panel development team'
19071920

1908-
echo "[ ! ] IMPORTANT: You must logout or restart the server before continuing."
1921+
echo "[ ! ] IMPORTANT: System will reboot"
19091922
echo ""
19101923
if [ "$interactive" = 'yes' ]; then
1911-
echo -n " Do you want to reboot now? [Y/N] "
1924+
echo -n " Press any key to continue!"
19121925
read reboot
1913-
1914-
if [ "$reboot" = "Y" ] || [ "$reboot" = "y" ]; then
1915-
reboot
1916-
fi
19171926
fi
19181927

19191928
# Clean-up
19201929
# Sort final configuration file
19211930
sort_config_file
19221931

1932+
reboot
19231933
# EOF

install/hst-install-ubuntu.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,7 @@ cp -rf $HESTIA_INSTALL_DIR/templates/web/skel/document_errors/* /var/www/documen
12061206
cp -rf $HESTIA_INSTALL_DIR/firewall $HESTIA/data/
12071207

12081208
# Configuring server hostname
1209-
$HESTIA/bin/v-change-sys-hostname $servername > /dev/null 2>&1
1209+
$HESTIA/bin/v-change-sys-hostname $servername 'no' > /dev/null 2>&1
12101210

12111211
# Generating SSL certificate
12121212
echo "[ * ] Generating default self-signed SSL certificate..."
@@ -1732,10 +1732,12 @@ if [ ! -z "$(grep ^admin: /etc/group)" ] && [ "$force" = 'yes' ]; then
17321732
fi
17331733

17341734
# Enable sftp jail
1735+
echo "[ * ] Enable SFTP jail..."
17351736
$HESTIA/bin/v-add-sys-sftp-jail > /dev/null 2>&1
17361737
check_result $? "can't enable sftp jail"
17371738

17381739
# Adding Hestia admin account
1740+
echo "[ * ] Create admin account..."
17391741
$HESTIA/bin/v-add-user admin $vpass $email default "System Administrator"
17401742
check_result $? "can't create admin user"
17411743
$HESTIA/bin/v-change-user-shell admin nologin
@@ -1756,6 +1758,7 @@ if [ "$iptables" = 'yes' ]; then
17561758
fi
17571759

17581760
# Get public IP
1761+
echo "[ * ] Configure System IP..."
17591762
pub_ip=$(curl --ipv4 -s https://ip.hestiacp.com/)
17601763
if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
17611764
if [ -e /etc/rc.local ]; then
@@ -1777,6 +1780,11 @@ if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
17771780
ip=$pub_ip
17781781
fi
17791782

1783+
if [ "$exim" = 'yes' ]; then
1784+
# Set HELO for IP as it didn't set during v-change-sys-hostname
1785+
$HESTIA/bin/v-change-sys-ip-helo $pub_ip $servername
1786+
fi
1787+
17801788
# Configuring libapache2-mod-remoteip
17811789
if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
17821790
cd /etc/apache2/mods-available
@@ -1864,6 +1872,9 @@ systemctl start hestia
18641872
check_result $? "hestia start failed"
18651873
chown admin:admin $HESTIA/data/sessions
18661874

1875+
# Create backup folder and set correct permission
1876+
mkdir -p /backup/
1877+
chmod 755 /backup/
18671878

18681879
#----------------------------------------------------------#
18691880
# Configure File Manager #
@@ -1872,6 +1883,8 @@ chown admin:admin $HESTIA/data/sessions
18721883
echo "[ * ] Configuring File Manager..."
18731884
$HESTIA/bin/v-add-sys-filemanager quiet
18741885

1886+
# create cronjob to generate ssl
1887+
echo "@reboot root sleep 10 && rm /etc/cron.d/hestia-ssl && /usr/local/hestia/bin/v-add-letsencrypt-host" > /etc/cron.d/hestia-ssl
18751888

18761889
#----------------------------------------------------------#
18771890
# Hestia Access Info #
@@ -1930,21 +1943,18 @@ cat $tmpfile
19301943
rm -f $tmpfile
19311944

19321945
# Add welcome message to notification panel
1933-
$HESTIA/bin/v-add-user-notification admin 'Welcome to Hestia Control Panel!' '<br>You are now ready to begin <a href="/add/user/">adding user accounts</a> and <a href="/add/web/">domains</a>. For help and assistance, view the <a href="https://docs.hestiacp.com/" target="_new">documentation</a> or visit our <a href="https://forum.hestiacp.com/" target="_new">user forum</a>.<br><br>Please report any bugs or issues via <a href="https://github.com/hestiacp/hestiacp/issues" target="_new"><i class="fab fa-github"></i> GitHub</a> or e-mail <a href="mailto:info@hestiacp.com?Subject="['$new_version'] Bug Report: ">info@hestiacp.com</a>.<br><br><b>Have a wonderful day!</b><br><br><i class="fas fa-heart status-icon red"></i> The Hestia Control Panel development team'
1946+
$HESTIA/bin/v-add-user-notification admin 'Welcome to Hestia Control Panel!' '<br>You are now ready to begin <a href="/add/user/">adding user accounts</a> and <a href="/add/web/">domains</a>. For help and assistance, view the <a href="https://docs.hestiacp.com/" target="_new">documentation</a> or visit our <a href="https://forum.hestiacp.com/" target="_new">user forum</a>.<br><br>Please report any bugs or issues via <a href="https://github.com/hestiacp/hestiacp/issues" target="_new"><i class="fab fa-github"></i> GitHub</a>.<br><br><b>Have a wonderful day!</b><br><br><i class="fas fa-heart status-icon red"></i> The Hestia Control Panel development team'
19341947

1935-
echo "[ ! ] IMPORTANT: You must logout or restart the server before continuing."
1948+
echo "[ ! ] IMPORTANT: System will reboot"
19361949
echo ""
19371950
if [ "$interactive" = 'yes' ]; then
1938-
echo -n " Do you want to reboot now? [Y/N] "
1951+
echo -n " Press any key to continue!"
19391952
read reboot
1940-
1941-
if [ "$reboot" = "Y" ] || [ "$reboot" = "y" ]; then
1942-
reboot
1943-
fi
19441953
fi
19451954

19461955
# Clean-up
19471956
# Sort final configuration file
19481957
sort_config_file
19491958

1959+
reboot
19501960
# EOF

install/upgrade/versions/1.4.0.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ if [ -e "/etc/nginx/nginx.conf" ]; then
1212
if [ -z "$check" ]; then
1313
echo "[ * ] Enabling nginx FastCGI cache support..."
1414
sed -i 's/# Cache bypass/# FastCGI cache\n fastcgi_cache_path \/var\/cache\/nginx\/micro levels=1:2 keys_zone=microcache:10m max_size=1024m inactive=30m;\n fastcgi_cache_key \"$scheme$request_method$host$request_uri\";\n fastcgi_cache_methods GET HEAD;\n fastcgi_cache_use_stale updating error timeout invalid_header http_500 http_503;\n fastcgi_ignore_headers Cache-Control Expires Set-Cookie;\n add_header X-FastCGI-Cache \$upstream_cache_status;\n\n # Cache bypass/g' /etc/nginx/nginx.conf
15+
sed -i 's/ fastcgi_cache_lock_timeout 5s;/ fastcgi_cache_lock_timeout 5s;\n fastcgi_cache_background_update on;\n fastcgi_cache_revalidate on;/g' /root/nginx.conf
16+
1517
fi
1618
fi
1719

1820
if [ -e "/etc/nginx/nginx.conf" ]; then
19-
echo "[ * ] Update Nginx.conf with changes to Cloudflare IP addresses"
21+
echo "[ * ] Updating nginx configuration with changes to Cloudflare IP addresses"
2022
sed -i 's/ set_real_ip_from 104.16.0.0\/12;/ set_real_ip_from 104.16.0.0\/13;\n set_real_ip_from 104.24.0.0\/14;/g' /etc/nginx/nginx.conf
2123
fi
2224

0 commit comments

Comments
 (0)