Skip to content

Commit c082c61

Browse files
authored
Merge pull request hestiacp#21 from serghey-rodin/master
updates from official vesta
2 parents c04eda5 + 8e37c4f commit c082c61

File tree

2 files changed

+60
-65
lines changed

2 files changed

+60
-65
lines changed

bin/v-add-backup-host

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ EOF
3838
sftpc() {
3939
expect -f "-" <<EOF "$@"
4040
set count 0
41-
spawn /usr/bin/sftp -o StrictHostKeyChecking=no -o \
42-
Port=$port $user@$host
41+
spawn "/usr/bin/sftp -o StrictHostKeyChecking=no -o \
42+
Port=$port '$user@$host'"
4343
expect {
4444
"password:" {
4545
send "$password\r"
@@ -94,12 +94,14 @@ EOF
9494

9595
if [ "$type" != 'local' ];then
9696
check_args '4' "$#" "TYPE HOST USERNAME PASSWORD [PATH] [PORT]"
97-
is_format_valid 'host'
97+
is_format_valid 'user' 'host' 'path' 'port'
9898
is_password_valid
9999
if [ "$type" = 'sftp' ]; then
100100
which expect >/dev/null 2>&1
101101
check_result $? "expect command not found" $E_NOTEXIST
102102
fi
103+
host "$host" >/dev/null 2>&1
104+
check_result $? "host connection failed" "$E_CONNECT"
103105
fi
104106

105107

install/vst-install-debian.sh

Lines changed: 55 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ arch=$(uname -i)
1616
os='debian'
1717
release=$(cat /etc/debian_version|grep -o [0-9]|head -n1)
1818
codename="$(cat /etc/os-release |grep VERSION= |cut -f 2 -d \(|cut -f 1 -d \))"
19-
vestacp="http://$CHOST/$VERSION/$release"
19+
vestacp="$VESTA/install/$VERSION/$release"
2020

2121
if [ "$release" -eq 9 ]; then
2222
software="nginx apache2 apache2-utils apache2-suexec-custom
@@ -274,7 +274,7 @@ if [ ! -e '/usr/bin/wget' ]; then
274274
fi
275275

276276
# Checking repository availability
277-
wget -q "$vestacp/deb_signing.key" -O /dev/null
277+
wget -q "c.vestacp.com/deb_signing.key" -O /dev/null
278278
check_result $? "No access to Vesta repository"
279279

280280
# Check installed packages
@@ -682,9 +682,9 @@ chmod 755 /usr/bin/rssh
682682
# Configure VESTA #
683683
#----------------------------------------------------------#
684684

685-
# Downloading sudo configuration
685+
# Installing sudo configuration
686686
mkdir -p /etc/sudoers.d
687-
wget $vestacp/sudo/admin -O /etc/sudoers.d/admin
687+
cp -f $vestacp/sudo/admin /etc/sudoers.d/
688688
chmod 440 /etc/sudoers.d/admin
689689

690690
# Configuring system env
@@ -695,8 +695,8 @@ echo 'PATH=$PATH:'$VESTA'/bin' >> /root/.bash_profile
695695
echo 'export PATH' >> /root/.bash_profile
696696
source /root/.bash_profile
697697

698-
# Configuring logrotate for vesta logs
699-
wget $vestacp/logrotate/vesta -O /etc/logrotate.d/vesta
698+
# Configuring logrotate for Vesta logs
699+
cp -f $vestacp/logrotate/vesta /etc/logrotate.d/
700700

701701
# Building directory tree and creating some blank files for vesta
702702
mkdir -p $VESTA/conf $VESTA/log $VESTA/ssl $VESTA/data/ips \
@@ -808,25 +808,18 @@ echo "LANGUAGE='$lang'" >> $VESTA/conf/vesta.conf
808808
# Version
809809
echo "VERSION='0.9.8'" >> $VESTA/conf/vesta.conf
810810

811-
# Downloading hosting packages
812-
cd $VESTA/data
813-
wget $vestacp/packages.tar.gz -O packages.tar.gz
814-
tar -xzf packages.tar.gz
815-
rm -f packages.tar.gz
811+
# Installing hosting packages
812+
cp -rf $vestacp/packages $VESTA/data/
816813

817-
# Downloading templates
818-
wget $vestacp/templates.tar.gz -O templates.tar.gz
819-
tar -xzf templates.tar.gz
820-
rm -f templates.tar.gz
814+
# Installing templates
815+
cp -rf $vestacp/templates $VESTA/data/
821816

822817
# Copying index.html to default documentroot
823-
cp templates/web/skel/public_html/index.html /var/www/
818+
cp $VESTA/data/templates/web/skel/public_html/index.html /var/www/
824819
sed -i 's/%domain%/It worked!/g' /var/www/index.html
825820

826-
# Downloading firewall rules
827-
wget $vestacp/firewall.tar.gz -O firewall.tar.gz
828-
tar -xzf firewall.tar.gz
829-
rm -f firewall.tar.gz
821+
# Installing firewall rules
822+
cp -rf $vestacp/firewall $VESTA/data/
830823

831824
# Configuring server hostname
832825
$VESTA/bin/v-change-sys-hostname $servername 2>/dev/null
@@ -855,12 +848,12 @@ rm /tmp/vst.pem
855848

856849
if [ "$nginx" = 'yes' ]; then
857850
rm -f /etc/nginx/conf.d/*.conf
858-
wget $vestacp/nginx/nginx.conf -O /etc/nginx/nginx.conf
859-
wget $vestacp/nginx/status.conf -O /etc/nginx/conf.d/status.conf
860-
wget $vestacp/nginx/phpmyadmin.inc -O /etc/nginx/conf.d/phpmyadmin.inc
861-
wget $vestacp/nginx/phppgadmin.inc -O /etc/nginx/conf.d/phppgadmin.inc
862-
wget $vestacp/nginx/webmail.inc -O /etc/nginx/conf.d/webmail.inc
863-
wget $vestacp/logrotate/nginx -O /etc/logrotate.d/nginx
851+
cp -f $vestacp/nginx/nginx.conf /etc/nginx/
852+
cp -f $vestacp/nginx/status.conf /etc/nginx/conf.d/
853+
cp -f $vestacp/nginx/phpmyadmin.inc /etc/nginx/conf.d/
854+
cp -f $vestacp/nginx/phppgadmin.inc /etc/nginx/conf.d/
855+
cp -f $vestacp/nginx/webmail.inc /etc/nginx/conf.d/
856+
cp -f $vestacp/logrotate/nginx /etc/logrotate.d/
864857
echo > /etc/nginx/conf.d/vesta.conf
865858
mkdir -p /var/log/nginx/domains
866859
update-rc.d nginx defaults
@@ -874,9 +867,9 @@ fi
874867
#----------------------------------------------------------#
875868

876869
if [ "$apache" = 'yes' ]; then
877-
wget $vestacp/apache2/apache2.conf -O /etc/apache2/apache2.conf
878-
wget $vestacp/apache2/status.conf -O /etc/apache2/mods-enabled/status.conf
879-
wget $vestacp/logrotate/apache2 -O /etc/logrotate.d/apache2
870+
cp -f $vestacp/apache2/apache2.conf /etc/apache2/
871+
cp -f $vestacp/apache2/status.conf /etc/apache2/mods-enabled/
872+
cp -f $vestacp/logrotate/apache2 /etc/logrotate.d/
880873
a2enmod rewrite
881874
a2enmod suexec
882875
a2enmod ssl
@@ -909,12 +902,12 @@ fi
909902

910903
if [ "$phpfpm" = 'yes' ]; then
911904
if [ "$release" -eq 9 ]; then
912-
wget $vestacp/php-fpm/www.conf -O /etc/php/7.0/fpm/pool.d/www.conf
905+
cp -f $vestacp/php-fpm/www.conf /etc/php/7.0/fpm/pool.d/www.conf
913906
update-rc.d php7.0-fpm defaults
914907
service php7.0-fpm start
915908
check_result $? "php-fpm start failed"
916909
else
917-
wget $vestacp/php5-fpm/www.conf -O /etc/php5/fpm/pool.d/www.conf
910+
cp -f $vestacp/php5-fpm/www.conf /etc/php5/fpm/pool.d/www.conf
918911
update-rc.d php5-fpm defaults
919912
service php5-fpm start
920913
check_result $? "php-fpm start failed"
@@ -941,7 +934,7 @@ done
941934
#----------------------------------------------------------#
942935

943936
if [ "$vsftpd" = 'yes' ]; then
944-
wget $vestacp/vsftpd/vsftpd.conf -O /etc/vsftpd.conf
937+
cp -f $vestacp/vsftpd/vsftpd.conf /etc/
945938
update-rc.d vsftpd defaults
946939
service vsftpd start
947940
check_result $? "vsftpd start failed"
@@ -957,7 +950,7 @@ fi
957950

958951
if [ "$proftpd" = 'yes' ]; then
959952
echo "127.0.0.1 $servername" >> /etc/hosts
960-
wget $vestacp/proftpd/proftpd.conf -O /etc/proftpd/proftpd.conf
953+
cp -f $vestacp/proftpd/proftpd.conf /etc/proftpd/
961954
update-rc.d proftpd defaults
962955
service proftpd start
963956
check_result $? "proftpd start failed"
@@ -978,7 +971,7 @@ if [ "$mysql" = 'yes' ]; then
978971
fi
979972

980973
# MySQL configuration
981-
wget $vestacp/mysql/$mycnf -O /etc/mysql/my.cnf
974+
cp -f $vestacp/mysql/$mycnf /etc/mysql/my.cnf
982975
mysql_install_db
983976
update-rc.d mysql defaults
984977
service mysql start
@@ -997,10 +990,10 @@ if [ "$mysql" = 'yes' ]; then
997990

998991
# Configuring phpMyAdmin
999992
if [ "$apache" = 'yes' ]; then
1000-
wget $vestacp/pma/apache.conf -O /etc/phpmyadmin/apache.conf
993+
cp -f $vestacp/pma/apache.conf /etc/phpmyadmin/
1001994
ln -s /etc/phpmyadmin/apache.conf /etc/apache2/conf.d/phpmyadmin.conf
1002995
fi
1003-
wget $vestacp/pma/config.inc.php -O /etc/phpmyadmin/config.inc.php
996+
cp -f $vestacp/pma/config.inc.php /etc/phpmyadmin/
1004997
chmod 777 /var/lib/phpmyadmin/tmp
1005998
fi
1006999

@@ -1010,16 +1003,15 @@ fi
10101003

10111004
if [ "$postgresql" = 'yes' ]; then
10121005
ppass=$(gen_pass)
1013-
wget $vestacp/postgresql/pg_hba.conf -O /etc/postgresql/*/main/pg_hba.conf
1006+
cp -f $vestacp/postgresql/pg_hba.conf /etc/postgresql/*/main/
10141007
service postgresql restart
10151008
sudo -u postgres psql -c "ALTER USER postgres WITH PASSWORD '$ppass'"
10161009

10171010
# Configuring phpPgAdmin
10181011
if [ "$apache" = 'yes' ]; then
1019-
wget $vestacp/pga/phppgadmin.conf \
1020-
-O /etc/apache2/conf.d/phppgadmin.conf
1012+
cp -f $vestacp/pga/phppgadmin.conf /etc/apache2/conf.d/
10211013
fi
1022-
wget $vestacp/pga/config.inc.php -O /etc/phppgadmin/config.inc.php
1014+
cp -f $vestacp/pga/config.inc.php /etc/phppgadmin/
10231015
fi
10241016

10251017

@@ -1028,7 +1020,7 @@ fi
10281020
#----------------------------------------------------------#
10291021

10301022
if [ "$named" = 'yes' ]; then
1031-
wget $vestacp/bind/named.conf -O /etc/bind/named.conf
1023+
cp -f $vestacp/bind/named.conf /etc/bind/
10321024
sed -i "s%listen-on%//listen%" /etc/bind/named.conf.options
10331025
chown root:bind /etc/bind/named.conf
10341026
chmod 640 /etc/bind/named.conf
@@ -1049,9 +1041,9 @@ fi
10491041

10501042
if [ "$exim" = 'yes' ]; then
10511043
gpasswd -a Debian-exim mail
1052-
wget $vestacp/exim/exim4.conf.template -O /etc/exim4/exim4.conf.template
1053-
wget $vestacp/exim/dnsbl.conf -O /etc/exim4/dnsbl.conf
1054-
wget $vestacp/exim/spam-blocks.conf -O /etc/exim4/spam-blocks.conf
1044+
cp -f $vestacp/exim/exim4.conf.template /etc/exim4/
1045+
cp -f $vestacp/exim/dnsbl.conf /etc/exim4/
1046+
cp -f $vestacp/exim/spam-blocks.conf /etc/exim4/
10551047
touch /etc/exim4/white-blocks.conf
10561048

10571049
if [ "$spamd" = 'yes' ]; then
@@ -1084,12 +1076,8 @@ fi
10841076

10851077
if [ "$dovecot" = 'yes' ]; then
10861078
gpasswd -a dovecot mail
1087-
wget $vestacp/dovecot.tar.gz -O /etc/dovecot.tar.gz
1088-
wget $vestacp/logrotate/dovecot -O /etc/logrotate.d/dovecot
1089-
cd /etc
1090-
rm -rf dovecot dovecot.conf
1091-
tar -xzf dovecot.tar.gz
1092-
rm -f dovecot.tar.gz
1079+
cp -rf $vestacp/dovecot /etc/
1080+
cp -f $vestacp/logrotate/dovecot /etc/logrotate.d/
10931081
chown -R root:root /etc/dovecot*
10941082
update-rc.d dovecot defaults
10951083
service dovecot start
@@ -1104,7 +1092,7 @@ fi
11041092
if [ "$clamd" = 'yes' ]; then
11051093
gpasswd -a clamav mail
11061094
gpasswd -a clamav Debian-exim
1107-
wget $vestacp/clamav/clamd.conf -O /etc/clamav/clamd.conf
1095+
cp -f $vestacp/clamav/clamd.conf /etc/clamav/
11081096
/usr/bin/freshclam
11091097
update-rc.d clamav-daemon defaults
11101098
if [ ! -d "/var/run/clamav" ]; then
@@ -1145,19 +1133,18 @@ fi
11451133

11461134
if [ "$exim" = 'yes' ] && [ "$mysql" = 'yes' ]; then
11471135
if [ "$apache" = 'yes' ]; then
1148-
wget $vestacp/roundcube/apache.conf -O /etc/roundcube/apache.conf
1136+
cp -f $vestacp/roundcube/apache.conf /etc/roundcube/
11491137
ln -s /etc/roundcube/apache.conf /etc/apache2/conf.d/roundcube.conf
11501138
fi
1151-
wget $vestacp/roundcube/main.inc.php -O /etc/roundcube/main.inc.php
1152-
wget $vestacp/roundcube/db.inc.php -O /etc/roundcube/db.inc.php
1139+
cp -f $vestacp/roundcube/main.inc.php /etc/roundcube/
1140+
cp -f $vestacp/roundcube/db.inc.php /etc/roundcube/
11531141
chmod 640 /etc/roundcube/debian-db-roundcube.php
11541142
chmod 640 /etc/roundcube/config.inc.php
11551143
chown root:www-data /etc/roundcube/debian-db-roundcube.php
11561144
chown root:www-data /etc/roundcube/config.inc.php
1157-
wget $vestacp/roundcube/vesta.php -O \
1158-
/usr/share/roundcube/plugins/password/drivers/vesta.php
1159-
wget $vestacp/roundcube/config.inc.php -O \
1160-
/etc/roundcube/plugins/password/config.inc.php
1145+
cp -f $vestacp/roundcube/vesta.php \
1146+
/usr/share/roundcube/plugins/password/drivers/
1147+
cp -f $vestacp/roundcube/config.inc.php /etc/roundcube/plugins/password/
11611148
r="$(gen_pass)"
11621149
mysql -e "CREATE DATABASE roundcube"
11631150
mysql -e "GRANT ALL ON roundcube.*
@@ -1208,10 +1195,7 @@ fi
12081195
#----------------------------------------------------------#
12091196

12101197
if [ "$fail2ban" = 'yes' ]; then
1211-
cd /etc
1212-
wget $vestacp/fail2ban.tar.gz -O fail2ban.tar.gz
1213-
tar -xzf fail2ban.tar.gz
1214-
rm -f fail2ban.tar.gz
1198+
cp -rf $vestacp/fail2ban /etc/
12151199
if [ "$dovecot" = 'no' ]; then
12161200
fline=$(cat /etc/fail2ban/jail.local |grep -n dovecot-iptables -A 2)
12171201
fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
@@ -1222,6 +1206,15 @@ if [ "$fail2ban" = 'yes' ]; then
12221206
fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
12231207
sed -i "${fline}s/true/false/" /etc/fail2ban/jail.local
12241208
fi
1209+
if [ "$vsftpd" = 'yes' ]; then
1210+
#Create vsftpd Log File
1211+
if [ ! -f "/var/log/vsftpd.log" ]; then
1212+
touch /var/log/vsftpd.log
1213+
fi
1214+
fline=$(cat /etc/fail2ban/jail.local |grep -n vsftpd-iptables -A 2)
1215+
fline=$(echo "$fline" |grep enabled |tail -n1 |cut -f 1 -d -)
1216+
sed -i "${fline}s/false/true/" /etc/fail2ban/jail.local
1217+
fi
12251218
update-rc.d fail2ban defaults
12261219
service fail2ban start
12271220
check_result $? "fail2ban start failed"

0 commit comments

Comments
 (0)