From 8d28bce22afb6ede69e95c2572336caff5a26042 Mon Sep 17 00:00:00 2001 From: hasufell Date: Fri, 2 Oct 2015 14:53:01 +0200 Subject: [PATCH] Remove amavis We will use spamassasin instead. --- README.md | 3 +- amavis/Dockerfile | 36 ------------- amavis/README.md | 8 --- amavis/boot | 16 ------ amavis/config/05-node_id | 15 ------ amavis/config/15-content_filter_mode | 27 ---------- amavis/config/50-user | 25 --------- amavis/config/rsyslog.conf | 28 ---------- core/boot.d/amavis | 76 ---------------------------- 9 files changed, 1 insertion(+), 233 deletions(-) delete mode 100644 amavis/Dockerfile delete mode 100644 amavis/README.md delete mode 100644 amavis/boot delete mode 100644 amavis/config/05-node_id delete mode 100644 amavis/config/15-content_filter_mode delete mode 100644 amavis/config/50-user delete mode 100644 amavis/config/rsyslog.conf delete mode 100644 core/boot.d/amavis diff --git a/README.md b/README.md index bb7fb2f..e39c302 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,6 @@ The setup is modular and so far has (more to come, feel free to contribute :) * `core` - base SMTP and IMAP server * `opendkim` - adds DKIM signing service to the core -* `amavis` - adds incoming SPAM filter Please see the README in each folder for more information on each image. @@ -32,4 +31,4 @@ and it will spin up both container and link them together, easy! * Testing ### TODO -* gentoo support for amavis and opendkim +* gentoo support for opendkim diff --git a/amavis/Dockerfile b/amavis/Dockerfile deleted file mode 100644 index 33faac6..0000000 --- a/amavis/Dockerfile +++ /dev/null @@ -1,36 +0,0 @@ -FROM ubuntu:14.10 - -ENV DEBIAN_FRONTEND noninteractive -RUN locale-gen en_GB en_GB.UTF-8 && dpkg-reconfigure locales - -# Prerequisites -RUN echo "#!/bin/sh\nexit 0" > /usr/sbin/policy-rc.d && \ - apt-get update && apt-get install -y \ - amavisd-new \ - spamassassin \ - libnet-dns-perl \ - libmail-spf-perl \ - pyzor \ - razor && \ - apt-get clean && \ - rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* - -# Set up razor and pyzor -RUN su - amavis -s /bin/bash && razor-admin -create && razor-admin -register && pyzor discover - -COPY ./config/05-node_id /etc/amavis/conf.d/05-node_id -COPY ./config/15-content_filter_mode /etc/amavis/conf.d/15-content_filter_mode -COPY ./config/50-user /etc/amavis/conf.d/50-user -COPY ./config/rsyslog.conf /etc/rsyslog.conf - -# Nice place for your settings -VOLUME ["/mail_settings"] - -# Configure boot script -COPY boot / -RUN chmod 755 /boot - -ENV AMAVIS=true - -EXPOSE 10024 -ENTRYPOINT ./boot; amavisd-new; rsyslogd -n diff --git a/amavis/README.md b/amavis/README.md deleted file mode 100644 index 96502d3..0000000 --- a/amavis/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Dockermail - Amavis -=== -Once configured and linked to the `email_core`, this image will filter incoming mail for SPAM. -This does not scan email for viruses/malware, only SPAM scoring. - -### Configuration - -This images only needs to know the domains, and will use the same `domains` file from `email_core` for easy administration. See `email_core` README for info on `domains` syntax. diff --git a/amavis/boot b/amavis/boot deleted file mode 100644 index 9170403..0000000 --- a/amavis/boot +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash - -# Update hostname if given -if [ -f /mail_settings/myhostname ]; then - echo $(sed 's:/:\\/:g' /mail_settings/myhostname) > /etc/mailname -fi - -readarray -t domains < /mail_settings/domains -first_fqdn="\$myhostname = \"${domains[0]}\";" -domain_string=$(printf "'%s' " "${domains[@]}") | tr ' ' , -domain_acl="@local_domains_acl = ( $domain_string );" - -sed "/# DOCKERMAIL DOMAINS START/,/# DOCKERMAIL DOMAINS END/{//!d}" /etc/amavis/conf.d/05-node_id -i -sed "/# DOCKERMAIL DOMAINS START/,/# DOCKERMAIL DOMAINS END/{//!d}" /etc/amavis/conf.d/50-user -i -sed "/# DOCKERMAIL DOMAINS START/a $first_fqdn" /etc/amavis/conf.d/05-node_id -i -sed "/# DOCKERMAIL DOMAINS START/a $domain_acl" /etc/amavis/conf.d/50-user -i diff --git a/amavis/config/05-node_id b/amavis/config/05-node_id deleted file mode 100644 index c564ae9..0000000 --- a/amavis/config/05-node_id +++ /dev/null @@ -1,15 +0,0 @@ -use strict; - -# $myhostname is used by amavisd-new for node identification, and it is -# important to get it right (e.g. for ESMTP EHLO, loop detection, and so on). - -chomp($myhostname = `hostname --fqdn`); - -# To manually set $myhostname, edit the following line with the correct Fully -# Qualified Domain Name (FQDN) and remove the # at the beginning of the line. -# -#$myhostname = "mail.example.com"; -# DOCKERMAIL DOMAINS START -# DOCKERMAIL DOMAINS END - -1; # ensure a defined return diff --git a/amavis/config/15-content_filter_mode b/amavis/config/15-content_filter_mode deleted file mode 100644 index d379241..0000000 --- a/amavis/config/15-content_filter_mode +++ /dev/null @@ -1,27 +0,0 @@ -use strict; - -# You can modify this file to re-enable SPAM checking through spamassassin -# and to re-enable antivirus checking. - -# -# Default antivirus checking mode -# Please note, that anti-virus checking is DISABLED by -# default. -# If You wish to enable it, please uncomment the following lines: - - -#@bypass_virus_checks_maps = ( -# \%bypass_virus_checks, \@bypass_virus_checks_acl, \$bypass_virus_checks_re); - - -# -# Default SPAM checking mode -# Please note, that anti-spam checking is DISABLED by -# default. -# If You wish to enable it, please uncomment the following lines: - - -@bypass_spam_checks_maps = ( - \%bypass_spam_checks, \@bypass_spam_checks_acl, \$bypass_spam_checks_re); - -1; # ensure a defined return diff --git a/amavis/config/50-user b/amavis/config/50-user deleted file mode 100644 index 98d785f..0000000 --- a/amavis/config/50-user +++ /dev/null @@ -1,25 +0,0 @@ -use strict; - -# -# Place your configuration directives here. They will override those in -# earlier files. -# -# See /usr/share/doc/amavisd-new/ for documentation and examples of -# the directives you can use in this file -# - -# DOCKERMAIL DOMAINS START -# DOCKERMAIL DOMAINS END - -# See http://opensource.apple.com/source/amavisd/amavisd-114/amavisd/amavisd-new-2.4.4/amavisd.conf-sample -# for details on asterisk reinjection configuration -$forward_method = 'smtp:*:10025'; -$notify_method = $forward_method; - -# Bind on all interfaces (needed to expose this to linked containers) -$inet_socket_bind = '0.0.0.0'; -# Accept incoming requests from private ip range -@inet_acl = qw(172.0.0.0/8); - -#------------ Do not modify anything below this line ------------- -1; # ensure a defined return diff --git a/amavis/config/rsyslog.conf b/amavis/config/rsyslog.conf deleted file mode 100644 index 1afcb9d..0000000 --- a/amavis/config/rsyslog.conf +++ /dev/null @@ -1,28 +0,0 @@ -# /etc/rsyslog.conf Configuration file for rsyslog. -# -# For more information see -# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html -# -# Default logging rules can be found in /etc/rsyslog.d/50-default.conf - - -################# -#### MODULES #### -################# - -$ModLoad imuxsock # provides support for local system logging - -########################### -#### GLOBAL DIRECTIVES #### -########################### - -# Filter duplicated messages -$RepeatedMsgReduction on -# -# Where to place spool and state files -# -$WorkDirectory /var/spool/rsyslog - -# Write everything to stdout -$template fmt,"%timestamp:::date-rfc3164%\n" -*.* /dev/stdout diff --git a/core/boot.d/amavis b/core/boot.d/amavis deleted file mode 100644 index 310d028..0000000 --- a/core/boot.d/amavis +++ /dev/null @@ -1,76 +0,0 @@ -#!/bin/bash -echo 'Running amavis boot script' - -POSTFIX_MAIN_CF=/etc/postfix/main.cf -POSTFIX_MASTER_CF=/etc/postfix/master.cf - -env_dump=$(printenv) - -AMAVIS_CONFIG_HEADER="# Amavis - dockermail - start" -AMAVIS_CONFIG_FOOTER="# Amavis - dockermail - end" - -function remove_amavis () { - # main.cf - if grep -q "$AMAVIS_CONFIG_HEADER" "$POSTFIX_MAIN_CF"; then - sed "/$AMAVIS_CONFIG_HEADER/,/$AMAVIS_CONFIG_FOOTER/d" "$POSTFIX_MAIN_CF" -i - fi - # master.cf - sed '/^pickup/,/^cleanup/{//!d}' "$POSTFIX_MASTER_CF" -i - sed "/$AMAVIS_CONFIG_HEADER/,/$AMAVIS_CONFIG_FOOTER/d" "$POSTFIX_MASTER_CF" -i -} - -function add_amavis () { - # main.cf - if ! grep -q "$AMAVIS_CONFIG_HEADER" "$POSTFIX_MAIN_CF"; then - echo "$AMAVIS_CONFIG_HEADER" >> "$POSTFIX_MAIN_CF" - echo "content_filter = smtp-amavis:[amavis]:10024" >> "$POSTFIX_MAIN_CF" - echo "$AMAVIS_CONFIG_FOOTER" >> "$POSTFIX_MAIN_CF" - else - echo "Warning: $POSTFIX_MAIN_CF already contains Amavis configuration, skipping" - fi - # master.cf - if ! grep -q "$AMAVIS_CONFIG_HEADER" "$POSTFIX_MASTER_CF"; then - sed "/^pickup.*/a \ -o content_filter= \n -o receive_override_options=no_header_body_checks" $POSTFIX_MASTER_CF -i - echo "$AMAVIS_CONFIG_HEADER" >> $POSTFIX_MASTER_CF - echo "smtp-amavis unix - - - - 2 smtp" >> $POSTFIX_MASTER_CF - echo " -o smtp_data_done_timeout=1200" >> $POSTFIX_MASTER_CF - echo " -o smtp_send_xforward_command=yes" >> $POSTFIX_MASTER_CF - echo " -o disable_dns_lookups=yes" >> $POSTFIX_MASTER_CF - echo " -o max_use=20" >> $POSTFIX_MASTER_CF - echo "0.0.0.0:10025 inet n - - - - smtpd" >> $POSTFIX_MASTER_CF - echo " -o content_filter=" >> $POSTFIX_MASTER_CF - echo " -o local_recipient_maps=" >> $POSTFIX_MASTER_CF - echo " -o relay_recipient_maps=" >> $POSTFIX_MASTER_CF - echo " -o smtpd_restriction_classes=" >> $POSTFIX_MASTER_CF - echo " -o smtpd_delay_reject=no" >> $POSTFIX_MASTER_CF - echo " -o smtpd_client_restrictions=permit_mynetworks,reject" >> $POSTFIX_MASTER_CF - echo " -o smtpd_helo_restrictions=" >> $POSTFIX_MASTER_CF - echo " -o smtpd_sender_restrictions=" >> $POSTFIX_MASTER_CF - echo " -o smtpd_recipient_restrictions=permit_mynetworks,reject" >> $POSTFIX_MASTER_CF - echo " -o smtpd_data_restrictions=reject_unauth_pipelining" >> $POSTFIX_MASTER_CF - echo " -o smtpd_end_of_data_restrictions=" >> $POSTFIX_MASTER_CF - # Allow the private ip range 172.x.x.x that Docker apparently uses - echo " -o mynetworks=172.0.0.0/8" >> $POSTFIX_MASTER_CF - echo " -o smtpd_error_sleep_time=0" >> $POSTFIX_MASTER_CF - echo " -o smtpd_soft_error_limit=1001" >> $POSTFIX_MASTER_CF - echo " -o smtpd_hard_error_limit=1000" >> $POSTFIX_MASTER_CF - echo " -o smtpd_client_connection_count_limit=0" >> $POSTFIX_MASTER_CF - echo " -o smtpd_client_connection_rate_limit=0" >> $POSTFIX_MASTER_CF - echo " -o receive_override_options=no_header_body_checks,no_unknown_recipient_checks" >> $POSTFIX_MASTER_CF - echo "$AMAVIS_CONFIG_FOOTER" >> $POSTFIX_MASTER_CF - else - echo "Warning: $POSTFIX_MASTER_CF already contains Amavis configuration, skipping" - fi -} - -if [[ $env_dump =~ ^(.+AMAVIS)= ]] ; then - if [ ! -z "${BASH_REMATCH[1]}" ]; then - echo "AMAVIS env set, enabling SPAM filter" - add_amavis - fi -else - echo "Cant find AMAVIS env, SPAM filter will be disabled" - remove_amavis -fi - -echo 'Finished amavis boot script'