code stringlengths 1 1.96M | language stringclasses 1
value |
|---|---|
#!/usr/bin/env bash
# Author: Zhang Huangbin (michaelbibby <at> gmail.com)
#---------------------------------------------------------------------
# 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:... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin <michaelbibby (at) gmail.com>
# ---------------------------------------------------------
# SpamAssassin.
# ---------------------------------------------------------
sa_config()
{
ECHO_INFO "Configure SpamAssassin (content-based spam filter)."
backup_file ${SA_LOC... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin <michaelbibby (at) gmail.com>
#---------------------------------------------------------------------
# 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: y... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin (michaelbibby <at> gmail.com)
#---------------------------------------------------------------------
# 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:... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin (michaelbibby <at> gmail.com).
# Date: 2008.04.07
# ---------------------------------------------
# Policyd.
# ---------------------------------------------
policyd_user()
{
ECHO_INFO "Configure Policyd (postfix policy daemon)."
ECHO_DEBUG "Add user and group... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin <michaelbibby (at) gmail.com>
# -------------------------------------------------------
# ---------------- User/Group: vmail --------------------
# -------------------------------------------------------
adduser_vmail()
{
ECHO_INFO "Configure User/Group: vmail."
h... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin (michaelbibby <at> gmail.com)
#---------------------------------------------------------------------
# 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:... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin (michaelbibby <at> gmail.com )
# Purpose: Migrate ExtMail MySQL 'mailbox' table to iRedMail format.
# Project: iRedMail (http://www.iredmail.org/)
#
# Migration guide wrote in Chinese:
# http://www.iredmail.org/wiki/index.php?title=Migrate_from_ExtMail_Solution
# Usa... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin (michaelbibby <at> gmail.com )
# 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:
# WinMail s... | Shell |
#!/usr/bin/env bash
# Author: Zhang Huangbin (michaelbibby <at> gmail.com)
# Purpose: Remove main components which installed by iRedMail, so that
# you can re-install iRedMail.
# Project: iRedMail (http://www.iredmail.org/)
# ------------ USAGE --------
# Execute this file in the current directory.
#
# ... | Shell |
#!/bin/sh
# =========================================================
# Author: Zhang Huangbin (michaelbibby@gmail.com)
# Date: 2009.07.28
# Purpose: Track user last login date & ip address with Dovecot.
# Project: iRedMail open source mail server solution.
# http://www.iredmail.org/
# ==============... | 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 |
# --------------------------------------------------
# --------------------- 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 /tmp/helo.all | 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 |
#!/bin/sh
# File: create_mail_ldap_user.sh
# $Revision: 451 $
# Author: Bibby(michaelbibby#gmail.com)
# Date: $LastChangedDate: 2008-02-28 12:15:49 +0800 (Thu, 28 Feb 2008) $.
# Purpose: Add new LDAP user for postfix mail server.
# ----------------------------------------------
# ------------ Global Setting --------... | 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 |
# 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:
* osspinc.com
" 20 76 2>/tmp/first_domain
FIRST_DOMAIN="$(cat /tmp/first_domain)"
[ X"${FIRST_D... | Shell |
# ------------------------------------
# Mailman related configuration.
# ------------------------------------
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "First Mailing List in Mailman" \
--inputbox "\
Please specify the name of your first mailing list for your
virtual domain:
* ${FIRST_DOMAIN}
... | 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 |
# --------------------------------------------------
# ------------------- PostfixAdmin -----------------
# --------------------------------------------------
# Username of PostfixAdmin site admin.
while :; do
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "Username of PostfixAdmin site admin" \
--i... | Shell |
# --------------------------------------------------
# --------------------- MySQL ----------------------
# --------------------------------------------------
. ${CONF_DIR}/mysql
# MySQL root password.
while : ; do
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "Password for MySQL administrator: root" ... | 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)
export PROG_NAME='iRedMail'
export PROG_NAME_LOWERCASE='iredmail'
export PROG_VERSION='0.2'
# -----------------
# ---- Generic ----
# -----------------
# Maildir format: mbox, Maildir.
export HOME_MAILBOX='Maildir'
# For distribute deployment.
export... | 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 SquirrelMail.
# ----------------------------------------
# Version number for core program: SquirrelMail.
export SM_VERSION='1.4.15'
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" ]; then
echo -ne "\033[42m${OUTPUT_FLAG}\033[0m $@"
else
echo -ne "${OUTPUT_FLAG} $@"
fi
... | 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
OPTIONS='-d -c 2'
PID='/var/run/clamav/freshclam.pid'
start()
{
if [ -e ${PID} ]; then
echo -n "freshclam is already running: "
echo -n "$... | Shell |
#!/bin/sh
# Author: Zhang Huangbin (michaelbibby <at> gmail.com)
#
# Sample policyd-cleanup crontab script. It should be localted at:
# /etc/cron.daily/policyd-cleanup
#
# Shipped within iRedMail project:
# * http://iRedMail.googlecode.com/
#
/usr/sbin/policyd-cleanup -c /etc/policyd.conf
/usr/sbin/policyd-clean... | 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 |
# -------------------------------------------
# Functions to install and configure ExtMail.
# -------------------------------------------
extmail_install()
{
cd ${MISC_DIR}
ECHO_INFO "Create necessary directory and extract ExtMail: ${EXTMAIL_TARBALL}..."
[ -d ${EXTSUITE_HTTPD_ROOT} ] || mkdir -p ${EXTSUIT... | Shell |
# -------------------------------------------------------
# -------------------- MySQL ----------------------------
# -------------------------------------------------------
mysql_initialize()
{
ECHO_INFO "Starting MySQL."
/etc/init.d/mysqld restart >/dev/null
ECHO_INFO -n "Sleep 5 seconds for MySQL daemon... | Shell |
# -------------------------------------------------------
# ------------------- phpLDAPadmin ----------------------
# -------------------------------------------------------
pla_install()
{
cd ${MISC_DIR}
extract_pkg ${PLA_TARBALL} ${HTTPD_SERVERROOT}
# Add iRedMail logo in login page, used to track how m... | Shell |
# --------------------------------------------
# Amavisd-new.
# --------------------------------------------
amavisd_dkim()
{
pem_file="${AMAVISD_DKIM_DIR}/${FIRST_DOMAIN}.pem"
ECHO_INFO "Create directory to store CA files: ${AMAVISD_DKIM_DIR}."
mkdir -p ${AMAVISD_DKIM_DIR} 2>/dev/null && \
chown ama... | Shell |
# -------------------------------------------------
# Mailman.
# -------------------------------------------------
mailman_config()
{
ECHO_INFO "Initialize mailman."
echo "MTA = 'Postfix'" >> /etc/mailman/mm_cfg.py
echo "POSTFIX_STYLE_VIRTUAL_DOMAINS = ['${FIRST_DOMAIN}',]" >> /etc/mailman/mm_cfg.py
EC... | Shell |
# -------------------------------------------------------
# Dovecot & dovecot-sieve.
# -------------------------------------------------------
# For dovecot SSL support.
enable_dovecot_ssl()
{
ECHO_INFO "Generate CA file for dovecot: /etc/pki/dovecot/*."
rm -f /etc/pki/dovecot/{certs,private}/dovecot.pem
c... | Shell |
# -------------------------------------------
# Install all optional components.
# -------------------------------------------
optional_components()
{
if [ X"${USE_SM}" == X"YES" ]; then
# ------------------------------------------------
# SquirrelMail and plugins.
# ------------------------... | Shell |
# -----------------------
# Roundcube.
# -----------------------
rcm_install()
{
cd ${MISC_DIR}
# Extract source tarball.
extract_pkg ${RCM_TARBALL} ${HTTPD_SERVERROOT}
ECHO_INFO "Set correct permission for Roundcubemail: ${RCM_HTTPD_ROOT}."
chown -R root:root ${RCM_HTTPD_ROOT}
chown -R apache... | Shell |
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.${ARCH} libmcrypt.${ARCH} php-mcrypt.${ARCH} php-pear.noarch php-xml.${A... | 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}
# Patch file.
cd ${HORDE_HTTPD_ROOT} && \... | Shell |
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_MASTER_CF}."
cat >> ${POSTFIX_FILE_MASTER_CF} <<EOF
dovecot unix ... | Shell |
# -------------------------------------------
# Misc.
# -------------------------------------------
disable_selinux()
{
ECHO_INFO "Disable SELinux."
[ -f /etc/selinux/config ] && perl -pi -e 's#^(SELINUX=)(.*)#${1}disabled#' /etc/selinux/config
echo 'export status_disable_selinux="DONE"' >> ${STATUS_FILE}
... | 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 |
# -----------------------------
# PostfixAdmin.
# -----------------------------
postfixadmin_install()
{
cd ${MISC_DIR}
extract_pkg ${POSTFIXADMIN_TARBALL} ${HTTPD_SERVERROOT} && \
cd ${POSTFIXADMIN_HTTPD_ROOT}/ && \
patch -p0 < ${PATCH_DIR}/postfixadmin/create_mailbox.patch >/dev/null
ECHO_INFO "... | Shell |
# --------------------------------------------
# ClamAV.
# --------------------------------------------
clamav_config()
{
ECHO_INFO "Configure ClamAV: ${CLAMD_CONF}."
perl -pi -e 's/^(TCPSocket.*)/#${1}/' ${CLAMD_CONF}
perl -pi -e 's/^(TCPAddr )/${1}no #/' ${CLAMD_CONF}
# The following options are no ... | Shell |
# -------------------------------------------------
# phpMyAdmin.
# -------------------------------------------------
phpmyadmin_install()
{
cd ${MISC_DIR}
extract_pkg ${PHPMYADMIN_TARBALL} ${HTTPD_SERVERROOT}
ECHO_INFO "Create directory alias for phpMyAdmin in Apache: ${HTTPD_CONF_DIR}/phpmyadmin.conf."
... | Shell |
# -------------------------------------------------------
# ---------------- Apache & PHP -------------------------
# -------------------------------------------------------
apache_php_config()
{
backup_file ${HTTPD_CONF}
ECHO_INFO "Disable 'AddDefaultCharset' in Apache."
perl -pi -e 's/^(AddDefaultCharse... | Shell |
# ---------------------------------------------------------
# SpamAssassin.
# ---------------------------------------------------------
sa_config()
{
backup_file ${SA_LOCAL_CF}
ECHO_INFO "Generate new configuration file: ${SA_LOCAL_CF}."
cp -f ${SAMPLE_DIR}/sa.local.cf ${SA_LOCAL_CF}
#ECHO_INFO "Disab... | Shell |
# -------------------------------------------------------
# ---------------------- Postfix ------------------------
# -------------------------------------------------------
postfix_config_basic()
{
backup_file ${SMTPD_CONF}
cat > ${SMTPD_CONF} <<EOF
${CONF_MSG}
pwcheck_method: saslauthd
mech_list: PLAIN LOGI... | Shell |
# -------------------------------------------------------
# ------------------- OpenLDAP --------------------------
# -------------------------------------------------------
openldap_config()
{
backup_file ${OPENLDAP_SLAPD_CONF} ${OPENLDAP_LDAP_CONF}
# Copy ${PROG_NAME}.schema.
cp -f ${SAMPLE_DIR}/${PROG_... | Shell |
# -------------------------------------------------------
# ------------------- Cyrus-SASL ------------------------
# -------------------------------------------------------
cyrus_sasl_config_ldap()
{
ECHO_INFO "Configure saslauthd for LDAP bind: ${SASLAUTHD_CONF}"
cat > ${SASLAUTHD_CONF} <<EOF
${CONF_MSG}
SOC... | Shell |
# -------------------------------------------------
# Mailgraph
# -------------------------------------------------
mailgraph_setup()
{
ECHO_INFO "Setup mailgraph for mail log monitor."
cp -f ${SAMPLE_DIR}/mailgraph/mailgraph.cgi ${HTTPD_SERVERROOT}/cgi-bin/
chmod 0755 ${HTTPD_SERVERROOT}/cgi-bin/mailgraph... | Shell |
# -------------------------------------------------------
# ---------------- User/Group: vmail --------------------
# -------------------------------------------------------
adduser_vmail()
{
homedir="$(dirname $(echo ${VMAIL_USER_HOME_DIR} | sed 's#/$##'))"
[ -d ${homedir} ] || mkdir -p ${homedir}
ECHO_IN... | Shell |
# -------------------------------------------------------
# ------------- Install and config backend. -------------
# -------------------------------------------------------
backend_install()
{
if [ X"${BACKEND}" == X"OpenLDAP" ]; then
# Install, config and initialize OpenLDAP.
check_status_before_r... | Shell |
# ---------------------------------------------------------
# SqruirrelMail.
# ---------------------------------------------------------
enable_sm_plugins()
{
# We do *NOT* use 'conf.pl' to enable plugins, because it's not easy to
# control in non-interactive mode, so we use 'perl' to modify the config
# fi... | 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 |
# --------------------------------------------------
# --------------------- 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 mailbox table to iRedMail.
# Migration guide wrote in Chinese:
# http://code.google.com/p/iRedMail/wiki/iRedMail_tut_Migration
# Usage:
# English:
# * Run into MySQL command line with privileg... | Shell |
# --------------------------------------------------
# ------------- SPF & DKIM -------------------------
# --------------------------------------------------
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "SPF & DKIM" \
--checklist "\
Do you want to support SPF and DKIM?
Note:
* DKIM is recomme... | Shell |
#!/bin/sh
# File: create_mail_ldap_user.sh
# $Revision: 451 $
# Author: Bibby(michaelbibby#gmail.com)
# Date: $LastChangedDate: 2008-02-28 12:15:49 +0800 (Thu, 28 Feb 2008) $.
# Purpose: Add new LDAP user for postfix mail server.
# ----------------------------------------------
# ------------ Global Setting --------... | 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 |
# First domain name.
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "Your first virtual domain" \
--inputbox "\
Please specify the name of your first virtual domain.
EXAMPLES:
* osspinc.com
" 20 76 2>/tmp/first_domain
FIRST_DOMAIN="$(cat /tmp/first_domain)"
echo "export FIRST_DOMAIN='${FIRST_DOMA... | Shell |
# ------------------------------------
# Mailman related configuration.
# ------------------------------------
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "First Mailing List in Mailman" \
--inputbox "\
Please specify the name of your first mailing list for your
virtual domain:
* ${FIRST_DOMAIN}
... | 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 |
# --------------------------------------------------
# ------------------- PostfixAdmin -----------------
# --------------------------------------------------
# Username of PostfixAdmin site admin.
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "Username of PostfixAdmin site admin" \
--inputbox "\
Pleas... | Shell |
# --------------------------------------------------
# --------------------- MySQL ----------------------
# --------------------------------------------------
. ${CONF_DIR}/mysql
# MySQL root password.
while : ; do
${DIALOG} --backtitle "${DIALOG_BACKTITLE}" \
--title "Password for MySQL administrator: root" ... | 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)
PROG_NAME='iRedMail'
PROG_NAME_LOWERCASE='iredmail'
# -----------------
# ---- Generic ----
# -----------------
# Maildir format: mbox, Maildir.
HOME_MAILBOX='Maildir'
# vmail user.
export VMAIL_USER_NAME='vmail'
export VMAIL_GROUP_NAME='vmail'
expor... | 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" ]; then
echo -ne "\033[42m${OUTPUT_FLAG}\033[0m $@"
else
echo -ne "${OUTPUT_FLAG} $@"
fi
... | Shell |
#!/bin/sh
# Author: Zhang Huangbin (michaelbibby <at> gmail.com)
# chkconfig: 35 90 90
# description: run freshclam as daemon.
. /etc/rc.d/init.d/functions
OPTIONS='-d -c 2'
PID='/var/run/clamav/freshclam.pid'
start()
{
if [ -e ${PID} ]; then
echo -n "freshclam is already running: "
echo -n "$(... | 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/bin/m... | 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 |
# -------------------------------------------
# Functions to install and configure ExtMail.
# -------------------------------------------
extmail_install()
{
cd ${MISC_DIR}
ECHO_INFO "Create necessary directory and extract ExtMail: ${EXTMAIL_TARBALL}..."
[ -d ${EXTSUITE_HTTPD_ROOT} ] || mkdir -p ${EXTSUIT... | Shell |
# -------------------------------------------------------
# -------------------- MySQL ----------------------------
# -------------------------------------------------------
mysql_initialize()
{
ECHO_INFO "Starting MySQL."
/etc/init.d/mysqld restart >/dev/null
ECHO_INFO -n "Sleep 5 seconds for MySQL daemon... | Shell |
# -------------------------------------------------------
# ------------------- phpLDAPadmin ----------------------
# -------------------------------------------------------
pla_install()
{
cd ${MISC_DIR}
extract_pkg ${PLA_TARBALL} ${HTTPD_SERVERROOT}
ECHO_INFO "Create directory alias for phpLDAPadmin."
... | Shell |
# --------------------------------------------
# Amavisd-new.
# --------------------------------------------
amavisd_dkim()
{
pem_file="${AMAVISD_DKIM_DIR}/${FIRST_DOMAIN}.pem"
ECHO_INFO "Create directory to store CA files: ${AMAVISD_DKIM_DIR}."
mkdir -p ${AMAVISD_DKIM_DIR} 2>/dev/null && \
chown ama... | Shell |
# -------------------------------------------------
# Mailman.
# -------------------------------------------------
mailman_config()
{
ECHO_INFO "Initialize mailman."
echo "MTA = 'Postfix'" >> /etc/mailman/mm_cfg.py
echo "POSTFIX_STYLE_VIRTUAL_DOMAINS = ['${FIRST_DOMAIN}',]" >> /etc/mailman/mm_cfg.py
EC... | Shell |
# -------------------------------------------------------
# Dovecot & dovecot-sieve.
# -------------------------------------------------------
# For dovecot SSL support.
enable_dovecot_ssl()
{
ECHO_INFO "Generate CA file for dovecot: /etc/pki/dovecot/*."
rm -f /etc/pki/dovecot/{certs,private}/dovecot.pem
c... | Shell |
# -------------------------------------------
# Install all optional components.
# -------------------------------------------
optional_components()
{
if [ X"${USE_SM}" == X"YES" ]; then
# ------------------------------------------------
# SquirrelMail and plugins.
# ------------------------... | Shell |
# -----------------------
# Roundcube.
# -----------------------
rcm_install()
{
cd ${MISC_DIR}
# Extract source tarball.
extract_pkg ${RCM_TARBALL} ${HTTPD_SERVERROOT}
ECHO_INFO "Set correct permission for Roundcubemail: ${RCM_HTTPD_ROOT}."
chown -R root:root ${RCM_HTTPD_ROOT}
chown -R apache... | Shell |
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.${ARCH} libmcrypt.${ARCH} php-mcrypt.${ARCH} php-pear.noarch php-xml.${A... | 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}
# Patch file.
cd ${HORDE_HTTPD_ROOT} && \... | Shell |
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_MASTER_CF}."
cat >> ${POSTFIX_FILE_MASTER_CF} <<EOF
dovecot unix ... | Shell |
# -------------------------------------------
# Misc.
# -------------------------------------------
disable_selinux()
{
ECHO_INFO "Disable SELinux."
[ -f /etc/selinux/config ] && perl -pi -e 's#^(SELINUX=)(.*)#${1}disabled#' /etc/selinux/config
echo 'export status_disable_selinux="DONE"' >> ${STATUS_FILE}
... | 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 |
# -----------------------------
# PostfixAdmin.
# -----------------------------
postfixadmin_install()
{
cd ${MISC_DIR}
ECHO_INFO "Extract PostfixAdmin: ${POSTFIXADMIN_TARBALL}..."
extract_pkg ${POSTFIXADMIN_TARBALL} ${HTTPD_SERVERROOT} && \
cd ${HTTPD_SERVERROOT}/postfixadmin-${POSTFIXADMIN_VERSION}/ ... | Shell |
# --------------------------------------------
# ClamAV.
# --------------------------------------------
clamav_config()
{
ECHO_INFO "Configure ClamAV: ${CLAMD_CONF}."
perl -pi -e 's/^(TCPSocket.*)/#${1}/' ${CLAMD_CONF}
perl -pi -e 's/^(TCPAddr )/${1}no #/' ${CLAMD_CONF}
# The following options are no ... | Shell |
# -------------------------------------------------
# phpMyAdmin.
# -------------------------------------------------
phpmyadmin_install()
{
cd ${MISC_DIR}
extract_pkg ${PHPMYADMIN_TARBALL} ${HTTPD_SERVERROOT}
ECHO_INFO "Create directory alias for phpMyAdmin in Apache: ${HTTPD_CONF_DIR}/phpmyadmin.conf."
... | Shell |
# -------------------------------------------------------
# ---------------- Apache & PHP -------------------------
# -------------------------------------------------------
apache_php_config()
{
backup_file ${HTTPD_CONF}
ECHO_INFO "Disable 'AddDefaultCharset' in Apache."
perl -pi -e 's/^(AddDefaultCharse... | Shell |
# ---------------------------------------------------------
# SpamAssassin.
# ---------------------------------------------------------
sa_config()
{
backup_file ${SA_LOCAL_CF}
ECHO_INFO "Generate new configuration file: ${SA_LOCAL_CF}."
cp -f ${SAMPLE_DIR}/sa.local.cf ${SA_LOCAL_CF}
ECHO_INFO "Enable... | Shell |
# -------------------------------------------------------
# ---------------------- Postfix ------------------------
# -------------------------------------------------------
postfix_config_basic()
{
backup_file ${SMTPD_CONF}
cat > ${SMTPD_CONF} <<EOF
${CONF_MSG}
pwcheck_method: saslauthd
mech_list: PLAIN LOGI... | Shell |
# -------------------------------------------------------
# ------------------- OpenLDAP --------------------------
# -------------------------------------------------------
openldap_config()
{
backup_file ${OPENLDAP_SLAPD_CONF} ${OPENLDAP_LDAP_CONF}
# Copy ${PROG_NAME}.schema.
cp -f ${SAMPLE_DIR}/${PROG_... | Shell |
# -------------------------------------------------------
# ------------------- Cyrus-SASL ------------------------
# -------------------------------------------------------
cyrus_sasl_config_ldap()
{
ECHO_INFO "Configure saslauthd for LDAP bind: ${SASLAUTHD_CONF}"
cat > ${SASLAUTHD_CONF} <<EOF
${CONF_MSG}
SOC... | Shell |
# -------------------------------------------------
# Mailgraph
# -------------------------------------------------
mailgraph_setup()
{
mkdir -p ${HTTPD_SERVERROOT}/cgi-bin/mailgraph/
cp -f ${SAMPLE_DIR}/mailgraph/mailgraph.cgi ${HTTPD_SERVERROOT}/cgi-bin/mailgraph/
chmod 0755 ${HTTPD_SERVERROOT}/cgi-bin/ma... | Shell |
# -------------------------------------------------------
# ---------------- User/Group: vmail --------------------
# -------------------------------------------------------
adduser_vmail()
{
homedir="$(dirname $(echo ${VMAIL_USER_HOME_DIR} | sed 's#/$##'))"
[ -d ${homedir} ] || mkdir -p ${homedir}
ECHO_IN... | Shell |
# -------------------------------------------------------
# ------------- Install and config backend. -------------
# -------------------------------------------------------
backend_install()
{
if [ X"${BACKEND}" == X"OpenLDAP" ]; then
# Install, config and initialize OpenLDAP.
check_status_before_r... | Shell |
# ---------------------------------------------------------
# SqruirrelMail.
# ---------------------------------------------------------
enable_sm_plugins()
{
# We do *NOT* use 'conf.pl' to enable plugins, because it's not easy to
# control in non-interactive mode, so we use 'perl' to modify the config
# fi... | Shell |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.