|
|
@@ -390,9 +390,9 @@ echo ' | _ | __/\__ \ |_| | (_| | |___| __/ '
|
|
|
echo ' |_| |_|\___||___/\__|_|\__,_|\____|_| '
|
|
|
echo
|
|
|
echo ' Hestia Control Panel'
|
|
|
-echo ' v1.0.1'
|
|
|
+echo ' v1.0.2'
|
|
|
echo -e "\n"
|
|
|
-echo "=============================================================================="
|
|
|
+echo "===================================================================="
|
|
|
echo -e "\n"
|
|
|
echo 'The following server components will be installed on your system:'
|
|
|
echo
|
|
|
@@ -458,13 +458,13 @@ fi
|
|
|
|
|
|
# Firewall stack
|
|
|
if [ "$iptables" = 'yes' ]; then
|
|
|
- echo -n ' - Iptables Firewall'
|
|
|
+ echo -n ' - Firewall (Iptables)'
|
|
|
fi
|
|
|
if [ "$iptables" = 'yes' ] && [ "$fail2ban" = 'yes' ]; then
|
|
|
echo -n ' + Fail2Ban Access Monitor'
|
|
|
fi
|
|
|
echo -e "\n"
|
|
|
-echo "=============================================================================="
|
|
|
+echo "===================================================================="
|
|
|
echo -e "\n"
|
|
|
|
|
|
# Asking for confirmation to proceed
|
|
|
@@ -541,24 +541,6 @@ fi
|
|
|
# Install repository #
|
|
|
#----------------------------------------------------------#
|
|
|
|
|
|
-# Updating system
|
|
|
-echo -ne "Updating currently installed packages, please wait... "
|
|
|
-apt-get -y upgrade >> $LOG &
|
|
|
-BACK_PID=$!
|
|
|
-
|
|
|
-# Check if package installation is done, print a spinner
|
|
|
-spin_i=1
|
|
|
-while kill -0 $BACK_PID > /dev/null 2>&1 ; do
|
|
|
- printf "\b${spinner:spin_i++%${#spinner}:1}"
|
|
|
- sleep 0.5
|
|
|
-done
|
|
|
-
|
|
|
-# Do a blank echo to get the \n back
|
|
|
-echo
|
|
|
-
|
|
|
-# Check Installation result
|
|
|
-check_result $? 'apt-get upgrade failed'
|
|
|
-
|
|
|
# Define apt conf location
|
|
|
apt=/etc/apt/sources.list.d
|
|
|
|
|
|
@@ -598,6 +580,25 @@ wget --quiet https://gpg.hestiacp.com/deb_signing.key -O /tmp/deb_signing.key
|
|
|
APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1 apt-key add /tmp/deb_signing.key > /dev/null 2>&1
|
|
|
echo
|
|
|
|
|
|
+# Updating system
|
|
|
+echo -ne "Updating currently installed packages, please wait... "
|
|
|
+apt-get -y upgrade >> $LOG &
|
|
|
+BACK_PID=$!
|
|
|
+
|
|
|
+# Check if package installation is done, print a spinner
|
|
|
+spin_i=1
|
|
|
+while kill -0 $BACK_PID > /dev/null 2>&1 ; do
|
|
|
+ printf "\b${spinner:spin_i++%${#spinner}:1}"
|
|
|
+ sleep 0.5
|
|
|
+done
|
|
|
+
|
|
|
+# Do a blank echo to get the \n back
|
|
|
+echo
|
|
|
+
|
|
|
+# Check Installation result
|
|
|
+check_result $? 'apt-get upgrade failed'
|
|
|
+
|
|
|
+
|
|
|
#----------------------------------------------------------#
|
|
|
# Backup #
|
|
|
#----------------------------------------------------------#
|
|
|
@@ -609,56 +610,56 @@ mkdir nginx apache2 php vsftpd proftpd bind exim4 dovecot clamd
|
|
|
mkdir spamassassin mysql postgresql hestia
|
|
|
|
|
|
# Backup nginx configuration
|
|
|
-service nginx stop > /dev/null 2>&1
|
|
|
+systemctl stop nginx > /dev/null 2>&1
|
|
|
cp -r /etc/nginx/* $hst_backups/nginx > /dev/null 2>&1
|
|
|
|
|
|
# Backup Apache configuration
|
|
|
-service apache2 stop > /dev/null 2>&1
|
|
|
+systemctl stop apache2 > /dev/null 2>&1
|
|
|
cp -r /etc/apache2/* $hst_backups/apache2 > /dev/null 2>&1
|
|
|
rm -f /etc/apache2/conf.d/* > /dev/null 2>&1
|
|
|
|
|
|
# Backup PHP-FPM configuration
|
|
|
-service php*-fpm stop > /dev/null 2>&1
|
|
|
+systemctl stop php*-fpm > /dev/null 2>&1
|
|
|
cp -r /etc/php/* $hst_backups/php/ > /dev/null 2>&1
|
|
|
|
|
|
# Backup Bind configuration
|
|
|
-service bind9 stop > /dev/null 2>&1
|
|
|
+systemctl stop bind9 > /dev/null 2>&1
|
|
|
cp -r /etc/bind/* $hst_backups/bind > /dev/null 2>&1
|
|
|
|
|
|
# Backup Vsftpd configuration
|
|
|
-service vsftpd stop > /dev/null 2>&1
|
|
|
+systemctl stop vsftpd > /dev/null 2>&1
|
|
|
cp /etc/vsftpd.conf $hst_backups/vsftpd > /dev/null 2>&1
|
|
|
|
|
|
# Backup ProFTPD configuration
|
|
|
-service proftpd stop > /dev/null 2>&1
|
|
|
+systemctl stop proftpd > /dev/null 2>&1
|
|
|
cp /etc/proftpd.conf $hst_backups/proftpd > /dev/null 2>&1
|
|
|
|
|
|
# Backup Exim configuration
|
|
|
-service exim4 stop > /dev/null 2>&1
|
|
|
+systemctl stop exim4 > /dev/null 2>&1
|
|
|
cp -r /etc/exim4/* $hst_backups/exim4 > /dev/null 2>&1
|
|
|
|
|
|
# Backup ClamAV configuration
|
|
|
-service clamav-daemon stop > /dev/null 2>&1
|
|
|
+systemctl stop clamav-daemon > /dev/null 2>&1
|
|
|
cp -r /etc/clamav/* $hst_backups/clamav > /dev/null 2>&1
|
|
|
|
|
|
# Backup SpamAssassin configuration
|
|
|
-service spamassassin stop > /dev/null 2>&1
|
|
|
+systemctl stop spamassassin > /dev/null 2>&1
|
|
|
cp -r /etc/spamassassin/* $hst_backups/spamassassin > /dev/null 2>&1
|
|
|
|
|
|
# Backup Dovecot configuration
|
|
|
-service dovecot stop > /dev/null 2>&1
|
|
|
+systemctl stop dovecot > /dev/null 2>&1
|
|
|
cp /etc/dovecot.conf $hst_backups/dovecot > /dev/null 2>&1
|
|
|
cp -r /etc/dovecot/* $hst_backups/dovecot > /dev/null 2>&1
|
|
|
|
|
|
# Backup MySQL/MariaDB configuration and data
|
|
|
-service mysql stop > /dev/null 2>&1
|
|
|
+systemctl stop mysql > /dev/null 2>&1
|
|
|
killall -9 mysqld > /dev/null 2>&1
|
|
|
mv /var/lib/mysql $hst_backups/mysql/mysql_datadir > /dev/null 2>&1
|
|
|
cp -r /etc/mysql/* $hst_backups/mysql > /dev/null 2>&1
|
|
|
mv -f /root/.my.cnf $hst_backups/mysql > /dev/null 2>&1
|
|
|
|
|
|
# Backup Hestia
|
|
|
-service hestia stop > /dev/null 2>&1
|
|
|
+systemctl stop hestia > /dev/null 2>&1
|
|
|
cp -r $HESTIA/* $hst_backups/hestia > /dev/null 2>&1
|
|
|
apt-get -y purge hestia hestia-nginx hestia-php > /dev/null 2>&1
|
|
|
rm -rf $HESTIA > /dev/null 2>&1
|
|
|
@@ -904,7 +905,7 @@ if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
|
|
|
fi
|
|
|
|
|
|
# Restart SSH daemon
|
|
|
-service ssh restart
|
|
|
+systemctl restart ssh
|
|
|
|
|
|
# Disable AWStats cron
|
|
|
rm -f /etc/cron.d/awstats
|
|
|
@@ -1022,7 +1023,6 @@ fi
|
|
|
# Mail stack
|
|
|
if [ "$exim" = 'yes' ]; then
|
|
|
echo "MAIL_SYSTEM='exim4'" >> $HESTIA/conf/hestia.conf
|
|
|
- echo "WEBMAIL_ALIAS='webmail'" >> $HESTIA/conf/hestia.conf
|
|
|
if [ "$clamd" = 'yes' ]; then
|
|
|
echo "ANTIVIRUS_SYSTEM='clamav-daemon'" >> $HESTIA/conf/hestia.conf
|
|
|
fi
|
|
|
@@ -1057,12 +1057,19 @@ echo "BACKUP_SYSTEM='local'" >> $HESTIA/conf/hestia.conf
|
|
|
echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
|
|
|
|
|
|
# Version & Release Branch
|
|
|
-echo "VERSION='1.0.1'" >> $HESTIA/conf/hestia.conf
|
|
|
+echo "VERSION='1.0.2'" >> $HESTIA/conf/hestia.conf
|
|
|
echo "RELEASE_BRANCH='release'" >> $HESTIA/conf/hestia.conf
|
|
|
|
|
|
# Installing hosting packages
|
|
|
cp -rf $hestiacp/packages $HESTIA/data/
|
|
|
|
|
|
+# Update nameservers in hosting package
|
|
|
+IFS='.' read -r -a domain_elements <<< "$servername"
|
|
|
+if [ ! -z "${domain_elements[-2]}" ] && [ ! -z "${domain_elements[-1]}" ]; then
|
|
|
+ serverdomain="${domain_elements[-2]}.${domain_elements[-1]}"
|
|
|
+ sed -i s/"domain.tld"/"$serverdomain"/g $HESTIA/data/packages/*.pkg
|
|
|
+fi
|
|
|
+
|
|
|
# Installing templates
|
|
|
cp -rf $hestiacp/templates $HESTIA/data/
|
|
|
|
|
|
@@ -1090,6 +1097,7 @@ key_start=$(grep -n "BEGIN RSA" /tmp/hst.pem |cut -f 1 -d:)
|
|
|
key_end=$(grep -n "END RSA" /tmp/hst.pem |cut -f 1 -d:)
|
|
|
|
|
|
# Adding SSL certificate
|
|
|
+echo "(*) Adding SSL certificate to Hestia Control Panel..."
|
|
|
cd $HESTIA/ssl
|
|
|
sed -n "1,${crt_end}p" /tmp/hst.pem > certificate.crt
|
|
|
sed -n "$key_start,${key_end}p" /tmp/hst.pem > certificate.key
|
|
|
@@ -1102,6 +1110,8 @@ if [ -z "$(grep nologin /etc/shells)" ]; then
|
|
|
echo "/usr/sbin/nologin" >> /etc/shells
|
|
|
fi
|
|
|
|
|
|
+# Install dhparam.pem
|
|
|
+cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
|
|
|
|
|
|
#----------------------------------------------------------#
|
|
|
# Configure Nginx #
|
|
|
@@ -1135,13 +1145,10 @@ if [ "$nginx" = 'yes' ]; then
|
|
|
ln -s $HESTIA/data/templates/web/nginx/PHP-$fpm_tpl.sh $HESTIA/data/templates/web/nginx/default.sh
|
|
|
ln -s $HESTIA/data/templates/web/nginx/PHP-$fpm_tpl.tpl $HESTIA/data/templates/web/nginx/default.tpl
|
|
|
ln -s $HESTIA/data/templates/web/nginx/PHP-$fpm_tpl.stpl $HESTIA/data/templates/web/nginx/default.stpl
|
|
|
- service php$fpm_v-fpm start >> $LOG
|
|
|
+ systemctl start php$fpm_v-fpm >> $LOG
|
|
|
check_result $? "php$fpm_v-fpm start failed"
|
|
|
fi
|
|
|
|
|
|
- # Install dhparam.
|
|
|
- cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl
|
|
|
-
|
|
|
# Update dns servers in nginx.conf
|
|
|
dns_resolver=$(cat /etc/resolv.conf | grep -i '^nameserver' | cut -d ' ' -f2 | tr '\r\n' ' ' | xargs)
|
|
|
for ip in $dns_resolver; do
|
|
|
@@ -1151,10 +1158,11 @@ if [ "$nginx" = 'yes' ]; then
|
|
|
done
|
|
|
if [ ! -z "$resolver" ]; then
|
|
|
sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /etc/nginx/nginx.conf
|
|
|
+ sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /usr/local/hestia/nginx/conf/nginx.conf
|
|
|
fi
|
|
|
|
|
|
update-rc.d nginx defaults > /dev/null 2>&1
|
|
|
- service nginx start >> $LOG
|
|
|
+ systemctl start nginx >> $LOG
|
|
|
check_result $? "nginx start failed"
|
|
|
fi
|
|
|
|
|
|
@@ -1199,11 +1207,11 @@ if [ "$apache" = 'yes' ]; then
|
|
|
fi
|
|
|
|
|
|
update-rc.d apache2 defaults > /dev/null 2>&1
|
|
|
- service apache2 start >> $LOG
|
|
|
+ systemctl start apache2 >> $LOG
|
|
|
check_result $? "apache2 start failed"
|
|
|
else
|
|
|
update-rc.d apache2 disable > /dev/null 2>&1
|
|
|
- service apache2 stop > /dev/null 2>&1
|
|
|
+ systemctl stop apache2 > /dev/null 2>&1
|
|
|
fi
|
|
|
|
|
|
|
|
|
@@ -1215,7 +1223,7 @@ if [ "$phpfpm" = 'yes' ]; then
|
|
|
echo "(*) Configuring PHP-FPM..."
|
|
|
cp -f $hestiacp/php-fpm/www.conf /etc/php/$fpm_v/fpm/pool.d/www.conf
|
|
|
update-rc.d php$fpm_v-fpm defaults > /dev/null 2>&1
|
|
|
- service php$fpm_v-fpm start >> $LOG
|
|
|
+ systemctl start php$fpm_v-fpm >> $LOG
|
|
|
check_result $? "php-fpm start failed"
|
|
|
fi
|
|
|
|
|
|
@@ -1255,7 +1263,7 @@ if [ "$vsftpd" = 'yes' ]; then
|
|
|
chown root:adm /var/log/xferlog
|
|
|
chmod 640 /var/log/xferlog
|
|
|
update-rc.d vsftpd defaults
|
|
|
- service vsftpd start
|
|
|
+ systemctl start vsftpd >> $LOG
|
|
|
check_result $? "vsftpd start failed"
|
|
|
|
|
|
fi
|
|
|
@@ -1270,7 +1278,7 @@ if [ "$proftpd" = 'yes' ]; then
|
|
|
echo "127.0.0.1 $servername" >> /etc/hosts
|
|
|
cp -f $hestiacp/proftpd/proftpd.conf /etc/proftpd/
|
|
|
update-rc.d proftpd defaults > /dev/null 2>&1
|
|
|
- service proftpd start >> $LOG
|
|
|
+ systemctl start proftpd >> $LOG
|
|
|
check_result $? "proftpd start failed"
|
|
|
fi
|
|
|
|
|
|
@@ -1294,7 +1302,7 @@ if [ "$mysql" = 'yes' ]; then
|
|
|
mysql_install_db >> $LOG
|
|
|
|
|
|
update-rc.d mysql defaults > /dev/null 2>&1
|
|
|
- service mysql start >> $LOG
|
|
|
+ systemctl start mysql >> $LOG
|
|
|
check_result $? "mariadb start failed"
|
|
|
|
|
|
# Securing MariaDB installation
|
|
|
@@ -1362,7 +1370,7 @@ if [ "$postgresql" = 'yes' ]; then
|
|
|
echo "(*) Configuring PostgreSQL database server..."
|
|
|
ppass=$(gen_pass)
|
|
|
cp -f $hestiacp/postgresql/pg_hba.conf /etc/postgresql/*/main/
|
|
|
- service postgresql restart
|
|
|
+ systemctl restart postgresql
|
|
|
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$ppass'"
|
|
|
|
|
|
# Configuring phpPgAdmin
|
|
|
@@ -1389,13 +1397,13 @@ if [ "$named" = 'yes' ]; then
|
|
|
aa-complain /usr/sbin/named > /dev/null 2>&1
|
|
|
echo "/home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2> /dev/null
|
|
|
if ! grep --quiet lxc /proc/1/environ; then
|
|
|
- service apparmor status > /dev/null 2>&1
|
|
|
+ systemctl status apparmor > /dev/null 2>&1
|
|
|
if [ $? -ne 0 ]; then
|
|
|
- service apparmor restart
|
|
|
+ systemctl restart apparmor >> $LOG
|
|
|
fi
|
|
|
fi
|
|
|
update-rc.d bind9 defaults
|
|
|
- service bind9 start
|
|
|
+ systemctl start bind9
|
|
|
check_result $? "bind9 start failed"
|
|
|
|
|
|
# Workaround for OpenVZ/Virtuozzo
|
|
|
@@ -1431,12 +1439,12 @@ if [ "$exim" = 'yes' ]; then
|
|
|
rm -f /etc/alternatives/mta
|
|
|
ln -s /usr/sbin/exim4 /etc/alternatives/mta
|
|
|
update-rc.d -f sendmail remove > /dev/null 2>&1
|
|
|
- service sendmail stop > /dev/null 2>&1
|
|
|
+ systemctl stop sendmail > /dev/null 2>&1
|
|
|
update-rc.d -f postfix remove > /dev/null 2>&1
|
|
|
- service postfix stop > /dev/null 2>&1
|
|
|
+ systemctl stop postfix > /dev/null 2>&1
|
|
|
|
|
|
update-rc.d exim4 defaults
|
|
|
- service exim4 start
|
|
|
+ systemctl start exim4 >> $LOG
|
|
|
check_result $? "exim4 start failed"
|
|
|
fi
|
|
|
|
|
|
@@ -1455,7 +1463,7 @@ if [ "$dovecot" = 'yes' ]; then
|
|
|
fi
|
|
|
chown -R root:root /etc/dovecot*
|
|
|
update-rc.d dovecot defaults
|
|
|
- service dovecot start
|
|
|
+ systemctl start dovecot >> $LOG
|
|
|
check_result $? "dovecot start failed"
|
|
|
fi
|
|
|
|
|
|
@@ -1478,7 +1486,7 @@ if [ "$clamd" = 'yes' ]; then
|
|
|
sleep 0.5
|
|
|
done
|
|
|
echo
|
|
|
- service clamav-daemon start
|
|
|
+ systemctl start clamav-daemon >> $LOG
|
|
|
check_result $? "clamav-daemon start failed"
|
|
|
fi
|
|
|
|
|
|
@@ -1491,7 +1499,7 @@ if [ "$spamd" = 'yes' ]; then
|
|
|
echo "(*) Configuring SpamAssassin..."
|
|
|
update-rc.d spamassassin defaults > /dev/null 2>&1
|
|
|
sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
|
|
|
- service spamassassin start >> $LOG
|
|
|
+ systemctl start spamassassin >> $LOG
|
|
|
check_result $? "spamassassin start failed"
|
|
|
unit_files="$(systemctl list-unit-files |grep spamassassin)"
|
|
|
if [[ "$unit_files" =~ "disabled" ]]; then
|
|
|
@@ -1540,10 +1548,10 @@ if [ "$dovecot" = 'yes' ] && [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
|
|
|
|
|
|
# Restart services
|
|
|
if [ "$apache" = 'yes' ]; then
|
|
|
- service apache2 restart
|
|
|
+ systemctl restart apache2 >> $LOG
|
|
|
fi
|
|
|
if [ "$nginx" = 'yes' ]; then
|
|
|
- service nginx restart
|
|
|
+ systemctl restart nginx >> $LOG
|
|
|
fi
|
|
|
fi
|
|
|
|
|
|
@@ -1575,7 +1583,7 @@ if [ "$fail2ban" = 'yes' ]; then
|
|
|
sed -i "${fline}s/false/true/" /etc/fail2ban/jail.local
|
|
|
fi
|
|
|
update-rc.d fail2ban defaults
|
|
|
- service fail2ban start
|
|
|
+ systemctl start fail2ban >> $LOG
|
|
|
check_result $? "fail2ban start failed"
|
|
|
fi
|
|
|
|
|
|
@@ -1662,9 +1670,6 @@ fi
|
|
|
$HESTIA/bin/v-add-web-domain admin $servername
|
|
|
check_result $? "can't create $servername domain"
|
|
|
|
|
|
-# Enable automatic updates
|
|
|
-$HESTIA/bin/v-add-cron-hestia-autoupdate
|
|
|
-
|
|
|
# Adding cron jobs
|
|
|
command="sudo $HESTIA/bin/v-update-sys-queue disk"
|
|
|
$HESTIA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
|
|
|
@@ -1680,7 +1685,10 @@ command="sudo $HESTIA/bin/v-update-user-stats"
|
|
|
$HESTIA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command"
|
|
|
command="sudo $HESTIA/bin/v-update-sys-rrd"
|
|
|
$HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
|
|
|
-service cron restart
|
|
|
+
|
|
|
+# Enable automatic updates
|
|
|
+$HESTIA/bin/v-add-cron-hestia-autoupdate
|
|
|
+systemctl restart cron
|
|
|
|
|
|
# Building initital rrd images
|
|
|
$HESTIA/bin/v-update-sys-rrd
|
|
|
@@ -1695,7 +1703,7 @@ $HESTIA/bin/v-change-sys-port $port
|
|
|
|
|
|
# Starting Hestia service
|
|
|
update-rc.d hestia defaults
|
|
|
-service hestia start
|
|
|
+systemctl start hestia
|
|
|
check_result $? "hestia start failed"
|
|
|
chown admin:admin $HESTIA/data/sessions
|
|
|
|
|
|
@@ -1711,7 +1719,7 @@ if [ "$host_ip" = "$ip" ]; then
|
|
|
fi
|
|
|
|
|
|
echo -e "\n"
|
|
|
-echo "=============================================================================="
|
|
|
+echo "===================================================================="
|
|
|
echo -e "\n"
|
|
|
|
|
|
# Sending notification to admin email
|