hst-install-debian.sh 70 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988
  1. #!/bin/bash
  2. # Hestia Debian installer v1.0
  3. #----------------------------------------------------------#
  4. # Variables&Functions #
  5. #----------------------------------------------------------#
  6. export PATH=$PATH:/sbin
  7. export DEBIAN_FRONTEND=noninteractive
  8. RHOST='apt.hestiacp.com'
  9. GPG='gpg.hestiacp.com'
  10. VERSION='debian'
  11. HESTIA='/usr/local/hestia'
  12. LOG="/root/hst_install_backups/hst_install-$(date +%d%m%Y%H%M).log"
  13. memory=$(grep 'MemTotal' /proc/meminfo |tr ' ' '\n' |grep [0-9])
  14. hst_backups="/root/hst_install_backups/$(date +%d%m%Y%H%M)"
  15. spinner="/-\|"
  16. os='debian'
  17. architecture="$(uname -m)"
  18. release=$(cat /etc/debian_version | tr "." "\n" | head -n1)
  19. codename="$(cat /etc/os-release |grep VERSION= |cut -f 2 -d \(|cut -f 1 -d \))"
  20. HESTIA_INSTALL_DIR="$HESTIA/install/deb"
  21. VERBOSE='no'
  22. # Define software versions
  23. HESTIA_INSTALL_VER='1.4.10~aplpha'
  24. pma_v='5.1.1'
  25. rc_v="1.4.11"
  26. multiphp_v=("5.6" "7.0" "7.1" "7.2" "7.3" "7.4" "8.0")
  27. fpm_v="7.4"
  28. mariadb_v="10.5"
  29. if [ "$release" -eq 9 ]; then
  30. software="nginx apache2 apache2-utils apache2-suexec-custom
  31. libapache2-mod-fcgid libapache2-mod-php$fpm_v php$fpm_v php$fpm_v-common
  32. php$fpm_v-cgi php$fpm_v-mysql php$fpm_v-curl php$fpm_v-pgsql
  33. php$fpm_v-imagick php$fpm_v-imap php$fpm_v-ldap php$fpm_v-apcu awstats
  34. php$fpm_v-zip php$fpm_v-bz2 php$fpm_v-cli php$fpm_v-gd php$fpm_v-intl
  35. php$fpm_v-json php$fpm_v-mbstring php$fpm_v-opcache php$fpm_v-pspell
  36. php$fpm_v-readline php$fpm_v-xml vsftpd proftpd-basic bind9 exim4
  37. exim4-daemon-heavy clamav-daemon spamassassin dovecot-imapd
  38. dovecot-pop3d net-tools
  39. mariadb-client mariadb-common mariadb-server postgresql
  40. postgresql-contrib phppgadmin mc flex whois rssh git idn zip
  41. sudo bc ftp lsof rrdtool quota e2fslibs bsdutils e2fsprogs curl
  42. imagemagick fail2ban dnsutils bsdmainutils cron hestia=${HESTIA_INSTALL_VER} hestia-nginx
  43. hestia-php expect libmail-dkim-perl unrar-free vim-common acl sysstat
  44. rsyslog openssh-server setpriv ipset libapache2-mod-ruid2 zstd lsb-release"
  45. elif [ "$release" -eq 10 ]; then
  46. software="nginx apache2 apache2-utils apache2-suexec-custom
  47. apache2-suexec-pristine libapache2-mod-fcgid libapache2-mod-php$fpm_v
  48. php$fpm_v php$fpm_v-common php$fpm_v-cgi php$fpm_v-mysql php$fpm_v-curl
  49. php$fpm_v-pgsql php$fpm_v-imagick php$fpm_v-imap php$fpm_v-ldap
  50. php$fpm_v-apcu awstats php$fpm_v-zip php$fpm_v-bz2 php$fpm_v-cli
  51. php$fpm_v-gd php$fpm_v-intl php$fpm_v-json php$fpm_v-mbstring
  52. php$fpm_v-opcache php$fpm_v-pspell php$fpm_v-readline php$fpm_v-xml
  53. awstats vsftpd proftpd-basic bind9 exim4 exim4-daemon-heavy
  54. clamav-daemon spamassassin dovecot-imapd dovecot-pop3d
  55. net-tools mariadb-client
  56. mariadb-common mariadb-server postgresql postgresql-contrib
  57. phppgadmin mc flex whois git idn zip sudo bc ftp lsof rrdtool
  58. quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils
  59. bsdmainutils cron hestia=${HESTIA_INSTALL_VER} hestia-nginx hestia-php expect
  60. libmail-dkim-perl unrar-free vim-common acl sysstat rsyslog openssh-server
  61. util-linux ipset libapache2-mpm-itk zstd lsb-release"
  62. fi
  63. installer_dependencies="apt-transport-https curl dirmngr gnupg wget ca-certificates"
  64. # Defining help function
  65. help() {
  66. echo "Usage: $0 [OPTIONS]
  67. -a, --apache Install Apache [yes|no] default: yes
  68. -w, --phpfpm Install PHP-FPM [yes|no] default: yes
  69. -o, --multiphp Install Multi-PHP [yes|no] default: no
  70. -v, --vsftpd Install Vsftpd [yes|no] default: yes
  71. -j, --proftpd Install ProFTPD [yes|no] default: no
  72. -k, --named Install Bind [yes|no] default: yes
  73. -m, --mysql Install MariaDB [yes|no] default: yes
  74. -g, --postgresql Install PostgreSQL [yes|no] default: no
  75. -x, --exim Install Exim [yes|no] default: yes
  76. -z, --dovecot Install Dovecot [yes|no] default: yes
  77. -c, --clamav Install ClamAV [yes|no] default: yes
  78. -t, --spamassassin Install SpamAssassin [yes|no] default: yes
  79. -i, --iptables Install Iptables [yes|no] default: yes
  80. -b, --fail2ban Install Fail2ban [yes|no] default: yes
  81. -q, --quota Filesystem Quota [yes|no] default: no
  82. -d, --api Activate API [yes|no] default: yes
  83. -r, --port Change Backend Port default: 8083
  84. -l, --lang Default language default: en
  85. -y, --interactive Interactive install [yes|no] default: yes
  86. -s, --hostname Set hostname
  87. -e, --email Set admin email
  88. -p, --password Set admin password
  89. -D, --with-debs Path to Hestia debs
  90. -f, --force Force installation
  91. -h, --help Print this help
  92. Example: bash $0 -e demo@hestiacp.com -p p4ssw0rd --multiphp yes"
  93. exit 1
  94. }
  95. # Defining file download function
  96. download_file() {
  97. wget $1 -q --show-progress --progress=bar:force
  98. }
  99. # Defining password-gen function
  100. gen_pass() {
  101. head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16
  102. }
  103. # Defining return code check function
  104. check_result() {
  105. if [ $1 -ne 0 ]; then
  106. echo "Error: $2"
  107. exit $1
  108. fi
  109. }
  110. # Defining function to set default value
  111. set_default_value() {
  112. eval variable=\$$1
  113. if [ -z "$variable" ]; then
  114. eval $1=$2
  115. fi
  116. if [ "$variable" != 'yes' ] && [ "$variable" != 'no' ]; then
  117. eval $1=$2
  118. fi
  119. }
  120. # Defining function to set default language value
  121. set_default_lang() {
  122. if [ -z "$lang" ]; then
  123. eval lang=$1
  124. fi
  125. lang_list="ar az bg bs cs da de el en es fa fi fr hr hu id it ja ka ko nl no pl pt pt-br ro
  126. ru sr sv th tr uk ur vi zh-cn zh-tw"
  127. if !(echo $lang_list |grep -w $lang > /dev/null 2>&1); then
  128. eval lang=$1
  129. fi
  130. }
  131. # Define the default backend port
  132. set_default_port() {
  133. if [ -z "$port" ]; then
  134. eval port=$1
  135. fi
  136. }
  137. # Write configuration KEY/VALUE pair to $HESTIA/conf/hestia.conf
  138. write_config_value() {
  139. local key="$1"
  140. local value="$2"
  141. echo "$key='$value'" >> $HESTIA/conf/hestia.conf
  142. }
  143. # Sort configuration file values
  144. # Write final copy to $HESTIA/conf/hestia.conf for active usage
  145. # Duplicate file to $HESTIA/conf/defaults/hestia.conf to restore known good installation values
  146. sort_config_file(){
  147. sort $HESTIA/conf/hestia.conf -o /tmp/updconf
  148. mv $HESTIA/conf/hestia.conf $HESTIA/conf/hestia.conf.bak
  149. mv /tmp/updconf $HESTIA/conf/hestia.conf
  150. rm -f $HESTIA/conf/hestia.conf.bak
  151. if [ ! -d "$HESTIA/conf/defaults/" ]; then
  152. mkdir -p "$HESTIA/conf/defaults/"
  153. fi
  154. cp $HESTIA/conf/hestia.conf $HESTIA/conf/defaults/hestia.conf
  155. }
  156. #----------------------------------------------------------#
  157. # Verifications #
  158. #----------------------------------------------------------#
  159. # Creating temporary file
  160. tmpfile=$(mktemp -p /tmp)
  161. # Translating argument to --gnu-long-options
  162. for arg; do
  163. delim=""
  164. case "$arg" in
  165. --apache) args="${args}-a " ;;
  166. --phpfpm) args="${args}-w " ;;
  167. --vsftpd) args="${args}-v " ;;
  168. --proftpd) args="${args}-j " ;;
  169. --named) args="${args}-k " ;;
  170. --mysql) args="${args}-m " ;;
  171. --postgresql) args="${args}-g " ;;
  172. --exim) args="${args}-x " ;;
  173. --dovecot) args="${args}-z " ;;
  174. --clamav) args="${args}-c " ;;
  175. --spamassassin) args="${args}-t " ;;
  176. --iptables) args="${args}-i " ;;
  177. --fail2ban) args="${args}-b " ;;
  178. --multiphp) args="${args}-o " ;;
  179. --quota) args="${args}-q " ;;
  180. --port) args="${args}-r " ;;
  181. --lang) args="${args}-l " ;;
  182. --interactive) args="${args}-y " ;;
  183. --api) args="${args}-d " ;;
  184. --hostname) args="${args}-s " ;;
  185. --email) args="${args}-e " ;;
  186. --password) args="${args}-p " ;;
  187. --force) args="${args}-f " ;;
  188. --with-debs) args="${args}-D " ;;
  189. --help) args="${args}-h " ;;
  190. *) [[ "${arg:0:1}" == "-" ]] || delim="\""
  191. args="${args}${delim}${arg}${delim} ";;
  192. esac
  193. done
  194. eval set -- "$args"
  195. # Parsing arguments
  196. while getopts "a:w:v:j:k:m:g:d:x:z:c:t:i:b:r:o:q:l:y:s:e:p:D:fh" Option; do
  197. case $Option in
  198. a) apache=$OPTARG ;; # Apache
  199. w) phpfpm=$OPTARG ;; # PHP-FPM
  200. o) multiphp=$OPTARG ;; # Multi-PHP
  201. v) vsftpd=$OPTARG ;; # Vsftpd
  202. j) proftpd=$OPTARG ;; # Proftpd
  203. k) named=$OPTARG ;; # Named
  204. m) mysql=$OPTARG ;; # MariaDB
  205. g) postgresql=$OPTARG ;; # PostgreSQL
  206. x) exim=$OPTARG ;; # Exim
  207. z) dovecot=$OPTARG ;; # Dovecot
  208. c) clamd=$OPTARG ;; # ClamAV
  209. t) spamd=$OPTARG ;; # SpamAssassin
  210. i) iptables=$OPTARG ;; # Iptables
  211. b) fail2ban=$OPTARG ;; # Fail2ban
  212. q) quota=$OPTARG ;; # FS Quota
  213. r) port=$OPTARG ;; # Backend Port
  214. l) lang=$OPTARG ;; # Language
  215. d) api=$OPTARG ;; # Activate API
  216. y) interactive=$OPTARG ;; # Interactive install
  217. s) servername=$OPTARG ;; # Hostname
  218. e) email=$OPTARG ;; # Admin email
  219. p) vpass=$OPTARG ;; # Admin password
  220. D) withdebs=$OPTARG ;; # Hestia debs path
  221. f) force='yes' ;; # Force install
  222. h) help ;; # Help
  223. *) help ;; # Print help (default)
  224. esac
  225. done
  226. # Defining default software stack
  227. set_default_value 'nginx' 'yes'
  228. set_default_value 'apache' 'yes'
  229. set_default_value 'phpfpm' 'yes'
  230. set_default_value 'multiphp' 'no'
  231. set_default_value 'vsftpd' 'yes'
  232. set_default_value 'proftpd' 'no'
  233. set_default_value 'named' 'yes'
  234. set_default_value 'mysql' 'yes'
  235. set_default_value 'postgresql' 'no'
  236. set_default_value 'exim' 'yes'
  237. set_default_value 'dovecot' 'yes'
  238. if [ $memory -lt 1500000 ]; then
  239. set_default_value 'clamd' 'no'
  240. set_default_value 'spamd' 'no'
  241. elif [ $memory -lt 3000000 ]; then
  242. set_default_value 'clamd' 'no'
  243. set_default_value 'spamd' 'yes'
  244. else
  245. set_default_value 'clamd' 'yes'
  246. set_default_value 'spamd' 'yes'
  247. fi
  248. set_default_value 'iptables' 'yes'
  249. set_default_value 'fail2ban' 'yes'
  250. set_default_value 'quota' 'no'
  251. set_default_value 'interactive' 'yes'
  252. set_default_value 'api' 'yes'
  253. set_default_port '8083'
  254. set_default_lang 'en'
  255. # Checking software conflicts
  256. if [ "$proftpd" = 'yes' ]; then
  257. vsftpd='no'
  258. fi
  259. if [ "$exim" = 'no' ]; then
  260. clamd='no'
  261. spamd='no'
  262. dovecot='no'
  263. fi
  264. if [ "$iptables" = 'no' ]; then
  265. fail2ban='no'
  266. fi
  267. # Checking root permissions
  268. if [ "x$(id -u)" != 'x0' ]; then
  269. check_result 1 "Script can be run executed only by root"
  270. fi
  271. # Checking admin user account
  272. if [ ! -z "$(grep ^admin: /etc/passwd /etc/group)" ] && [ -z "$force" ]; then
  273. echo 'Please remove admin user account before proceeding.'
  274. echo 'If you want to do it automatically run installer with -f option:'
  275. echo -e "Example: bash $0 --force\n"
  276. check_result 1 "User admin exists"
  277. fi
  278. # Check if a default webserver was set
  279. if [ $apache = 'no' ] && [ $nginx = 'no' ]; then
  280. check_result 1 "No web server was selected"
  281. fi
  282. # Clear the screen once launch permissions have been verified
  283. clear
  284. # Configure apt to retry downloading on error
  285. if [ ! -f /etc/apt/apt.conf.d/80-retries ]; then
  286. echo "APT::Acquire::Retries \"3\";" > /etc/apt/apt.conf.d/80-retries
  287. fi
  288. # Welcome message
  289. echo "Welcome to the Hestia Control Panel installer!"
  290. echo
  291. echo "Please wait, the installer is now checking for missing dependencies..."
  292. echo
  293. # Update apt repository
  294. apt-get -qq update
  295. # Creating backup directory
  296. mkdir -p $hst_backups
  297. # Pre-install packages
  298. echo "[ * ] Installing dependencies..."
  299. apt-get -y install $installer_dependencies >> $LOG
  300. check_result $? "Package installation failed, check log file for more details."
  301. # Check if apparmor is installed
  302. if [ $(dpkg-query -W -f='${Status}' apparmor 2>/dev/null | grep -c "ok installed") -eq 0 ]; then
  303. apparmor='no'
  304. else
  305. apparmor='yes'
  306. fi
  307. # Checking repository availability
  308. wget --quiet "https://$GPG/deb_signing.key" -O /dev/null
  309. check_result $? "Unable to connect to the Hestia APT repository"
  310. # Check installed packages
  311. tmpfile=$(mktemp -p /tmp)
  312. dpkg --get-selections > $tmpfile
  313. conflicts_pkg="exim4 mariadb-server apache2 nginx hestia postfix"
  314. # Drop postfix from the list if exim should not be installed
  315. if [ "$exim" = 'no' ]; then
  316. conflicts_pkg=$(echo $conflicts_pkg | sed 's/postfix//g' | xargs)
  317. fi
  318. for pkg in $conflicts_pkg; do
  319. if [ ! -z "$(grep $pkg $tmpfile)" ]; then
  320. conflicts="$pkg* $conflicts"
  321. fi
  322. done
  323. rm -f $tmpfile
  324. if [ ! -z "$conflicts" ] && [ -z "$force" ]; then
  325. echo '!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!'
  326. echo
  327. echo 'WARNING: The following packages are already installed'
  328. echo "$conflicts"
  329. echo
  330. echo 'It is highly recommended that you remove them before proceeding.'
  331. echo
  332. echo '!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!'
  333. echo
  334. read -p 'Would you like to remove the conflicting packages? [y/n] ' answer
  335. if [ "$answer" = 'y' ] || [ "$answer" = 'Y' ]; then
  336. apt-get -qq purge $conflicts -y
  337. check_result $? 'apt-get remove failed'
  338. unset $answer
  339. else
  340. check_result 1 "Hestia Control Panel should be installed on a clean server."
  341. fi
  342. fi
  343. # Check network configuration
  344. if [ -d /etc/netplan ] && [ -z "$force" ]; then
  345. if [ -z "$(ls -A /etc/netplan)" ]; then
  346. echo '!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!'
  347. echo
  348. echo 'WARNING: Your network configuration may not be set up correctly.'
  349. echo 'Details: The netplan configuration directory is empty.'
  350. echo ''
  351. echo 'You may have a network configuration file that was created using'
  352. echo 'systemd-networkd.'
  353. echo ''
  354. echo 'It is strongly recommended to migrate to netplan, which is now the'
  355. echo 'default network configuration system in newer releases of Ubuntu.'
  356. echo ''
  357. echo 'While you can leave your configuration as-is, please note that you'
  358. echo 'will not be able to use additional IPs properly.'
  359. echo ''
  360. echo 'If you wish to continue and force the installation,'
  361. echo 'run this script with -f option:'
  362. echo "Example: bash $0 --force"
  363. echo
  364. echo '!!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!! !!!'
  365. echo
  366. check_result 1 "Unable to detect netplan configuration."
  367. fi
  368. fi
  369. # Validate whether installation script matches release version before continuing with install
  370. if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
  371. release_branch_ver=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/release/src/deb/hestia/control |grep "Version:" |awk '{print $2}')
  372. if [ "$HESTIA_INSTALL_VER" != "$release_branch_ver" ]; then
  373. echo
  374. echo -e "\e[91mInstallation aborted\e[0m"
  375. echo "===================================================================="
  376. echo -e "\e[33mERROR: Install script version does not match package version!\e[0m"
  377. echo -e "\e[33mPlease download the installer from the release branch in order to continue:\e[0m"
  378. echo ""
  379. echo -e "\e[33mhttps://raw.githubusercontent.com/hestiacp/hestiacp/release/install/hst-install.sh\e[0m"
  380. echo ""
  381. echo -e "\e[33mTo test pre-release versions, build the .deb packages and re-run the installer:\e[0m"
  382. echo -e " \e[33m./hst_autocompile.sh \e[1m--hestia branchname no\e[21m\e[0m"
  383. echo -e " \e[33m./hst-install.sh .. \e[1m--with-debs /tmp/hestiacp-src/debs\e[21m\e[0m"
  384. echo ""
  385. check_result 1 "Installation aborted"
  386. fi
  387. fi
  388. case $architecture in
  389. x86_64)
  390. ARCH="amd64"
  391. ;;
  392. aarch64)
  393. ARCH="arm64"
  394. if [ -z "$withdebs" ] || [ ! -d "$withdebs" ]; then
  395. echo
  396. echo -e "\e[91mInstallation aborted\e[0m"
  397. echo "===================================================================="
  398. echo -e "\e[33mERROR: HestiaCP on ARM is currently not supported with install from ATP!\e[0m"
  399. echo -e "\e[33mPlease compile your own packages for HestiaCP. \e[0m"
  400. echo -e "\e[33mPlease follow the instructions at: \e[0m"
  401. echo -e " \e[33mhttps://docs.hestiacp.com/development/panel.html#compiling\e[21m\e[0m"
  402. echo ""
  403. check_result 1 "Installation aborted"
  404. fi
  405. ;;
  406. *)
  407. echo
  408. echo -e "\e[91mInstallation aborted\e[0m"
  409. echo "===================================================================="
  410. echo -e "\e[33mERROR: $architecture is currently not supported!\e[0m"
  411. echo -e "\e[33mPlease verify the achitecture used is currenlty supported\e[0m"
  412. echo ""
  413. echo -e "\e[33mhttps://github.com/hestiacp/hestiacp/blob/main/README.md\e[0m"
  414. echo ""
  415. check_result 1 "Installation aborted"
  416. esac
  417. #----------------------------------------------------------#
  418. # Brief Info #
  419. #----------------------------------------------------------#
  420. install_welcome_message() {
  421. DISPLAY_VER=$(echo $HESTIA_INSTALL_VER | sed "s|~alpha||g" | sed "s|~beta||g")
  422. echo
  423. echo ' _ _ _ _ ____ ____ '
  424. echo ' | | | | ___ ___| |_(_) __ _ / ___| _ \ '
  425. echo ' | |_| |/ _ \/ __| __| |/ _` | | | |_) | '
  426. echo ' | _ | __/\__ \ |_| | (_| | |___| __/ '
  427. echo ' |_| |_|\___||___/\__|_|\__,_|\____|_| '
  428. echo " "
  429. echo " Hestia Control Panel "
  430. if [[ "$HESTIA_INSTALL_VER" =~ "beta" ]]; then
  431. echo " BETA RELEASE "
  432. fi
  433. if [[ "$HESTIA_INSTALL_VER" =~ "alpha" ]]; then
  434. echo " DEVELOPMENT SNAPSHOT "
  435. echo " NOT INTENDED FOR PRODUCTION USE "
  436. echo " USE AT YOUR OWN RISK "
  437. fi
  438. echo " ${DISPLAY_VER} "
  439. echo " www.hestiacp.com "
  440. echo
  441. echo "========================================================================"
  442. echo
  443. echo "Thank you for downloading Hestia Control Panel! In a few moments,"
  444. echo "we will begin installing the following components on your server:"
  445. echo
  446. }
  447. # Printing nice ASCII logo
  448. clear
  449. install_welcome_message
  450. # Web stack
  451. echo ' - NGINX Web / Proxy Server'
  452. if [ "$apache" = 'yes' ] && [ "$nginx" = 'no' ] ; then
  453. echo ' - Apache Web Server'
  454. fi
  455. if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
  456. echo ' - Apache Web Server (as backend)'
  457. fi
  458. if [ "$phpfpm" = 'yes' ] && [ "$multiphp" = 'no' ]; then
  459. echo ' - PHP-FPM Application Server'
  460. fi
  461. if [ "$multiphp" = 'yes' ]; then
  462. phpfpm='yes'
  463. echo ' - Multi-PHP Environment'
  464. fi
  465. # DNS stack
  466. if [ "$named" = 'yes' ]; then
  467. echo ' - Bind DNS Server'
  468. fi
  469. # Mail stack
  470. if [ "$exim" = 'yes' ]; then
  471. echo -n ' - Exim Mail Server'
  472. if [ "$clamd" = 'yes' ] || [ "$spamd" = 'yes' ] ; then
  473. echo -n ' + '
  474. if [ "$clamd" = 'yes' ]; then
  475. echo -n 'ClamAV '
  476. fi
  477. if [ "$spamd" = 'yes' ]; then
  478. if [ "$clamd" = 'yes' ]; then
  479. echo -n '+ '
  480. fi
  481. echo -n 'SpamAssassin'
  482. fi
  483. fi
  484. echo
  485. if [ "$dovecot" = 'yes' ]; then
  486. echo ' - Dovecot POP3/IMAP Server'
  487. fi
  488. fi
  489. # Database stack
  490. if [ "$mysql" = 'yes' ]; then
  491. echo ' - MariaDB Database Server'
  492. fi
  493. if [ "$postgresql" = 'yes' ]; then
  494. echo ' - PostgreSQL Database Server'
  495. fi
  496. # FTP stack
  497. if [ "$vsftpd" = 'yes' ]; then
  498. echo ' - Vsftpd FTP Server'
  499. fi
  500. if [ "$proftpd" = 'yes' ]; then
  501. echo ' - ProFTPD FTP Server'
  502. fi
  503. # Firewall stack
  504. if [ "$iptables" = 'yes' ]; then
  505. echo -n ' - Firewall (Iptables)'
  506. fi
  507. if [ "$iptables" = 'yes' ] && [ "$fail2ban" = 'yes' ]; then
  508. echo -n ' + Fail2Ban Access Monitor'
  509. fi
  510. echo -e "\n"
  511. echo "========================================================================"
  512. echo -e "\n"
  513. # Asking for confirmation to proceed
  514. if [ "$interactive" = 'yes' ]; then
  515. read -p 'Would you like to continue with the installation? [Y/N]: ' answer
  516. if [ "$answer" != 'y' ] && [ "$answer" != 'Y' ]; then
  517. echo 'Goodbye'
  518. exit 1
  519. fi
  520. # Asking for contact email
  521. if [ -z "$email" ]; then
  522. read -p 'Please enter admin email address: ' email
  523. fi
  524. # Asking to set FQDN hostname
  525. if [ -z "$servername" ]; then
  526. read -p "Please enter FQDN hostname [$(hostname -f)]: " servername
  527. fi
  528. fi
  529. # Generating admin password if it wasn't set
  530. if [ -z "$vpass" ]; then
  531. vpass=$(gen_pass)
  532. fi
  533. # Set hostname if it wasn't set
  534. if [ -z "$servername" ]; then
  535. servername=$(hostname -f)
  536. fi
  537. # Set FQDN if it wasn't set
  538. mask1='(([[:alnum:]](-?[[:alnum:]])*)\.)'
  539. mask2='*[[:alnum:]](-?[[:alnum:]])+\.[[:alnum:]]{2,}'
  540. if ! [[ "$servername" =~ ^${mask1}${mask2}$ ]]; then
  541. if [ ! -z "$servername" ]; then
  542. servername="$servername.example.com"
  543. else
  544. servername="example.com"
  545. fi
  546. echo "127.0.0.1 $servername" >> /etc/hosts
  547. fi
  548. # Set email if it wasn't set
  549. if [ -z "$email" ]; then
  550. email="admin@$servername"
  551. fi
  552. # Defining backup directory
  553. echo -e "Installation backup directory: $hst_backups"
  554. # Print Log File Path
  555. echo "Installation log file: $LOG"
  556. # Print new line
  557. echo
  558. #----------------------------------------------------------#
  559. # Checking swap #
  560. #----------------------------------------------------------#
  561. # Checking swap on small instances
  562. if [ -z "$(swapon -s)" ] && [ $memory -lt 1000000 ]; then
  563. fallocate -l 1G /swapfile
  564. chmod 600 /swapfile
  565. mkswap /swapfile
  566. swapon /swapfile
  567. echo "/swapfile none swap sw 0 0" >> /etc/fstab
  568. fi
  569. #----------------------------------------------------------#
  570. # Install repository #
  571. #----------------------------------------------------------#
  572. # Define apt conf location
  573. apt=/etc/apt/sources.list.d
  574. # Updating system
  575. echo "Adding required repositories to proceed with installation:"
  576. echo
  577. # Installing Nginx repo
  578. echo "[ * ] NGINX"
  579. echo "deb [arch=$ARCH] https://nginx.org/packages/mainline/$VERSION/ $codename nginx" > $apt/nginx.list
  580. apt-key adv --fetch-keys 'https://nginx.org/keys/nginx_signing.key' > /dev/null 2>&1
  581. # Installing sury PHP repo
  582. echo "[ * ] PHP"
  583. echo "deb https://packages.sury.org/php/ $codename main" > $apt/php.list
  584. apt-key adv --fetch-keys 'https://packages.sury.org/php/apt.gpg' > /dev/null 2>&1
  585. # Installing sury Apache2 repo
  586. if [ "$apache" = 'yes' ]; then
  587. echo "[ * ] Apache2"
  588. echo "deb https://packages.sury.org/apache2/ $codename main" > $apt/apache2.list
  589. apt-key adv --fetch-keys 'https://packages.sury.org/apache2/apt.gpg' > /dev/null 2>&1
  590. fi
  591. # Installing MariaDB repo
  592. if [ "$mysql" = 'yes' ]; then
  593. echo "[ * ] MariaDB"
  594. echo "deb [arch=$ARCH] https://mirror.mva-n.net/mariadb/repo/$mariadb_v/$VERSION $codename main" > $apt/mariadb.list
  595. apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc' > /dev/null 2>&1
  596. fi
  597. # Installing HestiaCP repo
  598. echo "[ * ] Hestia Control Panel"
  599. if [ "$ARCH" = "amd64" ]; then
  600. echo "deb https://$RHOST/ $codename main" > $apt/hestia.list
  601. else
  602. echo "# deb https://$RHOST/ $codename main" > $apt/hestia.list
  603. echo -e "\e[91m[ ! ] HestiaCP on ARM is currently in Development.\e[0m"
  604. echo -e "\e[91m This will mean that we don't provide any packages and you are responisble\e[0m"
  605. echo -e "\e[91m for building the packages your self. To build your own packeges see\e[0m"
  606. echo -e "\e[91m https://docs.hestiacp.com/development/panel.html#compiling\e[0m"
  607. fi
  608. apt-key adv --keyserver keyserver.ubuntu.com --recv-keys A189E93654F0B0E5 > /dev/null 2>&1
  609. # Installing PostgreSQL repo
  610. if [ "$postgresql" = 'yes' ]; then
  611. echo "[ * ] PostgreSQL"
  612. echo "deb [arch=$ARCH] https://apt.postgresql.org/pub/repos/apt/ $codename-pgdg main" > $apt/postgresql.list
  613. apt-key adv --fetch-keys 'https://www.postgresql.org/media/keys/ACCC4CF8.asc' > /dev/null 2>&1
  614. fi
  615. # Echo for a new line
  616. echo
  617. # Updating system
  618. echo -ne "Updating currently installed packages, please wait... "
  619. apt-get -qq update
  620. apt-get -y upgrade >> $LOG &
  621. BACK_PID=$!
  622. # Check if package installation is done, print a spinner
  623. spin_i=1
  624. while kill -0 $BACK_PID > /dev/null 2>&1 ; do
  625. printf "\b${spinner:spin_i++%${#spinner}:1}"
  626. sleep 0.5
  627. done
  628. # Do a blank echo to get the \n back
  629. echo
  630. # Check Installation result
  631. wait $BACK_PID
  632. check_result $? 'apt-get upgrade failed'
  633. #----------------------------------------------------------#
  634. # Backup #
  635. #----------------------------------------------------------#
  636. # Creating backup directory tree
  637. mkdir -p $hst_backups
  638. cd $hst_backups
  639. mkdir nginx apache2 php vsftpd proftpd bind exim4 dovecot clamd
  640. mkdir spamassassin mysql postgresql hestia
  641. # Backup nginx configuration
  642. systemctl stop nginx > /dev/null 2>&1
  643. cp -r /etc/nginx/* $hst_backups/nginx > /dev/null 2>&1
  644. # Backup Apache configuration
  645. systemctl stop apache2 > /dev/null 2>&1
  646. cp -r /etc/apache2/* $hst_backups/apache2 > /dev/null 2>&1
  647. rm -f /etc/apache2/conf.d/* > /dev/null 2>&1
  648. # Backup PHP-FPM configuration
  649. systemctl stop php*-fpm > /dev/null 2>&1
  650. cp -r /etc/php/* $hst_backups/php/ > /dev/null 2>&1
  651. # Backup Bind configuration
  652. systemctl stop bind9 > /dev/null 2>&1
  653. cp -r /etc/bind/* $hst_backups/bind > /dev/null 2>&1
  654. # Backup Vsftpd configuration
  655. systemctl stop vsftpd > /dev/null 2>&1
  656. cp /etc/vsftpd.conf $hst_backups/vsftpd > /dev/null 2>&1
  657. # Backup ProFTPD configuration
  658. systemctl stop proftpd > /dev/null 2>&1
  659. cp /etc/proftpd/* $hst_backups/proftpd > /dev/null 2>&1
  660. # Backup Exim configuration
  661. systemctl stop exim4 > /dev/null 2>&1
  662. cp -r /etc/exim4/* $hst_backups/exim4 > /dev/null 2>&1
  663. # Backup ClamAV configuration
  664. systemctl stop clamav-daemon > /dev/null 2>&1
  665. cp -r /etc/clamav/* $hst_backups/clamav > /dev/null 2>&1
  666. # Backup SpamAssassin configuration
  667. systemctl stop spamassassin > /dev/null 2>&1
  668. cp -r /etc/spamassassin/* $hst_backups/spamassassin > /dev/null 2>&1
  669. # Backup Dovecot configuration
  670. systemctl stop dovecot > /dev/null 2>&1
  671. cp /etc/dovecot.conf $hst_backups/dovecot > /dev/null 2>&1
  672. cp -r /etc/dovecot/* $hst_backups/dovecot > /dev/null 2>&1
  673. # Backup MySQL/MariaDB configuration and data
  674. systemctl stop mysql > /dev/null 2>&1
  675. killall -9 mysqld > /dev/null 2>&1
  676. mv /var/lib/mysql $hst_backups/mysql/mysql_datadir > /dev/null 2>&1
  677. cp -r /etc/mysql/* $hst_backups/mysql > /dev/null 2>&1
  678. mv -f /root/.my.cnf $hst_backups/mysql > /dev/null 2>&1
  679. # Backup Hestia
  680. systemctl stop hestia > /dev/null 2>&1
  681. cp -r $HESTIA/* $hst_backups/hestia > /dev/null 2>&1
  682. apt-get -y purge hestia hestia-nginx hestia-php > /dev/null 2>&1
  683. rm -rf $HESTIA > /dev/null 2>&1
  684. #----------------------------------------------------------#
  685. # Package Includes #
  686. #----------------------------------------------------------#
  687. if [ "$phpfpm" = 'yes' ]; then
  688. fpm="php$fpm_v php$fpm_v-common php$fpm_v-bcmath php$fpm_v-cli
  689. php$fpm_v-curl php$fpm_v-fpm php$fpm_v-gd php$fpm_v-intl
  690. php$fpm_v-mysql php$fpm_v-soap php$fpm_v-xml php$fpm_v-zip
  691. php$fpm_v-mbstring php$fpm_v-json php$fpm_v-bz2 php$fpm_v-pspell
  692. php$fpm_v-imagick"
  693. software="$software $fpm"
  694. fi
  695. #----------------------------------------------------------#
  696. # Package Excludes #
  697. #----------------------------------------------------------#
  698. # Excluding packages
  699. software=$(echo "$software" | sed -e "s/apache2.2-common//")
  700. if [ "$apache" = 'no' ]; then
  701. software=$(echo "$software" | sed -e "s/apache2 //")
  702. software=$(echo "$software" | sed -e "s/apache2-bin//")
  703. software=$(echo "$software" | sed -e "s/apache2-utils//")
  704. software=$(echo "$software" | sed -e "s/apache2-suexec-custom//")
  705. software=$(echo "$software" | sed -e "s/apache2.2-common//")
  706. software=$(echo "$software" | sed -e "s/libapache2-mod-rpaf//")
  707. software=$(echo "$software" | sed -e "s/libapache2-mod-fcgid//")
  708. software=$(echo "$software" | sed -e "s/libapache2-mod-php$fpm_v//")
  709. fi
  710. if [ "$vsftpd" = 'no' ]; then
  711. software=$(echo "$software" | sed -e "s/vsftpd//")
  712. fi
  713. if [ "$proftpd" = 'no' ]; then
  714. software=$(echo "$software" | sed -e "s/proftpd-basic//")
  715. software=$(echo "$software" | sed -e "s/proftpd-mod-vroot//")
  716. fi
  717. if [ "$named" = 'no' ]; then
  718. software=$(echo "$software" | sed -e "s/bind9//")
  719. fi
  720. if [ "$exim" = 'no' ]; then
  721. software=$(echo "$software" | sed -e "s/exim4 //")
  722. software=$(echo "$software" | sed -e "s/exim4-daemon-heavy//")
  723. software=$(echo "$software" | sed -e "s/dovecot-imapd//")
  724. software=$(echo "$software" | sed -e "s/dovecot-pop3d//")
  725. software=$(echo "$software" | sed -e "s/clamav-daemon//")
  726. software=$(echo "$software" | sed -e "s/spamassassin//")
  727. fi
  728. if [ "$clamd" = 'no' ]; then
  729. software=$(echo "$software" | sed -e "s/clamav-daemon//")
  730. fi
  731. if [ "$spamd" = 'no' ]; then
  732. software=$(echo "$software" | sed -e "s/spamassassin//")
  733. fi
  734. if [ "$dovecot" = 'no' ]; then
  735. software=$(echo "$software" | sed -e "s/dovecot-imapd//")
  736. software=$(echo "$software" | sed -e "s/dovecot-pop3d//")
  737. fi
  738. if [ "$mysql" = 'no' ]; then
  739. software=$(echo "$software" | sed -e "s/mariadb-server//")
  740. software=$(echo "$software" | sed -e "s/mariadb-client//")
  741. software=$(echo "$software" | sed -e "s/mariadb-common//")
  742. software=$(echo "$software" | sed -e "s/php$fpm_v-mysql//")
  743. fi
  744. if [ "$postgresql" = 'no' ]; then
  745. software=$(echo "$software" | sed -e "s/postgresql-contrib//")
  746. software=$(echo "$software" | sed -e "s/postgresql//")
  747. software=$(echo "$software" | sed -e "s/php$fpm_v-pgsql//")
  748. software=$(echo "$software" | sed -e "s/phppgadmin//")
  749. fi
  750. if [ "$fail2ban" = 'no' ]; then
  751. software=$(echo "$software" | sed -e "s/fail2ban//")
  752. fi
  753. if [ "$iptables" = 'no' ]; then
  754. software=$(echo "$software" | sed -e "s/ipset//")
  755. software=$(echo "$software" | sed -e "s/fail2ban//")
  756. fi
  757. if [ "$phpfpm" = 'yes' ]; then
  758. software=$(echo "$software" | sed -e "s/php$fpm_v-cgi//")
  759. software=$(echo "$software" | sed -e "s/libapache2-mpm-itk//")
  760. software=$(echo "$software" | sed -e "s/libapache2-mod-ruid2//")
  761. software=$(echo "$software" | sed -e "s/libapache2-mod-php$fpm_v//")
  762. fi
  763. if [ -d "$withdebs" ]; then
  764. software=$(echo "$software" | sed -e "s/hestia-nginx//")
  765. software=$(echo "$software" | sed -e "s/hestia-php//")
  766. software=$(echo "$software" | sed -e "s/hestia=${HESTIA_INSTALL_VER}//")
  767. fi
  768. #----------------------------------------------------------#
  769. # Install packages #
  770. #----------------------------------------------------------#
  771. # Disabling daemon autostart on apt-get install
  772. echo -e '#!/bin/sh\nexit 101' > /usr/sbin/policy-rc.d
  773. chmod a+x /usr/sbin/policy-rc.d
  774. # Installing apt packages
  775. echo "The installer is now downloading and installing all required packages."
  776. echo -ne "NOTE: This process may take 10 to 15 minutes to complete, please wait... "
  777. echo
  778. apt-get -y install $software > /dev/null 2>&1 &
  779. BACK_PID=$!
  780. # Check if package installation is done, print a spinner
  781. spin_i=1
  782. while kill -0 $BACK_PID > /dev/null 2>&1 ; do
  783. printf "\b${spinner:spin_i++%${#spinner}:1}"
  784. sleep 0.5
  785. done
  786. # Do a blank echo to get the \n back
  787. echo
  788. # Check Installation result
  789. wait $BACK_PID
  790. check_result $? "apt-get install failed"
  791. echo
  792. echo "========================================================================"
  793. echo
  794. # Install Hestia packages from local folder
  795. if [ ! -z "$withdebs" ] && [ -d "$withdebs" ]; then
  796. echo "[ * ] Installing local package files..."
  797. echo " - hestia core package"
  798. dpkg -i $withdebs/hestia_*.deb > /dev/null 2>&1
  799. if [ -z $(ls $withdebs/hestia-php_*.deb 2>/dev/null) ]; then
  800. echo " - hestia-php backend package (from apt)"
  801. apt-get -y install hestia-php > /dev/null 2>&1
  802. else
  803. echo " - hestia-php backend package"
  804. dpkg -i $withdebs/hestia-php_*.deb > /dev/null 2>&1
  805. fi
  806. if [ -z $(ls $withdebs/hestia-nginx_*.deb 2>/dev/null) ]; then
  807. echo " - hestia-nginx backend package (from apt)"
  808. apt-get -y install hestia-nginx > /dev/null 2>&1
  809. else
  810. echo " - hestia-nginx backend package"
  811. dpkg -i $withdebs/hestia-nginx_*.deb > /dev/null 2>&1
  812. fi
  813. fi
  814. # Restoring autostart policy
  815. rm -f /usr/sbin/policy-rc.d
  816. #----------------------------------------------------------#
  817. # Configure system #
  818. #----------------------------------------------------------#
  819. echo "[ * ] Configuring system settings..."
  820. # Enable SFTP subsystem for SSH
  821. sftp_subsys_enabled=$(grep -iE "^#?.*subsystem.+(sftp )?sftp-server" /etc/ssh/sshd_config)
  822. if [ ! -z "$sftp_subsys_enabled" ]; then
  823. sed -i -E "s/^#?.*Subsystem.+(sftp )?sftp-server/Subsystem sftp internal-sftp/g" /etc/ssh/sshd_config
  824. fi
  825. # Reduce SSH login grace time
  826. sed -i "s/[#]LoginGraceTime [[:digit:]]m/LoginGraceTime 1m/g" /etc/ssh/sshd_config
  827. # Disable SSH suffix broadcast
  828. if [ -z "$(grep "^DebianBanner no" /etc/ssh/sshd_config)" ]; then
  829. echo '' >> /etc/ssh/sshd_config
  830. echo 'DebianBanner no' >> /etc/ssh/sshd_config
  831. fi
  832. # Restart SSH daemon
  833. systemctl restart ssh
  834. # Disable AWStats cron
  835. rm -f /etc/cron.d/awstats
  836. # Set directory color
  837. if [ -z "$(grep 'LS_COLORS="$LS_COLORS:di=00;33"' /etc/profile)" ]; then
  838. echo 'LS_COLORS="$LS_COLORS:di=00;33"' >> /etc/profile
  839. fi
  840. # Register /sbin/nologin and /usr/sbin/nologin
  841. if [ -z "$(grep ^/sbin/nologin /etc/shells)" ]; then
  842. echo "/sbin/nologin" >> /etc/shells
  843. fi
  844. if [ -z "$(grep ^/usr/sbin/nologin /etc/shells)" ]; then
  845. echo "/usr/sbin/nologin" >> /etc/shells
  846. fi
  847. # Configuring NTP
  848. sed -i 's/#NTP=/NTP=pool.ntp.org/' /etc/systemd/timesyncd.conf
  849. systemctl enable systemd-timesyncd
  850. systemctl start systemd-timesyncd
  851. # Setup rssh
  852. if [ ! "$release" -eq 10 ]; then
  853. if [ -z "$(grep /usr/bin/rssh /etc/shells)" ]; then
  854. echo /usr/bin/rssh >> /etc/shells
  855. fi
  856. sed -i 's/#allowscp/allowscp/' /etc/rssh.conf
  857. sed -i 's/#allowsftp/allowsftp/' /etc/rssh.conf
  858. sed -i 's/#allowrsync/allowrsync/' /etc/rssh.conf
  859. chmod 755 /usr/bin/rssh
  860. fi
  861. # Restrict access to /proc fs
  862. # - Prevent unpriv users from seeing each other running processes
  863. mount -o remount,defaults,hidepid=2 /proc > /dev/null 2>&1
  864. if [ $? -ne 0 ]; then
  865. echo "Info: Cannot remount /proc (LXC containers require additional perm added to host apparmor profile)"
  866. else
  867. echo "@reboot root sleep 5 && mount -o remount,defaults,hidepid=2 /proc" > /etc/cron.d/hestia-proc
  868. fi
  869. #----------------------------------------------------------#
  870. # Configure Hestia #
  871. #----------------------------------------------------------#
  872. echo "[ * ] Configuring Hestia Control Panel..."
  873. # Installing sudo configuration
  874. mkdir -p /etc/sudoers.d
  875. cp -f $HESTIA_INSTALL_DIR/sudo/admin /etc/sudoers.d/
  876. chmod 440 /etc/sudoers.d/admin
  877. # Add Hestia global config
  878. if [[ ! -e /etc/hestiacp/hestia.conf ]]; then
  879. mkdir -p /etc/hestiacp
  880. echo -e "# Do not edit this file, will get overwritten on next upgrade, use /etc/hestiacp/local.conf instead\n\nexport HESTIA='/usr/local/hestia'\n\n[[ -f /etc/hestiacp/local.conf ]] && source /etc/hestiacp/local.conf" > /etc/hestiacp/hestia.conf
  881. fi
  882. # Configuring system env
  883. echo "export HESTIA='$HESTIA'" > /etc/profile.d/hestia.sh
  884. echo 'PATH=$PATH:'$HESTIA'/bin' >> /etc/profile.d/hestia.sh
  885. echo 'export PATH' >> /etc/profile.d/hestia.sh
  886. chmod 755 /etc/profile.d/hestia.sh
  887. source /etc/profile.d/hestia.sh
  888. # Configuring logrotate for Hestia logs
  889. cp -f $HESTIA_INSTALL_DIR/logrotate/hestia /etc/logrotate.d/hestia
  890. # Building directory tree and creating some blank files for Hestia
  891. mkdir -p $HESTIA/conf $HESTIA/log $HESTIA/ssl $HESTIA/data/ips \
  892. $HESTIA/data/queue $HESTIA/data/users $HESTIA/data/firewall \
  893. $HESTIA/data/sessions
  894. touch $HESTIA/data/queue/backup.pipe $HESTIA/data/queue/disk.pipe \
  895. $HESTIA/data/queue/webstats.pipe $HESTIA/data/queue/restart.pipe \
  896. $HESTIA/data/queue/traffic.pipe $HESTIA/data/queue/daily.pipe $HESTIA/log/system.log \
  897. $HESTIA/log/nginx-error.log $HESTIA/log/auth.log
  898. chmod 750 $HESTIA/conf $HESTIA/data/users $HESTIA/data/ips $HESTIA/log
  899. chmod -R 750 $HESTIA/data/queue
  900. chmod 660 $HESTIA/log/*
  901. rm -f /var/log/hestia
  902. ln -s $HESTIA/log /var/log/hestia
  903. chmod 770 $HESTIA/data/sessions
  904. # Generating Hestia configuration
  905. rm -f $HESTIA/conf/hestia.conf > /dev/null 2>&1
  906. touch $HESTIA/conf/hestia.conf
  907. chmod 660 $HESTIA/conf/hestia.conf
  908. # Web stack
  909. if [ "$apache" = 'yes' ]; then
  910. write_config_value "WEB_SYSTEM" "apache2"
  911. write_config_value "WEB_RGROUPS" "www-data"
  912. write_config_value "WEB_PORT" "8080"
  913. write_config_value "WEB_SSL_PORT" "8443"
  914. write_config_value "WEB_SSL" "mod_ssl"
  915. write_config_value "PROXY_SYSTEM" "nginx"
  916. write_config_value "PROXY_PORT" "80"
  917. write_config_value "PROXY_SSL_PORT" "443"
  918. write_config_value "STATS_SYSTEM" "awstats"
  919. fi
  920. if [ "$apache" = 'no' ]; then
  921. write_config_value "WEB_SYSTEM" "nginx"
  922. write_config_value "WEB_PORT" "80"
  923. write_config_value "WEB_SSL_PORT" "443"
  924. write_config_value "WEB_SSL" "openssl"
  925. write_config_value "STATS_SYSTEM" "awstats"
  926. fi
  927. if [ "$release" -ge 9 ] || [ "$multiphp" = 'yes' ]; then
  928. if [ "$phpfpm" = 'yes' ]; then
  929. write_config_value "WEB_BACKEND" "php-fpm"
  930. fi
  931. else
  932. if [ "$phpfpm" = 'yes' ]; then
  933. write_config_value "WEB_BACKEND" "php5-fpm"
  934. fi
  935. fi
  936. # Database stack
  937. if [ "$mysql" = 'yes' ]; then
  938. installed_db_types='mysql'
  939. fi
  940. if [ "$postgresql" = 'yes' ]; then
  941. installed_db_types="$installed_db_types,pgsql"
  942. fi
  943. if [ ! -z "$installed_db_types" ]; then
  944. db=$(echo "$installed_db_types" |\
  945. sed "s/,/\n/g"|\
  946. sort -r -u |\
  947. sed "/^$/d"|\
  948. sed ':a;N;$!ba;s/\n/,/g')
  949. write_config_value "DB_SYSTEM" "$db"
  950. fi
  951. # FTP stack
  952. if [ "$vsftpd" = 'yes' ]; then
  953. write_config_value "FTP_SYSTEM" "vsftpd"
  954. fi
  955. if [ "$proftpd" = 'yes' ]; then
  956. write_config_value "FTP_SYSTEM" "proftpd"
  957. fi
  958. # DNS stack
  959. if [ "$named" = 'yes' ]; then
  960. write_config_value "DNS_SYSTEM" "bind9"
  961. fi
  962. # Mail stack
  963. if [ "$exim" = 'yes' ]; then
  964. write_config_value "MAIL_SYSTEM" "exim4"
  965. if [ "$clamd" = 'yes' ]; then
  966. write_config_value "ANTIVIRUS_SYSTEM" "clamav-daemon"
  967. fi
  968. if [ "$spamd" = 'yes' ]; then
  969. write_config_value "ANTISPAM_SYSTEM" "spamassassin"
  970. fi
  971. if [ "$dovecot" = 'yes' ]; then
  972. write_config_value "IMAP_SYSTEM" "dovecot"
  973. fi
  974. fi
  975. # Cron daemon
  976. write_config_value "CRON_SYSTEM" "cron"
  977. # Firewall stack
  978. if [ "$iptables" = 'yes' ]; then
  979. write_config_value "FIREWALL_SYSTEM" "iptables"
  980. fi
  981. if [ "$iptables" = 'yes' ] && [ "$fail2ban" = 'yes' ]; then
  982. write_config_value "FIREWALL_EXTENSION" "fail2ban"
  983. fi
  984. # Disk quota
  985. if [ "$quota" = 'yes' ]; then
  986. write_config_value "DISK_QUOTA" "yes"
  987. else
  988. write_config_value "DISK_QUOTA" "no"
  989. fi
  990. # Backups
  991. write_config_value "BACKUP_SYSTEM" "local"
  992. write_config_value "BACKUP_GZIP" "4"
  993. write_config_value "BACKUP_MODE" "zstd"
  994. # Language
  995. write_config_value "LANGUAGE" "$lang"
  996. # Login in screen
  997. write_config_value "LOGIN_STYLE" "default"
  998. # Theme
  999. write_config_value "THEME" "dark"
  1000. # Inactive session timeout
  1001. write_config_value "INACTIVE_SESSION_TIMEOUT" "60"
  1002. # Version & Release Branch
  1003. write_config_value "VERSION" "${HESTIA_INSTALL_VER}"
  1004. write_config_value "RELEASE_BRANCH" "release"
  1005. # Email notifications after upgrade
  1006. write_config_value "UPGRADE_SEND_EMAIL" "true"
  1007. write_config_value "UPGRADE_SEND_EMAIL_LOG" "false"
  1008. # Installing hosting packages
  1009. cp -rf $HESTIA_INSTALL_DIR/packages $HESTIA/data/
  1010. # Update nameservers in hosting package
  1011. IFS='.' read -r -a domain_elements <<< "$servername"
  1012. if [ ! -z "${domain_elements[-2]}" ] && [ ! -z "${domain_elements[-1]}" ]; then
  1013. serverdomain="${domain_elements[-2]}.${domain_elements[-1]}"
  1014. sed -i s/"domain.tld"/"$serverdomain"/g $HESTIA/data/packages/*.pkg
  1015. fi
  1016. # Installing templates
  1017. cp -rf $HESTIA_INSTALL_DIR/templates $HESTIA/data/
  1018. mkdir -p /var/www/html
  1019. mkdir -p /var/www/document_errors
  1020. # Install default success page
  1021. cp -rf $HESTIA_INSTALL_DIR/templates/web/unassigned/index.html /var/www/html/
  1022. cp -rf $HESTIA_INSTALL_DIR/templates/web/skel/document_errors/* /var/www/document_errors/
  1023. # Installing firewall rules
  1024. cp -rf $HESTIA_INSTALL_DIR/firewall $HESTIA/data/
  1025. # Configuring server hostname
  1026. $HESTIA/bin/v-change-sys-hostname $servername 'no' > /dev/null 2>&1
  1027. # Generating SSL certificate
  1028. echo "[ * ] Generating default self-signed SSL certificate..."
  1029. $HESTIA/bin/v-generate-ssl-cert $(hostname) '' 'US' 'California' \
  1030. 'San Francisco' 'Hestia Control Panel' 'IT' > /tmp/hst.pem
  1031. # Parsing certificate file
  1032. crt_end=$(grep -n "END CERTIFICATE-" /tmp/hst.pem |cut -f 1 -d:)
  1033. key_start=$(grep -n "BEGIN RSA" /tmp/hst.pem |cut -f 1 -d:)
  1034. key_end=$(grep -n "END RSA" /tmp/hst.pem |cut -f 1 -d:)
  1035. # Adding SSL certificate
  1036. echo "[ * ] Adding SSL certificate to Hestia Control Panel..."
  1037. cd $HESTIA/ssl
  1038. sed -n "1,${crt_end}p" /tmp/hst.pem > certificate.crt
  1039. sed -n "$key_start,${key_end}p" /tmp/hst.pem > certificate.key
  1040. chown root:mail $HESTIA/ssl/*
  1041. chmod 660 $HESTIA/ssl/*
  1042. rm /tmp/hst.pem
  1043. # Install dhparam.pem
  1044. cp -f $HESTIA_INSTALL_DIR/ssl/dhparam.pem /etc/ssl
  1045. # Deleting old admin user
  1046. if [ ! -z "$(grep ^admin: /etc/passwd)" ] && [ "$force" = 'yes' ]; then
  1047. chattr -i /home/admin/conf > /dev/null 2>&1
  1048. userdel -f admin > /dev/null 2>&1
  1049. chattr -i /home/admin/conf > /dev/null 2>&1
  1050. mv -f /home/admin $hst_backups/home/ > /dev/null 2>&1
  1051. rm -f /tmp/sess_* > /dev/null 2>&1
  1052. fi
  1053. if [ ! -z "$(grep ^admin: /etc/group)" ] && [ "$force" = 'yes' ]; then
  1054. groupdel admin > /dev/null 2>&1
  1055. fi
  1056. # Enable sftp jail
  1057. echo "[ * ] Enable SFTP jail..."
  1058. $HESTIA/bin/v-add-sys-sftp-jail > /dev/null 2>&1
  1059. check_result $? "can't enable sftp jail"
  1060. # Adding Hestia admin account
  1061. $HESTIA/bin/v-add-user admin $vpass $email default "System Administrator"
  1062. check_result $? "can't create admin user"
  1063. $HESTIA/bin/v-change-user-shell admin nologin
  1064. $HESTIA/bin/v-change-user-role admin admin
  1065. $HESTIA/bin/v-change-user-language admin $lang
  1066. $HESTIA/bin/v-change-sys-config-value 'POLICY_SYSTEM_PROTECTED_ADMIN' 'yes'
  1067. #----------------------------------------------------------#
  1068. # Configure Nginx #
  1069. #----------------------------------------------------------#
  1070. echo "[ * ] Configuring NGINX..."
  1071. rm -f /etc/nginx/conf.d/*.conf
  1072. cp -f $HESTIA_INSTALL_DIR/nginx/nginx.conf /etc/nginx/
  1073. cp -f $HESTIA_INSTALL_DIR/nginx/status.conf /etc/nginx/conf.d/
  1074. cp -f $HESTIA_INSTALL_DIR/nginx/agents.conf /etc/nginx/conf.d/
  1075. cp -f $HESTIA_INSTALL_DIR/nginx/phpmyadmin.inc /etc/nginx/conf.d/
  1076. cp -f $HESTIA_INSTALL_DIR/nginx/phppgadmin.inc /etc/nginx/conf.d/
  1077. cp -f $HESTIA_INSTALL_DIR/logrotate/nginx /etc/logrotate.d/
  1078. mkdir -p /etc/nginx/conf.d/domains
  1079. mkdir -p /etc/nginx/modules-enabled
  1080. mkdir -p /var/log/nginx/domains
  1081. # Update dns servers in nginx.conf
  1082. dns_resolver=$(cat /etc/resolv.conf | grep -i '^nameserver' | cut -d ' ' -f2 | tr '\r\n' ' ' | xargs)
  1083. for ip in $dns_resolver; do
  1084. if [[ $ip =~ ^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
  1085. resolver="$ip $resolver"
  1086. fi
  1087. done
  1088. if [ ! -z "$resolver" ]; then
  1089. sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /etc/nginx/nginx.conf
  1090. sed -i "s/1.0.0.1 1.1.1.1/$resolver/g" /usr/local/hestia/nginx/conf/nginx.conf
  1091. fi
  1092. update-rc.d nginx defaults > /dev/null 2>&1
  1093. systemctl start nginx >> $LOG
  1094. check_result $? "nginx start failed"
  1095. #----------------------------------------------------------#
  1096. # Configure Apache #
  1097. #----------------------------------------------------------#
  1098. if [ "$apache" = 'yes' ]; then
  1099. echo "[ * ] Configuring Apache Web Server..."
  1100. mkdir -p /etc/apache2/conf.d
  1101. mkdir -p /etc/apache2/conf.d/domains
  1102. # Copy configuration files
  1103. cp -f $HESTIA_INSTALL_DIR/apache2/apache2.conf /etc/apache2/
  1104. cp -f $HESTIA_INSTALL_DIR/apache2/status.conf /etc/apache2/mods-available/hestia-status.conf
  1105. cp -f /etc/apache2/mods-available/status.load /etc/apache2/mods-available/hestia-status.load
  1106. cp -f $HESTIA_INSTALL_DIR/logrotate/apache2 /etc/logrotate.d/
  1107. # Enable needed modules
  1108. a2enmod rewrite > /dev/null 2>&1
  1109. a2enmod suexec > /dev/null 2>&1
  1110. a2enmod ssl > /dev/null 2>&1
  1111. a2enmod actions > /dev/null 2>&1
  1112. a2dismod --quiet status > /dev/null 2>&1
  1113. a2enmod --quiet hestia-status > /dev/null 2>&1
  1114. if [ "$phpfpm" = 'yes' ]; then
  1115. # Disable prefork and php, enable event
  1116. a2dismod php$fpm_v > /dev/null 2>&1
  1117. a2dismod mpm_prefork > /dev/null 2>&1
  1118. a2enmod mpm_event > /dev/null 2>&1
  1119. cp -f $HESTIA_INSTALL_DIR/apache2/hestia-event.conf /etc/apache2/conf.d/
  1120. else
  1121. if [ "$release" -eq 10 ]; then
  1122. a2enmod mpm_itk > /dev/null 2>&1
  1123. else
  1124. a2enmod ruid2 > /dev/null 2>&1
  1125. fi
  1126. fi
  1127. echo "# Powered by hestia" > /etc/apache2/sites-available/default
  1128. echo "# Powered by hestia" > /etc/apache2/sites-available/default-ssl
  1129. echo "# Powered by hestia" > /etc/apache2/ports.conf
  1130. echo -e "/home\npublic_html/cgi-bin" > /etc/apache2/suexec/www-data
  1131. touch /var/log/apache2/access.log /var/log/apache2/error.log
  1132. mkdir -p /var/log/apache2/domains
  1133. chmod a+x /var/log/apache2
  1134. chmod 640 /var/log/apache2/access.log /var/log/apache2/error.log
  1135. chmod 751 /var/log/apache2/domains
  1136. # Prevent remote access to server-status page
  1137. sed -i '/Allow from all/d' /etc/apache2/mods-available/hestia-status.conf
  1138. update-rc.d apache2 defaults > /dev/null 2>&1
  1139. systemctl start apache2 >> $LOG
  1140. check_result $? "apache2 start failed"
  1141. else
  1142. update-rc.d apache2 disable > /dev/null 2>&1
  1143. systemctl stop apache2 > /dev/null 2>&1
  1144. fi
  1145. #----------------------------------------------------------#
  1146. # Configure PHP-FPM #
  1147. #----------------------------------------------------------#
  1148. if [ "$multiphp" = 'yes' ] ; then
  1149. for v in "${multiphp_v[@]}"; do
  1150. rm -f /etc/php/$v/fpm/pool.d/*
  1151. echo "[ * ] Install PHP version $v..."
  1152. $HESTIA/bin/v-add-web-php "$v" > /dev/null 2>&1
  1153. done
  1154. fi
  1155. if [ "$phpfpm" = 'yes' ]; then
  1156. echo "[ * ] Configuring PHP-FPM..."
  1157. $HESTIA/bin/v-add-web-php "$fpm_v" > /dev/null 2>&1
  1158. cp -f $HESTIA_INSTALL_DIR/php-fpm/www.conf /etc/php/$fpm_v/fpm/pool.d/www.conf
  1159. update-rc.d php$fpm_v-fpm defaults > /dev/null 2>&1
  1160. systemctl start php$fpm_v-fpm >> $LOG
  1161. check_result $? "php-fpm start failed"
  1162. update-alternatives --set php /usr/bin/php$fpm_v > /dev/null 2>&1
  1163. fi
  1164. #----------------------------------------------------------#
  1165. # Configure PHP #
  1166. #----------------------------------------------------------#
  1167. echo "[ * ] Configuring PHP..."
  1168. ZONE=$(timedatectl > /dev/null 2>&1|grep Timezone|awk '{print $2}')
  1169. if [ -z "$ZONE" ]; then
  1170. ZONE='UTC'
  1171. fi
  1172. for pconf in $(find /etc/php* -name php.ini); do
  1173. sed -i "s/;date.timezone =/date.timezone = $ZONE/g" $pconf
  1174. sed -i 's%_open_tag = Off%_open_tag = On%g' $pconf
  1175. done
  1176. # Cleanup php session files not changed in the last 7 days (60*24*7 minutes)
  1177. echo '#!/bin/sh' > /etc/cron.daily/php-session-cleanup
  1178. echo "find -O3 /home/*/tmp/ -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin '+10080' -delete > /dev/null 2>&1" >> /etc/cron.daily/php-session-cleanup
  1179. echo "find -O3 $HESTIA/data/sessions/ -ignore_readdir_race -depth -mindepth 1 -name 'sess_*' -type f -cmin '+10080' -delete > /dev/null 2>&1" >> /etc/cron.daily/php-session-cleanup
  1180. chmod 755 /etc/cron.daily/php-session-cleanup
  1181. #----------------------------------------------------------#
  1182. # Configure Vsftpd #
  1183. #----------------------------------------------------------#
  1184. if [ "$vsftpd" = 'yes' ]; then
  1185. echo "[ * ] Configuring Vsftpd server..."
  1186. cp -f $HESTIA_INSTALL_DIR/vsftpd/vsftpd.conf /etc/
  1187. touch /var/log/vsftpd.log
  1188. chown root:adm /var/log/vsftpd.log
  1189. chmod 640 /var/log/vsftpd.log
  1190. touch /var/log/xferlog
  1191. chown root:adm /var/log/xferlog
  1192. chmod 640 /var/log/xferlog
  1193. update-rc.d vsftpd defaults
  1194. systemctl start vsftpd
  1195. check_result $? "vsftpd start failed"
  1196. fi
  1197. #----------------------------------------------------------#
  1198. # Configure ProFTPD #
  1199. #----------------------------------------------------------#
  1200. if [ "$proftpd" = 'yes' ]; then
  1201. echo "[ * ] Configuring ProFTPD server..."
  1202. echo "127.0.0.1 $servername" >> /etc/hosts
  1203. cp -f $HESTIA_INSTALL_DIR/proftpd/proftpd.conf /etc/proftpd/
  1204. cp -f $HESTIA_INSTALL_DIR/proftpd/tls.conf /etc/proftpd/
  1205. update-rc.d proftpd defaults > /dev/null 2>&1
  1206. systemctl start proftpd >> $LOG
  1207. check_result $? "proftpd start failed"
  1208. fi
  1209. #----------------------------------------------------------#
  1210. # Configure MariaDB #
  1211. #----------------------------------------------------------#
  1212. if [ "$mysql" = 'yes' ]; then
  1213. echo "[ * ] Configuring MariaDB database server..."
  1214. mycnf="my-small.cnf"
  1215. if [ $memory -gt 1200000 ]; then
  1216. mycnf="my-medium.cnf"
  1217. fi
  1218. if [ $memory -gt 3900000 ]; then
  1219. mycnf="my-large.cnf"
  1220. fi
  1221. # Remove symbolic link
  1222. rm -f /etc/mysql/my.cnf
  1223. # Configuring MariaDB
  1224. cp -f $HESTIA_INSTALL_DIR/mysql/$mycnf /etc/mysql/my.cnf
  1225. mysql_install_db >> $LOG
  1226. update-rc.d mysql defaults > /dev/null 2>&1
  1227. systemctl start mysql >> $LOG
  1228. check_result $? "mariadb start failed"
  1229. # Securing MariaDB installation
  1230. mpass=$(gen_pass)
  1231. mysqladmin -u root password $mpass >> $LOG
  1232. echo -e "[client]\npassword='$mpass'\n" > /root/.my.cnf
  1233. chmod 600 /root/.my.cnf
  1234. # Clear MariaDB Test Users and Databases
  1235. mysql -e "DELETE FROM mysql.user WHERE User=''"
  1236. mysql -e "DROP DATABASE test" > /dev/null 2>&1
  1237. mysql -e "DELETE FROM mysql.db WHERE Db='test' OR Db='test\\_%'"
  1238. mysql -e "DELETE FROM mysql.user WHERE user='';"
  1239. mysql -e "DELETE FROM mysql.user WHERE password='' AND authentication_string='';"
  1240. fi
  1241. #----------------------------------------------------------#
  1242. # Configure phpMyAdmin #
  1243. #----------------------------------------------------------#
  1244. if [ "$mysql" = 'yes' ]; then
  1245. # Display upgrade information
  1246. echo "[ * ] Installing phpMyAdmin version v$pma_v..."
  1247. # Download latest phpmyadmin release
  1248. wget --quiet --retry-connrefused https://files.phpmyadmin.net/phpMyAdmin/$pma_v/phpMyAdmin-$pma_v-all-languages.tar.gz
  1249. # Unpack files
  1250. tar xzf phpMyAdmin-$pma_v-all-languages.tar.gz
  1251. # Create folders
  1252. mkdir -p /usr/share/phpmyadmin
  1253. mkdir -p /etc/phpmyadmin
  1254. mkdir -p /etc/phpmyadmin/conf.d/
  1255. mkdir /usr/share/phpmyadmin/tmp
  1256. # Configuring Apache2 for PHPMYADMIN
  1257. if [ "$apache" = 'yes' ]; then
  1258. cp -f $HESTIA_INSTALL_DIR/pma/apache.conf /etc/phpmyadmin/
  1259. ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
  1260. fi
  1261. # Overwrite old files
  1262. cp -rf phpMyAdmin-$pma_v-all-languages/* /usr/share/phpmyadmin
  1263. # Create copy of config file
  1264. cp -f $HESTIA_INSTALL_DIR/phpmyadmin/config.inc.php /etc/phpmyadmin/
  1265. mkdir -p /var/lib/phpmyadmin/tmp
  1266. chmod 770 /var/lib/phpmyadmin/tmp
  1267. chown root:www-data /usr/share/phpmyadmin/tmp
  1268. # Set config and log directory
  1269. sed -i "s|define('CONFIG_DIR', ROOT_PATH);|define('CONFIG_DIR', '/etc/phpmyadmin/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
  1270. sed -i "s|define('TEMP_DIR', ROOT_PATH . 'tmp/');|define('TEMP_DIR', '/var/lib/phpmyadmin/tmp/');|" /usr/share/phpmyadmin/libraries/vendor_config.php
  1271. # Create temporary folder and change permission
  1272. chmod 770 /usr/share/phpmyadmin/tmp
  1273. chown root:www-data /usr/share/phpmyadmin/tmp
  1274. # Generate blow fish
  1275. blowfish=$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 32)
  1276. sed -i "s|%blowfish_secret%|$blowfish|" /etc/phpmyadmin/config.inc.php
  1277. # Clean Up
  1278. rm -fr phpMyAdmin-$pma_v-all-languages
  1279. rm -f phpMyAdmin-$pma_v-all-languages.tar.gz
  1280. write_config_value "DB_PMA_ALIAS" "phpmyadmin"
  1281. $HESTIA/bin/v-change-sys-db-alias 'pma' "phpmyadmin"
  1282. # Special thanks to Pavel Galkin (https://skurudo.ru)
  1283. # https://github.com/skurudo/phpmyadmin-fixer
  1284. source $HESTIA_INSTALL_DIR/phpmyadmin/pma.sh > /dev/null 2>&1
  1285. # limit access to /etc/phpmyadmin/
  1286. chown -R root:www-data /etc/phpmyadmin/
  1287. chmod -R 640 /etc/phpmyadmin/*
  1288. chmod 750 /etc/phpmyadmin/conf.d/
  1289. fi
  1290. #----------------------------------------------------------#
  1291. # Configure PostgreSQL #
  1292. #----------------------------------------------------------#
  1293. if [ "$postgresql" = 'yes' ]; then
  1294. echo "[ * ] Configuring PostgreSQL database server..."
  1295. ppass=$(gen_pass)
  1296. cp -f $HESTIA_INSTALL_DIR/postgresql/pg_hba.conf /etc/postgresql/*/main/
  1297. systemctl restart postgresql
  1298. sudo -iu postgres psql -c "ALTER USER postgres WITH PASSWORD '$ppass'"
  1299. # Configuring phpPgAdmin
  1300. if [ "$apache" = 'yes' ]; then
  1301. cp -f $HESTIA_INSTALL_DIR/pga/phppgadmin.conf /etc/apache2/conf.d/
  1302. fi
  1303. cp -f $HESTIA_INSTALL_DIR/pga/config.inc.php /etc/phppgadmin/
  1304. write_config_value "DB_PGA_ALIAS" "phppgadmin"
  1305. $HESTIA/bin/v-change-sys-db-alias 'pga' "phppgadmin"
  1306. fi
  1307. #----------------------------------------------------------#
  1308. # Configure Bind #
  1309. #----------------------------------------------------------#
  1310. if [ "$named" = 'yes' ]; then
  1311. echo "[ * ] Configuring Bind DNS server..."
  1312. cp -f $HESTIA_INSTALL_DIR/bind/named.conf /etc/bind/
  1313. cp -f $HESTIA_INSTALL_DIR/bind/named.conf.options /etc/bind/
  1314. chown root:bind /etc/bind/named.conf
  1315. chown root:bind /etc/bind/named.conf.options
  1316. chown bind:bind /var/cache/bind
  1317. chmod 640 /etc/bind/named.conf
  1318. chmod 640 /etc/bind/named.conf.options
  1319. aa-complain /usr/sbin/named 2>/dev/null
  1320. if [ "$apparmor" = 'yes' ]; then
  1321. echo "/home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2> /dev/null
  1322. systemctl status apparmor >/dev/null 2>&1
  1323. if [ $? -ne 0 ]; then
  1324. systemctl restart apparmor
  1325. fi
  1326. fi
  1327. update-rc.d bind9 defaults
  1328. systemctl start bind9
  1329. check_result $? "bind9 start failed"
  1330. # Workaround for OpenVZ/Virtuozzo
  1331. if [ -e "/proc/vz/veinfo" ] && [ -e "/etc/rc.local" ]; then
  1332. sed -i "s/^exit 0/service bind9 restart\nexit 0/" /etc/rc.local
  1333. fi
  1334. fi
  1335. #----------------------------------------------------------#
  1336. # Configure Exim #
  1337. #----------------------------------------------------------#
  1338. if [ "$exim" = 'yes' ]; then
  1339. echo "[ * ] Configuring Exim mail server..."
  1340. gpasswd -a Debian-exim mail > /dev/null 2>&1
  1341. cp -f $HESTIA_INSTALL_DIR/exim/exim4.conf.template /etc/exim4/
  1342. cp -f $HESTIA_INSTALL_DIR/exim/dnsbl.conf /etc/exim4/
  1343. cp -f $HESTIA_INSTALL_DIR/exim/spam-blocks.conf /etc/exim4/
  1344. touch /etc/exim4/white-blocks.conf
  1345. if [ "$spamd" = 'yes' ]; then
  1346. sed -i "s/#SPAM/SPAM/g" /etc/exim4/exim4.conf.template
  1347. fi
  1348. if [ "$clamd" = 'yes' ]; then
  1349. sed -i "s/#CLAMD/CLAMD/g" /etc/exim4/exim4.conf.template
  1350. fi
  1351. chmod 640 /etc/exim4/exim4.conf.template
  1352. rm -rf /etc/exim4/domains
  1353. mkdir -p /etc/exim4/domains
  1354. rm -f /etc/alternatives/mta
  1355. ln -s /usr/sbin/exim4 /etc/alternatives/mta
  1356. update-rc.d -f sendmail remove > /dev/null 2>&1
  1357. systemctl stop sendmail > /dev/null 2>&1
  1358. update-rc.d -f postfix remove > /dev/null 2>&1
  1359. systemctl stop postfix > /dev/null 2>&1
  1360. update-rc.d exim4 defaults
  1361. systemctl start exim4
  1362. check_result $? "exim4 start failed"
  1363. fi
  1364. #----------------------------------------------------------#
  1365. # Configure Dovecot #
  1366. #----------------------------------------------------------#
  1367. if [ "$dovecot" = 'yes' ]; then
  1368. echo "[ * ] Configuring Dovecot POP/IMAP mail server..."
  1369. gpasswd -a dovecot mail > /dev/null 2>&1
  1370. cp -rf $HESTIA_INSTALL_DIR/dovecot /etc/
  1371. cp -f $HESTIA_INSTALL_DIR/logrotate/dovecot /etc/logrotate.d/
  1372. chown -R root:root /etc/dovecot*
  1373. if [ "$release" -eq 9 ] || [ "$release" -eq 10 ]; then
  1374. rm -f /etc/dovecot/conf.d/15-mailboxes.conf
  1375. fi
  1376. #Alter config for 2.2
  1377. version=$(dovecot --version | cut -f -2 -d .);
  1378. if [ "$version" = "2.2" ]; then
  1379. echo "[ * ] Downgrade dovecot config to sync with 2.2 settings"
  1380. sed -i 's|#ssl_dh_parameters_length = 4096|ssl_dh_parameters_length = 4096|g' /etc/dovecot/conf.d/10-ssl.conf
  1381. sed -i 's|ssl_dh = </etc/ssl/dhparam.pem|#ssl_dh = </etc/ssl/dhparam.pem|g' /etc/dovecot/conf.d/10-ssl.conf
  1382. sed -i 's|ssl_min_protocol = TLSv1.1|ssl_protocols = !SSLv3 !TLSv1|g' /etc/dovecot/conf.d/10-ssl.conf
  1383. fi
  1384. update-rc.d dovecot defaults
  1385. systemctl start dovecot
  1386. check_result $? "dovecot start failed"
  1387. fi
  1388. #----------------------------------------------------------#
  1389. # Configure ClamAV #
  1390. #----------------------------------------------------------#
  1391. if [ "$clamd" = 'yes' ]; then
  1392. gpasswd -a clamav mail > /dev/null 2>&1
  1393. gpasswd -a clamav Debian-exim > /dev/null 2>&1
  1394. cp -f $HESTIA_INSTALL_DIR/clamav/clamd.conf /etc/clamav/
  1395. update-rc.d clamav-daemon defaults
  1396. if [ ! -d "/var/run/clamav" ]; then
  1397. mkdir /var/run/clamav
  1398. fi
  1399. chown -R clamav:clamav /var/run/clamav
  1400. if [ -e "/lib/systemd/system/clamav-daemon.service" ]; then
  1401. exec_pre1='ExecStartPre=-/bin/mkdir -p /var/run/clamav'
  1402. exec_pre2='ExecStartPre=-/bin/chown -R clamav:clamav /var/run/clamav'
  1403. sed -i "s|\[Service\]/|[Service]\n$exec_pre1\n$exec_pre2|g" \
  1404. /lib/systemd/system/clamav-daemon.service
  1405. systemctl daemon-reload
  1406. fi
  1407. echo -ne "[ * ] Installing ClamAV anti-virus definitions... "
  1408. /usr/bin/freshclam >> $LOG &
  1409. BACK_PID=$!
  1410. spin_i=1
  1411. while kill -0 $BACK_PID > /dev/null 2>&1 ; do
  1412. printf "\b${spinner:spin_i++%${#spinner}:1}"
  1413. sleep 0.5
  1414. done
  1415. echo
  1416. systemctl start clamav-daemon
  1417. check_result $? "clamav-daemon start failed"
  1418. fi
  1419. #----------------------------------------------------------#
  1420. # Configure SpamAssassin #
  1421. #----------------------------------------------------------#
  1422. if [ "$spamd" = 'yes' ]; then
  1423. echo "[ * ] Configuring SpamAssassin..."
  1424. update-rc.d spamassassin defaults > /dev/null 2>&1
  1425. sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin
  1426. systemctl start spamassassin >> $LOG
  1427. check_result $? "spamassassin start failed"
  1428. unit_files="$(systemctl list-unit-files |grep spamassassin)"
  1429. if [[ "$unit_files" =~ "disabled" ]]; then
  1430. systemctl enable spamassassin > /dev/null 2>&1
  1431. fi
  1432. fi
  1433. #----------------------------------------------------------#
  1434. # Configure Fail2Ban #
  1435. #----------------------------------------------------------#
  1436. if [ "$fail2ban" = 'yes' ]; then
  1437. echo "[ * ] Configuring fail2ban access monitor..."
  1438. cp -rf $HESTIA_INSTALL_DIR/fail2ban /etc/
  1439. if [ "$dovecot" = 'no' ]; then
  1440. fline=$(cat /etc/fail2ban/jail.local |grep -n dovecot-iptables -A 2)
  1441. fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
  1442. sed -i "${fline}s/true/false/" /etc/fail2ban/jail.local
  1443. fi
  1444. if [ "$exim" = 'no' ]; then
  1445. fline=$(cat /etc/fail2ban/jail.local |grep -n exim-iptables -A 2)
  1446. fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
  1447. sed -i "${fline}s/true/false/" /etc/fail2ban/jail.local
  1448. fi
  1449. if [ "$vsftpd" = 'yes' ]; then
  1450. #Create vsftpd Log File
  1451. if [ ! -f "/var/log/vsftpd.log" ]; then
  1452. touch /var/log/vsftpd.log
  1453. fi
  1454. fline=$(cat /etc/fail2ban/jail.local |grep -n vsftpd-iptables -A 2)
  1455. fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
  1456. sed -i "${fline}s/false/true/" /etc/fail2ban/jail.local
  1457. fi
  1458. if [ ! -e /var/log/auth.log ]; then
  1459. # Debian workaround: auth logging was moved to systemd
  1460. touch /var/log/auth.log
  1461. chmod 640 /var/log/auth.log
  1462. chown root:adm /var/log/auth.log
  1463. fi
  1464. if [ -f /etc/fail2ban/jail.d/defaults-debian.conf ]; then
  1465. rm -f /etc/fail2ban/jail.d/defaults-debian.conf
  1466. fi
  1467. update-rc.d fail2ban defaults
  1468. systemctl start fail2ban
  1469. check_result $? "fail2ban start failed"
  1470. fi
  1471. #----------------------------------------------------------#
  1472. # Install Roundcube #
  1473. #----------------------------------------------------------#
  1474. echo "[ * ] Install Roundcube..."
  1475. # Min requirements Dovecote + Exim + Mysql
  1476. if [ "$mysql" == 'yes' ] && [ "$dovecot" == "yes" ]; then
  1477. $HESTIA/bin/v-add-sys-roundcube
  1478. write_config_value "WEBMAIL_ALIAS" "webmail"
  1479. fi
  1480. #----------------------------------------------------------#
  1481. # Configure API #
  1482. #----------------------------------------------------------#
  1483. if [ "$api" = "yes" ]; then
  1484. write_config_value "API" "yes"
  1485. write_config_value "API_ALLOWED_IP" ""
  1486. else
  1487. $HESTIA/bin/v-change-sys-api disable
  1488. fi
  1489. #----------------------------------------------------------#
  1490. # Configure IP #
  1491. #----------------------------------------------------------#
  1492. # Roundcube permissions fix
  1493. if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
  1494. if [ ! -d "/var/log/roundcube" ]; then
  1495. mkdir /var/log/roundcube
  1496. fi
  1497. chown admin:admin /var/log/roundcube
  1498. fi
  1499. # Configuring system IPs
  1500. echo "[ * ] Configure System IP..."
  1501. $HESTIA/bin/v-update-sys-ip > /dev/null 2>&1
  1502. # Get main IP
  1503. ip=$(ip addr|grep 'inet '|grep global|head -n1|awk '{print $2}'|cut -f1 -d/)
  1504. local_ip=$ip
  1505. # Configuring firewall
  1506. if [ "$iptables" = 'yes' ]; then
  1507. $HESTIA/bin/v-update-firewall
  1508. fi
  1509. # Get public IP
  1510. pub_ip=$(curl --ipv4 -s https://ip.hestiacp.com/)
  1511. if [ ! -z "$pub_ip" ] && [ "$pub_ip" != "$ip" ]; then
  1512. $HESTIA/bin/v-change-sys-ip-nat $ip $pub_ip > /dev/null 2>&1
  1513. ip=$pub_ip
  1514. fi
  1515. if [ "$exim" = 'yes' ]; then
  1516. # Set HELO for IP as it didn't set during v-change-sys-hostname
  1517. $HESTIA/bin/v-change-sys-ip-helo $local_ip $servername
  1518. fi
  1519. # Configuring libapache2-mod-remoteip
  1520. if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then
  1521. cd /etc/apache2/mods-available
  1522. echo "<IfModule mod_remoteip.c>" > remoteip.conf
  1523. echo " RemoteIPHeader X-Real-IP" >> remoteip.conf
  1524. if [ "$local_ip" != "127.0.0.1" ] && [ "$pub_ip" != "127.0.0.1" ]; then
  1525. echo " RemoteIPInternalProxy 127.0.0.1" >> remoteip.conf
  1526. fi
  1527. if [ ! -z "$local_ip" ] && [ "$local_ip" != "$pub_ip" ]; then
  1528. echo " RemoteIPInternalProxy $local_ip" >> remoteip.conf
  1529. fi
  1530. if [ ! -z "$pub_ip" ]; then
  1531. echo " RemoteIPInternalProxy $pub_ip" >> remoteip.conf
  1532. fi
  1533. echo "</IfModule>" >> remoteip.conf
  1534. sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf
  1535. a2enmod remoteip >> $LOG
  1536. systemctl restart apache2
  1537. fi
  1538. # Configuring MariaDB host
  1539. if [ "$mysql" = 'yes' ]; then
  1540. $HESTIA/bin/v-add-database-host mysql localhost root $mpass
  1541. fi
  1542. # Configuring PostgreSQL host
  1543. if [ "$postgresql" = 'yes' ]; then
  1544. $HESTIA/bin/v-add-database-host pgsql localhost postgres $ppass
  1545. fi
  1546. # Adding default domain
  1547. $HESTIA/bin/v-add-web-domain admin $servername
  1548. check_result $? "can't create $servername domain"
  1549. # Adding cron jobs
  1550. export SCHEDULED_RESTART="yes"
  1551. command="sudo $HESTIA/bin/v-update-sys-queue restart"
  1552. $HESTIA/bin/v-add-cron-job 'admin' '*/2' '*' '*' '*' '*' "$command"
  1553. systemctl restart cron
  1554. command="sudo $HESTIA/bin/v-update-sys-queue daily"
  1555. $HESTIA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command"
  1556. command="sudo $HESTIA/bin/v-update-sys-queue disk"
  1557. $HESTIA/bin/v-add-cron-job 'admin' '15' '02' '*' '*' '*' "$command"
  1558. command="sudo $HESTIA/bin/v-update-sys-queue traffic"
  1559. $HESTIA/bin/v-add-cron-job 'admin' '10' '00' '*' '*' '*' "$command"
  1560. command="sudo $HESTIA/bin/v-update-sys-queue webstats"
  1561. $HESTIA/bin/v-add-cron-job 'admin' '30' '03' '*' '*' '*' "$command"
  1562. command="sudo $HESTIA/bin/v-update-sys-queue backup"
  1563. $HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
  1564. command="sudo $HESTIA/bin/v-backup-users"
  1565. $HESTIA/bin/v-add-cron-job 'admin' '10' '05' '*' '*' '*' "$command"
  1566. command="sudo $HESTIA/bin/v-update-user-stats"
  1567. $HESTIA/bin/v-add-cron-job 'admin' '20' '00' '*' '*' '*' "$command"
  1568. command="sudo $HESTIA/bin/v-update-sys-rrd"
  1569. $HESTIA/bin/v-add-cron-job 'admin' '*/5' '*' '*' '*' '*' "$command"
  1570. # Enable automatic updates
  1571. $HESTIA/bin/v-add-cron-hestia-autoupdate apt
  1572. # Building initital rrd images
  1573. $HESTIA/bin/v-update-sys-rrd
  1574. # Enabling file system quota
  1575. if [ "$quota" = 'yes' ]; then
  1576. $HESTIA/bin/v-add-sys-quota
  1577. fi
  1578. # Set backend port
  1579. $HESTIA/bin/v-change-sys-port $port > /dev/null 2>&1
  1580. # Create default configuration files
  1581. $HESTIA/bin/v-update-sys-defaults
  1582. # Update remaining packages since repositories have changed
  1583. echo -ne "[ * ] Installing remaining software updates..."
  1584. apt-get -qq update
  1585. apt-get -y upgrade >> $LOG &
  1586. BACK_PID=$!
  1587. echo
  1588. # Starting Hestia service
  1589. update-rc.d hestia defaults
  1590. systemctl start hestia
  1591. check_result $? "hestia start failed"
  1592. chown admin:admin $HESTIA/data/sessions
  1593. # Create backup folder and set correct permission
  1594. mkdir -p /backup/
  1595. chmod 755 /backup/
  1596. # create cronjob to generate ssl
  1597. echo "@reboot root sleep 10 && rm /etc/cron.d/hestia-ssl && /usr/local/hestia/bin/v-add-letsencrypt-host" > /etc/cron.d/hestia-ssl
  1598. #----------------------------------------------------------#
  1599. # Configure File Manager #
  1600. #----------------------------------------------------------#
  1601. echo "[ * ] Configuring File Manager..."
  1602. $HESTIA/bin/v-add-sys-filemanager quiet
  1603. echo "[ * ] Finish up install..."
  1604. write_config_value "PHPMYADMIN_KEY" ""
  1605. write_config_value "POLICY_USER_VIEW_SUSPENDED" "no"
  1606. write_config_value "POLICY_USER_VIEW_LOGS" "yes"
  1607. write_config_value "POLICY_USER_EDIT_WEB_TEMPLATES" "true"
  1608. write_config_value "POLICY_USER_EDIT_DNS_TEMPLATES" "yes"
  1609. write_config_value "POLICY_USER_EDIT_DETAILS" "yes"
  1610. write_config_value "POLICY_USER_DELETE_LOGS" "yes"
  1611. write_config_value "POLICY_USER_CHANGE_THEME" "yes"
  1612. write_config_value "POLICY_SYSTEM_PROTECTED_ADMIN" "no"
  1613. write_config_value "POLICY_SYSTEM_PASSWORD_RESET" "no"
  1614. write_config_value "POLICY_SYSTEM_HIDE_SERVICES" "yes"
  1615. write_config_value "POLICY_SYSTEM_ENABLE_BACON" "no"
  1616. write_config_value "PLUGIN_APP_INSTALLER" "true"
  1617. write_config_value "DEBUG_MODE" "no"
  1618. write_config_value "ENFORCE_SUBDOMAIN_OWNERSHIP" "yes"
  1619. write_config_value "USE_SERVER_SMTP" "false"
  1620. write_config_value "SERVER_SMTP_PORT" ""
  1621. write_config_value "SERVER_SMTP_HOST" ""
  1622. write_config_value "SERVER_SMTP_SECURITY" ""
  1623. write_config_value "SERVER_SMTP_USER" ""
  1624. write_config_value "SERVER_SMTP_PASSWD" ""
  1625. write_config_value "SERVER_SMTP_ADDR" ""
  1626. #----------------------------------------------------------#
  1627. # Configure PHPMailer #
  1628. #----------------------------------------------------------#
  1629. echo "[ * ] Configuring PHPMailer..."
  1630. $HESTIA/bin/v-add-sys-phpmailer quiet
  1631. #----------------------------------------------------------#
  1632. # Hestia Access Info #
  1633. #----------------------------------------------------------#
  1634. # Comparing hostname and IP
  1635. host_ip=$(host $servername| head -n 1 |awk '{print $NF}')
  1636. if [ "$host_ip" = "$ip" ]; then
  1637. ip="$servername"
  1638. fi
  1639. echo -e "\n"
  1640. echo "===================================================================="
  1641. echo -e "\n"
  1642. # Sending notification to admin email
  1643. echo -e "Congratulations!
  1644. You have successfully installed Hestia Control Panel on your server.
  1645. Ready to get started? Log in using the following credentials:
  1646. Admin URL: https://$ip:$port
  1647. Username: admin
  1648. Password: $vpass
  1649. Thank you for choosing Hestia Control Panel to power your full stack web server,
  1650. we hope that you enjoy using it as much as we do!
  1651. Please feel free to contact us at any time if you have any questions,
  1652. or if you encounter any bugs or problems:
  1653. Web: https://www.hestiacp.com/
  1654. Forum: https://forum.hestiacp.com/
  1655. Discord: https://discord.gg/nXRUZch
  1656. GitHub: https://www.github.com/hestiacp/hestiacp
  1657. Note: Automatic updates are enabled by default. If you would like to disable them,
  1658. please log in and navigate to Server > Updates to turn them off.
  1659. Help support the Hestia Control Panel project by donating via PayPal:
  1660. https://www.hestiacp.com/donate
  1661. --
  1662. Sincerely yours,
  1663. The Hestia Control Panel development team
  1664. Made with love & pride by the open-source community around the world.
  1665. " > $tmpfile
  1666. send_mail="$HESTIA/web/inc/mail-wrapper.php"
  1667. cat $tmpfile | $send_mail -s "Hestia Control Panel" $email
  1668. # Congrats
  1669. echo
  1670. cat $tmpfile
  1671. rm -f $tmpfile
  1672. # Add welcome message to notification panel
  1673. $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'
  1674. # Clean-up
  1675. # Sort final configuration file
  1676. sort_config_file
  1677. if [ "$interactive" = 'yes' ]; then
  1678. echo "[ ! ] IMPORTANT: System will reboot"
  1679. echo ""
  1680. echo -n " Press any key to continue!"
  1681. read reboot
  1682. reboot
  1683. else
  1684. echo "[ ! ] IMPORTANT: You must logout or restart the server before continuing"
  1685. fi
  1686. # EOF