Source

iredmail / iRedMail / dialog / optional_components.sh

Full commit
Zhang Huangbin 7c26194 

Zhang Huangbin 69f2f69 
Zhang Huangbin 7c26194 





















Zhang Huangbin 4b87d19 


Zhang Huangbin 79f4ee0 
Zhang Huangbin 4b87d19 













Zhang Huangbin 7c26194 

Zhang Huangbin cef9bd2 
Zhang Huangbin 7c26194 
Zhang Huangbin cef9bd2 
Zhang Huangbin 7c26194 


Zhang Huangbin 9c2d200 
Zhang Huangbin 7c26194 




Zhang Huangbin 9c33fcf 
Zhang Huangbin 7c26194 


Zhang Huangbin 4b87d19 
Zhang Huangbin 7c26194 


Zhang Huangbin cef9bd2 
Zhang Huangbin 7c26194 
Zhang Huangbin cef9bd2 
Zhang Huangbin 7c26194 


Zhang Huangbin 9c2d200 
Zhang Huangbin 7c26194 






Zhang Huangbin 9c33fcf 
Zhang Huangbin 4b87d19 
Zhang Huangbin 7c26194 

Zhang Huangbin 4b87d19 
Zhang Huangbin 2d4d9fb 












Zhang Huangbin dc36968 
Zhang Huangbin c39af05 
Zhang Huangbin 4b87d19 
Zhang Huangbin 2d4d9fb 

Zhang Huangbin 7c26194 


Zhang Huangbin 2d4d9fb 
Zhang Huangbin 7c26194 









Zhang Huangbin c39af05 
Zhang Huangbin 7c26194 

Zhang Huangbin c39af05 
Zhang Huangbin 7c26194 




Zhang Huangbin c39af05 
Zhang Huangbin 7c26194 
Zhang Huangbin c39af05 
Zhang Huangbin 7c26194 










Zhang Huangbin c39af05 



Zhang Huangbin 7c26194 
Zhang Huangbin c39af05 








Zhang Huangbin 7c26194 

#!/usr/bin/env bash

# Author:   Zhang Huangbin <zhb _at_ iredmail.org>

#---------------------------------------------------------------------
# This file is part of iRedMail, which is an open source mail server
# solution for Red Hat(R) Enterprise Linux, CentOS, Debian and Ubuntu.
#
# iRedMail is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# iRedMail is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with iRedMail.  If not, see <http://www.gnu.org/licenses/>.
#---------------------------------------------------------------------

# ----------------------------------------
# Optional components for special backend.
# ----------------------------------------
# Detect selectable menu items
if [ X"${DISTRO}" == X'SUSE' ]; then
    # Apache module mod_auth_pgsql is not available
    [ X"${BACKEND}" == X'PGSQL' ] && export DIALOG_SELECTABLE_AWSTATS='NO'
elif [ X"${DISTRO}" == X'OPENBSD' ]; then
    # Binary/port Awstats is not available
    export DIALOG_SELECTABLE_AWSTATS='NO'
fi

# Construct dialog menu list
# Format: item_name item_descrition on/off
# Note: item_descrition must be concatenated by '_'.
export LIST_OF_OPTIONAL_COMPONENTS=''

if [ X"${DIALOG_SELECTABLE_AWSTATS}" == X'YES' ]; then
    LIST_OF_OPTIONAL_COMPONENTS="${LIST_OF_OPTIONAL_COMPONENTS} Awstats Advanced_web_and_mail_log_analyzer on"
fi

export tmp_config_optional_components="${ROOTDIR}/.optional_components"

if [ X"${BACKEND}" == X"OPENLDAP" ]; then
    ${DIALOG} \
    --title "Optional Components for ${BACKEND_ORIG} backend" \
    --checklist "\
Note:
    * DKIM is recommended.
    * SPF validation (Sender Policy Framework) is enabled by default.
    * DNS records (TXT type) are required for both SPF and DKIM.
    * Refer to file for more detail after installation:
      ${TIP_FILE}
" 20 76 8 \
    "DKIM signing/verification" "DomainKeys Identified Mail" "on" \
    "iRedAdmin" "Official web-based Admin Panel" "on" \
    "Roundcubemail" "WebMail program (PHP, AJAX)" "on" \
    "phpLDAPadmin" "Web-based OpenLDAP management tool" "on" \
    "phpMyAdmin" "Web-based MySQL management tool" "on" \
    ${LIST_OF_OPTIONAL_COMPONENTS} \
    "Fail2ban" "Ban IP with too many password failures" "on" \
    2>${tmp_config_optional_components}

elif [ X"${BACKEND}" == X"MYSQL" ]; then
    ${DIALOG} \
    --title "Optional Components for ${BACKEND_ORIG} backend" \
    --checklist "\
Note:
    * DKIM is recommended.
    * SPF validation (Sender Policy Framework) is enabled by default.
    * DNS record (TXT type) are required for both SPF and DKIM.
    * Please refer to file for more detail after installation:
      ${TIP_FILE}
