Skip to content

Commit 569bd23

Browse files
committed
new installer
1 parent 4823252 commit 569bd23

File tree

3 files changed

+149
-53
lines changed

3 files changed

+149
-53
lines changed

install/vst-install-debian.sh

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ software="nginx apache2 apache2-utils apache2.2-common bsdutils e2fsprogs
1818
flex dovecot-imapd dovecot-pop3d phpMyAdmin awstats webalizer
1919
jwhois rssh git spamassassin roundcube roundcube-mysql
2020
roundcube-plugins sudo bc ftp lsof ntpdate rrdtool quota e2fslibs
21-
dnsutils vesta vesta-nginx vesta-php"
21+
fail2ban dnsutils vesta vesta-nginx vesta-php"
2222

2323
help() {
2424
echo "usage: $0 [OPTIONS]
25-
-e, --email Set email address
26-
-f, --force Force installation
2725
-h, --help Print this help and exit
28-
-n, --noupdate Do not run apt-get upgrade command
29-
-m, --mysql-password Set MySQL password instead of generating it
30-
-p, --password Set admin password instead of generating it
26+
-f, --force Force installation
27+
-i, --disable-iptables Disable iptables support
28+
-b, --disable-fail2ban Disable fail2ban protection
29+
-n, --noupdate Do not run yum update command
3130
-s, --hostname Set server hostname
31+
-e, --email Set email address
32+
-p, --password Set admin password instead of generating it
33+
-m, --mysql-password Set MySQL password instead of generating it
3234
-q, --quota Enable File System Quota"
3335
exit 1
3436
}
@@ -53,13 +55,15 @@ gen_pass() {
5355
for arg; do
5456
delim=""
5557
case "$arg" in
56-
--email) args="${args}-e " ;;
57-
--force) args="${args}-f " ;;
5858
--help) args="${args}-h " ;;
59+
--force) args="${args}-f " ;;
60+
--disable-fail2ban) args="${args}-b " ;;
61+
--disable-iptables) args="${args}-i " ;;
5962
--noupdate) args="${args}-n " ;;
60-
--mysql-password) args="${args}-m " ;;
61-
--password) args="${args}-p " ;;
6263
--hostname) args="${args}-s " ;;
64+
--email) args="${args}-e " ;;
65+
--password) args="${args}-p " ;;
66+
--mysql-password) args="${args}-m " ;;
6367
--quota) args="${args}-q " ;;
6468
*) [[ "${arg:0:1}" == "-" ]] || delim="\""
6569
args="${args}${delim}${arg}${delim} ";;
@@ -68,15 +72,17 @@ done
6872
eval set -- "$args"
6973

7074
# Getopt
71-
while getopts "dhfnqe:m:p:s:" Option; do
75+
while getopts "hfibdnqe:m:p:s:" Option; do
7276
case $Option in
7377
h) help ;; # Help
74-
e) email=$OPTARG ;; # Set email
7578
f) force='yes' ;; # Force install
76-
n) noupdate='yes' ;; # Disable apt-get upgrade
77-
m) mpass=$OPTARG ;; # MySQL pasword
78-
p) vpass=$OPTARG ;; # Admin password
79+
i) disable_iptables='yes' ;; # Disable iptables
80+
b) disable_fail2ban='yes' ;; # Disable fail2ban
81+
n) noupdate='yes' ;; # Disable yum update
7982
s) servername=$OPTARG ;; # Server hostname
83+
e) email=$OPTARG ;; # Set email
84+
p) vpass=$OPTARG ;; # Admin password
85+
m) mpass=$OPTARG ;; # MySQL pasword
8086
q) quota='yes' ;; # Enable quota
8187
*) help ;; # Default
8288
esac
@@ -391,6 +397,11 @@ if [ "$srv_type" = 'small' ]; then
391397
software=$(echo "$software" | sed -e 's/spamassassin//')
392398
fi
393399

400+
# Exclude fail2ban
401+
if [ "$disable_fail2ban" = 'yes' ]; then
402+
software=$(echo "$software" | sed -e 's/fail2ban//')
403+
fi
404+
394405
# Update system packages
395406
apt-get update
396407

@@ -434,6 +445,7 @@ mkdir -p $VESTA/data
434445
mkdir -p $VESTA/data/ips
435446
mkdir -p $VESTA/data/queue
436447
mkdir -p $VESTA/data/users
448+
mkdir -p $VESTA/data/firewall
437449
touch $VESTA/data/queue/backup.pipe
438450
touch $VESTA/data/queue/disk.pipe
439451
touch $VESTA/data/queue/webstats.pipe
@@ -483,6 +495,15 @@ if [ "$srv_type" = 'micro' ]; then
483495
rm -f /usr/local/vesta/data/templates/web/apache2/phpfcgid.*
484496
fi
485497

