@@ -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
2424help () {
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() {
5657for 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} " ;;
7275eval 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)
106111codename=" ${os} _$release "
107112if [ $os != ' CentOS' ] && [ $os != ' Red' ]; then
108113 echo ' Error: sorry, we currently support RHEL and CentOS only'
114+ exit
109115fi
110116
111117# Check admin user account
@@ -447,6 +453,11 @@ if [ "$srv_type" = 'small' ]; then
447453 software=$( echo " $software " | sed -e ' s/spamassassin//' )
448454fi
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
451462if [ -z " $disable_remi " ]; then
452463 yum -y --disablerepo=* --enablerepo=" base,updates,nginx,epel,vesta,remi" \
@@ -495,6 +506,7 @@ mkdir -p $VESTA/data
495506mkdir -p $VESTA /data/ips
496507mkdir -p $VESTA /data/queue
497508mkdir -p $VESTA /data/users
509+ mkdir -p $VESTA /data/firewall
498510touch $VESTA /data/queue/backup.pipe
499511touch $VESTA /data/queue/disk.pipe
500512touch $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.*
543555fi
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/*
559582chmod 660 /usr/local/vesta/ssl/*
560583rm /tmp/vst.pem
561584
562- # Disabling iptables
563- chkconfig iptables off
564- service iptables stop
565-
566585# Disabling webalizer routine
567586rm -f /etc/cron.daily/00webalizer
568587
@@ -757,6 +776,18 @@ if [ "$srv_type" = 'medium' ] || [ "$srv_type" = 'large' ]; then
757776 fi
758777fi
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
761792sed -i ' s/short_open_tag = Off/short_open_tag = On/g' /etc/php.ini
762793sed -i " s/;date.timezone =/date.timezone = UTC/g" /etc/php.ini
0 commit comments