" 20 76 8 \
    "DKIM signing/verification" "DomainKeys Identified Mail" "on" \
    "Roundcubemail" "WebMail program (PHP, AJAX)" "on" \
    "phpMyAdmin" "Web-based MySQL management tool" "on" \
    "iRedAdmin" "Official web-based Admin Panel" "on" \
    ${LIST_OF_OPTIONAL_COMPONENTS} \
    "Fail2ban" "Ban IP with too many password failures" "on" \
    2>${tmp_config_optional_components}

elif [ X"${BACKEND}" == X"PGSQL" ]; then
    ${DIALOG} \
    --title "Optional Components for ${BACKEND_ORIG} backend" \
    --checklist "\
Note:
    * DKIM is recommended.
    * SPF validation (Sender Policy Framework) is enabled by default.
    * DNS record (TXT type) are required for both SPF and DKIM.
    * Please refer to file for more detail after installation:
      ${TIP_FILE}
" 20 76 8 \
    "DKIM signing/verification" "DomainKeys Identified Mail" "on" \
    "Roundcubemail" "WebMail program (PHP, AJAX)" "on" \
    "iRedAdmin" "Official web-based Admin Panel" "on" \
    "phpPgAdmin" "Web-based MySQL management tool" "on" \
    ${LIST_OF_OPTIONAL_COMPONENTS} \
    "Fail2ban" "Ban IP with too many password failures" "on" \
    2>${tmp_config_optional_components}
fi

OPTIONAL_COMPONENTS="$(cat ${tmp_config_optional_components})"
rm -f ${tmp_config_optional_components} &>/dev/null

echo ${OPTIONAL_COMPONENTS} | grep -i '\<SPF\>' >/dev/null 2>&1
[ X"$?" == X"0" ] && export ENABLE_SPF='YES' && echo "export ENABLE_SPF='YES'" >>${CONFIG_FILE}

echo ${OPTIONAL_COMPONENTS} | grep -i '\<DKIM\>' >/dev/null 2>&1
[ X"$?" == X"0" ] && export ENABLE_DKIM='YES' && echo "export ENABLE_DKIM='YES'" >>${CONFIG_FILE}

echo ${OPTIONAL_COMPONENTS} | grep -i 'iredadmin' >/dev/null 2>&1
[ X"$?" == X"0" ] && export USE_IREDADMIN='YES' && export USE_IREDADMIN='YES' && echo "export USE_IREDADMIN='YES'" >> ${CONFIG_FILE}

if echo ${OPTIONAL_COMPONENTS} | grep -i 'roundcubemail' &>/dev/null; then
    export USE_WEBMAIL='YES'
    export USE_RCM='YES'
    export REQUIRE_PHP='YES'
    echo "export USE_WEBMAIL='YES'" >> ${CONFIG_FILE}
    echo "export USE_RCM='YES'" >> ${CONFIG_FILE}
    echo "export REQUIRE_PHP='YES'" >> ${CONFIG_FILE}
fi

if echo ${OPTIONAL_COMPONENTS} | grep -i 'phpldapadmin' &>/dev/null; then
    export USE_PHPLDAPADMIN='YES'
    export REQUIRE_PHP='YES'
    echo "export USE_PHPLDAPADMIN='YES'" >>${CONFIG_FILE}
    echo "export REQUIRE_PHP='YES'" >> ${CONFIG_FILE}
fi

echo ${OPTIONAL_COMPONENTS} | grep -i 'phpmyadmin' >/dev/null 2>&1
if [ X"$?" == X"0" ]; then
    export USE_PHPMYADMIN='YES'
    echo "export USE_PHPMYADMIN='YES'" >>${CONFIG_FILE}
    echo "export REQUIRE_PHP='YES'" >> ${CONFIG_FILE}
fi

if echo ${OPTIONAL_COMPONENTS} | grep -i 'phppgadmin' &>/dev/null; then
    export USE_PHPPGADMIN='YES'
    echo "export USE_PHPPGADMIN='YES'" >>${CONFIG_FILE}
fi

if echo ${OPTIONAL_COMPONENTS} | grep -i 'awstats' &>/dev/null; then
    export USE_AWSTATS='YES'
    echo "export USE_AWSTATS='YES'" >>${CONFIG_FILE}
fi

if echo ${OPTIONAL_COMPONENTS} | grep -i 'fail2ban' &>/dev/null; then
    export USE_FAIL2BAN='YES'
    echo "export USE_FAIL2BAN='YES'" >>${CONFIG_FILE}
fi

# Used when you use awstats.
[ X"${USE_AWSTATS}" == X"YES" ] && . ${DIALOG_DIR}/awstats_config.sh