code
stringlengths
1
1.96M
language
stringclasses
1 value
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> awstats_config_basic() { # Change file owner and permission if we use ExtMail at the same time. if [ X"${USE_EXTMAIL}" == X"YES" ]; then chown -R ${VMAIL_USER_NAME}:${VMAIL_GROUP_NAME} ${AWSTATS_HTTPD_ROOT} else : fi ...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # Please refer another file: functions/backend.sh # ------------------------------------------------------- # -------------------- MySQL ---------------------------- # ------------------------------------------------------- mysql_initialize() { ECH...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------------- phpLDAPadmin ---------------------- # ------------------------------------------------------- pla_install() { cd ${MISC_DIR} extract_pkg ${PLA_TARBALL} ${HTTPD_SERV...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------- # Amavisd-new. # -------------------------------------------- amavisd_dkim() { pem_file="${AMAVISD_DKIM_DIR}/${FIRST_DOMAIN}.pem" ECHO_INFO "Create directory to store CA files: ${AMAVISD_DKIM_DIR}...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------- # Mailman. # ------------------------------------------------- mailman_config() { ECHO_INFO "Initialize mailman." echo "MTA = 'Postfix'" >> /etc/mailman/mm_cfg.py echo "POSTFIX_STYLE_VIRTUA...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # Configure pysieved. pysieved_config() { backup_file ${PYSIEVED_INI} ECHO_INFO "Setting up managesieve server: pysieved." cat > ${PYSIEVED_INI} <<EOF ${CONF_MSG} [main] # Authentication back-end to use auth = Dovecot # User DB back-...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # Dovecot & dovecot-sieve. # ------------------------------------------------------- # For dovecot SSL support. enable_dovecot_ssl() { ECHO_INFO "Enable TLS support in Dovecot." [ X"${E...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------- # Install all optional components. # ------------------------------------------- optional_components() { if [ X"${USE_SM}" == X"YES" ]; then # ------------------------------------------------ ...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ----------------------- # Roundcube. # ----------------------- rcm_install() { cd ${MISC_DIR} # Extract source tarball. extract_pkg ${RCM_TARBALL} ${HTTPD_SERVERROOT} ECHO_INFO "Set correct permission for Roundcubemail: ${RCM_HTTPD_R...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> install_all() { ALL_PKGS='' ENABLED_SERVICES='' DISABLED_SERVICES='' # Apache and PHP. if [ X"${USE_EXIST_AMP}" != X"YES" ]; then # Apache. ALL_PKGS="${ALL_PKGS} httpd.${ARCH} mod_ssl.${ARCH}" # PHP. ...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> horde_install() { cd ${MISC_DIR} # Extract source tarball. extract_pkg ${HORDE_TARBALL} ${HTTPD_DOCUMENTROOT} mv ${HTTPD_DOCUMENTROOT}/horde-webmail-${HORDE_VERSION} ${HORDE_HTTPD_ROOT} ECHO_INFO "Set correct permission for Horde w...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> enable_procmail() { ECHO_INFO "Setup procmail as Mail Deliver Agent(MDA)." ECHO_INFO "Copy ${SAMPLE_DIR}/procmailrc as ${PROCMAILRC}." cp -f ${SAMPLE_DIR}/procmailrc ${PROCMAILRC} ECHO_INFO "Setup Postfix transport in ${POSTFIX_FILE_MA...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------- # Misc. # ------------------------------------------- disable_selinux() { ECHO_INFO "Disable SELinux." [ -f /etc/selinux/config ] && perl -pi -e 's#^(SELINUX=)(.*)#${1}disabled#' /etc/selinux/config ...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com). # Date: 2008.04.07 # --------------------------------------------- # pypolicyd-spf. # --------------------------------------------- pypolicyd_spf_config() { ECHO_INFO "Install pypolicyd-spf for SPF." cd ${MISC_DIR} extract_pkg ${PYPOL...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ----------------------------- # PostfixAdmin. # ----------------------------- postfixadmin_install() { cd ${MISC_DIR} extract_pkg ${POSTFIXADMIN_TARBALL} ${HTTPD_SERVERROOT} && \ cd ${POSTFIXADMIN_HTTPD_ROOT}/ && \ patch -p0 < ${PATCH...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------- # ClamAV. # -------------------------------------------- clamav_config() { ECHO_INFO "Configure ClamAV: ${CLAMD_CONF}." perl -pi -e 's/^(TCPSocket.*)/#${1}/' ${CLAMD_CONF} perl -pi -e 's/^(TCPA...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------- # phpMyAdmin. # ------------------------------------------------- phpmyadmin_install() { cd ${MISC_DIR} extract_pkg ${PHPMYADMIN_TARBALL} ${HTTPD_SERVERROOT} ECHO_INFO "Set file permissio...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ---------------- Apache & PHP ------------------------- # ------------------------------------------------------- apache_php_config() { backup_file ${HTTPD_CONF} # -------------------...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # --------------------------------------------------------- # SpamAssassin. # --------------------------------------------------------- sa_config() { backup_file ${SA_LOCAL_CF} ECHO_INFO "Generate new configuration file: ${SA_LOCAL_CF}." cp...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ---------------------- Postfix ------------------------ # ------------------------------------------------------- postfix_config_basic() { backup_file ${SMTPD_CONF} ${POSTFIX_FILE_MAIN_CF}...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------------- OpenLDAP -------------------------- # ------------------------------------------------------- openldap_config() { backup_file ${OPENLDAP_SLAPD_CONF} ${OPENLDAP_LDAP_C...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------------- Cyrus-SASL ------------------------ # ------------------------------------------------------- cyrus_sasl_config_ldap() { ECHO_INFO "Configure saslauthd for LDAP bind: $...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------- # Mailgraph # ------------------------------------------------- mailgraph_setup() { ECHO_INFO "Setup mailgraph for mail log monitor." cp -f ${SAMPLE_DIR}/mailgraph/mailgraph.cgi ${HTTPD_SERVER...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ---------------- User/Group: vmail -------------------- # ------------------------------------------------------- adduser_vmail() { homedir="$(dirname $(echo ${VMAIL_USER_HOME_DIR} | sed 's...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------- Install and config backend. ------------- # ------------------------------------------------------- backend_install() { if [ X"${BACKEND}" == X"OpenLDAP" ]; then # Ins...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # --------------------------------------------------------- # SqruirrelMail. # --------------------------------------------------------- sm_install() { cd ${MISC_DIR} # Extract source tarball. extract_pkg ${SM_TARBALL} ${HTTPD_SERVERROOT} ...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # ------------------------------ # Define some global variables. # ------------------------------ ROOTDIR="$(pwd)" CONF_DIR="${ROOTDIR}/conf" FUNCTIONS_DIR="${ROOTDIR}/functions" TOOLS_DIR="${ROOTDIR}/tools" PKG_DIR="${ROOTDIR}/pkgs/rpms" MISC_DIR="${RO...
Shell
#!/bin/sh # Filename: backup_mysql_db.sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Date: 2007.09.16 # Purpose: Backup specified mysql databases. # Copyright: # # This shell script is shipped within iRedMail project, released under # GPL v2. # ---- # Usage: # * Add crontab job for whichever us...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------------- # --------------------- LDAP ----------------------- # -------------------------------------------------- # LDAP suffix. ${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \ --title "LDAP suffix" \ ...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com ) # Date: 2008.06.11 # Purpose: Migrate ExtMail MySQL 'mailbox' table to iRedMail format. # Migration guide wrote in Chinese: # http://code.google.com/p/iRedMail/wiki/iRedMail_tut_Migration # Usage: # English: # * Run into MySQL command lin...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # 'sort' will break in zh env. export LC_ALL=C grep 'helo=' /var/log/maillog | awk -F'helo=<' '{print $2}' | awk -F'>' '{print $1}' > helo.all.iredmail sort helo.all.iredmail | uniq -c | sort -nr > helo.count.iredmail rm -f helo.all.iredmail
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------------- # ------------- SPF & DKIM ------------------------- # -------------------------------------------------- ${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \ --title "SPF & DKIM" \ --checklist...
Shell
#!/bin/sh # Author: Bibby(michaelbibby#gmail.com) # File: create_mail_ldap_user.sh # Date: 2008.02.28 # Purpose: Add new LDAP user for postfix mail server. # ---------------------------------------------- # ------------ Global Setting ------------------ # ---------------------------------------------- # Mailbox for...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Date: 2008.03.29 # Purpose: Collect some log files and configuration files for iRedMail # error analytic. # Collect all ${ALL_FILES} to this directory. COLLDIR="/tmp/iRedMail_sysreport/" [ -d ${COLLDIR} ] || mkdir -p ${COLLDIR} rm -rf ${COLLD...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com ) # Date: 2008.06.11 # Purpose: Convert WinMail user mailboxs to standard IMAP directory # structure (mailbox format). # Migration guide wrote in Chinese: # http://code.google.com/p/iRedMail/wiki/iRedMail_tut_Migration # Description: ...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # First domain name. while : ; do ${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \ --title "Your first virtual domain" \ --inputbox "\ Please specify the name of your first virtual domain. EXAMPLES: * iredmail.org " 20 76 2>/tmp/first_...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------ # Mailman related configuration. # ------------------------------------ ${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \ --title "First Mailing List in Mailman" \ --inputbox "\ Please specify the name of you...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) . ./conf/global . ./conf/functions trap "exit 255" 2 check_arch DIALOG='dialog --no-collapse' DIALOG_BACKTITLE='iRedMail: Mail Server Installation Wizard for RHEL/CentOS 5.x' # Welcome message. ${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \ --tit...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------------- # ------------------- PostfixAdmin ----------------- # -------------------------------------------------- # Username of PostfixAdmin site admin. while :; do ${DIALOG} --backtitle "${DIALOG_BACK...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------------- # --------------------- MySQL ---------------------- # -------------------------------------------------- . ${CONF_DIR}/mysql # MySQL root password. while : ; do ${DIALOG} --backtitle "${DIALO...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Purpose: Import users from a plain text file. # Plain text file format: one name, one line. e.g. # ----------------------- # userA # userB # userC # ----------------------- # Mailbox format: mbox, Maildir. HOME_MAILBOX='Maildir' # Maildir format. # ...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # # Variables for extmail. # # ExtMail project: # - http://www.extmail.org/forum/ # Download link: # - http://mirror3.extmail.net/dist/ # export EXTMAIL_VERSION='1.0.5' export EXTMAIL_TARBALL="extmail-${EXTMAIL_VERSION}.tar.gz" export SYS_USER_LANG...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # --------------------------------------- # RoundcubeMail. http://roundcube.net # --------------------------------------- export RCM_VERSION='0.1.1' export RCM_TARBALL="roundcubemail-${RCM_VERSION}.tar.gz" export RCM_HTTPD_ROOT="${HTTPD_SERVERROOT}/rou...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # ------------------------------------------------ # pypolicyd-spf. # ------------------------------------------------ export PYPOLICYD_SPF_VERSION='0.6.1' export PYPOLICYD_SPF_TARBALL="pypolicyd-spf-${PYPOLICYD_SPF_VERSION}.tar.gz"
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # For phpLDAPadmin. export PLA_VERSION='1.1.0.5' export PLA_TARBALL="phpldapadmin-${PLA_VERSION}.tar.gz" export PLA_HTTPD_ROOT="${HTTPD_SERVERROOT}/phpldapadmin-${PLA_VERSION}"
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Variables for MySQL database server and related. export MYSQL_FRESH_INSTALLATION='YES' export MYSQL_SERVER='127.0.0.1' export MYSQL_PORT='3306' export MYSQL_SOCKET='/var/lib/mysql/mysql.sock' export MYSQL_ROOT_USER='root' # For virtual user query in...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Variables for pysieved. export PYSIEVED_INI='/etc/pysieved.ini' export PYSIEVED_BINDADDR='127.0.0.1' export PYSIEVED_PORT='2000' # default is '2000' # Directory to store sieve filter rule files. export PYSIEVED_RULE_DIR='.sieve' # We will run py...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Variables for Postfix and related. # Set 'message_size_limit', in 'byte'. Default is 10M. export MESSAGE_SIZE_LIMIT='15728640' # virtual_maildir_limit_message. export MAILDIR_LIMIT_MESSAGE="Sorry, the user's maildir has overdrawn the disk quota, ple...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) export PHPMYADMIN_VERSION='2.11.9.2-all-languages' export PHPMYADMIN_TARBALL="phpMyAdmin-${PHPMYADMIN_VERSION}.tar.bz2" export PHPMYADMIN_HTTPD_ROOT="${HTTPD_SERVERROOT}/phpMyAdmin-${PHPMYADMIN_VERSION}"
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Variables for OpenLDAP and related. export OPENLDAP_ROOTDIR="/etc/openldap" export OPENLDAP_SCHEMA_DIR="${OPENLDAP_ROOTDIR}/schema" export OPENLDAP_CACERT_DIR="${OPENLDAP_ROOTDIR}/cacerts" export OPENLDAP_SLAPD_CONF="${OPENLDAP_ROOTDIR}/slapd.conf" e...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) export POSTFIXADMIN_VERSION='2.2.1.1' export POSTFIXADMIN_TARBALL="postfixadmin-${POSTFIXADMIN_VERSION}.tar.gz" export POSTFIXADMIN_HTTPD_ROOT="${HTTPD_SERVERROOT}/postfixadmin-${POSTFIXADMIN_VERSION}"
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Variables for Apache & PHP and related. # ---- Apache ---- # Refer to files: # - functions/apache_php.sh # - functions/misc.sh export HTTPD_PORT='80' export HTTPD_SERVERROOT='/var/www' export HTTPD_DOCUMENTROOT="${HTTPD_SERVERROOT}/html/" expor...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Variables for horde-webmail and related. # ---- Horde WebMail ---- export HORDE_VERSION='1.2' export HORDE_TARBALL="horde-webmail-${HORDE_VERSION}.tar.gz" export HORDE_HTTPD_ROOT='/var/www/html/horde' # Database setting. export HORDE_DB_NAME="horde...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) export PROG_NAME='iRedMail' export PROG_NAME_LOWERCASE='iredmail' export PROG_VERSION='0.3.1' # ----------------- # ---- Generic ---- # ----------------- # Maildir format: mbox, Maildir. export HOME_MAILBOX='Maildir' # For distribute deployment. expo...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) export SASLAUTHD_CONF='/etc/sysconfig/saslauthd' export ETC_SASLAUTHD_CONF='/etc/saslauthd.conf' export SASLAUTHD_MUX='/var/run/saslauthd/mux' export SASLAUTHD_SOCKETDIR='/var/spool/postfix/var/run/saslauthd/' export AUTHDAEMOND_PATH='/var/spool/authdae...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # ---------------------------------------- # For Dovecot and dovecot-sieve. # ---------------------------------------- export DOVECOT_CONF='/etc/dovecot.conf' export DOVECOT_LDAP_CONF='/etc/dovecot-ldap.conf' export DOVECOT_MYSQL_CONF='/etc/dovecot-my...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # For SpamAssassin. export SA_INIT_PRE='/etc/mail/spamassassin/init.pre' export SA_LOCAL_CF='/etc/mail/spamassassin/local.cf'
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) export CLAMD_CONF='/etc/clamd.conf' export FRESHCLAM_CONF='/etc/freshclam.conf' export FRESHCLAM_PID_FILE='/var/run/clamav/freshclam.pid' export FRESHCLAM_INIT_FILE_SAMPLE="${SAMPLE_DIR}/freshclam.init"
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Variables for PHP and related. PHP_INI='/etc/php.ini'
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # ---------------------------------------- # For SquirrelMail. # ---------------------------------------- # Version number for core program: SquirrelMail. export SM_VERSION='1.4.16' export SM_TARBALL="squirrelmail-${SM_VERSION}.tar.bz2" # -----------...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) ECHO_INFO() { if [ X"$1" == X"-n" ]; then shift 1 if [ X"${TERM}" == X"xterm" -o X"${TERM}" == X"linux" -o X"${TERM}" == X"pcconsole" ]; then echo -ne "\033[42m${OUTPUT_FLAG}\033[0m $@" else echo -ne "...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) export AMAVISD_SERVER='127.0.0.1' export AMAVISD_CONF='/etc/amavisd.conf' export AMAVISD_LOGFILE='/var/log/amavisd.log' export AMAVISD_LOGROTATE_FILE="${LOG_ROTATE_DIR}/amavisd" export AMAVISD_DKIM_DIR='/var/lib/dkim' export AMAVISD_DKIM_SELECTOR='dkim'...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # ------------------------------------------------ # Policyd. # ------------------------------------------------ export POLICYD_CONF='/etc/policyd.conf' export POLICYD_INIT_SCRIPT='/etc/init.d/policyd' export POLICYD_BINDHOST='127.0.0.1' # Default valu...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) export PROCMAIL_BIN='/usr/bin/procmail' export PROCMAILRC='/etc/procmailrc' export PROCMAIL_LOGFILE='/var/log/procmail.log' export PROCMAIL_LOGROTATE_FILE="${LOG_ROTATE_DIR}/procmail"
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # chkconfig: 345 90 90 # description: run freshclam as daemon. . /etc/rc.d/init.d/functions PROG='freshclam' FRESHCLAM_BIN='/usr/bin/freshclam' OPTIONS='-d -c 2' PID='/var/run/clamav/freshclam.pid' start() { if [ -e ${PID} ]; then echo -n...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Date: 2008.09.05 # chkconfig: 345 99 99 # description: run pysieved as daemon. . /etc/rc.d/init.d/functions PROG='pysieved' PYSIEVED_BIN='/usr/sbin/pysieved' OPTIONS='-c /etc/pysieved.ini' PID='/var/run/pysieved/pysieved.pid' start() { if [ -e...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # chkconfig: 2345 82 28 # description: mailgraph postfix log grapher, based on official script of mailgraph. # # processname: mailgraph.pl # pidfile: /var/run/mailgraph.pid . /etc/rc.d/init.d/functions PATH='/bin:/usr/bin' MAILGRAPH_PL='/usr/local/bi...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Date: $LastChangedDate: 2008-03-02 21:11:40 +0800 (Sun, 02 Mar 2008) $ # Purpose: Fetch all extra packages we need to build mail server. FETCH_CMD='wget -c' # # Mirror site. # Site directory structure: # # ${MIRROR}/ # |- rpms/ # ...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------- # Functions to install and configure ExtMail. # ------------------------------------------- extmail_install() { cd ${MISC_DIR} ECHO_INFO "Create necessary directory and extract ExtMail: ${EXTMAIL_T...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # -------------------- MySQL ---------------------------- # ------------------------------------------------------- mysql_initialize() { ECHO_INFO "Starting MySQL." /etc/init.d/mysqld res...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------------- phpLDAPadmin ---------------------- # ------------------------------------------------------- pla_install() { cd ${MISC_DIR} extract_pkg ${PLA_TARBALL} ${HTTPD_SERV...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------- # Amavisd-new. # -------------------------------------------- amavisd_dkim() { pem_file="${AMAVISD_DKIM_DIR}/${FIRST_DOMAIN}.pem" ECHO_INFO "Create directory to store CA files: ${AMAVISD_DKIM_DIR}...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------- # Mailman. # ------------------------------------------------- mailman_config() { ECHO_INFO "Initialize mailman." echo "MTA = 'Postfix'" >> /etc/mailman/mm_cfg.py echo "POSTFIX_STYLE_VIRTUA...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # Configure pysieved. pysieved_config() { backup_file ${PYSIEVED_INI} ECHO_INFO "Setting up managesieve server: pysieved." cat > ${PYSIEVED_INI} <<EOF ${CONF_MSG} [main] # Authentication back-end to use auth = Dovecot # User DB back-...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # Dovecot & dovecot-sieve. # ------------------------------------------------------- # For dovecot SSL support. enable_dovecot_ssl() { ECHO_INFO "Enable TLS support in Dovecot." [ X"${E...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------- # Install all optional components. # ------------------------------------------- optional_components() { if [ X"${USE_SM}" == X"YES" ]; then # ------------------------------------------------ ...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ----------------------- # Roundcube. # ----------------------- rcm_install() { cd ${MISC_DIR} # Extract source tarball. extract_pkg ${RCM_TARBALL} ${HTTPD_SERVERROOT} ECHO_INFO "Set correct permission for Roundcubemail: ${RCM_HTTPD_R...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> install_all() { ALL_PKGS='' ENABLED_SERVICES='' DISABLED_SERVICES='' # Apache. ALL_PKGS="${ALL_PKGS} httpd.${ARCH} mod_ssl.${ARCH}" # PHP. ALL_PKGS="${ALL_PKGS} php.${ARCH} php-imap.${ARCH} php-gd.${ARCH} php-mbstring.${ARC...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> horde_install() { cd ${MISC_DIR} # Extract source tarball. extract_pkg ${HORDE_TARBALL} ${HTTPD_DOCUMENTROOT} mv ${HTTPD_DOCUMENTROOT}/horde-webmail-${HORDE_VERSION} ${HORDE_HTTPD_ROOT} ECHO_INFO "Set correct permission for Horde w...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> enable_procmail() { ECHO_INFO "Setup procmail as Mail Deliver Agent(MDA)." ECHO_INFO "Copy ${SAMPLE_DIR}/procmailrc as ${PROCMAILRC}." cp -f ${SAMPLE_DIR}/procmailrc ${PROCMAILRC} ECHO_INFO "Setup Postfix transport in ${POSTFIX_FILE_MA...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------- # Misc. # ------------------------------------------- disable_selinux() { ECHO_INFO "Disable SELinux." [ -f /etc/selinux/config ] && perl -pi -e 's#^(SELINUX=)(.*)#${1}disabled#' /etc/selinux/config ...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com). # Date: 2008.04.07 # --------------------------------------------- # Postgrey. # --------------------------------------------- postgrey_config() { # Modify initialize script. perl -pi -e 's#^(OPTIONS=".*)(")#${1} --greylist-text=Spammer -...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ----------------------------- # PostfixAdmin. # ----------------------------- postfixadmin_install() { cd ${MISC_DIR} extract_pkg ${POSTFIXADMIN_TARBALL} ${HTTPD_SERVERROOT} && \ cd ${POSTFIXADMIN_HTTPD_ROOT}/ && \ patch -p0 < ${PATCH...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # -------------------------------------------- # ClamAV. # -------------------------------------------- clamav_config() { ECHO_INFO "Configure ClamAV: ${CLAMD_CONF}." perl -pi -e 's/^(TCPSocket.*)/#${1}/' ${CLAMD_CONF} perl -pi -e 's/^(TCPA...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------- # phpMyAdmin. # ------------------------------------------------- phpmyadmin_install() { cd ${MISC_DIR} extract_pkg ${PHPMYADMIN_TARBALL} ${HTTPD_SERVERROOT} ECHO_INFO "Set file permissio...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ---------------- Apache & PHP ------------------------- # ------------------------------------------------------- apache_php_config() { backup_file ${HTTPD_CONF} # -------------------...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # --------------------------------------------------------- # SpamAssassin. # --------------------------------------------------------- sa_config() { backup_file ${SA_LOCAL_CF} ECHO_INFO "Generate new configuration file: ${SA_LOCAL_CF}." cp...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ---------------------- Postfix ------------------------ # ------------------------------------------------------- postfix_config_basic() { backup_file ${SMTPD_CONF} ECHO_INFO "Create ...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------------- OpenLDAP -------------------------- # ------------------------------------------------------- openldap_config() { backup_file ${OPENLDAP_SLAPD_CONF} ${OPENLDAP_LDAP_C...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------------- Cyrus-SASL ------------------------ # ------------------------------------------------------- cyrus_sasl_config_ldap() { ECHO_INFO "Configure saslauthd for LDAP bind: $...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------- # Mailgraph # ------------------------------------------------- mailgraph_setup() { ECHO_INFO "Setup mailgraph for mail log monitor." cp -f ${SAMPLE_DIR}/mailgraph/mailgraph.cgi ${HTTPD_SERVER...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ---------------- User/Group: vmail -------------------- # ------------------------------------------------------- adduser_vmail() { homedir="$(dirname $(echo ${VMAIL_USER_HOME_DIR} | sed 's...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # ------------------------------------------------------- # ------------- Install and config backend. ------------- # ------------------------------------------------------- backend_install() { if [ X"${BACKEND}" == X"OpenLDAP" ]; then # Ins...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # --------------------------------------------------------- # SqruirrelMail. # --------------------------------------------------------- sm_install() { cd ${MISC_DIR} # Extract source tarball. extract_pkg ${SM_TARBALL} ${HTTPD_SERVERROOT} ...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # ------------------------------ # Define some global variables. # ------------------------------ ROOTDIR="$(pwd)" CONF_DIR="${ROOTDIR}/conf" FUNCTIONS_DIR="${ROOTDIR}/functions" TOOLS_DIR="${ROOTDIR}/tools" PKG_DIR="${ROOTDIR}/pkgs/rpms" MISC_DIR="${RO...
Shell
#!/bin/sh # Filename: backup_mysql_db.sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com) # Date: 2007.09.16 # Purpose: Backup specified mysql databases. # Copyright: # # This shell script is shipped within iRedMail project, released under # GPL v2. # ---- # Usage: # * Add crontab job for whichever us...
Shell
# -------------------------------------------------- # --------------------- LDAP ----------------------- # -------------------------------------------------- # LDAP suffix. ${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \ --title "LDAP suffix" \ --inputbox "\ Please specify your LDAP suffix. EXAMPLE: +----...
Shell
#!/bin/sh # Author: Zhang Huangbin (michaelbibby <at> gmail.com ) # Date: 2008.06.11 # Purpose: Migrate ExtMail MySQL 'mailbox' table to iRedMail format. # Migration guide wrote in Chinese: # http://code.google.com/p/iRedMail/wiki/iRedMail_tut_Migration # Usage: # English: # * Run into MySQL command lin...
Shell
#!/bin/sh # Author: Zhang Huangbin <michaelbibby (at) gmail.com> # 'sort' will break in zh env. export LC_ALL=C grep 'helo=' /var/log/maillog | awk -F'helo=<' '{print $2}' | awk -F'>' '{print $1}' > helo.all.iredmail sort helo.all.iredmail | uniq -c | sort -nr > helo.count.iredmail rm -f helo.all.iredmail
Shell
# -------------------------------------------------- # ------------- SPF & DKIM ------------------------- # -------------------------------------------------- ${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \ --title "SPF & DKIM" \ --checklist "\ Do you want to support SPF and DKIM? Note: * DKIM is recomme...
Shell