498+
# Firewall configuartion
499+
wget $CHOST/$VERSION/firewall.tar.gz -O firewall.tar.gz
500+
tar -xzf firewall.tar.gz
501+
if [ "$disable_iptables" = 'yes' ]; then
502+
sed -i "s/iptables//" $VESTA/conf/vesta.conf
503+
else
504+
$BIN/v-update-firewall
505+
fi
506+
486507
# Generating SSL certificate
487508
$VESTA/bin/v-generate-ssl-cert $(hostname) $email 'US' 'California' \
488509
'San Francisco' 'Vesta Control Panel' 'IT' > /tmp/vst.pem
@@ -703,6 +724,17 @@ if [ "$srv_type" = 'medium' ] || [ "$srv_type" = 'large' ]; then
703724
fi
704725
fi
705726

727+
# Fail2ban configuration
728+
if [ -z "$disable_fail2ban" ]; then
729+
cd /etc
730+
wget $CHOST/$VERSION/fail2ban.tar.gz -O fail2ban.tar.gz
731+
tar -xzf fail2ban.tar.gz
732+
rm -f fail2ban.tar.gz
733+
chkconfig fail2ban on
734+
service fail2ban start
735+
else
736+
sed -i "s/fail2ban//" $VESTA/conf/vestac.conf
737+
fi
706738
# php configuration
707739
sed -i "s/;date.timezone =/date.timezone = UTC/g" /etc/php5/apache2/php.ini
708740
sed -i "s/;date.timezone =/date.timezone = UTC/g" /etc/php5/cli/php.ini

install/vst-install-rhel.sh

Lines changed: 53 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,23 @@ software="nginx httpd mod_ssl mod_ruid2 mod_extract_forwarded mod_fcgid
1717
phpMyAdmin awstats webalizer vsftpd mysql mysql-server exim dovecot clamd
1818
spamassassin curl roundcubemail bind bind-utils bind-libs mc screen ftp
1919
libpng libjpeg libmcrypt mhash zip unzip openssl flex rssh libxml2
20-
ImageMagick sqlite pcre sudo bc jwhois mailx lsof tar telnet rsync
21-
rrdtool GeoIP freetype ntp openssh-clients vesta vesta-nginx vesta-php"
20+
ImageMagick sqlite pcre sudo bc jwhois mailx lsof tar telnet rrdtool
21+
fail2ban GeoIP freetype ntp openssh-clients vesta vesta-nginx vesta-php"
2222

2323
# Help
2424
help() {
2525
echo "usage: $0 [OPTIONS]
26-
-d, --disable-remi Disable remi repository
27-
-e, --email Set email address
28-
-f, --force Force installation
2926
-h, --help Print this help and exit
27+
-f, --force Force installation
28+
-i, --disable-iptables Disable iptables support
29+
-b, --disable-fail2ban Disable fail2ban protection
30+
-d, --disable-remi Disable remi repository
3031
-n, --noupdate Do not run yum update command
31-
-m, --mysql-password Set MySQL password instead of generating it
32-
-p, --password Set admin password instead of generating it
3332
-s, --hostname Set server hostname
33+
-e, --email Set email address
34+
-p, --password Set admin password instead of generating it
35+
-m, --mysql-password Set MySQL password instead of generating it
3436
-q, --quota Enable File System Quota"
35-
3637
exit 1
3738
}
3839

@@ -56,14 +57,16 @@ gen_pass() {
5657
for arg; do
5758
delim=""
5859
case "$arg" in
59-
--disable-remi) args="${args}-d " ;;
60-
--email) args="${args}-e " ;;
61-
--force) args="${args}-f " ;;
6260
--help) args="${args}-h " ;;
61+
--force) args="${args}-f " ;;
62+
--disable-fail2ban) args="${args}-b " ;;
63+
--disable-remi) args="${args}-d " ;;
64+
--disable-iptables) args="${args}-i " ;;
6365
--noupdate) args="${args}-n " ;;
64-
--mysql-password) args="${args}-m " ;;
65-
--password) args="${args}-p " ;;
6666
--hostname) args="${args}-s " ;;
67+
--email) args="${args}-e " ;;
68+
--password) args="${args}-p " ;;
69+
--mysql-password) args="${args}-m " ;;
6770
--quota) args="${args}-q " ;;
6871
*) [[ "${arg:0:1}" == "-" ]] || delim="\""
6972
args="${args}${delim}${arg}${delim} ";;
@@ -72,16 +75,18 @@ done
7275
eval set -- "$args"
7376

