# HG changeset patch # User carl # Date 1134936305 28800 # Node ID 1c7677042b78b82975895fd6d83e3ead5fd191a9 # Parent eeaaecda4acc20c26310f774ced5c709b93b0e84 move to autoconf/automake/docbook diff -r eeaaecda4acc -r 1c7677042b78 Makefile.am --- a/Makefile.am Sun Dec 18 09:50:25 2005 -0800 +++ b/Makefile.am Sun Dec 18 12:05:05 2005 -0800 @@ -1,21 +1,20 @@ SUBDIRS = src man html info hackdir = $(sysconfdir) -hack_SCRIPTS = syslog2iptables -sysconf_DATA = syslog2iptables.conf -CLEANFILES = syslog2iptables xml/syslog2iptables xml/Makefile -EXTRA_DIST = syslog2iptables.rc syslog2iptables.conf syslog2iptables.spec $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/s*) +hack_SCRIPTS = dnsbl +dconfdir = $(sysconfdir)/dnsbl +dconf_DATA = dnsbl.conf hosts-ignore.conf html-tags.conf tld.conf +CLEANFILES = dnsbl xml/dnsbl xml/Makefile +EXTRA_DIST = dnsbl.rc $(dconf_DATA) dnsbl.spec $(wildcard xml/h*) $(wildcard xml/M*) $(wildcard xml/s*) -syslog2iptables: $(srcdir)/syslog2iptables.rc - rm -f syslog2iptables - echo "#!" $(BASH) >syslog2iptables - cat $(srcdir)/syslog2iptables.rc | \ +dnsbl: $(srcdir)/dnsbl.rc + rm -f dnsbl + echo "#!" $(BASH) >dnsbl + cat $(srcdir)/dnsbl.rc | \ sed -e "s,SBINDIR,$(sbindir),g" | \ - sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>syslog2iptables + sed -e "s,SYSCONFDIR,$(sysconfdir),g" >>dnsbl -chkconfig: syslog2iptables - mv -f $(sysconfdir)/syslog2iptables /etc/rc.d/init.d - /sbin/chkconfig --del syslog2iptables - /sbin/chkconfig --add syslog2iptables - /sbin/chkconfig --level 2345 syslog2iptables on - /etc/rc.d/init.d/syslog2iptables start +chkconfig: dnsbl + mv -f $(sysconfdir)/dnsbl /etc/rc.d/init.d + /sbin/chkconfig --del dnsbl + /sbin/chkconfig --add dnsbl diff -r eeaaecda4acc -r 1c7677042b78 package --- a/package Sun Dec 18 09:50:25 2005 -0800 +++ b/package Sun Dec 18 12:05:05 2005 -0800 @@ -29,6 +29,10 @@ /etc/rc.d/init.d/$NAME stop fi make chkconfig + if [ -f /etc/rc.d/init.d/$NAME ]; then + chkconfig $NAME on + /etc/rc.d/init.d/$NAME start + fi cd .. cd .. diff -r eeaaecda4acc -r 1c7677042b78 src/Makefile.am --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/Makefile.am Sun Dec 18 12:05:05 2005 -0800 @@ -0,0 +1,12 @@ +sbin_PROGRAMS = dnsbl +dnsbl_SOURCES = dnsbl.cpp dnsbl.h context.cpp context.h tokenizer.cpp tokenizer.h scanner.cpp scanner.h includes.h + +# set the include path found by configure +INCLUDES= $(all_includes) + +# the library search path. +dnsbl_LDFLAGS = $(all_libraries) -pthread + +# default compile flags +dnsbl_CXXFLAGS = -pthread + diff -r eeaaecda4acc -r 1c7677042b78 xml/dnsbl.in --- a/xml/dnsbl.in Sun Dec 18 09:50:25 2005 -0800 +++ b/xml/dnsbl.in Sun Dec 18 12:05:05 2005 -0800 @@ -1,40 +1,152 @@ - + + @PACKAGE@ Sendmail milter - Version @VERSION@ + + Packages + The various source and binary packages are available at http://www.five-ten-sg.com/@PACKAGE@/packages + The most recent documentation is available at http://www.five-ten-sg.com/@PACKAGE@/ + + + + + + + 2005-12-18 + - - -DNSBL Sendmail milter - Version 5.10 - + + @PACKAGE@ + 1 + @PACKAGE@ @VERSION@ + + + + @PACKAGE@ + a sendmail milter with per-user dnsbl filtering + + + + Synopsis + + @PACKAGE@ + + + + + + + + + -
Introduction
-

