#!/bin/bash # # Debian GNU/Linux Installation Script for LAMP + ISPConfig3 # Script written by Aris S Ripandi (riespandi@gmail.com) 15/01/2012 # # Referensi: # - http://www.howtoforge.com/how-to-run-your-own-name-server-with-ispconfig-3-and-fast-hosts # - http://www.howtoforge.com/perfect-server-debian-squeeze-with-bind-and-courier-ispconfig-3 # - http://www.howtoforge.com/installing-mydns-ng-and-mydnsconfig-on-debian-squeeze # - http://www.howtoforge.com/how-to-run-your-own-name-server-with-ispconfig-3-and-fast-hosts # - http://www.howtoforge.com/ispconfig_dns_godaddy # - http://docs.ispconfig.org/ # - http://bikramkawan.com.np/how-to-ispconfig-change-port-8080/ # # TODO: # - Redirect /cpanel to https and port ISPConfig # # Alias /cpanel /var/www/ispconfig/ # Redirect 301 /cpanel https://%{SERVER_ADDR}:9090/ # # # RewriteEngine On # RewriteCond %{SERVER_PORT} !^9090$ # RewriteCond %{REQUEST_URI} ^/cpanel # #RewriteRule ^/(.*)?$ https://%{HTTP_HOST}:9090/ # #RewriteRule ^/(.*)?$ https://%{SERVER_NAME}:9090/ # RewriteRule ^/(.*)?$ https://%{SERVER_ADDR}:9090/ # # # http://www.howtoforge.com/how-to-install-roundcube-0.7-for-ispconfig-3-on-debian-squeeze # http://nchc.dl.sourceforge.net/project/roundcubemail/roundcubemail/0.7.1/roundcubemail-0.7.1.tar.gz # http://ncu.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.5.0-alpha1/phpMyAdmin-3.5.0-alpha1-english.tar.gz # fuser -vki /var/lib/dpkg/lock && dpkg --configure -a # var_folder_anuieu="`pwd`" var_folder_asrcfg="`pwd`/asrcfg" var_IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'` var_OS=$(awk '/DISTRIB_ID=/' /etc/*-release | sed 's/DISTRIB_ID=//' | tr '[:upper:]' '[:lower:]') # cek os #if [ -f /etc/lsb-release ]; then # . /etc/lsb-release # OS=$DISTRIB_ID # CN=$DISTRIB_CODENAME #elif [ -f /etc/debian_version ]; then # OS=Debian #echo $OS $CN # Make sure only root can run our script [[ $(id -u) -ne 0 ]] && { echo "$0: You must be root user to run this script. Run it as 'sudo $0'"; exit 1; } clear echo "##################################################################" echo "# LAMP + ISPConfig Installation Package for Debian GNU/Linux #" echo "# ---------------------------------------------------------- #" echo "# Package maintainer: Aris S Ripandi (riespandi@gmail.com) #" echo "# Last updated: 15/01/2012 #" echo "# Website: http://www.kits.or.id #" echo "#################################################################" echo "" echo "Welcome to the online installer for LAMP + ISPCOnfig. This installer only for Debian Squeeze and Ubuntu " echo "This will download the required software and install LAMP + ISPConfig3." echo "" echo "Are you sure you want to continue? Press ENTER to continue or CTRL+C to quit!" read continue cd /tmp # Install the required development enviroment packages... echo "-----------------------------------------------------------------" echo "-- Updating package repository cache" echo "-----------------------------------------------------------------" ########################### update repository ########################## update_repo_debian(){ mv /etc/apt/sources.list /etc/apt/sources.list.bak echo "deb http://debian.indika.net.id/debian/ stable main" >> /etc/apt/sources.list echo "deb-src http://debian.indika.net.id/debian/ stable main" >> /etc/apt/sources.list #echo "deb http://repo.ugm.ac.id/debian squeeze main non-free contrib" >> /etc/apt/sources.list #echo "deb-src http://repo.ugm.ac.id/debian squeeze main non-free contrib" >> /etc/apt/sources.list echo "deb http://packages.dotdeb.org stable all" >> /etc/apt/sources.list echo "deb-src http://packages.dotdeb.org stable all" >> /etc/apt/sources.list wget http://www.dotdeb.org/dotdeb.gpg cat dotdeb.gpg | apt-key add - sed -i -e 's/deb http:\/\/packages.dotdeb.org stable all/#deb http:\/\/packages.dotdeb.org stable all/g' /etc/apt/sources.list sed -i -e 's/deb-src http:\/\/packages.dotdeb.org stable all/#deb-src http:\/\/packages.dotdeb.org stable all/g' /etc/apt/sources.list apt-get update apt-get -y upgrade } read -p "Do you want to change your repository [Y/n] ? " qrepo shopt -s nocasematch if [[ $qrepo =~ y|es ]]; then update_repo_debian; else echo "Press ENTER to continue update or press CTRL+C to cancel.." read continue fi shopt -u nocasematch ########################### update repository ########################## echo "-----------------------------------------------------------------" echo "-- Change your default editor, regional and shell" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue apt-get install -y -f nano ssh openssh-server ntp ntpdate ftp insserv dpkg-reconfigure dash dpkg-reconfigure tzdata ######################################################################## # file /etc/ntp.conf ############################## start file ############################## echo "# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help" >> /etc/ntp.conf echo "" >> /etc/ntp.conf echo "driftfile /var/lib/ntp/ntp.drift" >> /etc/ntp.conf echo "" >> /etc/ntp.conf echo "statistics loopstats peerstats clockstats" >> /etc/ntp.conf echo "filegen loopstats file loopstats type day enable" >> /etc/ntp.conf echo "filegen peerstats file peerstats type day enable" >> /etc/ntp.conf echo "filegen clockstats file clockstats type day enable" >> /etc/ntp.conf echo "" >> /etc/ntp.conf echo "server 0.id.pool.ntp.org" >> /etc/ntp.conf echo "server 1.id.pool.ntp.org" >> /etc/ntp.conf echo "server 2.id.pool.ntp.org" >> /etc/ntp.conf echo "server 3.id.pool.ntp.org" >> /etc/ntp.conf echo "" >> /etc/ntp.conf echo "restrict -4 default kod notrap nomodify nopeer noquery" >> /etc/ntp.conf echo "restrict -6 default kod notrap nomodify nopeer noquery" >> /etc/ntp.conf echo "" >> /etc/ntp.conf echo "restrict 127.0.0.1" >> /etc/ntp.conf echo "restrict ::1" >> /etc/ntp.conf echo "restrict 0.0.0.0 mask 0.0.0.0 nomodify notrap" >> /etc/ntp.conf ############################### end file ############################### /etc/init.d/ntp restart update-alternatives --config editor echo "-----------------------------------------------------------------" echo "-- Change your IP Address, Name Server and hostname" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue echo "Enter hostname:" read var_hostname echo ${var_hostname} > /etc/hostname ######################################################################## # file /etc/resolv.conf ############################## start file ############################## echo "nameserver ${var_IP}" >> /etc/resolv.conf echo "nameserver 127.0.0.1" >> /etc/resolv.conf echo "nameserver 8.8.8.8" >> /etc/resolv.conf ############################### end file ############################### /etc/init.d/networking stop /etc/init.d/networking start /etc/init.d/hostname.sh stop /etc/init.d/hostname.sh start echo "-----------------------------------------------------------------" echo "-- Installing Apache, PHP, MySQL, phpMyAdmin, Courier etc" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue apt-get install -y -f postfix postfix-mysql postfix-doc mysql-client mysql-server courier-authdaemon courier-authlib-mysql courier-pop courier-pop-ssl courier-imap courier-imap-ssl libsasl2-2 libsasl2-modules libsasl2-modules-sql sasl2-bin libpam-mysql openssl courier-maildrop getmail4 rkhunter binutils sudo apt-get install -y -f amavisd-new spamassassin clamav clamav-daemon zoo unzip bzip2 arj nomarch lzop cabextract apt-listchanges libnet-ldap-perl libauthen-sasl-perl clamav-docs daemon libio-string-perl libio-socket-ssl-perl libnet-ident-perl zip libnet-dns-perl apt-get install -y -f apache2 apache2.2-common apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert libapache2-mod-php5 php5 php5-common php5-gd php5-sqlite php5-mysql php5-imap phpmyadmin php5-cli php5-cgi libapache2-mod-fcgid apache2-suexec apache2-prefork-dev php-pear php-auth php5-mcrypt mcrypt php5-imagick imagemagick libapache2-mod-suphp libruby libapache2-mod-ruby pure-ftpd-common pure-ftpd-mysql quota quotatool apt-get install -y -f g++ libc6 gcc gawk make texinfo libmysqlclient15-dev dnsutils apt-get install -y -f vlogger webalizer awstats geoip-database squirrelmail apt-get install -y -f build-essential autoconf automake1.9 libtool flex bison debhelper fail2ban apt-get install pecl install pdo pdo_mysql pdo_sqlite echo "-----------------------------------------------------------------" echo "-- Configure MySQL" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue sed -i -e 's/bind-address/#bind-address/g' /etc/mysql/my.cnf /etc/init.d/mysql restart netstat -tap | grep mysql echo "-----------------------------------------------------------------" echo "-- Configure Courier" echo "-----------------------------------------------------------------" cd /etc/courier rm -f /etc/courier/imapd.pem rm -f /etc/courier/pop3d.pem ######################################################################## # file /etc/courier/imapd.cnf ############################## start file ############################## sed -i -e 's/CN=localhost/CN=${var_hostname}/g' /etc/courier/imapd.cnf sed -i -e 's/emailAddress=postmaster@localhost/emailAddress=postmaster@${var_hostname}/g' /etc/courier/imapd.cnf ######################################################################## # file /etc/courier/pop3d.cnf ############################## start file ############################## sed -i -e 's/CN=localhost/CN=${var_hostname}/g' /etc/courier/pop3d.cnf sed -i -e 's/emailAddress=postmaster@localhost/emailAddress=postmaster@${var_hostname}/g' /etc/courier/pop3d.cnf # # buat sertifikat # mkimapdcert mkpop3dcert /etc/init.d/courier-imap-ssl restart /etc/init.d/courier-pop-ssl restart echo "-----------------------------------------------------------------" echo "-- Configure SpamAssassin, Apache and Pure-FTP" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue service spamassassin stop update-rc.d -f spamassassin remove a2enmod suexec rewrite ssl actions include && a2enmod dav_fs dav auth_digest /etc/init.d/apache2 restart sed -i -e 's/STANDALONE_OR_INETD=inetd/STANDALONE_OR_INETD=standalone/g' /etc/default/pure-ftpd-common sed -i -e 's/VIRTUALCHROOT=false/VIRTUALCHROOT=true/g' /etc/default/pure-ftpd-common sed -i -e 's/ftp stream/#ftp stream/g' /etc/inetd.conf echo "#ftp stream tcp nowait root /usr/sbin/tcpd /usr/sbin/pure-ftpd-wrapper" >> /etc/inetd.conf /etc/init.d/openbsd-inetd restart echo 1 > /etc/pure-ftpd/conf/TLS mkdir -p /etc/ssl/private/ openssl req -x509 -nodes -days 7300 -newkey rsa:2048 -keyout /etc/ssl/private/pure-ftpd.pem -out /etc/ssl/private/pure-ftpd.pem echo "Press ENTER to continue.." read continue chmod 600 /etc/ssl/private/pure-ftpd.pem /etc/init.d/pure-ftpd-mysql restart echo "-----------------------------------------------------------------" echo "-- Configure fstab" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue echo "UUID=92bceda2-5ae4-4e3a-8748-b14da48fb297 / ext3 errors=remount-ro,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0 0 1" >> /fstab mount -o remount / quotacheck -avugm quotaon -avug echo "-----------------------------------------------------------------" echo "-- Install and Configure MyDNS" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue cd /tmp wget http://heanet.dl.sourceforge.net/sourceforge/mydns-ng/mydns-1.2.8.31.tar.gz tar xvfz mydns-*.tar.gz cd mydns-* ./configure make && make install insserv mydns ######################################################################## # file /etc/init.d/mydns ############################## start file ############################## echo "#! /bin/sh" >> /etc/init.d/mydns echo "#" >> /etc/init.d/mydns echo "# mydns Start the MyDNS server" >> /etc/init.d/mydns echo "#" >> /etc/init.d/mydns echo "# Author: Philipp Kern ." >> /etc/init.d/mydns echo "# Based upon skeleton 1.9.4 by Miquel van Smoorenburg" >> /etc/init.d/mydns echo "# and Ian Murdock ." >> /etc/init.d/mydns echo "#" >> /etc/init.d/mydns echo "set -e" >> /etc/init.d/mydns echo "PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" >> /etc/init.d/mydns echo "DAEMON=/usr/local/sbin/mydns" >> /etc/init.d/mydns echo "NAME=mydns" >> /etc/init.d/mydns echo "DESC=\"DNS server\"" >> /etc/init.d/mydns echo "SCRIPTNAME=/etc/init.d/$NAME" >> /etc/init.d/mydns echo "# Gracefully exit if the package has been removed." >> /etc/init.d/mydns echo "test -x $DAEMON || exit 0" >> /etc/init.d/mydns echo "case \"$1\" in" >> /etc/init.d/mydns echo " start)" >> /etc/init.d/mydns echo " echo -n \"Starting $DESC: $NAME\"" >> /etc/init.d/mydns echo " start-stop-daemon --start --quiet \\" >> /etc/init.d/mydns echo " --exec $DAEMON -- -b" >> /etc/init.d/mydns echo " echo \".\"" >> /etc/init.d/mydns echo " ;;" >> /etc/init.d/mydns echo " stop)" >> /etc/init.d/mydns echo " echo -n \"Stopping $DESC: $NAME\"" >> /etc/init.d/mydns echo " start-stop-daemon --stop --oknodo --quiet \\" >> /etc/init.d/mydns echo " --exec $DAEMON" >> /etc/init.d/mydns echo " echo \".\"" >> /etc/init.d/mydns echo " ;;" >> /etc/init.d/mydns echo " reload|force-reload)" >> /etc/init.d/mydns echo " echo -n \"Reloading $DESC configuration...\"" >> /etc/init.d/mydns echo " start-stop-daemon --stop --signal HUP --quiet \\" >> /etc/init.d/mydns echo " --exec $DAEMON" >> /etc/init.d/mydns echo " echo \"done.\"" >> /etc/init.d/mydns echo " ;;" >> /etc/init.d/mydns echo " restart)" >> /etc/init.d/mydns echo " echo -n \"Restarting $DESC: $NAME\"" >> /etc/init.d/mydns echo " start-stop-daemon --stop --quiet --oknodo \\" >> /etc/init.d/mydns echo " --exec $DAEMON" >> /etc/init.d/mydns echo " sleep 1" >> /etc/init.d/mydns echo " start-stop-daemon --start --quiet \\" >> /etc/init.d/mydns echo " --exec $DAEMON -- -b" >> /etc/init.d/mydns echo " echo \".\"" >> /etc/init.d/mydns echo " ;;" >> /etc/init.d/mydns echo " *)" >> /etc/init.d/mydns echo " echo \"Usage: $SCRIPTNAME {start|stop|restart|reload|force-reload}\" >&2" >> /etc/init.d/mydns echo " exit 1" >> /etc/init.d/mydns echo " ;;" >> /etc/init.d/mydns echo "esac" >> /etc/init.d/mydns echo "exit 0" >> /etc/init.d/mydns ############################### end file ############################### chmod +x /etc/init.d/mydns update-rc.d mydns defaults echo "-----------------------------------------------------------------" echo "-- Configure AWstats" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue mkdir -p /usr/share/awstats/tools/ cp -prf /usr/share/doc/awstats/examples/awstats_buildstaticpages.pl /usr/share/awstats/tools/awstats_buildstaticpages.pl ######################################################################## # file /etc/cron.d/awstats ############################## start file ############################## echo "# /etc/cron.d/awstats" >> /etc/cron.d/awstats echo "#" >> /etc/cron.d/awstats echo "#*/10 * * * * www-data [ -x /usr/share/awstats/tools/update.sh ] && /usr/share/awstats/tools/update.sh" >> /etc/cron.d/awstats echo "# Generate static reports:" >> /etc/cron.d/awstats echo "#10 03 * * * www-data [ -x /usr/share/awstats/tools/buildstatic.sh ] && /usr/share/awstats/tools/buildstatic.sh" >> /etc/cron.d/awstats ############################### end file ############################### echo "-----------------------------------------------------------------" echo "-- Install and Configure Jailkit" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue cd /tmp && wget http://olivier.sessink.nl/jailkit/jailkit-2.13.tar.gz tar xvfz jailkit-*.tar.gz cd jailkit-2.13 ./debian/rules binary cd .. && dpkg -i jailkit_2.13-1_*.deb rm -rf jailkit-2.13* ######################################################################## # file /etc/fail2ban/* ############################## start file ############################## echo "[pureftpd]" >> /etc/fail2ban/jail.local echo "enabled = true" >> /etc/fail2ban/jail.local echo "port = ftp" >> /etc/fail2ban/jail.local echo "filter = pureftpd" >> /etc/fail2ban/jail.local echo "logpath = /var/log/syslog" >> /etc/fail2ban/jail.local echo "maxretry = 3" >> /etc/fail2ban/jail.local echo "" >> /etc/fail2ban/jail.local echo "[sasl]" >> /etc/fail2ban/jail.local echo "enabled = true" >> /etc/fail2ban/jail.local echo "port = smtp" >> /etc/fail2ban/jail.local echo "filter = sasl" >> /etc/fail2ban/jail.local echo "logpath = /var/log/mail.log" >> /etc/fail2ban/jail.local echo "maxretry = 5" >> /etc/fail2ban/jail.local echo "" >> /etc/fail2ban/jail.local echo "[courierpop3]" >> /etc/fail2ban/jail.local echo "enabled = true" >> /etc/fail2ban/jail.local echo "port = pop3" >> /etc/fail2ban/jail.local echo "filter = courierpop3" >> /etc/fail2ban/jail.local echo "logpath = /var/log/mail.log" >> /etc/fail2ban/jail.local echo "maxretry = 5" >> /etc/fail2ban/jail.local echo "" >> /etc/fail2ban/jail.local echo "[courierpop3s]" >> /etc/fail2ban/jail.local echo "enabled = true" >> /etc/fail2ban/jail.local echo "port = pop3s" >> /etc/fail2ban/jail.local echo "filter = courierpop3s" >> /etc/fail2ban/jail.local echo "logpath = /var/log/mail.log" >> /etc/fail2ban/jail.local echo "maxretry = 5" >> /etc/fail2ban/jail.local echo "" >> /etc/fail2ban/jail.local echo "[courierimap]" >> /etc/fail2ban/jail.local echo "enabled = true" >> /etc/fail2ban/jail.local echo "port = imap2" >> /etc/fail2ban/jail.local echo "filter = courierimap" >> /etc/fail2ban/jail.local echo "logpath = /var/log/mail.log" >> /etc/fail2ban/jail.local echo "maxretry = 5" >> /etc/fail2ban/jail.local echo "" >> /etc/fail2ban/jail.local echo "[courierimaps]" >> /etc/fail2ban/jail.local echo "enabled = true" >> /etc/fail2ban/jail.local echo "port = imaps" >> /etc/fail2ban/jail.local echo "filter = courierimaps" >> /etc/fail2ban/jail.local echo "logpath = /var/log/mail.log" >> /etc/fail2ban/jail.local echo "maxretry = 5" >> /etc/fail2ban/jail.local echo "" >> /etc/fail2ban/jail.local echo "[Definition]" >> /etc/fail2ban/filter.d/pureftpd.conf echo "failregex = .*pure-ftpd: \\(.*@\\) \\[WARNING\\] Authentication failed for user.*" >> /etc/fail2ban/filter.d/pureftpd.conf echo "ignoreregex =" >> /etc/fail2ban/filter.d/pureftpd.conf echo "[Definition]" >> /etc/fail2ban/filter.d/courierimaps.conf echo "failregex = imapd-ssl: LOGIN FAILED.*ip=\\[.*:\\]" >> /etc/fail2ban/filter.d/courierimaps.conf echo "ignoreregex =" >> /etc/fail2ban/filter.d/courierimaps.conf echo "[Definition]" >> /etc/fail2ban/filter.d/courierimap.conf echo "failregex = imapd: LOGIN FAILED.*ip=\\[.*:\\]" >> /etc/fail2ban/filter.d/courierimap.conf echo "ignoreregex =" >> /etc/fail2ban/filter.d/courierimap.conf echo "[Definition]" >> /etc/fail2ban/filter.d/courierpop3s.conf echo "failregex = pop3d-ssl: LOGIN FAILED.*ip=\\[.*:\\]" >> /etc/fail2ban/filter.d/courierpop3s.conf echo "ignoreregex =" >> /etc/fail2ban/filter.d/courierpop3s.conf echo "[Definition]" >> /etc/fail2ban/filter.d/courierpop3.conf echo "failregex = pop3d: LOGIN FAILED.*ip=\\[.*:\\]" >> /etc/fail2ban/filter.d/courierpop3.conf echo" ignoreregex =" >> /etc/fail2ban/filter.d/courierpop3.conf ############################### end file ############################### /etc/init.d/fail2ban restart echo "-----------------------------------------------------------------" echo "-- Configure Squirellmail" echo "-----------------------------------------------------------------" echo " 1) Command >> <-- D" echo " 2) Command >> <-- courier" echo " 3) Press any key to continue... <-- press a key" echo " 4) Command >> <-- S" echo " 5) Command >> <-- Q" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue ln -s /usr/share/squirrelmail/ /var/www/webmail squirrelmail-configure cd /etc/apache2/conf.d/ ln -s ../../squirrelmail/apache.conf squirrelmail.conf mkdir /var/lib/squirrelmail/tmp chown www-data /var/lib/squirrelmail/tmp ######################################################################## # file /etc/apache2/conf.d/squirrelmail.conf ############################## start file ############################## echo "Alias /webmail /usr/share/squirrelmail" >> /etc/apache2/conf.d/squirrelmail.conf echo "" >> /etc/apache2/conf.d/squirrelmail.conf echo " Options FollowSymLinks" >> /etc/apache2/conf.d/squirrelmail.conf echo " " >> /etc/apache2/conf.d/squirrelmail.conf echo " AddType application/x-httpd-php .php" >> /etc/apache2/conf.d/squirrelmail.conf echo " php_flag magic_quotes_gpc Off" >> /etc/apache2/conf.d/squirrelmail.conf echo " php_flag track_vars On" >> /etc/apache2/conf.d/squirrelmail.conf echo " php_admin_flag allow_url_fopen Off" >> /etc/apache2/conf.d/squirrelmail.conf echo " php_value include_path ." >> /etc/apache2/conf.d/squirrelmail.conf echo " php_admin_value upload_tmp_dir /var/lib/squirrelmail/tmp" >> /etc/apache2/conf.d/squirrelmail.conf echo " php_admin_value open_basedir /usr/share/squirrelmail:/etc/squirrelmail:/var/lib/squirrelmail:/etc/hostname:/etc/mailname" >> /etc/apache2/conf.d/squirrelmail.conf echo " php_flag register_globals off" >> /etc/apache2/conf.d/squirrelmail.conf echo " " >> /etc/apache2/conf.d/squirrelmail.conf echo " " >> /etc/apache2/conf.d/squirrelmail.conf echo " DirectoryIndex index.php" >> /etc/apache2/conf.d/squirrelmail.conf echo " " >> /etc/apache2/conf.d/squirrelmail.conf echo " " >> /etc/apache2/conf.d/squirrelmail.conf echo " order deny,allow" >> /etc/apache2/conf.d/squirrelmail.conf echo " deny from all" >> /etc/apache2/conf.d/squirrelmail.conf echo " allow from 127.0.0.1" >> /etc/apache2/conf.d/squirrelmail.conf echo " " >> /etc/apache2/conf.d/squirrelmail.conf echo "" >> /etc/apache2/conf.d/squirrelmail.conf cat > /etc/apache2/roundcube.conf < Options +FollowSymLinks AllowOverride All order allow,deny allow from all AddType application/x-httpd-php .php php_flag magic_quotes_gpc Off php_flag track_vars On php_admin_flag allow_url_fopen Off php_value include_path . php_admin_value upload_tmp_dir /var/www/webmail/temp php_admin_value open_basedir /var/www/webmail php_flag register_globals off Options -FollowSymLinks AllowOverride None order deny,allow deny from all allow from 127.0.0.1 Options -FollowSymLinks AllowOverride None Order allow,deny Deny from all Options -FollowSymLinks AllowOverride None Order allow,deny Deny from all EOF ############################### end file ############################### /etc/init.d/apache2 reload echo "-----------------------------------------------------------------" echo "-- Install ISPConfig" echo "-----------------------------------------------------------------" echo "Press ENTER to continue.." read continue cd /tmp #wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz tar xjvf ispconfig.tar.bz2 cd /tmp/ispconfig/install/ php -q install.php ######################################################################## # file /var/www/index.html ############################## start file ############################## rm -f /var/www/index.html echo "" >> /var/www/index.html echo "" >> /var/www/index.html echo "" >> /var/www/index.html echo "" >> /var/www/index.html echo "Default Web Page" >> /var/www/index.html echo "" >> /var/www/index.html echo "" >> /var/www/index.html echo "
" >> /var/www/index.html echo "\"Oops\"" >> /var/www/index.html echo "

