1. Zhang Huangbin
  2. iredmail

Commits

Zhang Huangbin  committed 5e8c844

Remove support for Amazon EC2 CentOS instance. Amazon customizes too many components (e.g. clamav, perl), cannot make iRedMail fully work with default Amazon yum repositories.

  • Participants
  • Parent commits 4b6465b
  • Branches default

Comments (0)

Files changed (5)

File iRedMail/conf/global

View file
     # Directory of RC scripts.
     export DIR_RC_SCRIPTS='/etc/init.d'
 
-    # Amazon EC2 (CentOS) support.
-    if [ -f /etc/system-release -a -f /etc/yum.repos.d/amzn-main.repo ]; then
-        if [ ! -f /etc/redhat-release ]; then
-            # Identified as CentOS 6.
-            # Note: Amazon AMI it uses 'latest' as release version number, we
-            # have to use the latest CentOS version for it.
-            echo 'CentOS Linux 6' > /etc/redhat-release
-        fi
-        export YUM='yum -d 2 --disableplugin=priorities'
-    fi
-
     if [ -f /etc/redhat-release ]; then
         # RHEL/CentOS
         export DISTRO='RHEL'

File iRedMail/conf/web_server

View file
 . ${CONF_DIR}/apache_php
 . ${CONF_DIR}/nginx
 
-if [ X"${WEB_SERVER_USE_APACHE}" == X'YES' ]; then
-    export ENABLED_HTTPD_SERVICES="${APACHE_RC_SCRIPT_NAME}"
-    export DISABLED_HTTPD_SERVICES="${NGINX_RC_SCRIPT_NAME} ${PHP_FPM_RC_SCRIPT_NAME} ${UWSGI_RC_SCRIPT_NAME}"
-fi
-
 if [ X"${WEB_SERVER_WEB_SERVER_USE_NGINX}" == X'YES' ]; then
     # Use Nginx as web server if it's selected.
     # php-fpm will be listed in variable 'pkg_scripts' in /etc/rc.conf.local.
     export ENABLED_HTTPD_SERVICES="${NGINX_RC_SCRIPT_NAME} ${PHP_FPM_RC_SCRIPT_NAME} ${UWSGI_RC_SCRIPT_NAME}"
     export DISABLED_HTTPD_SERVICES="${APACHE_RC_SCRIPT_NAME}"
+else
+    export ENABLED_HTTPD_SERVICES="${APACHE_RC_SCRIPT_NAME}"
+    export DISABLED_HTTPD_SERVICES="${NGINX_RC_SCRIPT_NAME} ${PHP_FPM_RC_SCRIPT_NAME} ${UWSGI_RC_SCRIPT_NAME}"
 fi
 
 # PHP

File iRedMail/functions/fail2ban.sh

View file
 EOF
 
     # FreeBSD: Start fail2ban when system start up.
-    freebsd_enable_service_in_rc_conf 'fail2ban_enable' 'YES'
+    #freebsd_enable_service_in_rc_conf 'fail2ban_enable' 'YES'
 
     echo 'export status_fail2ban_config="DONE"' >> ${STATUS_FILE}
 }

File iRedMail/functions/nginx.sh

View file
     # iRedAdmin
     perl -pi -e 's#PH_IREDADMIN_HTTPD_ROOT_SYMBOL_LINK#$ENV{IREDADMIN_HTTPD_ROOT_SYMBOL_LINK}#g' ${NGINX_CONF_DEFAULT}
 
-    # php-fpm listen socket
+    # php-fpm
     perl -pi -e 's#^(listen *=).*#${1} $ENV{PHP_FASTCGI_SOCKET}#g' ${PHP_FPM_POOL_WWW_CONF}
+    perl -pi -e 's#^;(listen.owner *=).*#${1} $ENV{HTTPD_USER}#g' ${PHP_FPM_POOL_WWW_CONF}
+    perl -pi -e 's#^;(listen.group *=).*#${1} $ENV{HTTPD_GROUP}#g' ${PHP_FPM_POOL_WWW_CONF}
+    perl -pi -e 's#^;(listen.mode *=).*#${1} 0660#g' ${PHP_FPM_POOL_WWW_CONF}
 
     # Copy uwsgi config file for iRedAdmin
     if [ X"${DISTRO}" == X'DEBIAN' -o X"${DISTRO}" == X'UBUNTU' ]; then
 
     if [ X"${DISTRO}" == X'FREEBSD' ]; then
         mkdir -p /var/log/nginx &>/dev/null
+        rm -f /var/log/nginx-error.log &>/dev/null
+
         freebsd_enable_service_in_rc_conf 'nginx_enable' 'YES'
         freebsd_enable_service_in_rc_conf 'uwsgi_enable' 'YES'