This milter is released under the GPL license version 2 included in -the LICENSE file in the distribution, and also available at -http://www.gnu.org/licenses/gpl.html + + Options + + + -c + + + Load the configuration file, print a cannonical form + of the configuration on stdout, and exit. + + + + + -s + + + Stress test the configuration loading code by repeating + the load/free cycle in an infinite loop. + + + + + -d n + + + Set the debug level to n. + + + + + -e from|to + + + Print the results of looking up the from and to addresses in the + current configuration. The | character is used to separate the from and to + addresses in the argument to the -e switch. + + + + + -r local-domain-socket + + + Set the local socket used for the connection to our own dns resolver processes. + + + + + -p sendmail-socket + + + Set the socket used for the milter connection to sendmail. This is either + "inet:port@ip-address" or "local:local-domain-socket-file-name". + + + + + -t timeout + + + Set the timeout in seconds used for communication with sendmail. + + + + + -

Consider the case of a mail server that is acting as secondary MX for -a collection of clients, each of which has a collection of mail domains. + + Usage + @PACKAGE@ -c + @PACKAGE@ -s + @PACKAGE@ -d 2 + @PACKAGE@ -e'someone@aol.com|localname@mydomain.tld' + @PACKAGE@ -d 10 -r /var/run/dnsbl/dnsbl.resolver.sock -p local:/var/run/dnsbl/dnsbl.sock + + + + Introduction + + Consider the case of a mail server that is acting as secondary MX for a + collection of clients, each of which has a collection of mail domains. Each client may use their own collection of DNSBLs on their primary mail server. We present here a mechanism whereby the backup mail server can use the correct set of DNSBLs for each recipient for each message. As a side-effect, it gives us the ability to customize the set of DNSBLs on a per-recipient basis, so that fred@example.com could use SPEWS and the SBL, where all other users @example.com use only the SBL. - -

This milter can also verify the envelope from/recipient pairs with -the primary MX server. This allows the backup mail servers to properly + + + This milter can also verify the envelope from/recipient pairs with the + primary MX server. This allows the backup mail servers to properly reject mail sent to invalid addresses. Otherwise, the backup mail servers will accept that mail, and then generate a bounce message when the message is forwarded to the primary server (and rejected there with no such user). - -

This milter will also decode (uuencode, base64, mime, html entity, -url encodings) and scan for HTTP and HTTPS URLs and bare hostnames in -the body of the mail. If any of those host names have A or NS records -on the SBL (or a single configurable DNSBL), the mail will be rejected + + + This milter will also decode (uuencode, base64, mime, html entity, url + encodings) and scan for HTTP and HTTPS URLs and bare hostnames in the + body of the mail. If any of those host names have A or NS records on + the SBL (or a single configurable DNSBL), the mail will be rejected unless previously whitelisted. This milter also counts the number of invalid HTML tags, and can reject mail if that count exceeds your specified limit. - -

The DNSBL milter reads a text configuration file (dnsbl.conf) on + + + The DNSBL milter reads a text configuration file (dnsbl.conf) on startup, and whenever the config file (or any of the referenced include files) is changed. The entire configuration file is case insensitive. If the configuration cannot be loaded due to a syntax error, the milter @@ -43,17 +155,22 @@ root from dnsbl@$hostname. You probably want to added dnsbl@$hostname to your /etc/mail/virtusertable since otherwise sendmail will reject that message. + + -


DCC Issues
-