Welcome to our site

" >> /var/www/index.html echo "

it seems the website is still under development, please visit again later

" >> /var/www/index.html echo "

Copyright © All right reserved.

" >> /var/www/index.html echo "
" >> /var/www/index.html echo "" >> /var/www/index.html echo "" >> /var/www/index.html ############################### end file ############################### echo "-----------------------------------------------------------------" echo "-- Installing ConfigServer Security & Firewall" echo "-----------------------------------------------------------------" apt-get install -y -f libapache2-mod-evasive read -p "Do you want install ConfigServer Security & Firewall [Y/n] ? " instal_csf shopt -s nocasematch if [[ $instal_csf =~ y|es ]]; then cd /tmp wget http://configserver.com/free/csf.tgz tar zxvf csf.tgz cd /csf chmod +x install.sh ./install.sh cp /etc/csf/csf.conf /etc/csf/csf.conf.bak sed -i -e 's/TESTING = "1"/TESTING = "0"/g' /etc/csf/csf.conf sed -i -e 's/AUTO_UPDATES = "0"/AUTO_UPDATES = "1"/g' /etc/csf/csf.conf sed -i -e 's/LF_HTACCESS = "5"/LF_HTACCESS = "9"/g' /etc/csf/csf.conf csf -r else read -p "Press ENTER to continue.." continue fi shopt -u nocasematch echo "-----------------------------------------------------------------" echo "-- Securing PHP and Apache" echo "-----------------------------------------------------------------" read -p "Do you want update PHP and MySQL [Y/n] ? " updatelamp shopt -s nocasematch if [[ $updatelamp =~ y|es ]]; then sed -i -e 's/#deb http://packages.dotdeb.org stable all/deb http://packages.dotdeb.org stable all/g' /etc/apt/sources.list sed -i -e 's/#deb-src http://packages.dotdeb.org stable all/deb-src http://packages.dotdeb.org stable all/g' /etc/apt/sources.list apt-get update && apt-get safe upgrade else read -p "Press ENTER to continue.." continue fi shopt -u nocasematch echo "-----------------------------------------------------------------" echo "-- Securing SSH, PHP and Apache" echo "-----------------------------------------------------------------" sed -i -e 's/expose_php = On/expose_php = Off/g' /etc/php/php.ini sed -i -e 's/ServerSignature On/ServerSignature Off/g' /etc/apache2/apache2.conf echo "ClientAliveInterval 10" >> /etc/ssh/sshd_config # Reconfigure sshd - change port and disable root login sed -i 's/^Port [0-9]*/Port 911/' /etc/ssh/sshd_config #sed -i 's/PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config #read -p "Enter Unix username ? " ssh_usrname #adduser ssh_usrname #echo "${ssh_usrname} ALL=NOPASSWD: ALL" >> /etc/sudoers cat > /etc/motd <