1+ #! /bin/bash
2+
3+ CHOST=' c.vestacp.com'
4+ VERSION=' debian'
5+ VESTA=' /usr/local/vesta'
6+ os=' debian'
7+ release=$( cat /etc/debian_version| grep -o [0-9]| head -n1)
8+ codename=" $( cat /etc/os-release | grep VERSION= | cut -f 2 -d \( | cut -f 1 -d \) ) "
9+ vestacp=" http://$CHOST /$VERSION /$release "
10+ servername=$( hostname -f)
11+
12+ apt-get update > /dev/null 2>&1
13+
14+ if [ -f " /etc/roundcube/plugins/password/config.inc.php" ]; then
15+
16+ # Roundcube Vesta password driver - changing password_vesta_host (in config) to server hostname
17+ sed -i " s/localhost/$servername /g" /etc/roundcube/plugins/password/config.inc.php
18+
19+ # Roundcube log permission fix
20+ if [ ! -d " /var/log/roundcube" ]; then
21+ mkdir /var/log/roundcube
22+ fi
23+ chown admin:admin /var/log/roundcube
24+
25+ fi
26+
27+
28+ # Added default install "expect" to work for backup sftp
29+ apt-get -y install expect > /dev/null 2>&1
30+
31+
32+ # apparmor rules for bind9
33+ if [ -f " /etc/bind/named.conf" ]; then
34+ file=" /etc/apparmor.d/local/usr.sbin.named"
35+ if [ ! -f " $file " ] || [ $( grep -ic " /home/" $file ) -eq 0 ]; then
36+ aa-complain /usr/sbin/named 2> /dev/null
37+ echo " /home/** rwm," >> /etc/apparmor.d/local/usr.sbin.named 2> /dev/null
38+ service apparmor restart > /dev/null 2>&1
39+ fi
40+ fi
41+
42+
43+ # Debian fix for spamassassin when it's not in startup list
44+ if [[ $( systemctl list-unit-files | grep spamassassin) =~ " disabled" ]]; then
45+ systemctl enable spamassassin
46+ fi
47+
48+
49+ # RoundCube tinyMCE fix
50+ tinymceFixArchiveURL=$vestacp /roundcube/roundcube-tinymce.tar.gz
51+ tinymceParentFolder=/usr/share/roundcube/program/js
52+ tinymceFolder=$tinymceParentFolder /tinymce
53+ tinymceBadJS=$tinymceFolder /tiny_mce.js
54+ tinymceFixArchive=$tinymceParentFolder /roundcube-tinymce.tar.gz
55+ if [[ -L " $tinymceFolder " && -d " $tinymceFolder " ]]; then
56+ if [ -f " $tinymceBadJS " ]; then
57+ wget $tinymceFixArchiveURL -O $tinymceFixArchive
58+ if [[ -f " $tinymceFixArchive " && -s " $tinymceFixArchive " ]]; then
59+ rm $tinymceFolder
60+ tar -xzf $tinymceFixArchive -C $tinymceParentFolder
61+ rm $tinymceFixArchive
62+ chown -R root:root $tinymceFolder
63+ else
64+ echo " File roundcube-tinymce.tar.gz is not downloaded, RoundCube tinyMCE fix is not applied"
65+ rm $tinymceFixArchive
66+ fi
67+ fi
68+ fi
69+
70+
71+ # Fixing empty NAT ip
72+ ip=$( ip addr| grep ' inet ' | grep global| head -n1| awk ' {print $2}' | cut -f1 -d/)
73+ pub_ip=$( curl -s vestacp.com/what-is-my-ip/)
74+ file=" $VESTA /data/ips/$ip "
75+ if [ -f " $file " ] && [ $( grep -ic " NAT=''" $file ) -eq 1 ]; then
76+ if [ ! -z " $pub_ip " ] && [ " $pub_ip " != " $ip " ]; then
77+ v-change-sys-ip-nat $ip $pub_ip
78+ fi
79+ fi
80+
81+
82+ file=" /etc/exim4/exim4.conf.template"
83+ if [ -f " $file " ]; then
84+ apt-get -y install libmail-dkim-perl > /dev/null 2>&1
85+ fi
86+
87+
88+ if [ ! -f " /etc/apache2/mods-enabled/remoteip.load" ]; then
89+ $VESTA /upd/switch_rpath.sh
90+ fi
0 commit comments