iredmail / iRedMail / functions /

#!/usr/bin/env bash

# Author: Zhang Huangbin <zhb _at_>

# ---------------------------------------------------------
# SpamAssassin.
# ---------------------------------------------------------
    ECHO_INFO "Configure SpamAssassin (content-based spam filter)."

    backup_file ${SA_LOCAL_CF}

    ECHO_DEBUG "Generate new configuration file: ${SA_LOCAL_CF}."
    cp -f ${SAMPLE_DIR}/ ${SA_LOCAL_CF}

    #ECHO_DEBUG "Disable plugin: URIDNSBL."
    #perl -pi -e 's/(^loadplugin.*Mail.*SpamAssassin.*Plugin.*URIDNSBL.*)/#${1}/' ${SA_INIT_PRE}

    ECHO_DEBUG "Enable crontabs for SpamAssassin update."
    if [ X"${DISTRO}" == X"RHEL" ]; then
        chmod 0644 /etc/cron.d/sa-update
        perl -pi -e 's/#(10.*)/${1}/' /etc/cron.d/sa-update
    elif [ X"${DISTRO}" == X"UBUNTU" -o X"${DISTRO}" == X"DEBIAN" ]; then
        perl -pi -e 's#^(CRON=)0#${1}1#' /etc/cron.daily/spamassassin

    if [ X"${DISTRO}" == X"FREEBSD" ]; then
        ECHO_DEBUG "Compile SpamAssassin ruleset into native code."
        sa-compile >/dev/null 2>&1

    cat >> ${TIP_FILE} <<EOF
    * Configuration files and rules:
        - ${SA_CONF_DIR}
        - ${SA_CONF_DIR}/


    echo 'export status_sa_config="DONE"' >> ${STATUS_FILE}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.