1.0.2.sh 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/sh
  2. # Hestia Control Panel upgrade script for target version 1.0.2
  3. #######################################################################################
  4. ####### Place additional commands below. #######
  5. #######################################################################################
  6. # Replace dhparam 1024 with dhparam 4096
  7. echo "[ * ] Increasing Diffie-Hellman Parameter strength to 4096-bit..."
  8. if [ -e /etc/ssl/dhparam.pem ]; then
  9. mv /etc/ssl/dhparam.pem $HESTIA_BACKUP/conf/
  10. fi
  11. cp -f $HESTIA/install/deb/ssl/dhparam.pem /etc/ssl/
  12. chmod 600 /etc/ssl/dhparam.pem
  13. # Enhance Vsftpd security
  14. if [ "$FTP_SYSTEM" = "vsftpd" ]; then
  15. echo "[ * ] Hardening Vsftpd SSL configuration..."
  16. cp -f /etc/vsftpd.conf $HESTIA_BACKUP/conf/
  17. sed -i "s|ssl_tlsv1=YES|ssl_tlsv1=NO|g" /etc/vsftpd.conf
  18. fi
  19. # Enhance Dovecot security
  20. if [ "$IMAP_SYSTEM" = "dovecot" ]; then
  21. echo "[ * ] Hardening Dovecot SSL configuration..."
  22. mv /etc/dovecot/conf.d/10-ssl.conf $HESTIA_BACKUP/conf/
  23. cp -f $HESTIA/install/deb/dovecot/conf.d/10-ssl.conf /etc/dovecot/conf.d/
  24. fi
  25. # Update DNS resolvers in hestia-nginx's configuration
  26. echo "[ * ] Updating DNS resolvers for Hestia Internal Web Server..."
  27. dns_resolver=$(cat /etc/resolv.conf | grep -i '^nameserver' | cut -d ' ' -f2 | tr '\r\n' ' ' | xargs)
  28. for ip in $dns_resolver; do
  29. if [[ $ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
  30. resolver="$ip $resolver"
  31. fi
  32. done
  33. if [ ! -z "$resolver" ]; then
  34. sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /usr/local/hestia/nginx/conf/nginx.conf
  35. fi
  36. # Remove Webalizer and set AWStats as default
  37. WEBALIZER_CHECK=$(cat $HESTIA/conf/hestia.conf | grep webalizer)
  38. if [ ! -z "$WEBALIZER_CHECK" ]; then
  39. echo "[ * ] Set awstats as default web statistics backend..."
  40. $HESTIA/bin/v-change-sys-config-value 'STATS_SYSTEM' 'awstats'
  41. fi
  42. # Remove old hestia.conf files from Apache & NGINX if they exist
  43. if [ -f "/etc/apache2/conf.d/hestia.conf" ]; then
  44. echo "[ * ] Removing old Apache configuration file from previous version of Hestia Control Panel..."
  45. rm -f /etc/apache2/conf.d/hestia.conf
  46. fi
  47. if [ -f "/etc/nginx/conf.d/hestia.conf" ]; then
  48. echo "[ * ] Removing old NGINX configuration file from previous version of Hestia Control Panel..."
  49. rm -f /etc/nginx/conf.d/hestia.conf
  50. fi
  51. # Update webmail templates to enable OCSP/SSL stapling
  52. if [ ! -z "$IMAP_SYSTEM" ]; then
  53. echo "[ * ] Enabling OCSP stapling support for webmail services..."
  54. $BIN/v-update-mail-templates > /dev/null 2>&1
  55. fi
  56. # Enhance webmail security
  57. if [ -e "/etc/nginx/conf.d/webmail.inc" ]; then
  58. cp -f /etc/nginx/conf.d/webmail.inc $HESTIA_BACKUP/conf/
  59. sed -i "s/config|temp|logs/README.md|config|temp|logs|bin|SQL|INSTALL|LICENSE|CHANGELOG|UPGRADING/g" /etc/nginx/conf.d/webmail.inc
  60. fi