If you are also using the DCC milter, there are -a few considerations. You may need to whitelist senders from the DCC -bulk detector, or from the DNS based lists. Those are two very + + DCC Issues + + If you are also using the DCC milter, there + are a few considerations. You may need to whitelist senders from the + DCC bulk detector, or from the DNS based lists. Those are two very different reasons for whitelisting. The former is done thru the DCC whiteclnt config file, the later is done thru the DNSBL milter config file. - -

You may want to blacklist some specific senders or sending domains. + + + You may want to blacklist some specific senders or sending domains. This could be done thru either the DCC (on a global basis, or for a specific single recipient). We prefer to do such blacklisting via the DNSBL milter config, since it can be done for a collection of recipient @@ -61,48 +178,58 @@ entire message in the DCC log files. The DNSBL milter approach has the feature that the mail is rejected earlier (at RCPT TO time), and the sending machine just gets a generic "550 5.7.1 no such user" message. - -

The DCC whiteclnt file can be included in the DNSBL milter config by -the dcc_to and dcc_from statements. This will import the (env_to, -env_from, and substitute mail_host) entries from the DCC config into the -DNSBL config. This allows using the DCC config as the single point for + + + The DCC whiteclnt file can be included in the DNSBL milter config by the + dcc_to and dcc_from statements. This will import the (env_to, env_from, + and substitute mail_host) entries from the DCC config into the DNSBL + config. This allows using the DCC config as the single point for white/blacklisting. - -

Consider the case where you have multiple clients, each with their -own mail servers, and each running their own DCC milters. Each client -is using the DCC facilities for envelope from/to white/blacklisting. + + + Consider the case where you have multiple clients, each with their own + mail servers, and each running their own DCC milters. Each client is + using the DCC facilities for envelope from/to white/blacklisting. Presumably you can use rsync or scp to fetch copies of your clients DCC whiteclnt files on a regular basis. Your mail server, acting as a backup MX for your clients, can use the DNSBL milter, and include those client DCC config files. The envelope from/to white/blacklisting will be appropriately tagged and used only for the domains controlled by each of those clients. - -


Definitions
- -

CONTEXT - a collection of parameters that defines the filtering -context to be used for a collection of envelope recipient addresses. -The context includes such things as the list of DNSBLs to be used, and -the various content filtering parameters. - -

DNSBL - a named DNS based blocking list is defined by a dns suffix -(e.g. sbl-xbl.spamhaus.org) and a message string that is used to -generate the "550 5.7.1" smtp error return code. The names of these -DNSBLs will be used to define the DNSBL-LISTs. + + -

DNSBL-LIST - a named list of DNSBLs that will be used for specific + + Definitions + + CONTEXT - a collection of parameters that defines the filtering context + to be used for a collection of envelope recipient addresses. The + context includes such things as the list of DNSBLs to be used, and the + various content filtering parameters. + + + DNSBL - a named DNS based blocking list is defined by a dns suffix (e.g. + sbl-xbl.spamhaus.org) and a message string that is used to generate the + "550 5.7.1" smtp error return code. The names of these DNSBLs will be + used to define the DNSBL-LISTs. + + + DNSBL-LIST - a named list of DNSBLs that will be used for specific recipients or recipient domains. - -


Filtering Procedure
+ + -

