diff --git a/install/vst-install-debian.sh b/install/vst-install-debian.sh index 0b001ec3..b670d5a2 100755 --- a/install/vst-install-debian.sh +++ b/install/vst-install-debian.sh @@ -29,7 +29,8 @@ if [ "$release" -eq 8 ]; then mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils - bsdmainutils cron vesta vesta-nginx vesta-php expect libmail-dkim-perl unrar-free" + bsdmainutils cron vesta vesta-nginx vesta-php expect libmail-dkim-perl + unrar-free vim-common" else software="nginx apache2 apache2-utils apache2.2-common apache2-suexec-custom libapache2-mod-ruid2 @@ -41,7 +42,8 @@ else mysql-client postgresql postgresql-contrib phppgadmin phpMyAdmin mc flex whois rssh git idn zip sudo bc ftp lsof ntpdate rrdtool quota e2fslibs bsdutils e2fsprogs curl imagemagick fail2ban dnsutils - bsdmainutils cron vesta vesta-nginx vesta-php expect unrar-free" + bsdmainutils cron vesta vesta-nginx vesta-php expect unrar-free + vim-common" fi # Defining help function @@ -967,11 +969,12 @@ fi if [ "$postgresql" = 'yes' ]; then wget $vestacp/postgresql/pg_hba.conf -O /etc/postgresql/*/main/pg_hba.conf service postgresql restart - sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$vpass'" 2>/dev/null + sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$vpass'" # Configuring phpPgAdmin if [ "$apache" = 'yes' ]; then - wget $vestacp/pga/phppgadmin.conf -O /etc/apache2/conf.d/phppgadmin.conf + wget $vestacp/pga/phppgadmin.conf \ + -O /etc/apache2/conf.d/phppgadmin.conf fi wget $vestacp/pga/config.inc.php -O /etc/phppgadmin/config.inc.php fi @@ -1065,13 +1068,13 @@ if [ "$clamd" = 'yes' ]; then mkdir /var/run/clamav fi chown -R clamav:clamav /var/run/clamav - if [ -f "/lib/systemd/system/clamav-daemon.service" ]; then - file="/lib/systemd/system/clamav-daemon.service" - if [ $( grep -ic "mkdir" $file ) -eq 0 ]; then - sed -i "s/\[Service\]/\[Service\]\nExecStartPre = \/bin\/mkdir -p \/var\/run\/clamav\nExecStartPre = \/bin\/chown -R clamav:clamav \/var\/run\/clamav/g" $file - fi + if [ -e "/lib/systemd/system/clamav-daemon.service" ]; then + exec_pre1='ExecStartPre=/bin/mkdir -p /var/run/clamav' + exec_pre2='ExecStartPre=/bin/chown -R clamav:clamav /var/run/clamav' + sed -i "s|\[Service\]/|[Service]\n$exec_pre1\n$exec_pre2|g" \ + /lib/systemd/system/clamav-daemon.service + systemctl daemon-reload fi - service clamav-daemon start check_result $? "clamav-daeom start failed" fi @@ -1086,7 +1089,8 @@ if [ "$spamd" = 'yes' ]; then sed -i "s/ENABLED=0/ENABLED=1/" /etc/default/spamassassin service spamassassin start check_result $? "spamassassin start failed" - if [[ $(systemctl list-unit-files | grep spamassassin) =~ "disabled" ]]; then + unit_files="$(systemctl list-unit-files |grep spamassassin)" + if [[ "$unit_files" =~ "disabled" ]]; then systemctl enable spamassassin fi fi @@ -1113,9 +1117,11 @@ if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then /etc/roundcube/plugins/password/config.inc.php r="$(gen_pass)" mysql -e "CREATE DATABASE roundcube" - mysql -e "GRANT ALL ON roundcube.* TO roundcube@localhost IDENTIFIED BY '$r'" + mysql -e "GRANT ALL ON roundcube.* + TO roundcube@localhost IDENTIFIED BY '$r'" sed -i "s/%password%/$r/g" /etc/roundcube/db.inc.php - sed -i "s/localhost/$servername/g" /etc/roundcube/plugins/password/config.inc.php + sed -i "s/localhost/$servername/g" \ + /etc/roundcube/plugins/password/config.inc.php mysql roundcube < /usr/share/dbconfig-common/data/roundcube/install/mysql chmod a+r /etc/roundcube/main.inc.php if [ "$release" -eq 8 ]; then @@ -1134,13 +1140,15 @@ if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then if [[ -L "$tinymceFolder" && -d "$tinymceFolder" ]]; then if [ -f "$tinymceBadJS" ]; then wget $tinymceFixArchiveURL -O $tinymceFixArchive - if [[ -f "$tinymceFixArchive" && -s "$tinymceFixArchive" ]]; then + if [[ -f "$tinymceFixArchive" && -s "$tinymceFixArchive" ]] + then rm $tinymceFolder tar -xzf $tinymceFixArchive -C $tinymceParentFolder rm $tinymceFixArchive chown -R root:root $tinymceFolder else - echo "File roundcube-tinymce.tar.gz is not downloaded, RoundCube tinyMCE fix is not applied" + echo -n "File roundcube-tinymce.tar.gz is not downloaded," + echo "RoundCube tinyMCE fix is not applied" rm $tinymceFixArchive fi fi @@ -1210,7 +1218,7 @@ $VESTA/bin/v-update-sys-ip # Get main ip ip=$(ip addr|grep 'inet '|grep global|head -n1|awk '{print $2}'|cut -f1 -d/) -copy_of_ip=$ip +local_ip=$ip # Firewall configuration if [ "$iptables" = 'yes' ]; then @@ -1227,19 +1235,19 @@ fi # Configuring libapache2-mod-remoteip if [ "$apache" = 'yes' ] && [ "$nginx" = 'yes' ] ; then - copy_of_pub_ip=$pub_ip - echo "" > /etc/apache2/mods-available/remoteip.conf - echo " RemoteIPHeader X-Real-IP" >> /etc/apache2/mods-available/remoteip.conf - if [ "$copy_of_ip" != "127.0.0.1" ] && [ "$copy_of_pub_ip" != "127.0.0.1" ]; then - echo " RemoteIPInternalProxy 127.0.0.1" >> /etc/apache2/mods-available/remoteip.conf + cd /etc/apache2/mods-available + echo "" > remoteip.conf + echo " RemoteIPHeader X-Real-IP" >> remoteip.conf + if [ "$local_ip" != "127.0.0.1" ] && [ "$pub_ip" != "127.0.0.1" ]; then + echo " RemoteIPInternalProxy 127.0.0.1" >> remoteip.conf fi - if [ ! -z "$copy_of_ip" ] && [ "$copy_of_ip" != "$copy_of_pub_ip" ]; then - echo " RemoteIPInternalProxy $copy_of_ip" >> /etc/apache2/mods-available/remoteip.conf + if [ ! -z "$local_ip" ] && [ "$local_ip" != "$pub_ip" ]; then + echo " RemoteIPInternalProxy $local_ip" >> remoteip.conf fi - if [ ! -z "$copy_of_pub_ip" ]; then - echo " RemoteIPInternalProxy $copy_of_pub_ip" >> /etc/apache2/mods-available/remoteip.conf + if [ ! -z "$pub_ip" ]; then + echo " RemoteIPInternalProxy $pub_ip" >> remoteip.conf fi - echo "" >> /etc/apache2/mods-available/remoteip.conf + echo "" >> remoteip.conf sed -i "s/LogFormat \"%h/LogFormat \"%a/g" /etc/apache2/apache2.conf a2enmod remoteip service apache2 restart