Barricade MX
smtpf/2.6
|
IPv4 Lookup | IPv6 Lookup | |
---|---|---|
tag:192.0.2.9 | tag:2001:0DB8:0:0:0:0:1234:5678 | |
tag:192.0.2 | tag:2001:0DB8:0:0:0:0:1234 | |
tag:192.0 | tag:2001:0DB8:0:0:0:0 | |
tag:192 | tag:2001:0DB8:0:0:0 | |
tag:2001:0DB8:0:0 | ||
tag:2001:0DB8:0 | ||
tag:2001:0DB8 | ||
tag:2001 |
Note that the compact form of an IPv6 address, "2001:0DB8::1234:5678
", cannot be used.
Only the full IPv6 address format, with all intervening zeros, is currently supported.
tag:[ipv6:2001:0DB8::1234:5678] |
tag:[192.0.2.9] |
tag:sub.domain.tld |
tag:domain.tld |
tag:tld |
tag: |
Note that the bare tag is often used to specify system wide defaults.
tag:account@sub.domain.tld |
tag:sub.domain.tld |
tag:domain.tld |
tag:tld |
tag:account@ |
tag: |
Note that the bare tag is often used to specify system wide defaults.
The following list outlines the available tags and their supported key lookups:
REJECT
), the connection
will be dropped. If white listed (OK
), then the messages from this connection
by-passes all the filtering except anti-virus. The connection can also be "grey-listed"
(CONTENT
), similar to dns-gl, which
only white lists a connection as far as, but not including, the data content filters.
REJECT
),
mail from this sender is refused. If white listed (OK
), then the messages from
this sender will by-pass all the filtering except anti-virus. Black listing using
this tag is fine, but white listing is not recommended as it is too easy
for someone to fake the sender address.
REJECT
), the connection will be dropped. If white listed (OK
),
then the messages from this connection by-passes all the filtering except anti-virus. The
connection can also be "grey-listed" (CONTENT
), similar to
dns-gl, which only white lists a connection as far as,
but not including, the data content filters.
This tag is not recommended for white listing as the HELO argument it can be too easily
falsified. It is primarily intended for data gathering and diagnostics when used with
SAVE
, TAG
, or TRAP
actions. The other actions are
supported for completeness.
When there are multiple message length limits possible, then the limit applied, in order of precedence is:
messages '/' time [unit]
which is the number of messages per time interval. The time unit
specifier can be one of week, day, hour, minute, or seconds (note
only the first letter is significant). A negative number
for messages
will disable any limit.
When there are multiple message limits possible, then the limit applied, in order of precedence is: Msg-Limit-To:, Msg-Limit-From:, and Msg-Limit-Connect.
hotmail.com
.
In some cases
when a third party mail system rejects spam or virus mail during the
SMTP session, a DSN (bounce message) is generated and sent back to the
false sender. Since spammers typically send millions of messages with
falsified sender addresses, the mail system of the abused domain can
be swamped by the backscatter. smtpf's
EMEW facility was designed in
part to help with backscatter, but cannot be deployed in some mail
system architectures.
So smtpf provides another mechanism to help with backscatter situations, where smtpf monitors the rate of DSN or MDN messages (essentially any message from the "null sender" ie. MAIL FROM:<>) arriving per minute and rejects such messages above a certain threshold that can be configured globally, by domain, and by recipient.
The right-hand-side value is a positive number representing the permitted number of messages from the null sender per minute to the given recipient or domain; -1 to disable.
OK
is used, then the message is not processed by spamd.
REJECT
),
mail to this recipient will be refused; the current message transaction is permitted
to specify addition recipients or abandon the transaction. If white listed (OK
), then
the message will by-passes all the filtering except anti-virus.
It should be noted that black & white listing with Connect:, Connect:From:, Connect:To:, From:, From:To:, and To: take effect immediately in the SMTP state they apply to. This can be changed by enabling smtp-delay-checks which delays policy rejections until the recipients have been specified with the possibility to white list. The auth-delay-checks option can be used to delay the connection and EHLO related tests until a MAIL FROM: is received allowing for an SMTP AUTH command to be issued.
When a key lookup matches, then the value returned is a pattern list, which in
its simplest and most common form is either an action word like
OK
, CONTENT
, DISCARD
, REJECT
,
IREJECT
, TAG
, etc;
or a numerical value depending on the tag involved. For example:
Connect:192.168.0 OK Rate-Connect:fsl.com 17 Msg-Limit-From:hotmail.com 150/30m
The action words supported are:
OK White list, by-pass one or more tests, except anti-virus scanning CONTENT White list as far as, but not including, the content filters;
used only with Connect: or Helo:.DISCARD:"log-comment" Accept and discard message skipping tests; use with care. The :"log-comment" is optional IREJECT:"custom-reply" Immediate REJECT, ignore smtp-delay-checks; applies only to Connect:, Connect:From:, From:, and Helo:. :"custom-reply" is optional PROTOCOL Similar to CONTENT, reject on pre-DATA tests, but ignore post-DATA ones, execpt for anti-virus. Useful for some mailing lists. Used with Connect:, from:, to:, connect:from:, connect:to:, or from:to:. REJECT:"custom-reply" Black list, either reject or drop. The :"custom-reply" is optional REQUIRE The client is required to establish STARTTLS before the server will accept messages. Used only with Tls-Connect:, Tls-From:, and Tls-To:. SAVE:"path" Save a copy of message if delivered and save message to save-dir, unles the optional :"path" is specified SKIP Stop lookup and return no result ie. continue testing.
For Tls-Connect: by-pass the offering of STARTTLS extension.SPF-PASS White list sender if SPF returns Pass; used only with Connect:From: and From: TAG If a policy rejection or drop would occur, simply tag the Subject: header and by-pass remaining tests TEMPFAIL:"custom-reply" Report a temporary failure condition. The :"custom-reply" is optional TRAP:"path" Accept and save message, but do not deliver, to trap-dir, unless the optional :"path" is specified VERIFY:"CN=name" The client is required to establish STARTTLS before the server will accept messages and the client certificate must validated. Used only with Tls-Connect:, Tls-From:, and Tls-To:. The :CN=name is optional; when specified the CN field of client certificate must match name.
In most instances, the above forms of key lookup and values are sufficient. However, there may be times when finer granularity of control is required, in which case pattern lists can be used. A pattern list is a white space separated list of pattern-action pairs followed by an optional default action. The supported types are:
[network/cidr]action Classless Inter-Domain Routing
(only with IP address lookups)!pattern!action Simple fast text matching. /regex/action Extended Regular Expressions.
The simple pattern matching, !pattern!, uses an asterisk (*) for a wildcard, scanning over zero or more characters; a question-mark (?) matches any single character; a backslash followed by any character treats that character as a literal. This method always tries to match the beginning and end of string. For example:
!abc! exact match for 'abc' !abc*! match 'abc' at start of string !*abc! match 'abc' at the end of string !abc*def! match 'abc' at the start and match 'def' at the end, maybe with stuff in between. !*abc*def*! find 'abc', then find 'def'
The following is an example using a simple pattern to reject client connections that originate from a range of IP addresses of an ISP assigned to ADSL customers. Using a pattern like this allows you to drop connects from the ISP's ADSL, while still accepting connections from mail and web servers.
Connect:hananet.net !adsl-*-*.usr.hananet.net!REJECT
If you know that an ISP's mail and web servers follow a standard naming convention, you might prefer to only accept mail from those instead. We include web servers here to handle the case where a web server might have to send a mail response based on a form being filled in.
Connect:hananet.net !smtp*.hananet.net!OK !www*.hananet.net!OK REJECT
Note that SPF was designed to help mail servers identify originators of mail, so creating patterns as shown in the above two examples is not normally required. However, SPF is still considered experimental and not as widely deployed as one might hope.
The next example, /regex/, uses Extended Regular Expressions to validate the
format of the local-part of an AOL address, which must be between 3 and 16
characters long, can contain dots and RFC 2822 ``atext'' characters except %
and /
.
The NEXT word allows the one regular expression to validate the format of the address and resume key lookup if the
pattern matches; otherwise if the regular expression failed to match, REJECT the suspect aol.com address.
From:grandma@aol.com OK
From:aol.com /^[a-zA-Z0-9!#$&'*+=?^_`{|}~.-]{3,16}@aol.com$/NEXT REJECT
The discussion of Extended Regular Expressions is vast and complex, well beyond the scope of this document. There are many on-line tutorials and references available and the book Mastering Regular Expressions, 3e from O'Reilly covers the topic in depth.
If you need to use a pattern list, then try and follow these suggestions:
- TOP -