diff --git a/.travis.yml b/.travis.yml index a2bffd87..f9c2e332 100644 --- a/.travis.yml +++ b/.travis.yml @@ -126,6 +126,8 @@ script: - sudo bash ee debug - sudo bash ee debug --stop +- sudo bash ee stack install mail + - sudo cat /var/log/easyengine/* diff --git a/CHANGELOG.txt b/CHANGELOG.txt index c64f5e2d..9034e027 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,11 @@ +v 2.1.0 - Sept 2, 2014 + - Added Mail Server Package installation #65 + - Fixed incorrect log file path during debug #299 + - Added support for pt-query-advisor #189 + - Fixed Firefox cross-domain fonts + - Fixed ee site edit command on Nano editor + + v 2.0.2 - Aug 13, 2014 - Remote MySQL Support diff --git a/bin/easyengine b/bin/easyengine index c7dd012e..a8d2a05e 100644 --- a/bin/easyengine +++ b/bin/easyengine @@ -90,7 +90,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Display success message ee_lib_echo "$EE_THIRD successfully installed" - elif [ "$EE_THIRD" = "" ]; then + elif [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ]; then # Setup NGINX/PHP repository ee_mod_repo_nginx ee_mod_repo_php @@ -125,9 +125,68 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then ee_ven_install_utils # Display success message - ee_lib_echo "Successfully installed all packages" - ee_lib_echo "Create your first WordPress site powered by NGINX using:" - ee_lib_echo_info "ee site create example.com --wp" + if [ "$EE_THIRD" != "all" ];then + ee_lib_echo "Successfully installed web server packages" + ee_lib_echo "Create your first WordPress site powered by NGINX using:" + ee_lib_echo_info "ee site create example.com --wp" + fi + fi + # EasyEngine mail server setup + if [ "$EE_THIRD" = "mail" ] || [ "$EE_THIRD" = "all" ];then + + # Check required Packages are installed or not + dpkg --get-selections | grep -v deinstall | grep nginx > /dev/null \ + && dpkg --get-selections | grep -v deinstall | grep php5-fpm > /dev/null \ + && mysqladmin ping &> /dev/null \ + && dpkg --get-selections | grep -v deinstall | grep postfix > /dev/null + if [ $? -ne 0 ];then + ee_lib_error "Failed to find NGINX PHP MySQL Postfix, exit status=" 1 + fi + + dpkg --get-selections | grep -v deinstall | grep dovecot-core > /dev/null + if [ $? -eq 0 ];then + ee_lib_error "Found installed Dovecot Packages server, exit status=" 1 + fi + + # Install Dovecot + ee_mod_install_dovecot + + # Install mail scanner packages + ee_mod_install_mailscan + + # Install ViMbAdmin + ee_ven_install_vimbadmin + + # Install Roundcube + ee_ven_install_roundcube + + # Configure PostFix + ee_mod_setup_postfix + + # Configure Dovecot + ee_mod_setup_dovecot + + # Setup Amavis + ee_mod_setup_mailscan + + # Setup ViMbAdmin + ee_ven_setup_vimbadmin + + # Setup Roundcube + ee_ven_setup_roundcube + + # Setup Sieve Rules + ee_mod_setup_sieve + + ee_lib_service nginx postfix dovecot amavis restart + + ee_lib_git /etc/nginx /etc/postfix /etc/dovecot /etc/amavis "Initialize Git" + + # Display message for mail server + ee_lib_echo_escape "Configure ViMbAdmin:\thttps://$(hostname -f):22222/vimbadmin" + ee_lib_echo_escape "Security Salt:\t\t${ee_security_salt}\n" + + ee_lib_echo "Successfully installed mail server packages" fi # EasyEngine remove/purge @@ -153,7 +212,7 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then elif [ "$EE_SECOND" = "purge" ];then ee_lib_echo "$EE_THIRD successfully purged" fi - elif [ "$EE_THIRD" = "" ]; then + elif [ "$EE_THIRD" = "" ] || [ "$EE_THIRD" = "web" ] || [ "$EE_THIRD" = "all" ]; then # Remove/Purge NGINX/PHP/MySQL/Postfix package ee_mod_remove_nginx ee_mod_remove_php @@ -171,11 +230,35 @@ elif [ "$EE_FIRST" = "stack" ] || [ "$EE_FIRST" = "system" ]; then # Display success message if [ "$EE_SECOND" = "remove" ];then - ee_lib_echo "Successfully removed all packages" + ee_lib_echo "Successfully removed web packages" + elif [ "$EE_SECOND" = "purge" ];then + ee_lib_echo "Successfully purged web packages" + fi + fi + if [ "$EE_THIRD" = "all" ] || [ "$EE_THIRD" = "mail" ];then + # Remove Dovecot + ee_mod_remove_dovecot + + # Remove Amavis + ee_mod_remove_mailscan + + # Remove ViMbAdmin + ee_ven_remove_vimbadmin + + # Remove Roundcube + ee_ven_remove_roundcube + + # Execute: apt-get autoremove + ee_lib_autoremove + + # Display success message + if [ "$EE_SECOND" = "remove" ];then + ee_lib_echo "Successfully removed mail server packages" elif [ "$EE_SECOND" = "purge" ];then - ee_lib_echo "Successfully purged all packages" + ee_lib_echo "Successfully purged mail server packages" fi fi + elif [ "$EE_SECOND" = "status" ]; then ee_mod_stack_status elif [ "$EE_SECOND" = "start" ] || [ "$EE_SECOND" = "stop" ] || [ "$EE_SECOND" = "reload" ] || [ "$EE_SECOND" = "restart" ]; then @@ -201,7 +284,7 @@ elif [ "$EE_FIRST" = "site" ]; then || ee_lib_error "Unable to display list of sites-available websites, exit status = " $? else ee_lib_echo "List of sites-enabled websites:" - ls /etc/nginx/sites-available/ \ + ls /etc/nginx/sites-enabled/ \ || ee_lib_error "Unable to display list of sites-enabled websites, exit status = " $? fi elif [ "$EE_SECOND" = "info" ] || [ "$EE_SECOND" = "show" ]; then diff --git a/bin/install b/bin/install index 980ded4a..2125dc5d 100644 --- a/bin/install +++ b/bin/install @@ -42,6 +42,7 @@ readonly EE_LOG_DIR=/var/log/easyengine readonly EE_INSTALL_LOG=/var/log/easyengine/install.log readonly EE_ERROR_LOG=/var/log/easyengine/error.log readonly EE_LINUX_DISTRO=$(lsb_release -i |awk '{print $3}') +readonly EE_DEBIAN_VERSION=$(lsb_release -sc) # Checking linux distro if [ "$EE_LINUX_DISTRO" != "Ubuntu" ] && [ "$EE_LINUX_DISTRO" != "Debian" ]; then @@ -81,6 +82,27 @@ function ee_lib_package_check() done } +# Check hostname is FQDN or not. If not set it +function ee_lib_check_fqdn() +{ + case $1 in + *.*) + if [ "$EE_FQDN" != "" ];then + echo $EE_FQDN > /etc/hostname + if [ "$EE_DEBIAN_VERSION" == "squeeze" ];then + /etc/init.d/hostname.sh start &>> $EE_INSTALL_LOG + else + service hostname restart &>> $EE_INSTALL_LOG + fi + hostname -f &>> $EE_INSTALL_LOG + fi + ;; + *) + read -p "Enter hostname [FQDN]: " EE_FQDN + ee_lib_check_fqdn $EE_FQDN + ;; + esac +} # Pre checks to avoid later screw ups # Checking EasyEngine (ee) log directory @@ -184,6 +206,8 @@ fi cp -a /tmp/easyengine/docs/man/ee.8 /usr/share/man/man8/ &>> $EE_INSTALL_LOG \ || ee_lib_error "Unable to copy EasyEngine (ee) man page, exit status = " $? +# Make hostname as FQDN +ee_lib_check_fqdn $(hostname -f) # Git config settings GIT_USER_NAME=$(git config user.name) diff --git a/bin/update b/bin/update index d332bd74..278eeb20 100644 --- a/bin/update +++ b/bin/update @@ -285,7 +285,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then || ee_lib_error "Unable to generate SSL certificate for port 22222, exit status = " $? # Update PHP configuration - dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG + dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then ee_lib_echo "Installing php5-xdebug package, please wait..." apt-get -y install php5-xdebug \ @@ -325,7 +325,7 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then || ee_lib_error "Unable to add xdebug settings for debug pool, exit status = " $? fi - dpkg -l | grep mysql-server &>> $EE_UPDATE_LOG + dpkg --get-selections | grep -v deinstall | grep mysql-server &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then ee_lib_echo "Installing percona-toolkit package, please wait..." apt-get -y install percona-toolkit \ @@ -395,8 +395,11 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then done fi + # Make hostname as FQDN + ee_lib_check_fqdn $(hostname -f) + if [[ $EE_CURRENT_VERSION = 2.0.0 ]]; then - dpkg -l | grep php5-fpm &>> $EE_UPDATE_LOG + dpkg --get-selections | grep -v deinstall | grep php5-fpm &>> $EE_UPDATE_LOG if [ $? -eq 0 ]; then # WP-CLI change the installation method @@ -414,6 +417,34 @@ if [[ $EE_CURRENT_VERSION < $EE_LATEST_VERSION ]]; then fi fi + if [[ $EE_CURRENT_VERSION < 2.1.0 ]];then + if [ -f /etc/nginx/sites-available/22222 ];then + ee_port=$(grep listen /etc/nginx/sites-available/22222 | awk '{ print $2 }') + cp -av /usr/share/easyengine/nginx/22222 /etc/nginx/sites-available/ &>> $EE_UPDATE_LOG + if [ "$EE_LINUX_DISTRO" == "Ubuntu" ]; then + sed -i "s/listen.*/listen $ee_port default_server ssl spdy;/" /etc/nginx/sites-available/22222 \ + || ee_lib_error "Unable to change EasyEngine admin port, exit status = " $? + elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then + # Dotdeb nginx repository doesn't support spdy + sed -i "s/listen.*/listen $ee_port default_server ssl;/" /etc/nginx/sites-available/22222 \ + || ee_lib_error "Unable to change EasyEngine admin port, exit status = " $? + fi + fi + if [ -d /var/www/22222/htdocs/db/anemometer ];then + # Download pt-query-advisor Fixed #189 + wget -q http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.1/download/head:/ptquerydigest-20110624220137-or26tn4expb9ul2a-16/pt-query-digest -O /usr/bin/pt-query-advisor \ + || ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $? + chmod 0755 /usr/bin/pt-query-advisor + + # Enable pt-query-advisor plugin in Anemometer + sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ + || ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $? + fi + + # Update EasyEngine current version + EE_CURRENT_VERSION="2.1.0" + fi + # Restart service ee_lib_service nginx php5-fpm restart diff --git a/config/bash_completion.d/ee b/config/bash_completion.d/ee index 72d723b6..1efbbef1 100644 --- a/config/bash_completion.d/ee +++ b/config/bash_completion.d/ee @@ -25,7 +25,7 @@ function EE_AUTO() ;; install|remove|purge) - COMPREPLY=( $( compgen -W '$( cd /usr/local/lib/easyengine/modules/stack/install; find -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null; cd /usr/local/lib/easyengine/vendor/; find -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null)' -- $CURRENT ) ) + COMPREPLY=( $( compgen -W '$(echo mail all web; cd /usr/local/lib/easyengine/modules/stack/install; find -maxdepth 1 -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null; cd /usr/local/lib/easyengine/vendor/; find -type f | grep install | cut -d'_' -f4 | cut -d '.' -f1 2> /dev/null | egrep -v "roundcube|vimbadmin" )' -- $CURRENT ) ) return 0 ;; diff --git a/config/nginx/common/locations.conf b/config/nginx/common/locations.conf index 4667565c..c506f2bc 100644 --- a/config/nginx/common/locations.conf +++ b/config/nginx/common/locations.conf @@ -15,6 +15,7 @@ location = /robots.txt { # Cache static files location ~* \.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|css|rss|atom|js|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf|swf)$ { + add_header "Access-Control-Allow-Origin" "*"; access_log off; log_not_found off; expires max; diff --git a/docs/man/ee.8 b/docs/man/ee.8 index 7294a639..d36a25bd 100644 --- a/docs/man/ee.8 +++ b/docs/man/ee.8 @@ -5,7 +5,7 @@ .SH SYNOPSIS ee [ version | help | info | stack | site | debug | update ] .TP -ee stack [ install | remove | purge ] [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] +ee stack [ install | remove | purge ] [ --web | --mail | --all | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] .TP ee stack [ status | start | stop | reload | restart ] .TP @@ -44,19 +44,19 @@ Display easyengine (ee) help. .TP .B stack .TP -.B install [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] +.B install [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] .br Install Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options.Installs specific package if used with option. .TP -.B remove [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] +.B remove [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] .br Remove Nginx PHP5 MySQL Postfix stack Packages if not used with .br any options. Remove specific package if used with option. .TP -.B purge [ nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] +.B purge [ all | web | mail | nginx | php | mysql | postfix | adminer | phpmyadmin | wpcli | utils ] .br Purge Nginx PHP5 MySQL Postfix stack Packages if not used with any .br diff --git a/src/lib/ee_lib_check_fqdn.sh b/src/lib/ee_lib_check_fqdn.sh new file mode 100644 index 00000000..1f8648a0 --- /dev/null +++ b/src/lib/ee_lib_check_fqdn.sh @@ -0,0 +1,22 @@ +# Check Server hostname is FQDN or not + +function ee_lib_check_fqdn() +{ + case $1 in + *.*) + if [ "$EE_FQDN" != "" ];then + echo $EE_FQDN > /etc/hostname + if [ "$EE_DEBIAN_VERSION" == "squeeze" ];then + /etc/init.d/hostname.sh start &>> $EE_COMMAND_LOG + else + service hostname restart &>> $EE_COMMAND_LOG + fi + hostname -f &>> $EE_COMMAND_LOG + fi + ;; + *) + read -p "Enter hostname [FQDN]: " EE_FQDN + ee_lib_check_fqdn $EE_FQDN + ;; + esac +} diff --git a/src/lib/ee_lib_error.sh b/src/lib/ee_lib_error.sh index eabfdf04..206a9023 100644 --- a/src/lib/ee_lib_error.sh +++ b/src/lib/ee_lib_error.sh @@ -2,6 +2,6 @@ function ee_lib_error() { - echo "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG + echo -e "[ `date` ] $(tput setaf 1)$@$(tput sgr0)" | tee -ai $EE_ERROR_LOG exit $2 } diff --git a/src/lib/ee_lib_git.sh b/src/lib/ee_lib_git.sh index 7f050dc4..3467c90e 100644 --- a/src/lib/ee_lib_git.sh +++ b/src/lib/ee_lib_git.sh @@ -3,22 +3,24 @@ function ee_lib_git() { for ee_git_dir in ${@:1:$(($#-1))}; do - # Change directory - cd $ee_git_dir || ee_lib_error "Unable to change directory $ee_git_dir, exit status = " $? + if [ -d $ee_git_dir ]; then + # Change directory + cd $ee_git_dir - # Check .git - if [ ! -d .git ]; then - # ee_lib_echo "Initialize Git on ${ee_git_dir}" - git init &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? - fi + # Check .git + if [ ! -d .git ]; then + # ee_lib_echo "Initialize Git on ${ee_git_dir}" + git init &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to initialize Git on $ee_git_dir, exit status = " $? + fi - # Check for untracked files - if [ $(git status -s | wc -l) -ne 0 ]; then - # Add files in Git version control - ee_lib_echo "Git commit on $ee_git_dir, please wait..." - git add --all && git commit -am "${@: -1}" &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? + # Check for untracked files + if [ $(git status -s | wc -l) -ne 0 ]; then + # Add files in Git version control + ee_lib_echo "Git commit on $ee_git_dir, please wait..." + git add --all && git commit -am "${@: -1}" &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to Git commit on $ee_git_dir, exit status = " $? + fi fi done } diff --git a/src/lib/ee_lib_service.sh b/src/lib/ee_lib_service.sh index 70efefe7..6ec5dcc2 100644 --- a/src/lib/ee_lib_service.sh +++ b/src/lib/ee_lib_service.sh @@ -7,31 +7,38 @@ function ee_lib_service() { for ee_service_name in ${@:1:$(($#-1))}; do - # Display message - ee_lib_echo "Executing service $ee_service_name ${@: -1}, please wait..." + if [ -f /etc/init.d/$ee_service_name ];then + # Display message + ee_lib_echo "Executing service $ee_service_name ${@: -1}, please wait..." - # Check nginx and php5-fpm test before start/stop/restart/reload - if [ $ee_service_name = "nginx" ]; then - # Adjust nginx server_names_hash_bucket_size - $ee_service_name -t 2>&1 | grep server_names_hash_bucket_size &>> $EE_COMMAND_LOG - if [ $? -eq 0 ];then - EE_NGINX_CALCULATION=$(echo "l($(ls /etc/nginx/sites-enabled/ | wc -c))/l(2)+2" | bc -l) - EE_NGINX_SET_BUCKET=$(echo "2^$EE_NGINX_CALCULATION" | bc -l 2> /dev/null) - sed -i "s/.*server_names_hash_bucket_size.*/\tserver_names_hash_bucket_size $EE_NGINX_SET_BUCKET;/" /etc/nginx/nginx.conf + # Check nginx and php5-fpm test before start/stop/restart/reload + if [ $ee_service_name = "nginx" ]; then + # Adjust nginx server_names_hash_bucket_size + $ee_service_name -t 2>&1 | grep server_names_hash_bucket_size &>> $EE_COMMAND_LOG + if [ $? -eq 0 ];then + EE_NGINX_CALCULATION=$(echo "l($(ls /etc/nginx/sites-enabled/ | wc -c))/l(2)+2" | bc -l) + EE_NGINX_SET_BUCKET=$(echo "2^$EE_NGINX_CALCULATION" | bc -l 2> /dev/null) + sed -i "s/.*server_names_hash_bucket_size.*/\tserver_names_hash_bucket_size $EE_NGINX_SET_BUCKET;/" /etc/nginx/nginx.conf + fi + # Test and start/stop/restart/reload nginx service + $ee_service_name -t &>> $EE_COMMAND_LOG \ + && service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? + elif [ $ee_service_name = "php5-fpm" ]; then + # Test and start/stop/restart/reload php5-fpm service + $ee_service_name -t &>> $EE_COMMAND_LOG \ + && service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG\ + || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? + elif [ $ee_service_name = "dovecot" ]; then + # Test and start/stop/restart/reload Dovecot service + $ee_service_name -n &>> $EE_COMMAND_LOG \ + && service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG\ + || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? + else + # start/stop/restart/reload services + service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? fi - # Test and start/stop/restart/reload nginx service - $ee_service_name -t &>> $EE_COMMAND_LOG \ - && service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? - elif [ $ee_service_name = "php5-fpm" ]; then - # Test and start/stop/restart/reload php5-fpm service - $ee_service_name -t &>> $EE_COMMAND_LOG \ - && service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG\ - || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? - else - # start/stop/restart/reload services - service $ee_service_name ${@: -1} &>> $EE_COMMAND_LOG \ - || ee_lib_error "Unable to execute service $ee_service_name ${@: -1}, exit status = " $? fi done } diff --git a/src/lib/ee_lib_variables.sh b/src/lib/ee_lib_variables.sh index cb2ee37a..c5b2113e 100644 --- a/src/lib/ee_lib_variables.sh +++ b/src/lib/ee_lib_variables.sh @@ -1,7 +1,7 @@ # Define global variables # EasyEngine version -readonly EE_VERSION='2.0.2' +readonly EE_VERSION='2.1.0' # WP-CLI version readonly EE_WP_CLI_VERSION='0.16.0' @@ -9,6 +9,12 @@ readonly EE_WP_CLI_VERSION='0.16.0' # Adminer version readonly EE_ADMINER_VERSION='4.1.0' +# Roundcube Version +readonly EE_ROUNDCUBE_VERSION='1.0.2' + +# ViMbAdmin Version +readonly EE_VIMBADMIN_VERSION='3.0.10' + EE_COMMAND_LOG=/var/log/easyengine/ee.log readonly EE_LOG_DIR=/var/log/easyengine readonly EE_ERROR_LOG=/var/log/easyengine/error.log @@ -26,7 +32,7 @@ elif [ "$EE_LINUX_DISTRO" == "Debian" ]; then # Specify nginx package readonly EE_NGINX_PACKAGE=nginx-full # Detect Debian version - readonly EE_DEBIAN_VERSION=$(lsb_release -r | awk '{print($2)}' | cut -d'.' -f1) + readonly EE_DEBIAN_VERSION=$(lsb_release -sc) fi # Find php user-name diff --git a/src/modules/debug/ee_mod_debug_rewrite.sh b/src/modules/debug/ee_mod_debug_rewrite.sh index 387cc43d..e7560a67 100644 --- a/src/modules/debug/ee_mod_debug_rewrite.sh +++ b/src/modules/debug/ee_mod_debug_rewrite.sh @@ -18,7 +18,9 @@ function ee_mod_debug_rewrite() fi # Debug message - EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/nginx/*.error.log" + if [ "$EE_DEBUG_MSG" != "/var/log/nginx/*.error.log" ];then + EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/nginx/*.error.log" + fi else grep "rewrite_log on;" /etc/nginx/sites-available/$EE_DOMAIN &>> $EE_COMMAND_LOG if [ $? -ne 0 ]; then @@ -34,7 +36,9 @@ function ee_mod_debug_rewrite() fi # Debug message - EE_DEBUG_MSG="$EE_DEBUG_MSG /var/log/$EE_DOMAIN/logs/error.log" + if [ "$EE_DEBUG_MSG" != "/var/www/$EE_DOMAIN/logs/error.log" ];then + EE_DEBUG_MSG="$EE_DEBUG_MSG /var/www/$EE_DOMAIN/logs/error.log" + fi fi elif [ "$EE_DEBUG" = "--stop" ]; then if [ -z $EE_DOMAIN ]; then diff --git a/src/modules/site/ee_mod_site_edit.sh b/src/modules/site/ee_mod_site_edit.sh index a9670216..6028d027 100644 --- a/src/modules/site/ee_mod_site_edit.sh +++ b/src/modules/site/ee_mod_site_edit.sh @@ -2,5 +2,5 @@ function ee_mod_site_edit() { - sensible-editor /etc/nginx/sites-available/$EE_DOMAIN $1 2> /dev/null + sensible-editor /etc/nginx/sites-available/$EE_DOMAIN $1 } diff --git a/src/modules/stack/ee_mod_stack_status.sh b/src/modules/stack/ee_mod_stack_status.sh index f2a6e4eb..6083a89e 100644 --- a/src/modules/stack/ee_mod_stack_status.sh +++ b/src/modules/stack/ee_mod_stack_status.sh @@ -30,13 +30,13 @@ function ee_mod_stack_status() fi # Service status - local ee_nginx_status=$(service nginx status | grep 'nginx is running' \ + local ee_nginx_status=$(service nginx status 2> /dev/null 2>> $EE_COMMAND_LOG| grep 'nginx is running' \ &>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") - local ee_php_status=$(service php5-fpm status | grep running \ + local ee_php_status=$(service php5-fpm status 2> /dev/null | grep running \ &>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") local ee_mysql_status=$(mysqladmin ping \ &>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") - local ee_postfix_status=$(service postfix status | grep 'postfix is running' \ + local ee_postfix_status=$(service postfix status 2> /dev/null | grep 'postfix is running' \ &>> $EE_COMMAND_LOG && ee_lib_echo "Running" || ee_lib_echo_fail "Stopped") ee_lib_echo diff --git a/src/modules/stack/install/ee_mod_repo_nginx.sh b/src/modules/stack/install/ee_mod_repo_nginx.sh index bb1c1bec..773b8d54 100644 --- a/src/modules/stack/install/ee_mod_repo_nginx.sh +++ b/src/modules/stack/install/ee_mod_repo_nginx.sh @@ -13,7 +13,7 @@ function ee_mod_repo_nginx() # Add Dotdeb nginx repository ee_lib_echo "Adding Dotdeb NGINX repository, please wait..." - echo "deb http://packages.dotdeb.org $(lsb_release -c | awk '{print($2)}') all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -c | awk '{print($2)}').list \ + echo "deb http://packages.dotdeb.org $(lsb_release -sc) all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -sc).list \ || ee_lib_error "Unable to add Dotdeb NGINX repository, exit status = " $? # Fetch and install dotdeb GnuPG key diff --git a/src/modules/stack/install/ee_mod_repo_php.sh b/src/modules/stack/install/ee_mod_repo_php.sh index d08cbed6..2e1015a5 100644 --- a/src/modules/stack/install/ee_mod_repo_php.sh +++ b/src/modules/stack/install/ee_mod_repo_php.sh @@ -11,20 +11,20 @@ function ee_mod_repo_php() || ee_lib_error "Unable to add ondrej php5 launchpad repository, exit status = " $? # Debian 6 - elif [ $EE_DEBIAN_VERSION -eq 6 ]; then + elif [ "$EE_DEBIAN_VERSION" == "squeeze" ]; then ee_lib_echo "Adding Dotdeb PHP5.4 repository, please wait..." - echo "deb http://packages.dotdeb.org $(lsb_release -c | awk '{print($2)}')-php54 all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -c | awk '{print($2)}')-php54.list \ + echo "deb http://packages.dotdeb.org $(lsb_release -sc)-php54 all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -sc)-php54.list \ || ee_lib_error "Unable to add Dotdeb PHP5.4 repository, exit status = " $? # Fetch and install Dotdeb GnuPG key ee_lib_dotdeb # Debian 7 - elif [ $EE_DEBIAN_VERSION -eq 7 ]; then + elif [ "$EE_DEBIAN_VERSION" == "wheezy" ]; then ee_lib_echo "Adding Dotdeb PHP5.5 repository, please wait..." - echo "deb http://packages.dotdeb.org $(lsb_release -c | awk '{print($2)}')-php55 all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -c | awk '{print($2)}')-php55.list \ + echo "deb http://packages.dotdeb.org $(lsb_release -sc)-php55 all" > /etc/apt/sources.list.d/dotdeb-$(lsb_release -sc)-php55.list \ || ee_lib_error "Unable to add Dotdeb PHP5.5 repository, exit status = " $? # Fetch and install dotdeb GnuPG key diff --git a/src/modules/stack/install/mail/ee_mod_install_dovecot.sh b/src/modules/stack/install/mail/ee_mod_install_dovecot.sh new file mode 100644 index 00000000..09225e4b --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_install_dovecot.sh @@ -0,0 +1,23 @@ +# Install Dovecot package + +function ee_mod_install_dovecot() +{ + # Add Dovecot repo for Debian 6 + ee_mod_repo_dovecot + ee_lib_apt_get_update + + # Install Dovecot + ee_lib_echo "Installing Dovecot, please wait..." + debconf-set-selections <<< "dovecot-core dovecot-core/create-ssl-cert boolean yes" + debconf-set-selections <<< "dovecot-core dovecot-core/ssl-cert-name string $(hostname -f)" + + # Debian 6 doesn't provide Dovecot 2.x + if [ "$EE_DEBIAN_VERSION" == "squeeze" ]; then + $EE_APT_GET -t squeeze-backports install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \ + || ee_lib_error "Unable to install Dovecot, exit status = " $? + else + $EE_APT_GET install dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \ + || ee_lib_error "Unable to install Dovecot, exit status = " $? + fi + +} diff --git a/src/modules/stack/install/mail/ee_mod_install_mailscan.sh b/src/modules/stack/install/mail/ee_mod_install_mailscan.sh new file mode 100644 index 00000000..18559f74 --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_install_mailscan.sh @@ -0,0 +1,9 @@ +# Install Amavis package + +function ee_mod_install_mailscan() +{ + # Install Amavis + ee_lib_echo "Installing Amavis, SpamAssassin and ClamAV, please wait..." + $EE_APT_GET install amavisd-new spamassassin clamav clamav-daemon arj zoo nomarch cpio lzop cabextract p7zip rpm unrar-free \ + || ee_lib_error "Unable to install Amavis, SpamAssassin and ClamAV, exit status = " $? +} diff --git a/src/modules/stack/install/mail/ee_mod_repo_dovecot.sh b/src/modules/stack/install/mail/ee_mod_repo_dovecot.sh new file mode 100644 index 00000000..5f27164b --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_repo_dovecot.sh @@ -0,0 +1,13 @@ +# Setup nginx repository + +function ee_mod_repo_dovecot() +{ + if [ "$EE_DEBIAN_VERSION" == "squeeze" ];then + + # Add Dovecot repository + ee_lib_echo "Adding Dovecot repository, please wait..." + echo "deb http://http.debian.net/debian-backports squeeze-backports main" > /etc/apt/sources.list.d/dovecot-$(lsb_release -sc).list \ + || ee_lib_error "Unable to add Dovecot repository, exit status = " $? + + fi +} diff --git a/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh new file mode 100644 index 00000000..2b1e62ad --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh @@ -0,0 +1,69 @@ +# Setup Dovecot + +function ee_mod_setup_dovecot() +{ + + EE_EMAIL=$($EE_CONFIG_GET wordpress.email) + if [[ $EE_EMAIL = "" ]]; then + EE_EMAIL=$(git config user.email) + fi + + EE_HOSTNAME=$(hostname -f) + + ee_lib_echo "Setting up Dovecot, please wait..." + # Adding mail user with GID 5000 and UID 5000 + adduser --uid 5000 --home /var/vmail --disabled-password --gecos '' vmail &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to setup vmail user/group = " $? + + # Configuring dovecot.conf + sed -i "s/*.protocol/*.protocol\\nprotocols = imap pop3 lmtp sieve/" /etc/dovecot/dovecot.conf \ + || ee_lib_error "Unable to configure Dovecot protocol, exit status = " $? + + # Configuring 10-mail.conf + sed -i "s/mail_location = mbox:~\/mail:INBOX=\/var\/mail\/%u/mail_location = maildir:\/var\/vmail\/%d\/%n/" /etc/dovecot/conf.d/10-mail.conf \ + || ee_lib_error "Unable to configure Dovecot mail_location, exit status = " $? + + # Configuring 10-auth.conf + sed -i "s/#disable_plaintext_auth = yes/disable_plaintext_auth = no/" /etc/dovecot/conf.d/10-auth.conf && \ + sed -i "s/auth_mechanisms = plain/auth_mechanisms = plain login/" /etc/dovecot/conf.d/10-auth.conf && \ + sed -i "s/\!include auth-system.conf.ext/#\!include auth-system.conf.ext/" /etc/dovecot/conf.d/10-auth.conf && \ + sed -i "s/#\!include auth-sql.conf.ext/\!include auth-sql.conf.ext/" /etc/dovecot/conf.d/10-auth.conf \ + || ee_lib_error "Unable to setup 10-auth.conf file, exit status = " $? + + # Configuring dovecot-sql.conf.ext + cp -v /usr/share/easyengine/mail/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to copy dovecot-sql.conf.ext, exit status = " $? + + cp -v /usr/share/easyengine/mail/auth-sql.conf.ext /etc/dovecot/conf.d/auth-sql.conf.ext &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to setup auth-sql.conf.ext, exit status = " $? + + + # Configuring 10-master.conf + cp -v /etc/dovecot/conf.d/10-master.conf /etc/dovecot/conf.d/10-master.conf.bak &>> $EE_COMMAND_LOG + cp -v /usr/share/easyengine/mail/10-master.conf /etc/dovecot/conf.d/10-master.conf &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to setup 10-master.conf, exit status = " $? + + # Change Dovecot log location + sed -i "s/#log_path = syslog/log_path = \/var\/log\/dovecot.log/" /etc/dovecot/conf.d/10-logging.conf \ + || ee_lib_error "Unable to setup Dovecot log_path, exit status = " $? + + # Configure self signed SSL for Dovecot + ee_lib_echo "Generating self signed certificate for Dovecot, please wait..." + openssl req -new -x509 -days 3650 -nodes -subj /commonName=${EE_HOSTNAME}/emailAddress=${EE_EMAIL} -out /etc/ssl/certs/dovecot.pem -keyout /etc/ssl/private/dovecot.pem &>> $EE_COMMAND_LOG + chmod 0600 /etc/ssl/private/dovecot.pem + + # Setting up certificate in file + sed -i "s'/etc/dovecot/dovecot.pem'/etc/ssl/certs/dovecot.pem'" /etc/dovecot/conf.d/10-ssl.conf \ + && sed -i "s'/etc/dovecot/private/dovecot.pem'/etc/ssl/private/dovecot.pem'" /etc/dovecot/conf.d/10-ssl.conf \ + || ee_lib_error "Unable to setup Dovecot SSL certificate path, exit status = " $? + + # Setting Dovecot init.d script + if [ ! -f /etc/init.d/dovecot ];then + cp -v /usr/share/easyengine/mail/dovecot /etc/init.d/dovecot &>> $EE_COMMAND_LOG + fi + # Add autocreate plugin + sed -i "s'#mail_plugins = \$mail_plugins'mail_plugins = \$mail_plugins autocreate'" /etc/dovecot/conf.d/20-imap.conf \ + || ee_lib_error "Unable to setup Dovecot autocreate plugin, exit status = " $? + cat /usr/share/easyengine/mail/autocreate >> /etc/dovecot/conf.d/20-imap.conf + +} diff --git a/src/modules/stack/install/mail/ee_mod_setup_mailscan.sh b/src/modules/stack/install/mail/ee_mod_setup_mailscan.sh new file mode 100644 index 00000000..8fe08a1f --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_setup_mailscan.sh @@ -0,0 +1,40 @@ +# Install mail scanner packages + +function ee_mod_setup_mailscan() +{ + # Confiure Amavis + + ee_lib_echo "Setting up Amavis, please wait..." + sed -i "s'#@'@'" /etc/amavis/conf.d/15-content_filter_mode && \ + sed -i "s'# ' '" /etc/amavis/conf.d/15-content_filter_mode \ + || ee_lib_error "Unable to setup Amavis, exit status = " $? + + # Add mail filtering rules + sed -i "s/use strict;/use strict;\n\$sa_spam_subject_tag = undef;\n\$spam_quarantine_to = undef;\n\$sa_tag_level_deflt = undef;\n\n# Prevent spams from automatically rejected by mail-server\n\$final_spam_destiny = D_PASS;\n# We need to provide list of domains for which filtering need to be done\n@lookup_sql_dsn = (\n ['DBI:mysql:database=vimbadmin;host=127.0.0.1;port=3306',\n 'vimbadmin',\n 'password']);\n\n\$sql_select_policy = 'SELECT domain FROM domain WHERE CONCAT("@",domain) IN (%k)';/" /etc/amavis/conf.d/50-user \ + || ee_lib_error "Unable to setup Amavis, exit status = " $? + + sed -i "s'\@local_domains_acl = ( \".\$mydomain\" );'\@local_domains_acl = ( \".\" );'" /etc/amavis/conf.d/05-domain_id \ + || ee_lib_error "Unable to setup Amavis, exit status = " $? + + # Configure Postfix to use Amavis + # For postfix main.cf + postconf -e "content_filter = smtp-amavis:[127.0.0.1]:10024" + + # For postfix master.cf + sed -i "s/1 pickup/1 pickup\n -o content_filter=\n -o receive_override_options=no_header_body_checks/" /etc/postfix/master.cf \ + || ee_lib_error "Unable to setup Amavis, exit status = " $? + cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf + + # Configure ClamAv and Amavis to each other files + adduser clamav amavis &>> $EE_COMMAND_LOG + adduser amavis clamav &>> $EE_COMMAND_LOG + chmod -R 775 /var/lib/amavis/tmp &>> $EE_COMMAND_LOG + + # Update ClamAV database (freshclam) + ee_lib_echo "Updating ClamAV database, please wait..." + freshclam &>> $EE_COMMAND_LOG + + service clamav-daemon restart &>> $EE_COMMAND_LOG \ + || ee_lib_echo "Unable to start ClamAV deamon" + +} diff --git a/src/modules/stack/install/mail/ee_mod_setup_postfix.sh b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh new file mode 100644 index 00000000..6ffbf518 --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_setup_postfix.sh @@ -0,0 +1,65 @@ +# Setup Postfix + +function ee_mod_setup_postfix() +{ + + EE_EMAIL=$($EE_CONFIG_GET wordpress.email) + if [[ $EE_EMAIL = "" ]]; then + EE_EMAIL=$(git config user.email) + fi + + EE_HOSTNAME=$(hostname -f) + + #We previously not used this package. So, if some one don't have Postfix-MySQL installed, + #Postfix will not work + ee_lib_echo "Installing Postfix-MySQL, please wait..." + $EE_APT_GET install postfix-mysql \ + || ee_lib_error "Unable to install Postfix-MySQL, exit status = " $? + + ee_lib_echo "Setting up Postfix, please wait..." + #Configure Master.cf + sed -i 's/#submission/submission/' /etc/postfix/master.cf && + sed -i 's/#smtps/smtps/' /etc/postfix/master.cf \ + || ee_lib_error "Unable to setup details in master.cf file, exit status = " $? + + # Handle SMTP authentication using Dovecot" + # On Debian6 following command not work ( Postfix < 2.8 ) + # postconf "smtpd_sasl_type = dovecot" + # The -e option is no longer needed with Postfix version 2.8 and later. + + postconf -e "smtpd_sasl_type = dovecot" + postconf -e "smtpd_sasl_path = private/auth" + postconf -e "smtpd_sasl_auth_enable = yes" + + postconf -e "smtpd_relay_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination" + + # other destination domains should be handled using virtual domains + postconf -e "mydestination = localhost" + + # using Dovecot's LMTP for mail delivery and giving it path to store mail + postconf -e "virtual_transport = lmtp:unix:private/dovecot-lmtp" + + # virtual mailbox setups + postconf -e "virtual_uid_maps = static:5000" + postconf -e "virtual_gid_maps = static:5000" + postconf -e "virtual_mailbox_domains = mysql:/etc/postfix/mysql/virtual_domains_maps.cf" + postconf -e "virtual_mailbox_maps = mysql:/etc/postfix/mysql/virtual_mailbox_maps.cf" + #postconf "message_size_limit = 20971520" + + + # Setting up Postfix MySQL configuration + mkdir -p /etc/postfix/mysql + cp -av /usr/share/easyengine/mail/virtual_alias_maps.cf /etc/postfix/mysql/virtual_alias_maps.cf &>> $EE_COMMAND_LOG && \ + cp -av /usr/share/easyengine/mail/virtual_domains_maps.cf /etc/postfix/mysql/virtual_domains_maps.cf &>> $EE_COMMAND_LOG && \ + cp -av /usr/share/easyengine/mail/virtual_mailbox_maps.cf /etc/postfix/mysql/virtual_mailbox_maps.cf &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to copy Postfix MySQL configuration files, exit status = " $? + + # Configure self signed SSL for Postfix + ee_lib_echo "Generating self signed certificate for Postfix, please wait..." + openssl req -new -x509 -days 3650 -nodes -subj /commonName=${EE_HOSTNAME}/emailAddress=${EE_EMAIL} -out /etc/ssl/certs/postfix.pem -keyout /etc/ssl/private/postfix.pem &>> $EE_COMMAND_LOG + chmod 0600 /etc/ssl/private/postfix.pem + + postconf -e smtpd_tls_cert_file=/etc/ssl/certs/postfix.pem + postconf -e smtpd_tls_key_file=/etc/ssl/private/postfix.pem + +} diff --git a/src/modules/stack/install/mail/ee_mod_setup_sieve.sh b/src/modules/stack/install/mail/ee_mod_setup_sieve.sh new file mode 100644 index 00000000..40cf3889 --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_setup_sieve.sh @@ -0,0 +1,34 @@ +# Setup Sieve rules + +function ee_mod_setup_sieve() +{ + EE_EMAIL=$($EE_CONFIG_GET wordpress.email) + if [[ $EE_EMAIL = "" ]]; then + EE_EMAIL=$(git config user.email) + fi + + ee_lib_echo "Setting up Sieve rules, please wait..." + + # Enable sieve plugin support for dovecot-lmtp + sed -i "s' #mail_plugins = \$mail_plugins' postmaster_address =$EE_EMAIL \n mail_plugins = \$mail_plugins sieve'" /etc/dovecot/conf.d/20-lmtp.conf \ + || ee_lib_error "Unable to add sieve plugin support for dovecot-lmtp, exit status = " $? + + # Sieve dovecot-pluign configuration + sed -i "s'sieve = ~/.dovecot.sieve'sieve = ~/.dovecot.sieve\n sieve_global_path = /var/lib/dovecot/sieve/default.sieve'" /etc/dovecot/conf.d/90-sieve.conf && \ + sed -i "s'#sieve_global_dir ='sieve_global_dir = /var/lib/dovecot/sieve/'" /etc/dovecot/conf.d/90-sieve.conf \ + || ee_lib_error "Unable to setup Sieve dovecot-pluign, exit status = " $? + + # Create global Sieve rules file + mkdir -p /var/lib/dovecot/sieve/ + cp /usr/share/easyengine/mail/default.sieve /var/lib/dovecot/sieve/default.sieve + chown -R vmail:vmail /var/lib/dovecot + + # Compile Sieve rules + sievec /var/lib/dovecot/sieve/default.sieve \ + || ee_lib_error "Unable to compile Sieve rules, exit status = " $? + + # Configure Roundcube + sed -i "s:\$config\['plugins'\] = array(:\$config\['plugins'\] = array(\n 'sieverules',:" /var/www/roundcubemail/htdocs/config/config.inc.php \ + || ee_lib_error "Unable to configure Sieve Roundcube plugin, exit status = " $? + echo "\$config['sieverules_port'] = 4190;" >> /var/www/roundcubemail/htdocs/config/config.inc.php +} diff --git a/src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh b/src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh new file mode 100644 index 00000000..b929b43b --- /dev/null +++ b/src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh @@ -0,0 +1,13 @@ +# Remove Dovecot package + +function ee_mod_remove_dovecot() +{ + ee_lib_echo "$EE_SECOND Dovecot package, please wait..." + $EE_APT_GET $EE_SECOND dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \ + || ee_lib_error "Unable to $EE_SECOND Dovecot, exit status = " $? + + deluser --remove-home vmail &>> $EE_COMMAND_LOG || ee_lib_error "Unable to Remove user vmail, exit status = " $? + rm -f /etc/init.d/dovecot + rm -rf /var/vmail + +} diff --git a/src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh b/src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh new file mode 100644 index 00000000..d893959f --- /dev/null +++ b/src/modules/stack/remove/mail/ee_mod_remove_mailscan.sh @@ -0,0 +1,9 @@ +# Remove MailScan package + +function ee_mod_remove_mailscan() +{ + ee_lib_echo "$EE_SECOND Amavis, SpamAssassin and ClamAV package, please wait..." + $EE_APT_GET $EE_SECOND amavisd-new spamassassin clamav clamav-daemon arj zoo nomarch lzop cabextract p7zip rpm unrar-free \ + || ee_lib_error "Unable to $EE_SECOND Amavis, SpamAssassin and ClamAV,, exit status = " $? + +} diff --git a/src/vendor/ee_ven_install_roundcube.sh b/src/vendor/ee_ven_install_roundcube.sh new file mode 100644 index 00000000..03e65f02 --- /dev/null +++ b/src/vendor/ee_ven_install_roundcube.sh @@ -0,0 +1,30 @@ +# Install Roundcube + +function ee_ven_install_roundcube() +{ + # Install Roundcube dependencies + ee_lib_echo "Installing Roundcube, please wait..." + $EE_APT_GET install php-pear \ + || ee_lib_error "Unable to install php-pear, exit status = " $? + pear install Mail_Mime Net_SMTP Mail_mimeDecode Net_IDNA2-beta Auth_SASL Net_Sieve Crypt_GPG &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to install pear packages, exit status = " $? + + # Setup Roundcube directory + mkdir -p /var/www/roundcubemail/{htdocs,logs} + ee_lib_symbolic_link /var/log/nginx/roundcubemail.access.log /var/www/roundcubemail/logs/access.log + ee_lib_symbolic_link /var/log/nginx/roundcubemail.error.log /var/www/roundcubemail/logs/error.log + + # Install Roundcube + wget -cqO /var/www/roundcube.tar.gz https://github.com/roundcube/roundcubemail/releases/download/${EE_ROUNDCUBE_VERSION}/roundcubemail-${EE_ROUNDCUBE_VERSION}.tar.gz \ + || ee_lib_error "Unable to download Roundcube, exit status = " $? + + tar -zxf /var/www/roundcube.tar.gz -C /var/www/roundcubemail/htdocs/ --strip-components=1 \ + || ee_lib_error "Unable to extract Roundcube, exit status = " $? + + # Fix permissions + chown -R $EE_PHP_USER:$EE_PHP_USER /var/www/roundcubemail \ + || ee_lib_error "Unable to change ownership for ViMbAdmin, exit status = " $? + + # Remove unwanted files + rm -rf /var/www/roundcube.tar.gz /var/www/roundcubemail-1.0.1 +} diff --git a/src/vendor/ee_ven_install_utils.sh b/src/vendor/ee_ven_install_utils.sh index be315097..502598d1 100644 --- a/src/vendor/ee_ven_install_utils.sh +++ b/src/vendor/ee_ven_install_utils.sh @@ -115,6 +115,16 @@ function ee_ven_install_utils() echo -e "\t\tendscript" >> /etc/logrotate.d/mysql-server echo -e "}" >> /etc/logrotate.d/mysql-server fi + + # Download pt-query-advisor Fixed #189 + wget -q http://bazaar.launchpad.net/~percona-toolkit-dev/percona-toolkit/2.1/download/head:/ptquerydigest-20110624220137-or26tn4expb9ul2a-16/pt-query-digest -O /usr/bin/pt-query-advisor \ + || ee_lib_error "Unable to copy download pt-query-advisor, exit status = " $? + chmod 0755 /usr/bin/pt-query-advisor + + # Enable pt-query-advisor plugin in Anemometer + sed -i "s/# 'query_advisor'/ 'query_advisor'/" /var/www/22222/htdocs/db/anemometer/conf/config.inc.php \ + || ee_lib_error "Unable to to activate pt-query-advisor plugin, exit status = " $? + fi fi # Change permission diff --git a/src/vendor/ee_ven_install_vimbadmin.sh b/src/vendor/ee_ven_install_vimbadmin.sh new file mode 100644 index 00000000..4f1d23a9 --- /dev/null +++ b/src/vendor/ee_ven_install_vimbadmin.sh @@ -0,0 +1,33 @@ +# Install ViMbAdmin + +function ee_ven_install_vimbadmin() +{ + + # Install needed PHP5 libraries for ViMbAdmin + # ee stack install php installed php5-mcrypt, php5-memcache, php5-mysqlnd + $EE_APT_GET install php5-cgi php5-json php-gettext \ + || ee_lib_error "Unable to install php-pear, exit status = " $? + + # Install ViMbAdmin + ee_lib_echo "Installing ViMbAdmin, please wait..." + ee_lib_echo "It will take nearly 10-20 minutes, please wait..." + wget -cqO /var/www/22222/htdocs/vimbadmin.tar.gz https://github.com/opensolutions/ViMbAdmin/archive/${EE_VIMBADMIN_VERSION}.tar.gz \ + || ee_lib_error "Unable to download ViMbAdmin, exit status = " $? + + mkdir -p /var/www/22222/htdocs/vimbadmin + tar --strip-components=1 -zxf /var/www/22222/htdocs/vimbadmin.tar.gz -C /var/www/22222/htdocs/vimbadmin + + # Install Composer + cd /var/www/22222/htdocs/vimbadmin + curl -sS https://getcomposer.org/installer | php &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to install Composer, exit status = " $? + php composer.phar install --prefer-dist --no-dev &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to install ViMbAdmin, exit status = " $? + + # Fix permissions + chown -R $EE_PHP_USER:$EE_PHP_USER /var/www/22222/htdocs/vimbadmin \ + || ee_lib_error "Unable to change ownership for ViMbAdmin, exit status = " $? + + # Remove unwanted files + rm -rf /var/www/22222/htdocs/vimbadmin.tar.gz /var/www/22222/htdocs/vimbadmin/composer.phar +} diff --git a/src/vendor/ee_ven_install_wpcli.sh b/src/vendor/ee_ven_install_wpcli.sh index b78667b2..0a1f5a07 100644 --- a/src/vendor/ee_ven_install_wpcli.sh +++ b/src/vendor/ee_ven_install_wpcli.sh @@ -12,6 +12,6 @@ function ee_ven_install_wpcli() || ee_lib_error "Unable to set executable permission for wp-cli, exit status = " $? # Download auto completion - wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/v0.16.0/utils/wp-completion.bash + wget -qO /etc/bash_completion.d/wp-completion.bash https://raw.githubusercontent.com/wp-cli/wp-cli/v${EE_WP_CLI_VERSION}/utils/wp-completion.bash fi } diff --git a/src/vendor/ee_ven_remove_roundcube.sh b/src/vendor/ee_ven_remove_roundcube.sh new file mode 100644 index 00000000..57546631 --- /dev/null +++ b/src/vendor/ee_ven_remove_roundcube.sh @@ -0,0 +1,17 @@ +# Remove Roundcube + +function ee_ven_remove_roundcube() +{ + ee_lib_echo "Removing Roundcube dependencies, please wait..." + # Remove packages installed using Pear + pear uninstall Mail_Mime Net_SMTP Mail_mimeDecode Net_IDNA2-beta Auth_SASL Net_Sieve Crypt_GPG &>> $EE_COMMAND_LOG + + # Remove Roundcube + ee_lib_echo "Removing Roundcube, please wait..." + + mysql -e "drop database \`roundcubemail\`" &>> $EE_COMMAND_LOG + mysql -e "drop user roundcube@'$EE_MYSQL_GRANT_HOST'" &>> $EE_COMMAND_LOG + + rm -rf /var/www/roundcubemail /etc/nginx/sites-available/webmail /etc/nginx/sites-enabled/webmail \ + || ee_lib_error "Unable to remove Roundcube, exit status = " $? +} diff --git a/src/vendor/ee_ven_remove_vimbadmin.sh b/src/vendor/ee_ven_remove_vimbadmin.sh new file mode 100644 index 00000000..3966ae19 --- /dev/null +++ b/src/vendor/ee_ven_remove_vimbadmin.sh @@ -0,0 +1,16 @@ +# Remove ViMbAdmin + +function ee_ven_remove_vimbadmin() +{ + ee_lib_echo "Removing ViMbAdmin, please wait..." + + mysql -e "drop database \`vimbadmin\`" &>> $EE_COMMAND_LOG + mysql -e "drop user vimbadmin@'$EE_MYSQL_GRANT_HOST'" &>> $EE_COMMAND_LOG + + ee_lib_echo "Removing ViMbAdmin PHP dependencies, please wait..." + $EE_APT_GET $EE_SECOND php5-cgi php-gettext \ + ||ee_lib_error "Unable to $EE_SECOND ViMbAdmin PHP dependencies, exit status = " $? + + rm -rf /var/www/22222/htdocs/vimbadmin \ + || ee_lib_error "Unable to remove ViMbAdmin, exit status = " $? +} diff --git a/src/vendor/ee_ven_setup_roundcube.sh b/src/vendor/ee_ven_setup_roundcube.sh new file mode 100644 index 00000000..0af6c635 --- /dev/null +++ b/src/vendor/ee_ven_setup_roundcube.sh @@ -0,0 +1,35 @@ +# Setup Roundcube + +function ee_ven_setup_roundcube() +{ + ee_lib_echo "Setting up Roundcube, please wait..." + + # Random characters + local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) + + # Setting up database for Roundcube + mysql -e "create database \`roundcubemail\`" \ + || ee_lib_error "Unable to create Roundcube database, exit status = " $? + + # Create MySQL user + mysql -e "grant all privileges on roundcubemail.* to roundcube@'$EE_MYSQL_GRANT_HOST' IDENTIFIED BY '$ee_random'" \ + || ee_lib_error "Unable to grant privileges for Roundcube database user, exit status = " $? + mysql -e "flush privileges" + + # Import Roundcube initial database + mysql roundcubemail < /var/www/roundcubemail/htdocs/SQL/mysql.initial.sql \ + || ee_lib_error "Unable to import database for Roundcube, exit status = " $? + + # Setup configuration for Roundcube + cp -av /var/www/roundcubemail/htdocs/config/config.inc.php.sample /var/www/roundcubemail/htdocs/config/config.inc.php &>> $EE_COMMAND_LOG + sed -i "s'mysql://roundcube:pass@localhost/roundcubemail'mysql://roundcube:${ee_random}@${EE_MYSQL_HOST}/roundcubemail'" /var/www/roundcubemail/htdocs/config/config.inc.php \ + || ee_lib_error "Unable to setup Roundcube database details in config.inc.php file, exit status = " $? + + # Setup Nginx configuration to access Webmail + cp -v /usr/share/easyengine/mail/webmail /etc/nginx/sites-available/ &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to copy Nginx configuration for Roundcube, exit status = " $? + + ln -sf /etc/nginx/sites-available/webmail /etc/nginx/sites-enabled/ \ + || ee_lib_error "Unable to create softlink for Webmail, exit status = " $? + +} diff --git a/src/vendor/ee_ven_setup_vimbadmin.sh b/src/vendor/ee_ven_setup_vimbadmin.sh new file mode 100644 index 00000000..993b94fc --- /dev/null +++ b/src/vendor/ee_ven_setup_vimbadmin.sh @@ -0,0 +1,78 @@ +# Setup ViMbAdmin + +function ee_ven_setup_vimbadmin() +{ + if [ $EE_MYSQL_HOST = "localhost" ];then + ee_vimbadmin_host="127.0.0.1" + else + ee_vimbadmin_host=$EE_MYSQL_HOST + fi + + ee_lib_echo "Setting up ViMbAdmin, please wait..." + + # Random characters + local ee_random=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 15 | head -n1) + + # Setting up database for ViMbAdmin + mysql -e "create database \`vimbadmin\`" \ + || ee_lib_error "Unable to create ViMbAdmin database, exit status = " $? + + # Create MySQL User + mysql -e "grant all privileges on vimbadmin.* to vimbadmin@'$EE_MYSQL_GRANT_HOST' IDENTIFIED BY '$ee_random'" \ + || ee_lib_error "Unable to grant privileges for ViMbAdmin database user, exit status = " $? + mysql -e "flush privileges" + + # Setup configuration for ViMbAdmin + cp -av /var/www/22222/htdocs/vimbadmin/application/configs/application.ini.dist /var/www/22222/htdocs/vimbadmin/application/configs/application.ini &>> $EE_COMMAND_LOG + + sed -i "s/defaults.mailbox.uid = 2000/defaults.mailbox.uid = 5000/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s/defaults.mailbox.gid = 2000/defaults.mailbox.gid = 5000/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s'maildir:/srv/vmail/%d/%u/mail:LAYOUT=fs'maildir:/var/vmail/%d/%u'" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s'/srv/vmail/%d/%u'/var/vmail/'" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s/pdo_mysql/mysqli/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s/'xxx'/'$ee_random'/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s/resources.doctrine2.connection.options.host = 'localhost'/resources.doctrine2.connection.options.host = '$ee_vimbadmin_host'/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini && + sed -i "s/defaults.mailbox.password_scheme = \"md5.salted\"/defaults.mailbox.password_scheme = \"md5\"/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini \ + || ee_lib_error "Unable to setup ViMbAdmin configuration file, exit status = " $? + + # Changing hosts and password of ViMbAdmin database in postfix configuration + sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_alias_maps.cf && + sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_alias_maps.cf \ + || ee_lib_error "Unable to setup ViMbAdmin database details in virtual_alias_maps.cf file, exit status = " $? + + sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_domains_maps.cf && + sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_domains_maps.cf \ + || ee_lib_error "Unable to setup ViMbAdmin database details in virtual_domains_maps.cf file, exit status = " $? + + sed -i "s/password = password/password = $ee_random/" /etc/postfix/mysql/virtual_mailbox_maps.cf && + sed -i "s/hosts = 127.0.0.1/hosts = $ee_vimbadmin_host/" /etc/postfix/mysql/virtual_mailbox_maps.cf \ + || ee_lib_error "Unable to setup ViMbAdmin database details in virtual_mailbox_maps.cf file, exit status = " $? + + sed -i "s/password=password/password=$ee_random/" /etc/dovecot/dovecot-sql.conf.ext && + sed -i "s/hosts=localhost/hosts=$ee_vimbadmin_host/" /etc/dovecot/dovecot-sql.conf.ext \ + || ee_lib_error "Unable to setup ViMbAdmin database details in dovecot-sql.conf.ext file, exit status = " $? + + # Changing hosts and password of ViMbAdmin database in Amavis configuration + sed -i "s/127.0.0.1/$ee_vimbadmin_host/" /etc/amavis/conf.d/50-user && + sed -i "s/password/$ee_random/" /etc/amavis/conf.d/50-user \ + || ee_lib_error "Unable to setup ViMbAdmin database details in 50-user file, exit status = " $? + + # Copying HTACCESS + cp -av /var/www/22222/htdocs/vimbadmin/public/.htaccess.dist /var/www/22222/htdocs/vimbadmin/public/.htaccess &>> $EE_COMMAND_LOG + + # Setting default database + /var/www/22222/htdocs/vimbadmin/bin/doctrine2-cli.php orm:schema-tool:create &>> $EE_COMMAND_LOG \ + || ee_lib_error "Unable to setup ViMbAdmin default database , exit status = " $? + + ee_security_salt=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n1) + sed -i "s/securitysalt = \"\"/securitysalt = \"$ee_security_salt\"/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini \ + || ee_lib_error "Unable to setup ViMbAdmin security salt , exit status = " $? + + ee_rememberme_salt=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n1) + sed -i "s/resources.auth.oss.rememberme.salt = \"\"/resources.auth.oss.rememberme.salt = \"$ee_rememberme_salt\"/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini \ + || ee_lib_error "Unable to setup ViMbAdmin remember me salt , exit status = " $? + + ee_password_salt=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 64 | head -n1) + sed -i "s/defaults.mailbox.password_salt = \"\"/defaults.mailbox.password_salt = \"$ee_password_salt\"/" /var/www/22222/htdocs/vimbadmin/application/configs/application.ini \ + || ee_lib_error "Unable to setup ViMbAdmin mailbox password salt , exit status = " $? +} diff --git a/templates/mail/10-master.conf b/templates/mail/10-master.conf new file mode 100644 index 00000000..1c46e384 --- /dev/null +++ b/templates/mail/10-master.conf @@ -0,0 +1,26 @@ +service lmtp { + unix_listener /var/spool/postfix/private/dovecot-lmtp { + mode = 0600 + user = postfix + group = postfix + } +} + +service auth { + unix_listener /var/spool/postfix/private/auth { + mode = 0666 + user = postfix + group = postfix + } + + unix_listener auth-userdb { + mode = 0600 + user = vmail + } + + user = dovecot +} + +service auth-worker { + user = vmail +} diff --git a/templates/mail/amavis-master.cf b/templates/mail/amavis-master.cf new file mode 100644 index 00000000..cc4b872c --- /dev/null +++ b/templates/mail/amavis-master.cf @@ -0,0 +1,24 @@ +smtp-amavis unix - - n - 2 smtp + -o smtp_data_done_timeout=1200 + -o smtp_send_xforward_command=yes + -o disable_dns_lookups=yes + -o max_use=20 + +127.0.0.1:10025 inet n - n - - smtpd + -o content_filter= + -o smtpd_delay_reject=no + -o smtpd_client_restrictions=permit_mynetworks,reject + -o smtpd_helo_restrictions= + -o smtpd_sender_restrictions= + -o smtpd_recipient_restrictions=permit_mynetworks,reject + -o smtpd_data_restrictions=reject_unauth_pipelining + -o smtpd_end_of_data_restrictions= + -o smtpd_restriction_classes= + -o mynetworks=127.0.0.0/8 + -o smtpd_error_sleep_time=0 + -o smtpd_soft_error_limit=1001 + -o smtpd_hard_error_limit=1000 + -o smtpd_client_connection_count_limit=0 + -o smtpd_client_connection_rate_limit=0 + -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks + -o local_header_rewrite_clients= diff --git a/templates/mail/auth-sql.conf.ext b/templates/mail/auth-sql.conf.ext new file mode 100644 index 00000000..d3f0b7fa --- /dev/null +++ b/templates/mail/auth-sql.conf.ext @@ -0,0 +1,13 @@ +passdb { +driver = sql +args = /etc/dovecot/dovecot-sql.conf.ext +} + +userdb { +driver = prefetch +} + +userdb { +driver = sql +args = /etc/dovecot/dovecot-sql.conf.ext +} diff --git a/templates/mail/autocreate b/templates/mail/autocreate new file mode 100644 index 00000000..66a68eb0 --- /dev/null +++ b/templates/mail/autocreate @@ -0,0 +1,10 @@ +plugin { +autocreate = Trash +autocreate2 = Junk +autocreate3 = Drafts +autocreate4 = Sent +autosubscribe = Trash +autosubscribe2 = Junk +autosubscribe3 = Drafts +autosubscribe4 = Sent +} diff --git a/templates/mail/default.sieve b/templates/mail/default.sieve new file mode 100644 index 00000000..62532322 --- /dev/null +++ b/templates/mail/default.sieve @@ -0,0 +1,4 @@ +require "fileinto"; +if header :contains "X-Spam-Flag" "YES" { + fileinto "Junk"; +} diff --git a/templates/mail/dovecot b/templates/mail/dovecot new file mode 100644 index 00000000..7d001128 --- /dev/null +++ b/templates/mail/dovecot @@ -0,0 +1,73 @@ +# EasyEngine Dovecot init script +### BEGIN INIT INFO +# Provides: dovecot +# Required-Start: $local_fs $remote_fs $network $syslog $time +# Required-Stop: $local_fs $remote_fs $network $syslog +# Should-Start: postgresql mysql slapd winbind +# Should-Stop: postgresql mysql slapd winbind +# Default-Start: 2 3 4 5 +# Default-Stop: 0 1 6 +# Short-Description: Dovecot init script +# Description: Init script for dovecot services +### END INIT INFO + +# Example /etc/init.d/dovecot script. Change DAEMON if necessary. +# License is public domain. + +DAEMON=/usr/sbin/dovecot + +# Uncomment to allow Dovecot daemons to produce core dumps. +#ulimit -c unlimited + +test -x $DAEMON || exit 1 +set -e + +base_dir=`$DAEMON config -h base_dir` +pidfile=$base_dir/master.pid + +if test -f $pidfile; then + running=yes +else + running=no +fi + +case "$1" in + start) + echo -n "Starting Dovecot" + $DAEMON + echo "." + ;; + stop) + if test $running = yes; then + echo "Stopping Dovecot" + kill `cat $pidfile` + echo "." + else + echo "Dovecot is already stopped." + fi + ;; + reload) + if test $running = yes; then + echo -n "Reloading Dovecot configuration" + kill -HUP `cat $pidfile` + echo "." + else + echo "Dovecot isn't running." + fi + ;; + restart|force-reload) + echo -n "Restarting Dovecot" + if test $running = yes; then + kill `cat $pidfile` + sleep 1 + fi + $DAEMON + echo "." + ;; + *) + echo "Usage: /etc/init.d/dovecot {start|stop|reload|restart|force-reload}" >&2 + exit 1 + ;; +esac + +exit 0 diff --git a/templates/mail/dovecot-sql.conf.ext b/templates/mail/dovecot-sql.conf.ext new file mode 100644 index 00000000..03d413fb --- /dev/null +++ b/templates/mail/dovecot-sql.conf.ext @@ -0,0 +1,15 @@ +driver = mysql + +connect = host=localhost user=vimbadmin password=password dbname=vimbadmin +default_pass_scheme = MD5 + +password_query = SELECT username as user, password as password, \ +homedir AS home, maildir AS mail, \ +concat('*:bytes=', quota) as quota_rule, uid, gid \ +FROM mailbox \ +WHERE username = '%Lu' AND active = '1' \ +AND ( access_restriction = 'ALL' OR LOCATE( access_restriction, '%Us' ) > 0 ) + +user_query = SELECT homedir AS home, maildir AS mail, \ +concat('*:bytes=', quota) as quota_rule, uid, gid \ +FROM mailbox WHERE username = '%u' diff --git a/templates/mail/virtual_alias_maps.cf b/templates/mail/virtual_alias_maps.cf new file mode 100644 index 00000000..2b312477 --- /dev/null +++ b/templates/mail/virtual_alias_maps.cf @@ -0,0 +1,5 @@ +user = vimbadmin +password = password +hosts = 127.0.0.1 +dbname = vimbadmin +query = SELECT goto FROM alias WHERE address = '%s' AND active = '1' diff --git a/templates/mail/virtual_domains_maps.cf b/templates/mail/virtual_domains_maps.cf new file mode 100644 index 00000000..a7c11133 --- /dev/null +++ b/templates/mail/virtual_domains_maps.cf @@ -0,0 +1,5 @@ +user = vimbadmin +password = password +hosts = 127.0.0.1 +dbname = vimbadmin +query = SELECT domain FROM domain WHERE domain = '%s' AND backupmx = '0' AND active = '1' diff --git a/templates/mail/virtual_mailbox_maps.cf b/templates/mail/virtual_mailbox_maps.cf new file mode 100644 index 00000000..e777f79d --- /dev/null +++ b/templates/mail/virtual_mailbox_maps.cf @@ -0,0 +1,7 @@ +user = vimbadmin +password = password +hosts = 127.0.0.1 +dbname = vimbadmin +table = mailbox +select_field = maildir +where_field = username diff --git a/templates/mail/webmail b/templates/mail/webmail new file mode 100644 index 00000000..b1b2b3a1 --- /dev/null +++ b/templates/mail/webmail @@ -0,0 +1,23 @@ +# Nginx Configuration to access webmail +# Don't modify this file, EasyEngine replaces it with new version + +server { + server_name webmail.*; + + access_log /var/log/nginx/webmail.access.log; + error_log /var/log/nginx/webmail.error.log; + + root /var/www/roundcubemail/htdocs/; + index index.php; + + location / { + try_files $uri $uri/ /index.php?$args; + } + + location ~ \.php$ { + try_files $uri =404; + include fastcgi_params; + fastcgi_pass 127.0.0.1:9000; + } + +} diff --git a/templates/nginx/22222 b/templates/nginx/22222 index 1ea0e1bd..44e50952 100644 --- a/templates/nginx/22222 +++ b/templates/nginx/22222 @@ -39,4 +39,23 @@ server { fastcgi_pass php; } + # ViMbAdmin Rules + location = /vimbadmin/ { + return 301 $scheme://$host:22222/vimbadmin/public/; + } + + location ~* \.(js|css|jpg|gif|png)$ { + root /var/www/22222/htdocs/; + } + + location ~* /vimbadmin/public/(.*)/(.*) { + root /var/www/22222/htdocs/vimbadmin/public; + try_files $uri $uri/ /vimbadmin/public/index.php?$args; + } + + location ~* /vimbadmin/public/(.*) { + root /var/www/22222/htdocs/vimbadmin/public; + try_files $uri $uri/ /vimbadmin/public/index.php?$args; + } + }