+        freebsd_enable_service_in_rc_conf 'php_fpm_enable' 'YES'
     elif [ X"${DISTRO}" == X'OPENBSD' ]; then
         # Enable unchrooted Nginx
         echo 'nginx_flags="-u"' >> ${RC_CONF_LOCAL}

File iRedMail/functions/packages.sh

View file
     PKG_SCRIPTS=''  # OpenBSD only
 
     # OpenBSD: Hard-code package versions
-    export OB_PHP_VER='5.4.24'
-    export OB_POSTFIX_VER='2.11.0'
-    export OB_OPENLDAP_VER='2.4.38'
+    export OB_PHP_VER='-5.4.24'
+    export OB_POSTFIX_VER='-2.11.0'
+    export OB_OPENLDAP_VER='-2.4.38'
 
     # Enable syslog or rsyslog.
     if [ X"${DISTRO}" == X'RHEL' ]; then
         #             start amavisd before postfix since Amavisd is content
         #             filter.
         if [ X"${BACKEND}" == X'OPENLDAP' ]; then
-            ALL_PKGS="${ALL_PKGS} postfix-${OB_POSTFIX_VER}-ldap"
+            ALL_PKGS="${ALL_PKGS} postfix${OB_POSTFIX_VER}-ldap"
         elif [ X"${BACKEND}" == X'MYSQL' ]; then
-            ALL_PKGS="${ALL_PKGS} postfix-${OB_POSTFIX_VER}-mysql"
+            ALL_PKGS="${ALL_PKGS} postfix${OB_POSTFIX_VER}-mysql"
         elif [ X"${BACKEND}" == X'PGSQL' ]; then
-            ALL_PKGS="${ALL_PKGS} postfix-${OB_POSTFIX_VER}-pgsql"
+            ALL_PKGS="${ALL_PKGS} postfix${OB_POSTFIX_VER}-pgsql"
         fi
     fi
 
 
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
             if [ X"${BACKEND_ORIG}" == X'OPENLDAP' ]; then
-                ALL_PKGS="${ALL_PKGS} openldap-server-${OB_OPENLDAP_VER}"
+                ALL_PKGS="${ALL_PKGS} openldap-server${OB_OPENLDAP_VER}"
                 PKG_SCRIPTS="${PKG_SCRIPTS} ${OPENLDAP_RC_SCRIPT_NAME}"
             fi
 
         [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} php5-mysql"
         [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} php5-pgsql"
     elif [ X"${DISTRO}" == X'OPENBSD' ]; then
-        ALL_PKGS="${ALL_PKGS} php-${OB_PHP_VER} php-bz2-${OB_PHP_VER} php-imap-${OB_PHP_VER} php-mcrypt-${OB_PHP_VER} php-gd-${OB_PHP_VER} pecl-APC"
+        ALL_PKGS="${ALL_PKGS} php${OB_PHP_VER} php-bz2${OB_PHP_VER} php-imap${OB_PHP_VER} php-mcrypt${OB_PHP_VER} php-gd${OB_PHP_VER} pecl-APC"
 
-        [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} php-ldap-${OB_PHP_VER} php-mysql-${OB_PHP_VER} php-mysqli-${OB_PHP_VER} php-pdo_mysql-${OB_PHP_VER}"
-        [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} php-mysql-${OB_PHP_VER} php-mysqli-${OB_PHP_VER} php-pdo_mysql-${OB_PHP_VER}"
-        [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} php-pgsql-${OB_PHP_VER} php-pdo_pgsql-${OB_PHP_VER}"
+        [ X"${BACKEND}" == X'OPENLDAP' ] && ALL_PKGS="${ALL_PKGS} php-ldap${OB_PHP_VER} php-mysql${OB_PHP_VER} php-mysqli${OB_PHP_VER} php-pdo_mysql${OB_PHP_VER}"
+        [ X"${BACKEND}" == X'MYSQL' ] && ALL_PKGS="${ALL_PKGS} php-mysql${OB_PHP_VER} php-mysqli${OB_PHP_VER} php-pdo_mysql${OB_PHP_VER}"
+        [ X"${BACKEND}" == X'PGSQL' ] && ALL_PKGS="${ALL_PKGS} php-pgsql${OB_PHP_VER} php-pdo_pgsql${OB_PHP_VER}"
     fi
 
     # Web servers
             ALL_PKGS="${ALL_PKGS} nginx php5-fpm"
         elif [ X"${DISTRO}" == X'OPENBSD' ]; then
             # Nginx is available in base system
-            ALL_PKGS="${ALL_PKGS} php-fpm-${OB_PHP_VER}"
+            ALL_PKGS="${ALL_PKGS} php-fpm${OB_PHP_VER}"
             PKG_SCRIPTS="${PKG_SCRIPTS} ${PHP_FPM_RC_SCRIPT_NAME}"
         fi
     fi