From 1aff03472add1cdf6e7d6d625da63d1d810a6a7d Mon Sep 17 00:00:00 2001 From: Jonas Smedegaard Date: Tue, 25 Sep 2007 12:22:10 +0000 Subject: Avoid spamscanning when MX backup. --- amavis/amavisd.conf.addon | 21 +++++++++++++------- amavis/mklists.sh | 49 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 7 deletions(-) create mode 100755 amavis/mklists.sh (limited to 'amavis') diff --git a/amavis/amavisd.conf.addon b/amavis/amavisd.conf.addon index 899ea7b..ee7e79f 100644 --- a/amavis/amavisd.conf.addon +++ b/amavis/amavisd.conf.addon @@ -3,7 +3,7 @@ # /etc/local-COMMON/amavisd.conf.addon # Copyright 2002-2007 Jonas Smedegaard # -# $Id: amavisd.conf.addon,v 1.48 2007-09-25 11:49:36 jonas Exp $ +# $Id: amavisd.conf.addon,v 1.49 2007-09-25 12:22:10 jonas Exp $ # # AMaViS configuration file addon (Debian package "amavisd-new") # @@ -14,14 +14,21 @@ # do $config_file_addon or die "Error in config file $config_file_addon: $@"; # -# We explicitly set local domains -my $local_domain_file="/etc/local-ORG/amavis/local_domains"; -if ( -f $local_domain_file ) { +# Explicitly set local domains +my $local_domains_file="/etc/local-ORG/amavis/local_domains"; +if ( -f $local_domains_file ) { @local_domains_acl = undef; - read_hash(\%local_domains, $local_domain_file); -# read_hash(\%bypass_spam_checks, $local_domain_file); + read_hash(\%local_domains, $local_domains_file); } else { - warn "Ignoring non-existing file $local_domain_file"; + warn "Ignoring non-existing file $local_domains_file"; +} + +# Avoid expensive spamscanning when MX backup +my $nonlocal_domains_file="/etc/local-ORG/amavis/nonlocal_domains"; +if ( -f $nonlocal_domains_file ) { + read_hash(\%bypass_spam_checks, $nonlocal_domains_file); +} else { + warn "Ignoring non-existing file $nonlocal_domains_file"; } # Suppress virus notifications (noone reads them anyway) diff --git a/amavis/mklists.sh b/amavis/mklists.sh new file mode 100755 index 0000000..7a5a370 --- /dev/null +++ b/amavis/mklists.sh @@ -0,0 +1,49 @@ +#!/bin/sh +# +# /etc/local-COMMON/amavis/mklists.sh +# Copyright 2007 Jonas Smedegaard +# +# $Id: mklists.sh,v 1.1 2007-09-25 12:22:10 jonas Exp $ +# +# Resolve own mail domains and MX backup domains + +set -e + +# Let's standardize sort +export LC_ALL=C + +realmsdir='/etc/local-REDPILL' +domainconfdir='/etc/local-ORG/amavis' +if ! [ -d "$realmsdir" ]; then + echo "WARNING: Realms directory \"$realmsdir\" does not exist." +fi +if ! [ -d "$domainconfdir" ]; then + echo "WARNING: Domain config directory \"$domainconfdir\" does not exist." +fi + +catfilefromownrealm() { + file="$1" + [ -d "$realmsdir" ] || exit 0 + + thisrealm="$(cat /etc/local-ORG/realm || dnsdomainname | tr '[a-z]' '[A-Z]')" + + cat "$realmsdir/$thisrealm/$file" +} + +catallfilesfromotherrealms() { + file="$1" + [ -d "$realmsdir" ] || exit 0 + [ -f "$realmsdir/realms" ] || exit 0 + + realms="$(cat "$realmsdir/realms" | sed 's/#.*//')" + thisrealm="$(cat /etc/local-ORG/realm || dnsdomainname | tr '[a-z]' '[A-Z]')" + + for realm in $realms; do + if [ "$thisrealm" != "$realm" ]; then + cat "$realmsdir/$realm/$file" + fi + done +} + +catfilefromownrealm maildomains | sort > "$domainconfdir/local_domains" +catallfilesfromotherrealms maildomains | sort > "$domainconfdir/nonlocal_domains" -- cgit v1.2.3