7477
# Getopt
75-
while getopts "dhfnqe:m:p:s:" Option; do
78+
while getopts "hfibdnqe:m:p:s:" Option; do
7679
case $Option in
77-
d) disable_remi='yes' ;; # Disable remi repo
7880
h) help ;; # Help
79-
e) email=$OPTARG ;; # Set email
8081
f) force='yes' ;; # Force install
82+
i) disable_iptables='yes' ;; # Disable iptables
83+
b) disable_fail2ban='yes' ;; # Disable fail2ban
84+
d) disable_remi='yes' ;; # Disable remi repo
8185
n) noupdate='yes' ;; # Disable yum update
82-
m) mpass=$OPTARG ;; # MySQL pasword
83-
p) vpass=$OPTARG ;; # Admin password
8486
s) servername=$OPTARG ;; # Server hostname
87+
e) email=$OPTARG ;; # Set email
88+
p) vpass=$OPTARG ;; # Admin password
89+
m) mpass=$OPTARG ;; # MySQL pasword
8590
q) quota='yes' ;; # Enable quota
8691
*) help ;; # Default
8792
esac
@@ -106,6 +111,7 @@ release=$(grep -o "[0-9]" /etc/redhat-release |head -n1)
106111
codename="${os}_$release"
107112
if [ $os != 'CentOS' ] && [ $os != 'Red' ]; then
108113
echo 'Error: sorry, we currently support RHEL and CentOS only'
114+
exit
109115
fi
110116

111117
# Check admin user account
@@ -447,6 +453,11 @@ if [ "$srv_type" = 'small' ]; then
447453
software=$(echo "$software" | sed -e 's/spamassassin//')
448454
fi
449455

456+
# Exclude fail2ban
457+
if [ "$disable_fail2ban" = 'yes' ]; then
458+
software=$(echo "$software" | sed -e 's/fail2ban//')
459+
fi
460+
450461
# Install Vesta packages
451462
if [ -z "$disable_remi" ]; then
452463
yum -y --disablerepo=* --enablerepo="base,updates,nginx,epel,vesta,remi" \
@@ -495,6 +506,7 @@ mkdir -p $VESTA/data
495506
mkdir -p $VESTA/data/ips
496507
mkdir -p $VESTA/data/queue
497508
mkdir -p $VESTA/data/users
509+
mkdir -p $VESTA/data/firewall
498510
touch $VESTA/data/queue/backup.pipe
499511
touch $VESTA/data/queue/disk.pipe
500512
touch $VESTA/data/queue/webstats.pipe
@@ -542,6 +554,17 @@ if [ "$srv_type" = 'micro' ]; then
542554
rm -f /usr/local/vesta/data/templates/web/httpd/phpfcgid.*
543555
fi
544556

557+
# Firewall configuration
558+
wget $CHOST/$VERSION/firewall.tar.gz -O firewall.tar.gz
559+
tar -xzf firewall.tar.gz
560+
if [ "$disable_iptables" = 'yes' ]; then
561+
sed -i "s/iptables//" $VESTA/conf/vesta.conf
562+
chkconfig iptables off
563+
service iptables stop
564+
else
565+
$BIN/v-update-firewall
566+
fi
567+
545568
# Generating SSL certificate
546569
$VESTA/bin/v-generate-ssl-cert $(hostname) $email 'US' 'California' \
547570
'San Francisco' 'Vesta Control Panel' 'IT' > /tmp/vst.pem
@@ -559,10 +582,6 @@ chown root:mail /usr/local/vesta/ssl/*
559582
chmod 660 /usr/local/vesta/ssl/*
560583
rm /tmp/vst.pem
561584

562-
# Disabling iptables
563-
chkconfig iptables off
564-
service iptables stop
565-
566585
# Disabling webalizer routine
567586
rm -f /etc/cron.daily/00webalizer
568587

@@ -757,6 +776,18 @@ if [ "$srv_type" = 'medium' ] || [ "$srv_type" = 'large' ]; then
757776
fi
758777
fi
759778

779+
# Fail2ban configuration
780+
if [ -z "$disable_fail2ban" ]; then
781+
cd /etc
782+
wget $CHOST/$VERSION/fail2ban.tar.gz -O fail2ban.tar.gz
783+
tar -xzf fail2ban.tar.gz
784+
rm -f fail2ban.tar.gz
785+
chkconfig fail2ban on
786+
service fail2ban start
787+
else
788+
sed -i "s/fail2ban//" $VESTA/conf/vestac.conf
789+
fi
790+
760791
# php configuration
761792
sed -i 's/short_open_tag = Off/short_open_tag = On/g' /etc/php.ini
762793
sed -i "s/;date.timezone =/date.timezone = UTC/g" /etc/php.ini

0 commit comments

Comments
 (0)