diff --git a/postfix/HISTORY b/postfix/HISTORY index cb2b0805e..f210ba68d 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -8384,6 +8384,19 @@ Apologies for any names omitted. "check_smtpd_policy_service" in smtpd_mumble_restrictions. See SMTPD_POLICY_SERVICE_README for details. +20030716 + + Bugfix: in the sample policy server, changed "ok" into + "dunno" so the server can be used in the middle of a + restriction list. + + Cleanup: when an RBL reply has multiple TXT records, + concatenate them up to some reasonable limit, instead of + selecting one randomly. File: smtpd/smtpd_check.c. + + Safety: always truncate SMTP server error replies to 512 + bytes. File: smtpd/smtpd_check.c. + Open problems: Low: smtp-source may block when sending large test messages. diff --git a/postfix/README_FILES/SMTPD_POLICY_README b/postfix/README_FILES/SMTPD_POLICY_README index b5eee81c1..5469ef45f 100644 --- a/postfix/README_FILES/SMTPD_POLICY_README +++ b/postfix/README_FILES/SMTPD_POLICY_README @@ -47,8 +47,8 @@ server sends in a delegated SMTPD access policy request: The following is specific to SMTPD delegated policy requests: - Protocol names are ESMTP or SMTP. -- Protocol states are CONNECT, EHLO, HELO, MAIL, RCPT, or DATA; - these are all the SMTP protocol states where the Postfix SMTP +- Protocol states are CONNECT, EHLO, HELO, MAIL, RCPT, DATA or + ETRN; these are the SMTP protocol states where the Postfix SMTP server makes an OK/REJECT/HOLD/etc. decision. The policy server replies with any action that is allowed in a @@ -259,9 +259,11 @@ sub smtpd_access_policy { update_database($key, $time_stamp); } + # Specify DUNNO instead of OK so that the check_policy_service restriction + # can be used in the middle of a restriction list. syslog $syslog_priority, "request age %d", $now - $time_stamp if $verbose; if ($now - $time_stamp > $greylist_delay) { - return "ok"; + return "dunno"; } else { return "450 Service is unavailable"; } diff --git a/postfix/conf/sample-smtpd.cf b/postfix/conf/sample-smtpd.cf index 2fa27b6f0..a03938158 100644 --- a/postfix/conf/sample-smtpd.cf +++ b/postfix/conf/sample-smtpd.cf @@ -148,6 +148,8 @@ smtpd_banner = $myhostname ESMTP $mail_name # in an A record under domain.tld. # Append e.g., "=127.0.0.2" to the RBL domain name to select a specific # address record when an RBL server provides multi-valued results. +# check_policy_service transport:endpoint: delegate the decision to +# an external policy server. See SMTPD_POLICY_README for details. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. # warn_if_reject: next restriction logs a warning instead of rejecting. @@ -326,6 +328,8 @@ mynetworks_style = subnet # in an A record under domain.tld. # Append e.g., "=127.0.0.2" to the RBL domain name to select a specific # address record when an RBL server provides multi-valued results. +# check_policy_service transport:endpoint: delegate the decision to +# an external policy server. See SMTPD_POLICY_README for details. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. # warn_if_reject: next restriction logs a warning instead of rejecting. @@ -370,6 +374,8 @@ smtpd_helo_required = no # Filter the message if the result is FILTER transport:nexthop. # Redirect the message if the result is REDIRECT user@domain. # Permit the HELO command if the result is OK or all numerical. +# check_policy_service transport:endpoint: delegate the decision to +# an external policy server. See SMTPD_POLICY_README for details. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. # warn_if_reject: next restriction logs a warning instead of rejecting. @@ -415,6 +421,8 @@ smtpd_helo_restrictions = # the client login name doesn't own the MAIL FROM address according to # $smtpd_sender_login_maps (see above). # reject_non_fqdn_sender: reject sender address that is not in FQDN form +# check_policy_service transport:endpoint: delegate the decision to +# an external policy server. See SMTPD_POLICY_README for details. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. # warn_if_reject: next restriction logs a warning instead of rejecting. @@ -486,6 +494,8 @@ smtpd_sender_restrictions = # Redirect the message if the result is REDIRECT user@domain. # Permit the recipient if the result is OK or all numerical. # reject_non_fqdn_recipient: reject recipient address that is not in FQDN form +# check_policy_service transport:endpoint: delegate the decision to +# an external policy server. See SMTPD_POLICY_README for details. # reject: reject the request. Place this at the end of a restriction. # permit: permit the request. Place this at the end of a restriction. # warn_if_reject: next restriction logs a warning instead of rejecting. diff --git a/postfix/examples/smtpd-policy/smtpd-policy.pl b/postfix/examples/smtpd-policy/smtpd-policy.pl index b9f60efbb..f3f9c7a64 100755 --- a/postfix/examples/smtpd-policy/smtpd-policy.pl +++ b/postfix/examples/smtpd-policy/smtpd-policy.pl @@ -26,7 +26,7 @@ use Sys::Syslog qw(:DEFAULT setlogsock); # To use this from Postfix SMTPD, use in /etc/postfix/main.cf: # # smtpd_recipient_restrictions = -# ... reject_unauth_destination +# ... reject_unauth_destination # check_policy_service unix:private/policy ... # # NOTE: specify check_policy_service AFTER reject_unauth_destination @@ -53,7 +53,7 @@ use Sys::Syslog qw(:DEFAULT setlogsock); # The policy server script will answer in the same style, with an # attribute list followed by a empty line: # -# action=ok +# action=dunno # [empty line] # @@ -67,7 +67,7 @@ $database_name="/var/mta/smtpd-policy.db"; $greylist_delay=3600; # -# Syslogging options for verbose mode and for fatal errors. +# Syslogging options for verbose mode and for fatal errors. # NOTE: comment out the $syslog_socktype line if syslogging does not # work on your system. # @@ -92,15 +92,17 @@ sub smtpd_access_policy { $time_stamp = read_database($key); $now = time(); - # If new request, add this client/sender/recipient to the database. + # If this is a new request add this client/sender/recipient to the database. if ($time_stamp == 0) { $time_stamp = $now; update_database($key, $time_stamp); } + # Specify DUNNO instead of OK so that the check_policy_service restriction + # can be followed by other restrictions. syslog $syslog_priority, "request age %d", $now - $time_stamp if $verbose; if ($now - $time_stamp > $greylist_delay) { - return "ok"; + return "dunno"; } else { return "450 Service is unavailable"; } @@ -130,7 +132,7 @@ sub open_database { my($database_fd); # Use tied database to make complex manipulations easier to express. - $database_obj = tie(%db_hash, 'DB_File', $database_name, + $database_obj = tie(%db_hash, 'DB_File', $database_name, O_CREAT|O_RDWR, 0644) || fatal_exit "Cannot open database %s: $!", $database_name; $database_fd = $database_obj->fd; @@ -187,7 +189,7 @@ while ($option = shift(@ARGV)) { if ($option eq "-v") { $verbose = 1; } else { - syslog $syslog_priority, "Invalid option: %s. Usage: %s [-v]", + syslog $syslog_priority, "Invalid option: %s. Usage: %s [-v]", $option, $0; exit 1; } diff --git a/postfix/html/uce.html b/postfix/html/uce.html index fb7f8207d..ec9d020cf 100644 --- a/postfix/html/uce.html +++ b/postfix/html/uce.html @@ -441,6 +441,8 @@ significant octets.
+
+
+
+
+
+Example:
+
+