If the client has authenticated with sendmail, the mail is accepted, -the filtering contexts are not used, the dns lists are not checked, and -the body content is not scanned. Otherwise, we follow these steps for -each recipient. - -

    - -
  1. The envelope to email address is used to find an initial filtering + + Filtering Procedure + + If the client has authenticated with sendmail, the mail is accepted, the + filtering contexts are not used, the dns lists are not checked, and the + body content is not scanned. Otherwise, we follow these steps for each + recipient. + + + + The envelope to email address is used to find an initial filtering context. We first look for a context that specified the full email address in the env_to statement. If that is not found, we look for a context that specified the entire domain name of the envelope recipient @@ -110,200 +237,453 @@ that specified the user@ part of the envelope recipient in the env_to statement. If that is not found, we use the first top level context defined in the config file. - -

  2. The initial filtering context may redirect to a child -context based on the values in the initial context's env_from statement. -We look for [1) the full envelope from email address, 2) the domain name + + + The initial filtering context may redirect to a child context based on + the values in the initial context's env_from statement. We look for [1) + the full envelope from email address, 2) the domain name part of the + envelope from address, 3) the user@ part of the envelope from address] + in that context's env_from statement, with values that point to a child + context. If such an entry is found, we switch to that child filtering + context. + + + We lookup [1) the full envelope from email address, 2) the domain name part of the envelope from address, 3) the user@ part of the envelope -from address] in that context's env_from statement, with values that -point to a child context. If such an entry is found, we switch to that -child filtering context. - -

  3. We lookup [1) the full envelope from email address, 2) the -domain name part of the envelope from address, 3) the user@ part of the -envelope from address] in the filtering context env_from statement. -That results in one of (white, black, unknown, inherit). - -

  4. If the answer is black, mail to this recipient is rejected -with "no such user", and the dns lists are not checked. - -

  5. If the answer is white, mail to this recipient is accepted -and the dns lists are not checked. - -

  6. If the answer is unknown, we don't reject yet, but the dns -lists will be checked, and the content may be scanned. - -

  7. If the answer is inherit, we repeat the envelope from search -in the parent context. - -

  8. The dns lists specified in the filtering context are checked -and the mail is rejected if any list has an A record for the standard -dns based lookup scheme (reversed octets of the client followed by the -dns suffix). - -

  9. If the mail has not been accepted or rejected yet, we look -for a verification context, which is the closest ancestor of the -filtering context that both specifies a verification host, and which -covers the envelope to address. If we find such a verification context, -and the verification host is not our own hostname, we open an smtp -conversation with that verification host. The current envelope from and -recipient to values are passed to that verification host. If we receive -a 5xy response those commands, we reject the current recipient with "no -such user". - -

  10. If the mail has not been accepted or rejected yet, and the -filtering context enables content filtering, and this is the first such -recipient in this smtp transaction, we set the content filtering -parameters from this context, and enable content filtering for the body -of this message. - -
- -

If content filtering is enabled for this body, the mail text is -decoded (uuencode, base64, mime, html entity, url encodings), scanned -for HTTP and HTTPS URLs, and the first <configurable> host names -are checked for their presence on the single <configurable> DNSBL. + from address] in the filtering context env_from statement. That results + in one of (white, black, unknown, inherit). + + + If the answer is black, mail to this recipient is rejected with "no such + user", and the dns lists are not checked. + + + If the answer is white, mail to this recipient is accepted and the dns + lists are not checked. + + + If the answer is unknown, we don't reject yet, but the dns lists will be + checked, and the content may be scanned. + + If the answer is inherit, we repeat the envelope from search in the + parent context. + + + The dns lists specified in the filtering context are checked and the + mail is rejected if any list has an A record for the standard dns based + lookup scheme (reversed octets of the client followed by the dns + suffix). + + + If the mail has not been accepted or rejected yet, we look for a + verification context, which is the closest ancestor of the filtering + context that both specifies a verification host, and which covers the + envelope to address. If we find such a verification context, and the + verification host is not our own hostname, we open an smtp conversation + with that verification host. The current envelope from and recipient to + values are passed to that verification host. If we receive a 5xy + response those commands, we reject the current recipient with "no such + user". + + + If the mail has not been accepted or rejected yet, and the filtering + context enables content filtering, and this is the first such recipient + in this smtp transaction, we set the content filtering parameters from + this context, and enable content filtering for the body of this message. + + + + If content filtering is enabled for this body, the mail text is decoded + (uuencode, base64, mime, html entity, url encodings), scanned for HTTP + and HTTPS URLs, and the first <configurable> host names are + checked for their presence on the single <configurable> DNSBL. The only known list that is suitable for this purpose is the SBL. If any of those host names are on that DNSBL (or have nameservers that are on that list), and it is not on the <configurable> ignore list, the mail is rejected. We also scan for excessive bad html tags, and if a <configurable> limit is exceeded, the mail is rejected. + + -


