From f3bdc92413f7a20540967cd688a44d41b610009f Mon Sep 17 00:00:00 2001 From: gau1991 Date: Fri, 8 Aug 2014 11:55:09 +0530 Subject: [PATCH] Added Amavis configuration --- .../install/mail/ee_mod_install_amavis.sh | 9 +++++++ .../stack/install/mail/ee_mod_setup_amavis.sh | 16 +++++++++++++ templates/mail/amavis-master.cf | 24 +++++++++++++++++++ 3 files changed, 49 insertions(+) create mode 100644 src/modules/stack/install/mail/ee_mod_install_amavis.sh create mode 100644 src/modules/stack/install/mail/ee_mod_setup_amavis.sh create mode 100644 templates/mail/amavis-master.cf diff --git a/src/modules/stack/install/mail/ee_mod_install_amavis.sh b/src/modules/stack/install/mail/ee_mod_install_amavis.sh new file mode 100644 index 00000000..c2804cb1 --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_install_amavis.sh @@ -0,0 +1,9 @@ +# Install Amavis package + +function ee_mod_install_dovecot() +{ + # Install Amavis + ee_lib_echo "Installing Amavis, please wait..." + $EE_APT_GET amavisd-new spamassassin clamav clamav-daemon arj zoo nomarch cpio lzop cabextract apt-listchanges libauthen-sasl-perl libdbi-perl libmail-dkim-perl p7zip rpm unrar-free libsnmp-perl \ + || ee_lib_error "Unable to install Amavis, exit status = " $? +} diff --git a/src/modules/stack/install/mail/ee_mod_setup_amavis.sh b/src/modules/stack/install/mail/ee_mod_setup_amavis.sh new file mode 100644 index 00000000..f545e0c9 --- /dev/null +++ b/src/modules/stack/install/mail/ee_mod_setup_amavis.sh @@ -0,0 +1,16 @@ +# Setup Amavis + +function ee_mod_setup_amavis() +{ + # Confiure Amavis + sed -i "s'#@'@'" /etc/amavis/conf.d/15-content_filter_mode + sed -i "s'# ' '" /etc/amavis/conf.d/15-content_filter_mode + + # Add mail filtering rules + sed -i "s/use strict;/use strict;\n\$sa_spam_subject_tag = undef;\n\$spam_quarantine_to = undef;\n\$sa_tag_level_deflt = undef;\n\n# Prevent spams from automatically rejected by mail-server\n\$final_spam_destiny = D_PASS;\n# We need to provide list of domains for which filtering need to be done\n@lookup_sql_dsn = (\n ['DBI:mysql:database=vimbadmin;host=127.0.0.1;port=3306',\n 'vimbadmin',\n 'password']);\n\n\$sql_select_policy = 'SELECT domain FROM domain WHERE CONCAT("@",domain) IN (%k)';/" /etc/amavis/conf.d/50-user + + # Configure Postfix to use Amavis + sed -i "s/1 pickup/1 pickup\n -o content_filter=\n -o receive_override_options=no_header_body_checks/" /etc/postfix/master.cf + cat /usr/share/easyengine/mail/amavis-master.cf >> /etc/postfix/master.cf + +} diff --git a/templates/mail/amavis-master.cf b/templates/mail/amavis-master.cf new file mode 100644 index 00000000..1ffae842 --- /dev/null +++ b/templates/mail/amavis-master.cf @@ -0,0 +1,24 @@ +smtp-amavis unix - - n - 2 smtp + -o smtp_data_done_timeout=1200 + -o smtp_send_xforward_command=yes + -o disable_dns_lookups=yes + -o max_use=20 + +127.0.0.1:10025 inet n - n - - smtpd + -o content_filter= + -o smtpd_delay_reject=no + -o smtpd_client_restrictions=permit_mynetworks,reject + -o smtpd_helo_restrictions= + -o smtpd_sender_restrictions= + -o smtpd_recipient_restrictions=permit_mynetworks,reject + -o smtpd_data_restrictions=reject_unauth_pipelining + -o smtpd_end_of_data_restrictions= + -o smtpd_restriction_classes= + -o mynetworks=127.0.0.0/8 + -o smtpd_error_sleep_time=0 + -o smtpd_soft_error_limit=1001 + -o smtpd_hard_error_limit=1000 + -o smtpd_client_connection_count_limit=0 + -o smtpd_client_connection_rate_limit=0 + -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks + -o local_header_rewrite_clients= \ No newline at end of file