Sendmail access vs. DNSBL
-

With the standard sendmail.mc dnsbl FEATURE, the dnsbl checks may be + + Sendmail access vs. DNSBL + + With the standard sendmail.mc dnsbl FEATURE, the dnsbl checks may be suppressed by entries in the /etc/mail/access database. For example, suppose you control a /18 of address space, and have allocated some /24s to some clients. You have access entries like - -

+                
 192.168.4   OK
 192.168.17  OK
-
- -

to allow those clients to smarthost thru your mail server. Now if -one of those clients happens get infected with a virus that turns a -machine into an open proxy, and their 192.168.4.45 lands on the SBL-XBL, -you will still wind up allowing that infected machine to smarthost thru -your mail servers. - -

With this DNSBL milter, the sendmail access database cannot override -the dnsbl checks, so that machine won't be able to send mail to or thru -your smarthost mail server (unless the virus/proxy can use smtp-auth). - -

Using the standard sendmail features, you would add access entries to + + + + to allow those clients to smarthost thru your mail server. Now if one + of those clients happens get infected with a virus that turns a machine + into an open proxy, and their 192.168.4.45 lands on the SBL-XBL, you + will still wind up allowing that infected machine to smarthost thru your + mail servers. + + + With this DNSBL milter, the sendmail access database cannot override the + dnsbl checks, so that machine won't be able to send mail to or thru your + smarthost mail server (unless the virus/proxy can use smtp-auth). + + + Using the standard sendmail features, you would add access entries to allow hosts on your local network to relay thru your mail server. Those OK entries in the sendmail access database will override all the dnsbl checks. With this DNSBL milter, you will need to have the local users -authenticate with smtp-auth to get the same effect. You might find -these directions helpful for setting up smtp-auth if you are on RH -Linux. - -


Installation and configuration
-

Usage: Note that this has ONLY been tested on Linux, specifically -RedHat Linux. In particular, this milter makes no attempt to understand -IPv6. Your mileage will vary. You will need at a minimum a C++ -compiler with a minimally thread safe STL implementation. The -distribution includes a test.cpp program. If it fails this milter won't -work. If it passes, this milter might work. + authenticate with smtp-auth to get the same effect. You might find + + these directions helpful for setting up smtp-auth if you are on + RH Linux. + + -Fetch dnsbl.tar.gz -and - -

-tar xfvz dnsbl.tar.gz
-bash install.bash
-
- -Read and understand the contents of that install.bash script before you -run it. It may not be suitable for your system. Modify your -sendmail.mc by removing all the "FEATURE(dnsbl" lines, add the following -line in your sendmail.mc and rebuild the .cf file - -
+        
+            Installation and configuration
+            
+                This is a standard GNU autoconf/automake installation, so the normal
+                
+                    ./configure
+                    make
+                    su
+                    make install
+                
+                works. "make chkconfig" will setup the init.d runlevel scripts.
+            
+            
+                Note that this has ONLY been tested on Linux, specifically RedHat Linux.
+                In particular, this milter makes no attempt to understand IPv6.  Your
+                mileage will vary.  You will need at a minimum a C++ compiler with a
+                minimally thread safe STL implementation.  The distribution includes a
+                test.cpp program.  If it fails this milter won't work.  If it passes,
+                this milter might work.
+            
+            
+                Modify your sendmail.mc by removing all the "FEATURE(dnsbl" lines, add
+                the following line in your sendmail.mc and rebuild the .cf file
+            
+            
+                
 INPUT_MAIL_FILTER(`dnsbl', `S=local:/var/run/dnsbl/dnsbl.sock, F=T, T=C:30s;S:5m;R:5m;E:5m')
-
- -Read the sample /etc/dnsbl/dnsbl.conf -file and modify it to fit your configuration. You can test your -configuration files, and see a readable internal dump of them on stdout -with - -
-cd /etc/dnsbl
-/usr/sbin/dnsbl -c
-
+ + + + Modify the default + @PACKAGE@.conf 5 + configuration. + -You can check a specific envelope from/to pair with -
-cd /etc/dnsbl
-from="$1" # or your from address
-to="$2"   # or your to address
-/usr/sbin/dnsbl -e "$from"'|'"$to"
-
- -
Performance issues
- -

Consider a high volume high performance machine running sendmail. -Each sendmail process can do its own dns resolution. Typically, such -dns resolver libraries are not thread safe, and so must be protected by -some sort of mutex in a threaded environment. When we add a milter to + + Performance Issues + + Consider a high volume high performance machine running sendmail. Each + sendmail process can do its own dns resolution. Typically, such dns + resolver libraries are not thread safe, and so must be protected by some + sort of mutex in a threaded environment. When we add a milter to sendmail, we now have a collection of sendmail processes, and a collection of milter threads. - -

We will be doing a lot of dns lookups per mail message, and at least + + + We will be doing a lot of dns lookups per mail message, and at least some of those will take many tens of seconds. If all this dns work is serialized inside the milter, we have an upper limit of about 25K mail messages per day. That is clearly not sufficient for many sites. - -

Since we want to do parallel dns resolution across those milter -threads, we add another collection of dns resolver processes. Each -sendmail process is talking to a milter thread over a socket, and each -milter thread is talking to a dns resolver process over another socket. - -

Suppose we are processing 20 messages per second, and each message + + + Since we want to do parallel dns resolution across those milter threads, + we add another collection of dns resolver processes. Each sendmail + process is talking to a milter thread over a socket, and each milter + thread is talking to a dns resolver process over another socket. + + + Suppose we are processing 20 messages per second, and each message requires 20 seconds of dns work. Then we will have 400 sendmail processes, 400 milter threads, and 400 dns resolver processes. Of course that steady state is very unlikely to happen. + + -


Rejected Ideas
-

The following ideas have been considered and rejected. - -

Add max_recipients for each mail domain to the configuration. + + Rejected Ideas + + The following ideas have been considered and rejected. + + + Add max_recipients for each mail domain to the configuration. Recipients in excess of that limit will be rejected, and all the recipients in that domain will be removed if there are some other whitelisted recipients. Current spammers *very* rarely send more than -ten recipients in a single smtp transaction, so this won't stop -any significant amount of spam. - -

Add poison addresses to the configuration. If any recipient is + ten recipients in a single smtp transaction, so this won't stop any + significant amount of spam. + + + Add poison addresses to the configuration. If any recipient is poison, all recipients are rejected even if they would be whitelisted, and the data is rejected if sent. I have a collection of spam trap addresses that would be suitable for such use. Based on my log files, any mail to those spam trap addresses is rejected based on either dnsbl lookups or the DCC. So this won't result in blocking any additional spam. - -

Add an option to only allow one recipient if the return path is + + + Add an option to only allow one recipient if the return path is empty. Based on my log files, there is no mail that violates this check. + + + Reject the mail if the envelope from domain name contains any MX + records pointing to 127.0.0.0/8. I don't see any significant amount of + spam sent with such domain names. + + -

Reject the mail if the envelope from domain name contains any MX -records pointing to 127.0.0.0/8. I don't see any significant amount of spam -sent with such domain names. + + TODO + + The following ideas are under consideration. + + + Add a per-context option to reject mail if the number of digits in + the reverse dns client name exceeds some threshold. + + + + + Configuration + + The configuration file is documented in + @PACKAGE@.conf 5 + . Any change to the config file, or any file included + from that config file, will cause it to be reloaded within three + minutes. + + + + + Copyright + + Copyright (C) 2005 by 510 Software Group <carl@five-ten-sg.com> + + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + + You should have received a copy of the GNU General Public License along + with this program; see the file COPYING. If not, please write to the + Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. + + + + + + $Id$ + + + + + + + + 2005-12-18 + -


Future work
+ + @PACKAGE@.conf + 5 + @PACKAGE@ @VERSION@ + + + + @PACKAGE@.conf + configuration file for @PACKAGE@ + + + + Synopsis + + @PACKAGE@.conf + + + + + Description + The @PACKAGE@.conf configuration file is + specified by this partial bnf description. + + The following ideas are under consideration. +DNSBL = "dnsbl" NAME DNSPREFIX ERROR-MSG + +DNSBLLIST = "dnsbl_list" {NAME}+ + +CONTENT = "content" ("on" | "off") "{" {CONTENT-ST}+ "}" +CONTENT-ST = (FILTER | IGNORE | TLD | HTML-TAGS | HTML-LIMIT | HOST-LIMIT) ";" +FILTER = "filter" DNSPREFIX ERROR-MSG +IGNORE = "ignore" "{" {HOSTNAME [";"]}+ "}" +TLD = "tld" "{" {TLD [";"]}+ "}" +HTML-TAGS = "html_tags" "{" {HTMLTAG [";"]}+ "}" +ERROR-MSG = string containing exactly two %s replacement tokens for the client ip address + +HTML-LIMIT = "html_limit" ("on" INTEGER ERROR-MSG | "off") + +HOST-LIMIT = "host_limit" ("on" INTEGER ERROR-MSG | "off" | "soft" INTEGER) + +ENV-TO = "env_to" "{" {(TO-ADDR | DCC-TO)}+ "}" +TO-ADDR = ADDRESS [";"] +DCC-TO = "dcc_to" ("ok" | "many") "{" DCCINCLUDEFILE "}" ";" + +VERIFY = "verify" HOSTNAME ";" + +ENV_FROM = "env_from" [DEFAULT] "{" {(FROM-ADDR | DCC-FROM)}+ "}" +FROM-ADDR = ADDRESS VALUE [";"] +DCC-FROM = "dcc_from" "{" DCCINCLUDEFILE "}" ";" +DEFAULT = ("white" | "black" | "unknown" | "inherit" | "") +ADDRESS = (USER@ | DOMAIN | USER@DOMAIN) +VALUE = ("white" | "black" | "unknown" | CHILD-CONTEXT-NAME)]]> + -

Add a per-context option to reject mail if the number of digits in -the reverse dns client name exceeds some threshold. + + Sample + + context blacklist { + env_to { + dcc_to many { include "/var/dcc/whitecommon"; }; # copy the dcc MANY values (env_to) into this context + old-employee@mydomain.com; + }; + env_from black {}; # black forces all unmatched from addresses (everyone in this case) to be blacklisted + # so all mail TO these env_to addresses is rejected + }; + + context vp { # special context for the vp + env_to { + vp@mydomain.com; + }; + env_from inherit { + nai.com black; # the vp does not like nai + yahoo.com unknown; # override parent context blacklisting + mother@spammyisp.com white; # suppress dnsbl checking + }; + }; + + context customer1 { + dnsbl_list sbl dul; + env_to { + customer1.com; + customer1a.com; + customer1b.com; + }; + + verify mail.customer1.com; + + context customer1a { + env_to { + customer1a.com; + } + env_from black { # blacklist everything + first@acceptable.com unknown; # except these specific envelope senders + second@another.com unknown; + yahoo.com inherit; # delegate to the parent + }; + }; + + env_from { # default value of the default is inherit + yahoo.com black; # no mail from yahoo + first@yahoo.com unknown; # except this one + }; + }; + + context customer2 { + dnsbl_list sbl; + env_to { + customer2.com; + customer2a.com; + customer2b.com; + }; + }; + + env_from unknown { + dcc_from { include "/var/dcc/whitecommon"; }; # copy the dcc OK/MANY values (env_from, substitute mail_host) into this context + abuse@ abuse; # replies to abuse reports use the abuse context + yahoo.com black; # don't take mail from yahoo + spammer@example.com black; + }; +};]]> + + + + $Id$ - - - + + + + +