diff --git a/postfix/HISTORY b/postfix/HISTORY index 602d353b2..6b3ea022d 100644 --- a/postfix/HISTORY +++ b/postfix/HISTORY @@ -7295,16 +7295,16 @@ Apologies for any names omitted. syntax as the mydestination parameter. Default settings are backwards compatible with Postfix 1.1. - Cleanup: just like $mydestination+$inet_interfaces control + Concept: just like $mydestination+$inet_interfaces control what routes to $local_transport, $virtual_mailbox_domains now controls what routes to $virtual_transport (default transport: virtual), and $relay_domains now controls what routes to $relay_transport (default transport: relay, a clone of the smtp transport). Everything else routes to $default_transport as before. This eliminates the need - for transport maps for virtual(8) domains, and avoids - performance problems with inbound relay mail. This was - improvement was suggested by Victor Duchovni. File: + for transport map entries for every virtual(8) domain, and + avoids performance problems with inbound relay mail. This + was improvement was suggested by Victor Duchovni. File: trivial-rewrite/resolve.c. 20021206 @@ -7315,25 +7315,52 @@ Apologies for any names omitted. 20021207 - Performance: apparently, RFC 2821 blesses the use of CNAME - domain names in SMTP commands. This speeds things up a bit. - File: smtp/smtp_proto.c. + Cleanup: deleted the description of sendmail-style virtual + domains from the virtual(5) manual page. This part of + Postfix was too confusing. + + Performance: RFC 2821 blesses the use of CNAME domain names + in MAIL FROM and RCPT TO. Not having to expand CNAME domain + names speeds things up a bit. File: smtp/smtp_proto.c. Workaround: exclude error mailer destinations from transport - table lookups. File: trivial-rewrite/resolve.c. + mapping lookups :-(. File: trivial-rewrite/resolve.c. - Cleanup: relocated_maps lookups moved to the trivial-rewrite - server. The queue manager no longer does any map lookups, - so it won't restart when maps change. This required that - resolver clients be prepared for the case that the resolver - reports it is unable to access a lookup table. This also - required that trivial-rewrite be running as multiple - processes to reduce the impact of table lookup latencies. - Files: *qmgr/qmgr_message.c, trivial-rewrite/resolve.c, - local/resolve.c, smtpd/smtpd_check.c, master/multi-server.c. + Cleanup: relocated_maps lookups are now moved to the + trivial-rewrite server. As of now, the queue manager no + longer does any map lookups, so it won't restart when maps + change. Files: *qmgr/qmgr_message.c, trivial-rewrite/resolve.c. - Workaround: don't discard all DNS lookup results when one - has a malformed name or address. File: dns/dns_lookups.c. + Robustness: because the trivial-rewrite server now does + many more table lookups, some of which are often LDAP or + SQL based, trivial-rewrite clients must be be prepared for + the case that the resolver reports a failure while processing + a request (when it was unable to access a lookup table). + Files: trivial-rewrite/resolve.c, local/resolve.c, + smtpd/smtpd_check.c. + + Robustness: moving possible LDAP or SQL table lookups into + the trivial-rewrite server also required that trivial-rewrite + be running as multiple processes to reduce lookup latencies. + Files: master/multi-server.c. + + Workaround: don't discard all the DNS lookup results when + only one of the results has a malformed name or address. + File: dns/dns_lookup.c. + +200201208 + + Cleanup: with the preliminary address domain classification + concept as implemented by the trivial-rewrite address + resolver, a lot of table lookups could be eliminated from + the SMTP server. Files: smtpd/smtpd_check.c. + + Feature: new relay_recipient_maps parameter, for optional + maps with all the recipients in the domains that match + $relay_domains (so you can reject mail for unknown relay + recipients). This is for consistency with virtual_xx_maps + and virtual_xx_domains, and with local_recipient_maps and + the local delivery agent. File: smtpd/smtpd_check.c. Open problems: diff --git a/postfix/README_FILES/VIRTUAL_README b/postfix/README_FILES/VIRTUAL_README index 52e44da86..1781a0d47 100644 --- a/postfix/README_FILES/VIRTUAL_README +++ b/postfix/README_FILES/VIRTUAL_README @@ -8,9 +8,9 @@ Purpose of this software You can use the virtual delivery agent for mailbox delivery of some or all domains that are handled by a machine. -This mechanism is different from virtual domains that are implemented -by translating each virtual address into a real local user. For -that, see the virtual(5) manual page. +This mechanism is different from simulated virtual domains that +are implemented by translating each virtual address into a real +local user. For that, see the virtual(5) manual page. This is what Andrew McNamara wrote when he made the virtual delivery agent available. @@ -80,8 +80,9 @@ virtual_mailbox_maps If a recipient is not found the mail is returned to the sender. - For security reasons, regexp maps are not allowed here, because - their $1 etc. substitutions would open a security hole. + For security reasons, regular expression maps are allowed but + regular expression substitution of $1 etc. is disallowed, + because that would open a security hole. The mail administrator is expected to create and chown recipient mailbox files or maildir directories ahead of time. @@ -102,8 +103,9 @@ virtual_uid_maps specific user@domain.tld entry. While searching a lookup table, an address extension (user+foo@domain.tld) is ignored. - For security reasons, regexp maps are not allowed here, because - their $1 etc. substitutions would open a security hole. + For security reasons, regular expression maps are allowed but + regular expression substitution of $1 etc. is disallowed, + because that would open a security hole. Specify a static map if all mailboxes should be owned by the same UID. For example, to specify that all mailboxes are owned by the @@ -121,8 +123,9 @@ virtual_gid_maps specific user@domain.tld entry. While searching a lookup table, an address extension (user+foo@domain.tld) is ignored. - For security reasons, regexp maps are not allowed here, because - their $1 etc. substitutions would open a security hole. + For security reasons, regular expression maps are allowed but + regular expression substitution of $1 etc. is disallowed, + because that would open a security hole. Specify a static map if all mailboxes should be owned by the same GID. For example, to specify that all mailboxes are owned by the diff --git a/postfix/RELEASE_NOTES b/postfix/RELEASE_NOTES index 8434c2bba..02c8254d5 100644 --- a/postfix/RELEASE_NOTES +++ b/postfix/RELEASE_NOTES @@ -15,13 +15,92 @@ the same bugfixes as a patch release. Incompatible changes with Postfix snapshot 1.1.12-200212XX ========================================================== -The default hash_queue_depth setting is reduced to 1 level of -subdirectories. This improves "mailq" performance on most systems, -but results in poorer worst-case performance on systems with lots -of mail in the queue. +Postfix now uses the "relay" mail delivery transport for relayed +mail (domains matching relay_domains). This may affect your +defer_transports settings. The old "smtp" transport is now the +default mail delivery transport for domains that do not match +relay_domains or any local or virtual domain name. -The check_relay_domains restriction is going away. The SMTP server -logs a warning and suggests using reject_unauth_destination instead. +The "virtual_maps" configuration parameter is now called +"virtual_alias_maps", for consistency with "virtual_mailbox_maps". +Default settings are backwards compatible with Postfix 1.1. + +Postfix-style virtual domains are now called simulated virtual +domains. Sendmail-style virtual domains are no longer documented. +This part of Postfix was too confusing. + +The default queue directory hash_queue_depth setting is reduced to +1 level of subdirectories per Postfix queue. This improves "mailq" +performance on most systems, but can result in poorer worst-case +performance on systems with lots of mail in the queue. + +The "reject_maps_rbl" restriction is going away. The SMTP server +logs a warning and suggests using the more flexible "reject_rbl_client" +instead. + +The "check_relay_domains" restriction is going away. The SMTP server +logs a warning and suggests using "reject_unauth_destination" +instead. + +Major changes with Postfix snapshot 1.1.11-200212XX +=================================================== + +This release introduces separation of lookup tables for addresses +and for domain names of virtual domains. + +- virtual_maps is replaced by virtual_alias_maps (for address + lookups) and virtual_alias_domains (for the names of what were + formerly called "Postfix-style virtual domains"). + + For backwards compatibility with Postfix version 1.1, the new + virtual_alias_maps parameter defaults to $virtual_maps, and the + new virtual_alias_domains parameter defaults to $virtual_alias_maps. + +- virtual_mailbox_maps now has a companion parameter called + virtual_mailbox_domains (for the names of domains served by the + virtual delivery agent). virtual_mailbox_maps is now used for + address lookups only. + + For backwards compatibility with Postfix version 1.1,, the new + virtual_mailbox_domains parameter defaults to $virtual_mailbox_maps. + +This release introduces the concept of address domain classes, each +having its own default mail delivery transport: + + Destination matches Default transport Default name + -------------------------------------------------------------- + $mydestination or + $inet_interfaces $local_transport local + $virtual_alias_domains (not applicable) (not applicable) + $virtual_mailbox_domains $virtual_transport virtual + $relay_domains $relay_transport relay + other $default_transport smtp + +The benefits of these changes are that: + +- You no longer need to specify all the virtual(8) domains in the + Postfix transport map. + +- A lot of table lookups could be eliminated from the SMTP server's + mail relay control and unknown user blocking code. + +Better handling of unknown recipients. Each address domain class +now has its own table with known recipients, so that you can reject +mail for unknown addresses consistently. + + Destination matches Recipients defined by Remarks + -------------------------------------------------------------- + $mydestination or + $inet_interfaces $local_recipient_maps optional + $virtual_alias_domains $virtual_alias_maps none + $virtual_mailbox_domains $virtual_mailbox_maps none + $relay_domains $relay_recipient_maps optional + other (not applicable) (not applicable) + +Finally, regular expression maps are now allowed with local delivery +agent alias tables and with all virtual delivery agent lookup tables. +However, regular expression substitution of $1 etc. is still +forbidden for security reasons. Incompatible changes with Postfix snapshot 1.1.11-20021108 ========================================================== @@ -389,7 +468,7 @@ Postfix header_checks now properly recognize MIME headers in attachments. This is much more efficient than previous versions that recognized MIME headers via body_checks. MIME headers are now processed one multi-line header at a time, instead of one body -line at a time. +line at a time. In fact, Postfix now has three classes of header patterns: header_checks (for primary message headers except MIME headers), @@ -1675,7 +1754,7 @@ environments. Specify "home_mailbox = Maildir/", or specify required to turn on maildir delivery. - Incremental updates of aliases and maps. Specify "postmap -i -mapname" and it will read new entries from stdin. +mapname" and it will read new entries from stdin. - Newaliases will now update more than one alias database. Specify the names with the main.cf "alias_database" parameter. diff --git a/postfix/conf/aliases b/postfix/conf/aliases index 2b44b3aa1..b5da8eef3 100644 --- a/postfix/conf/aliases +++ b/postfix/conf/aliases @@ -36,7 +36,6 @@ abuse: postmaster # trap decode to catch security attacks decode: root -# # ALIASES(5) ALIASES(5) # # NAME @@ -166,12 +165,19 @@ decode: root # Delimiter that separates recipients from address # extensions. # +# BUGS +# Regular expression alias lookup tables are allowed, but +# substitution of $1 etc. is forbidden because that would +# open a security loophole. +# # STANDARDS # RFC 822 (ARPA Internet Text Messages) # # SEE ALSO # local(8) local delivery agent -# postalias(1) alias database management +# newaliases(1) alias database management +# regexp_table(5) POSIX regular expression table format +# pcre_table(5) Perl Compatible Regular Expression table format # # LICENSE # The Secure Mailer license must be distributed with this @@ -183,5 +189,4 @@ decode: root # P.O. Box 704 # Yorktown Heights, NY 10598, USA # -# 1 -# +# ALIASES(5) diff --git a/postfix/conf/main.cf b/postfix/conf/main.cf index 5e7eda712..eafabbd65 100644 --- a/postfix/conf/main.cf +++ b/postfix/conf/main.cf @@ -119,17 +119,21 @@ mail_owner = postfix #proxy_interfaces = 1.2.3.4 # The mydestination parameter specifies the list of domains that this -# machine considers itself the final destination for. That includes -# Sendmail-style virtual domains hosted on this machine. +# machine considers itself the final destination for. # -# Do not include Postfix-style virtual domains - those domains are -# specified elsewhere (see sample-virtual.cf, and sample-transport.cf). +# These domains are routed to the delivery agent specified with the +# local_transport parameter setting. # # The default is $myhostname + localhost.$mydomain. On a mail domain -# gateway, you should also include $mydomain. Do not specify the -# names of domains that this machine is backup MX host for. Specify -# those names via the relay_domains or permit_mx_backup settings for -# the SMTP server (see sample-smtpd.cf). +# gateway, you should also include $mydomain. +# +# Do not specify the names of virtual domains - those domains are +# specified elsewhere (see sample-virtual.cf). +# +# Do not specify the names of domains that this machine is backup MX +# host for. Specify those names via the relay_domains settings for +# the SMTP server, or use permit_mx_backup if you are lazy (see +# sample-smtpd.cf). # # The local machine is always the final destination for mail addressed # to user@[the.net.work.address] of an interface that the mail system @@ -242,6 +246,16 @@ mail_owner = postfix #relayhost = uucphost #relayhost = [an.ip.add.ress] +# REJECTING UNKNOWN RELAY USERS +# +# The relay_recipient_maps parameter specifies optional lookup tables +# with all addresses in the domains that match $relay_domains. +# +# If this parameter is defined, then the SMTP server will reject +# mail for unknown relay users. +# +#relay_recipient_maps = hash:/etc/postfix/relay_recipients + # REJECTING UNKNOWN LOCAL USERS # # The local_recipient_maps parameter specifies optional lookup tables @@ -302,6 +316,7 @@ mail_owner = postfix # # The alias_maps parameter specifies the list of alias databases used # by the local delivery agent. The default list is system dependent. +# # On systems with NIS, the default is to search the local alias # database, then the NIS alias database. See aliases(5) for syntax # details. diff --git a/postfix/conf/sample-misc.cf b/postfix/conf/sample-misc.cf index ea626cb96..44042f6bf 100644 --- a/postfix/conf/sample-misc.cf +++ b/postfix/conf/sample-misc.cf @@ -41,7 +41,9 @@ berkeley_db_read_buffer_size = 131072 #default_database_type = dbm # The default_transport parameter specifies the default message -# delivery transport to use when no transport is explicitly given in +# delivery transport for domains that do not match mydestination, +# inet_interfaces, virtual_alias_domains, virtual_mailbox_domains, +# relay_domains, and for which no transport is explicitly given in # the optional transport(5) table. # # Specify a string of the form transport:nexthop, where transport is @@ -195,17 +197,21 @@ max_idle = 100s max_use = 100 # The mydestination parameter specifies the list of domains that this -# machine considers itself the final destination for. That includes -# Sendmail-style virtual domains hosted on this machine. +# machine considers itself the final destination for. # -# Do not include Postfix-style virtual domains - those domains are -# specified elsewhere (see sample-virtual.cf, and sample-transport.cf). +# These domains are routed to the delivery agent specified with the +# local_transport parameter setting. # # The default is $myhostname + localhost.$mydomain. On a mail domain -# gateway, you should also include $mydomain. Do not specify the -# names of domains that this machine is backup MX host for. Specify -# those names via the relay_domains or permit_mx_backup settings for -# the SMTP server (see sample-smtpd.cf). +# gateway, you should also include $mydomain. +# +# Do not specify the names of virtual domains - those domains are +# specified elsewhere (see sample-virtual.cf). +# +# Do not specify the names of domains that this machine is backup MX +# host for. Specify those names via the relay_domains settings for +# the SMTP server, or use permit_mx_backup if you are lazy (see +# sample-smtpd.cf). # # The local machine is always the final destination for mail addressed # to user@[the.net.work.address] of an interface that the mail system diff --git a/postfix/conf/sample-smtpd.cf b/postfix/conf/sample-smtpd.cf index c5e6a8a62..673b7a59a 100644 --- a/postfix/conf/sample-smtpd.cf +++ b/postfix/conf/sample-smtpd.cf @@ -406,6 +406,9 @@ allow_untrusted_routing = no # and restricts what destination domains (and subdomains thereof) # this system will relay mail to. # +# These domains are routed to the delivery agent specified with the +# relay_transport parameter setting. +# # By default, Postfix relays mail # - from trusted clients whose IP address matches $mynetworks, # - from untrusted clients to destinations that match $relay_domains diff --git a/postfix/conf/sample-virtual.cf b/postfix/conf/sample-virtual.cf index 601d485ee..e54db815c 100644 --- a/postfix/conf/sample-virtual.cf +++ b/postfix/conf/sample-virtual.cf @@ -4,19 +4,20 @@ # This file contains example settings of Postfix configuration # parameters that control virtual alias database lookups. -# This file describes settings for simulated virtual domains. These -# are domains for which all mail is aliased to one or more local or -# remote addresses. For details, see the virtual(5) manual page. +# This file describes configuration settings that can be used for +# aliasing and for implementing SIMULATED VIRTUAL DOMAINS (domains +# for which all mail is aliased to one or more local or remote +# addresses). For details, see the virtual(5) manual page. # -# If you need virtual domains where each virtual address can have -# its own mailbox, then you should use the virtual(8) delivery agent -# instead. For details, see the VIRTUAL_README file. +# If you need TRUE VIRTUAL DOMAINS (domains where each virtual address +# can have its own mailbox), then you should use the virtual(8) +# delivery agent instead. For details, see the VIRTUAL_README file. # The virtual_alias_maps parameter specifies optional lookup tables to -# redirect specific addresses or even complete domains to another +# alias specific addresses or even complete domains to another # address. This is typically used to simulate virtual domain support. # -# By default, no address redirection is done. +# By default, no address aliasing is done. # # If you use this feature, run "postmap /etc/postfix/virtual" to # build the necessary DBM or DB file after change. diff --git a/postfix/conf/transport b/postfix/conf/transport index 8cf9d9a7e..becab48af 100644 --- a/postfix/conf/transport +++ b/postfix/conf/transport @@ -59,6 +59,28 @@ # "do not change": use the delivery transport and nexthop # information that would be used if no match were found. # +# TRANSPORT FIELD +# The transport field specifies the name of a mail delivery +# transport (the first name of a mail delivery service entry +# in the Postfix master.cf file). +# +# When a null transport field is specified, Postfix uses one +# of the following transports: +# +# $local_transport +# The domain matches $mydestination or $inet_inter- +# faces. +# +# $virtual_transport +# The domain matches $virtual_mailbox_domains. +# +# $relay_transport +# The domain matches $relay_transport. +# +# $default_transport +# All other non-local, non-virtual destinations. +# +# NEXTHOP FIELD # The interpretation of the nexthop field is transport # dependent. In the case of SMTP, specify host:service for a # non-default server port, and use [host] or [host]:port in @@ -66,6 +88,7 @@ # form can also be used with IP addresses instead of host- # names. # +# LOOKUP ORDER # With lookups from indexed files such as DB or DBM, or from # networked tables such as NIS, LDAP or SQL, patterns are # tried in the order as listed below: @@ -123,64 +146,63 @@ # # foo.org slow: # -# When no transport is specified, Postfix uses either -# $local_transport or $default_transport, depending on -# whether the destination matches $mydestination. The fol- -# lowing sends all mail for foo.org and its subdomains to -# host gateway.foo.org: +# When no transport is specified, Postfix uses the transport +# that matches the address domain class (see TRANSPORT FIELD +# discussion above). The following sends all mail for +# foo.org and its subdomains to host gateway.foo.org: # # foo.org :[gateway.foo.org] # .foo.org :[gateway.foo.org] # -# In the above example, the [] are used to suppress MX -# lookups. The result would likely point to your local +# In the above example, the [] are used to suppress MX +# lookups. The result would likely point to your local # machine. # -# In the case of delivery via SMTP, one may specify host- +# In the case of delivery via SMTP, one may specify host- # name:service instead of just a host: # # foo.org smtp:bar.org:2025 # -# This directs mail for user@foo.org to host bar.org port -# 2025. Instead of a numerical port a symbolic name may be -# used. Specify [] around the hostname in order to disable +# This directs mail for user@foo.org to host bar.org port +# 2025. Instead of a numerical port a symbolic name may be +# used. Specify [] around the hostname in order to disable # MX lookups. # # The error mailer can be used to bounce mail: # -# .foo.org error:mail for *.foo.org is not deliv- +# .foo.org error:mail for *.foo.org is not deliv- # erable # -# This causes all mail for user@anything.foo.org to be +# This causes all mail for user@anything.foo.org to be # bounced. # # REGULAR EXPRESSION TABLES -# This section describes how the table lookups change when +# This section describes how the table lookups change when # the table is given in the form of regular expressions. For -# a description of regular expression lookup table syntax, +# a description of regular expression lookup table syntax, # see regexp_table(5) or pcre_table(5). # -# Each pattern is a regular expression that is applied to +# Each pattern is a regular expression that is applied to # the entire domain being looked up. Thus, some.domain.hier- # archy is not broken up into parent domains. # -# Patterns are applied in the order as specified in the -# table, until a pattern is found that matches the search +# Patterns are applied in the order as specified in the +# table, until a pattern is found that matches the search # string. # -# Results are the same as with indexed file lookups, with -# the additional feature that parenthesized substrings from +# Results are the same as with indexed file lookups, with +# the additional feature that parenthesized substrings from # the pattern can be interpolated as $1, $2 and so on. # # CONFIGURATION PARAMETERS -# The following main.cf parameters are especially relevant -# to this topic. See the Postfix main.cf file for syntax -# details and for default values. Use the postfix reload +# The following main.cf parameters are especially relevant +# to this topic. See the Postfix main.cf file for syntax +# details and for default values. Use the postfix reload # command after a configuration change. # # parent_domain_matches_subdomains -# List of Postfix features that use domain.tld pat- -# terns to match sub.domain.tld (as opposed to +# List of Postfix features that use domain.tld pat- +# terns to match sub.domain.tld (as opposed to # requiring .domain.tld patterns). # # transport_maps @@ -189,14 +211,21 @@ # Other parameters of interest: # # local_transport -# The mail delivery transport to use when no trans- -# port is explicitly specified, and the destination -# matches $mydestination. +# The default mail delivery transport when the desti- +# nation matches $mydestination or $inet_interfaces. +# +# virtual_transport +# The default mail delivery transport when the desti- +# nation matches virtual_mailbox_domains. +# +# relay_transport +# The default mail delivery transport when the desti- +# nation matches relay_domains. # # default_transport -# The mail delivery transport to use when no trans- -# port is explicitly specified, and the destination -# does not match $mydestination. +# The default mail delivery transport when the desti- +# nation does not match a local, virtual or relay +# destination. # # mydestination # The destinations that are given to $local_transport @@ -204,7 +233,8 @@ # # relayhost # The default host for destinations that do not match -# $mydestination. +# $mydestination, $inet_interfaces, vir- +# tual_alias_domains or virtual_mailbox_domains. # # SEE ALSO # postmap(1) create mapping table diff --git a/postfix/conf/virtual b/postfix/conf/virtual index b524bcdc6..c04f06c31 100644 --- a/postfix/conf/virtual +++ b/postfix/conf/virtual @@ -12,9 +12,17 @@ # # DESCRIPTION # The optional virtual alias table specifies address alias- -# ing for local and non-local recipients. Virtual aliasing -# is used by the cleanup(8) daemon. Virtual aliasing is -# recursive. +# ing for arbitrary local or non-local recipient addresses. +# Virtual aliasing is recursive, and is done by the Postfix +# cleanup(8) daemon. +# +# The main applications of virtual aliasing are: +# +# o To redirect mail from one address to one or more +# other addresses. +# +# o To simulate virtual domains where all virtual +# addresses are aliased to non-virtual addresses. # # Virtual aliasing is applied only to recipient envelope # addresses, and does not affect message headers. Think @@ -52,8 +60,8 @@ # With a simulated virtual domain, the virtual domain has # its own user name space. Local (i.e. non-virtual) user- # names are not visible in a simulated virtual domain. In -# particular, local aliases(5) and mailing lists are not -# visible as localname@virtual.domain. +# particular, local aliases(5) and local mailing lists are +# not visible as localname@simulated.domain. # # Support for a simulated virtual domain looks like: # @@ -65,21 +73,21 @@ # types. # # /etc/postfix/virtual: -# virtual.domain anything (right-hand content does not matter) -# postmaster@virtual.domain postmaster -# user1@virtual.domain address1 -# user2@virtual.domain address2, address3 +# simulated.domain anything (right-hand content does not matter) +# postmaster@simulated.domain postmaster +# user1@simulated.domain address1 +# user2@simulated.domain address2, address3 # -# The virtual.domain anything entry is required for a simu- -# lated virtual domain. Without this entry, mail will be +# The simulated.domain anything entry is required for a sim- +# ulated virtual domain. Without this entry, mail will be # rejected with a "relay access denied" error condition. # # Do not list a simulated virtual domain name in the main.cf # mydestination configuration parameter. # # With a simulated virtual domain, the Postfix SMTP server -# accepts mail for known-user@virtual.domain, and rejects -# mail for unknown-user@virtual.domain as undeliverable. +# accepts mail for known-user@simulated.domain, and rejects +# mail for unknown-user@simulated.domain as undeliverable. # # Instead of specifying the simulated virtual domain name # via the virtual_alias_maps table, you may also specify it @@ -187,7 +195,8 @@ # local. # # myorigin -# The domain that is appended to locally-posted mail. +# The domain that is appended to any address that +# does not have a domain. # # owner_request_special # Give special treatment to owner-xxx and xxx-request @@ -196,8 +205,8 @@ # SEE ALSO # cleanup(8) canonicalize and enqueue mail # postmap(1) create mapping table -# pcre_table(5) format of PCRE tables -# regexp_table(5) format of POSIX regular expression tables +# regexp_table(5) POSIX regular expression table format +# pcre_table(5) Perl Compatible Regular Expression table format # # LICENSE # The Secure Mailer license must be distributed with this diff --git a/postfix/html/aliases.5.html b/postfix/html/aliases.5.html index 2992fc0c4..fae204825 100644 --- a/postfix/html/aliases.5.html +++ b/postfix/html/aliases.5.html @@ -1,5 +1,4 @@
-
 ALIASES(5)                                             ALIASES(5)
 
 NAME
@@ -129,12 +128,19 @@ ALIASES(5)                                             ALIASES(5)
               Delimiter  that  separates  recipients from address
               extensions.
 
+BUGS
+       Regular expression alias lookup tables  are  allowed,  but
+       substitution  of  $1  etc. is forbidden because that would
+       open a security loophole.
+
 STANDARDS
        RFC 822 (ARPA Internet Text Messages)
 
 SEE ALSO
        local(8) local delivery agent
-       postalias(1) alias database management
+       newaliases(1) alias database management
+       regexp_table(5) POSIX regular expression table format
+       pcre_table(5) Perl Compatible Regular Expression table format
 
 LICENSE
        The Secure Mailer license must be  distributed  with  this
@@ -146,6 +152,5 @@ ALIASES(5)                                             ALIASES(5)
        P.O. Box 704
        Yorktown Heights, NY 10598, USA
 
-                                                                1
-
+                                                       ALIASES(5)
 
diff --git a/postfix/html/cleanup.8.html b/postfix/html/cleanup.8.html index 74aa675db..1c7326f38 100644 --- a/postfix/html/cleanup.8.html +++ b/postfix/html/cleanup.8.html @@ -209,7 +209,7 @@ CLEANUP(8) CLEANUP(8) qmgr(8) queue manager daemon syslogd(8) system logging trivial-rewrite(8) address rewriting - virtual(5) virtual address lookup table format + virtual(5) virtual alias lookup table format FILES /etc/postfix/canonical*, canonical mapping table diff --git a/postfix/html/postfix.1.html b/postfix/html/postfix.1.html index 78adcb06a..2d2e98b3d 100644 --- a/postfix/html/postfix.1.html +++ b/postfix/html/postfix.1.html @@ -141,7 +141,14 @@ POSTFIX(1) POSTFIX(1) $config_directory/master.cf, Postfix daemon processes SEE ALSO - master(8) Postfix master program + postconf(1) Postfix configuration management + postsuper(1) Postfix housekeeping + sendmail(1) Sendmail-compatible interface + postmap(1) Postfix lookup table management + master(8) Postfix master daemon + The respective manual pages for the daemon processes spec- + ified in the master.cf file, and the manual pages refer- + enced by those manual pages. LICENSE The Secure Mailer license must be distributed with this diff --git a/postfix/html/smtpd.8.html b/postfix/html/smtpd.8.html index 36109d05e..7d1221af6 100644 --- a/postfix/html/smtpd.8.html +++ b/postfix/html/smtpd.8.html @@ -151,21 +151,27 @@ SMTPD(8) SMTPD(8) defined, then the SMTP server rejects mail for unknown local users. + relay_recipient_maps + List of maps that define all the email addresses in + the domains that match $relay_domains. If this + parameter is defined, then the SMTP server rejects + mail for unknown relay recipients. + notify_classes List of error classes. Of special interest are: - policy When a client violates any policy, mail a + policy When a client violates any policy, mail a transcript of the entire SMTP session to the postmaster. protocol - When a client violates the SMTP protocol or + When a client violates the SMTP protocol or issues an unimplemented command, mail a transcript of the entire SMTP session to the postmaster. smtpd_banner - Text that follows the 220 status code in the SMTP + Text that follows the 220 status code in the SMTP greeting banner. smtpd_expansion_filter @@ -173,25 +179,25 @@ SMTPD(8) SMTPD(8) expansion of rbl template responses and other text. smtpd_recipient_limit - Restrict the number of recipients that the SMTP + Restrict the number of recipients that the SMTP server accepts per message delivery. smtpd_timeout - Limit the time to send a server response and to + Limit the time to send a server response and to receive a client request. soft_bounce - Change hard (5xx) reject responses into soft (4xx) - reject responses. This can be useful for testing + Change hard (5xx) reject responses into soft (4xx) + reject responses. This can be useful for testing purposes. verp_delimiter_filter - The characters that Postfix accepts as VERP delim- + The characters that Postfix accepts as VERP delim- iter characters. Resource controls line_length_limit - Limit the amount of memory in bytes used for the + Limit the amount of memory in bytes used for the handling of partial input lines. message_size_limit @@ -199,8 +205,8 @@ SMTPD(8) SMTPD(8) ing on-disk storage for envelope information. queue_minfree - Minimal amount of free space in bytes in the queue - file system for the SMTP server to accept any mail + Minimal amount of free space in bytes in the queue + file system for the SMTP server to accept any mail at all. smtpd_history_flush_threshold @@ -215,23 +221,23 @@ SMTPD(8) SMTPD(8) smtpd_soft_error_limit When an SMTP client has made this number of errors, - wait error_count seconds before responding to any + wait error_count seconds before responding to any client request. smtpd_hard_error_limit - Disconnect after a client has made this number of + Disconnect after a client has made this number of errors. smtpd_junk_command_limit Limit the number of times a client can issue a junk - command such as NOOP, VRFY, ETRN or RSET in one - SMTP session before it is penalized with tarpit + command such as NOOP, VRFY, ETRN or RSET in one + SMTP session before it is penalized with tarpit delays. UCE control restrictions parent_domain_matches_subdomains - List of Postfix features that use domain.tld pat- - terns to match sub.domain.tld (as opposed to + List of Postfix features that use domain.tld pat- + terns to match sub.domain.tld (as opposed to requiring .domain.tld patterns). smtpd_client_restrictions @@ -239,19 +245,19 @@ SMTPD(8) SMTPD(8) tem. smtpd_helo_required - Require that clients introduce themselves at the + Require that clients introduce themselves at the beginning of an SMTP session. smtpd_helo_restrictions - Restrict what client hostnames are allowed in HELO + Restrict what client hostnames are allowed in HELO and EHLO commands. smtpd_sender_restrictions - Restrict what sender addresses are allowed in MAIL + Restrict what sender addresses are allowed in MAIL FROM commands. smtpd_recipient_restrictions - Restrict what recipient addresses are allowed in + Restrict what recipient addresses are allowed in RCPT TO commands. smtpd_etrn_restrictions @@ -259,40 +265,41 @@ SMTPD(8) SMTPD(8) mands, and what clients may issue ETRN commands. smtpd_data_restrictions - Restrictions on the DATA command. Currently, the - only restriction that makes sense here is + Restrictions on the DATA command. Currently, the + only restriction that makes sense here is reject_unauth_pipelining. allow_untrusted_routing - Allow untrusted clients to specify addresses with - sender-specified routing. Enabling this opens up - nasty relay loopholes involving trusted backup MX + Allow untrusted clients to specify addresses with + sender-specified routing. Enabling this opens up + nasty relay loopholes involving trusted backup MX hosts. smtpd_restriction_classes - Declares the name of zero or more parameters that - contain a list of UCE restrictions. The names of - these parameters can then be used instead of the + Declares the name of zero or more parameters that + contain a list of UCE restrictions. The names of + these parameters can then be used instead of the restriction lists that they represent. smtpd_null_access_lookup_key - The lookup key to be used in SMTPD access tables - instead of the null sender address. A null sender + The lookup key to be used in SMTPD access tables + instead of the null sender address. A null sender address cannot be looked up. maps_rbl_domains (deprecated) - List of DNS domains that publish the addresses of + List of DNS domains that publish the addresses of blacklisted hosts. This is used with the deprecated reject_maps_rbl restriction. permit_mx_backup_networks - Only domains whose primary MX hosts match the - listed networks are eligible for the per- + Only domains whose primary MX hosts match the + listed networks are eligible for the per- mit_mx_backup feature. relay_domains - Restrict what domains or networks this mail system - will relay mail from or to. + Restrict what domains this mail system will relay + mail to. The domains are routed to the delivery + agent specified with the relay_transport setting. UCE control responses access_map_reject_code @@ -345,6 +352,7 @@ SMTPD(8) SMTPD(8) reject_unknown_hostname restriction. SEE ALSO + trivial-rewrite(8) address resolver cleanup(8) message canonicalization master(8) process manager syslogd(8) system logging diff --git a/postfix/html/transport.5.html b/postfix/html/transport.5.html index a826316b1..1a8b4c093 100644 --- a/postfix/html/transport.5.html +++ b/postfix/html/transport.5.html @@ -60,13 +60,36 @@ TRANSPORT(5) TRANSPORT(5) "do not change": use the delivery transport and nexthop information that would be used if no match were found. - The interpretation of the nexthop field is transport +TRANSPORT FIELD + The transport field specifies the name of a mail delivery + transport (the first name of a mail delivery service entry + in the Postfix master.cf file). + + When a null transport field is specified, Postfix uses one + of the following transports: + + $local_transport + The domain matches $mydestination or $inet_inter- + faces. + + $virtual_transport + The domain matches $virtual_mailbox_domains. + + $relay_transport + The domain matches $relay_transport. + + $default_transport + All other non-local, non-virtual destinations. + +NEXTHOP FIELD + The interpretation of the nexthop field is transport dependent. In the case of SMTP, specify host:service for a non-default server port, and use [host] or [host]:port in order to disable MX (mail exchanger) DNS lookups. The [] form can also be used with IP addresses instead of host- names. +LOOKUP ORDER With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: @@ -115,7 +138,7 @@ TRANSPORT(5) TRANSPORT(5) foo.org uucp:foo .foo.org uucp:foo - When no nexthop host name is specified, the destination + When no nexthop host name is specified, the destination domain name is used instead. For example, the following directs mail for user@foo.org via the slow transport to a mail exchanger for foo.org. The slow transport could be @@ -124,64 +147,63 @@ TRANSPORT(5) TRANSPORT(5) foo.org slow: - When no transport is specified, Postfix uses either - $local_transport or $default_transport, depending on - whether the destination matches $mydestination. The fol- - lowing sends all mail for foo.org and its subdomains to - host gateway.foo.org: + When no transport is specified, Postfix uses the transport + that matches the address domain class (see TRANSPORT FIELD + discussion above). The following sends all mail for + foo.org and its subdomains to host gateway.foo.org: foo.org :[gateway.foo.org] .foo.org :[gateway.foo.org] - In the above example, the [] are used to suppress MX - lookups. The result would likely point to your local + In the above example, the [] are used to suppress MX + lookups. The result would likely point to your local machine. - In the case of delivery via SMTP, one may specify host- + In the case of delivery via SMTP, one may specify host- name:service instead of just a host: foo.org smtp:bar.org:2025 - This directs mail for user@foo.org to host bar.org port - 2025. Instead of a numerical port a symbolic name may be - used. Specify [] around the hostname in order to disable + This directs mail for user@foo.org to host bar.org port + 2025. Instead of a numerical port a symbolic name may be + used. Specify [] around the hostname in order to disable MX lookups. The error mailer can be used to bounce mail: - .foo.org error:mail for *.foo.org is not deliv- + .foo.org error:mail for *.foo.org is not deliv- erable - This causes all mail for user@anything.foo.org to be + This causes all mail for user@anything.foo.org to be bounced. REGULAR EXPRESSION TABLES - This section describes how the table lookups change when + This section describes how the table lookups change when the table is given in the form of regular expressions. For - a description of regular expression lookup table syntax, + a description of regular expression lookup table syntax, see regexp_table(5) or pcre_table(5). - Each pattern is a regular expression that is applied to + Each pattern is a regular expression that is applied to the entire domain being looked up. Thus, some.domain.hier- archy is not broken up into parent domains. - Patterns are applied in the order as specified in the - table, until a pattern is found that matches the search + Patterns are applied in the order as specified in the + table, until a pattern is found that matches the search string. - Results are the same as with indexed file lookups, with - the additional feature that parenthesized substrings from + Results are the same as with indexed file lookups, with + the additional feature that parenthesized substrings from the pattern can be interpolated as $1, $2 and so on. CONFIGURATION PARAMETERS - The following main.cf parameters are especially relevant - to this topic. See the Postfix main.cf file for syntax - details and for default values. Use the postfix reload + The following main.cf parameters are especially relevant + to this topic. See the Postfix main.cf file for syntax + details and for default values. Use the postfix reload command after a configuration change. parent_domain_matches_subdomains - List of Postfix features that use domain.tld pat- - terns to match sub.domain.tld (as opposed to + List of Postfix features that use domain.tld pat- + terns to match sub.domain.tld (as opposed to requiring .domain.tld patterns). transport_maps @@ -190,14 +212,21 @@ TRANSPORT(5) TRANSPORT(5) Other parameters of interest: local_transport - The mail delivery transport to use when no trans- - port is explicitly specified, and the destination - matches $mydestination. + The default mail delivery transport when the desti- + nation matches $mydestination or $inet_interfaces. + + virtual_transport + The default mail delivery transport when the desti- + nation matches virtual_mailbox_domains. + + relay_transport + The default mail delivery transport when the desti- + nation matches relay_domains. default_transport - The mail delivery transport to use when no trans- - port is explicitly specified, and the destination - does not match $mydestination. + The default mail delivery transport when the desti- + nation does not match a local, virtual or relay + destination. mydestination The destinations that are given to $local_transport @@ -205,7 +234,8 @@ TRANSPORT(5) TRANSPORT(5) relayhost The default host for destinations that do not match - $mydestination. + $mydestination, $inet_interfaces, vir- + tual_alias_domains or virtual_mailbox_domains. SEE ALSO postmap(1) create mapping table diff --git a/postfix/html/virtual.5.html b/postfix/html/virtual.5.html index 96219ceb5..3c2df2719 100644 --- a/postfix/html/virtual.5.html +++ b/postfix/html/virtual.5.html @@ -13,9 +13,17 @@ VIRTUAL(5) VIRTUAL(5) DESCRIPTION The optional virtual alias table specifies address alias- - ing for local and non-local recipients. Virtual aliasing - is used by the cleanup(8) daemon. Virtual aliasing is - recursive. + ing for arbitrary local or non-local recipient addresses. + Virtual aliasing is recursive, and is done by the Postfix + cleanup(8) daemon. + + The main applications of virtual aliasing are: + + o To redirect mail from one address to one or more + other addresses. + + o To simulate virtual domains where all virtual + addresses are aliased to non-virtual addresses. Virtual aliasing is applied only to recipient envelope addresses, and does not affect message headers. Think @@ -53,8 +61,8 @@ VIRTUAL(5) VIRTUAL(5) With a simulated virtual domain, the virtual domain has its own user name space. Local (i.e. non-virtual) user- names are not visible in a simulated virtual domain. In - particular, local aliases(5) and mailing lists are not - visible as localname@virtual.domain. + particular, local aliases(5) and local mailing lists are + not visible as localname@simulated.domain. Support for a simulated virtual domain looks like: @@ -66,21 +74,21 @@ VIRTUAL(5) VIRTUAL(5) types. /etc/postfix/virtual: - virtual.domain anything (right-hand content does not matter) - postmaster@virtual.domain postmaster - user1@virtual.domain address1 - user2@virtual.domain address2, address3 + simulated.domain anything (right-hand content does not matter) + postmaster@simulated.domain postmaster + user1@simulated.domain address1 + user2@simulated.domain address2, address3 - The virtual.domain anything entry is required for a simu- - lated virtual domain. Without this entry, mail will be + The simulated.domain anything entry is required for a sim- + ulated virtual domain. Without this entry, mail will be rejected with a "relay access denied" error condition. Do not list a simulated virtual domain name in the main.cf mydestination configuration parameter. With a simulated virtual domain, the Postfix SMTP server - accepts mail for known-user@virtual.domain, and rejects - mail for unknown-user@virtual.domain as undeliverable. + accepts mail for known-user@simulated.domain, and rejects + mail for unknown-user@simulated.domain as undeliverable. Instead of specifying the simulated virtual domain name via the virtual_alias_maps table, you may also specify it @@ -188,7 +196,8 @@ VIRTUAL(5) VIRTUAL(5) local. myorigin - The domain that is appended to locally-posted mail. + The domain that is appended to any address that + does not have a domain. owner_request_special Give special treatment to owner-xxx and xxx-request @@ -197,8 +206,8 @@ VIRTUAL(5) VIRTUAL(5) SEE ALSO cleanup(8) canonicalize and enqueue mail postmap(1) create mapping table - pcre_table(5) format of PCRE tables - regexp_table(5) format of POSIX regular expression tables + regexp_table(5) POSIX regular expression table format + pcre_table(5) Perl Compatible Regular Expression table format LICENSE The Secure Mailer license must be distributed with this diff --git a/postfix/html/virtual.8.html b/postfix/html/virtual.8.html index 7050e88d6..93e15fd6a 100644 --- a/postfix/html/virtual.8.html +++ b/postfix/html/virtual.8.html @@ -116,7 +116,7 @@ VIRTUAL(8) VIRTUAL(8) boxes. While it could be set to "/", this setting isn't recommended. - virtual_mailbox_maps (regexp maps disallowed) + virtual_mailbox_maps Recipients are looked up in these maps to determine the path to their mailbox or maildir. If the returned path ends in a slash ("/"), maildir-style @@ -134,33 +134,43 @@ VIRTUAL(8) VIRTUAL(8) Note that virtual_mailbox_base is unconditionally prepended to this path. + For security reasons, regular expression maps are + allowed but regular expression substitution of $1 + etc. is disallowed, because that would open a secu- + rity hole. + virtual_mailbox_domains - The list of domains that should be delivered via - the Postfix virtual delivery agent. This uses the + The list of domains that should be delivered via + the Postfix virtual delivery agent. This uses the same syntax as the mydestination configuration parameter. virtual_minimum_uid - Specifies a minimum uid that will be accepted as a - return from a virtual_owner_maps or vir- - tual_uid_maps lookup. Returned values less than - this will be rejected, and the message will be + Specifies a minimum uid that will be accepted as a + return from a virtual_owner_maps or vir- + tual_uid_maps lookup. Returned values less than + this will be rejected, and the message will be deferred. - virtual_uid_maps (regexp maps disallowed) + virtual_uid_maps Recipients are looked up in these maps to determine - the user ID to be used when writing to the target + the user ID to be used when writing to the target mailbox. - While searching a lookup table, an address exten- + While searching a lookup table, an address exten- sion (user+foo@domain.tld) is ignored. - In a lookup table, specify a left-hand side of - @domain.tld to match any user in the specified - domain that does not have a specific + In a lookup table, specify a left-hand side of + @domain.tld to match any user in the specified + domain that does not have a specific user@domain.tld entry. - virtual_gid_maps (regexp maps disallowed) + For security reasons, regular expression maps are + allowed but regular expression substitution of $1 + etc. is disallowed, because that would open a secu- + rity hole. + + virtual_gid_maps Recipients are looked up in these maps to determine the group ID to be used when writing to the target mailbox. @@ -173,72 +183,79 @@ VIRTUAL(8) VIRTUAL(8) domain that does not have a specific user@domain.tld entry. + For security reasons, regular expression maps are + allowed but regular expression substitution of $1 + etc. is disallowed, because that would open a secu- + rity hole. + Locking controls virtual_mailbox_lock - How to lock UNIX-style mailboxes: one or more of - flock, fcntl or dotlock. The dotlock method - requires that the recipient UID or GID has write + How to lock UNIX-style mailboxes: one or more of + flock, fcntl or dotlock. The dotlock method + requires that the recipient UID or GID has write access to the parent directory of the mailbox file. - This setting is ignored with maildir style deliv- + This setting is ignored with maildir style deliv- ery, because such deliveries are safe without explicit locks. - Use the command postconf -l to find out what lock- + Use the command postconf -l to find out what lock- ing methods are available on your system. deliver_lock_attempts - Limit the number of attempts to acquire an exclu- + Limit the number of attempts to acquire an exclu- sive lock on a UNIX-style mailbox file. deliver_lock_delay Time (default: seconds) between successive attempts - to acquire an exclusive lock on a UNIX-style mail- - box file. The actual delay is slightly randomized. + to acquire an exclusive lock on a UNIX-style mail- + box file. The actual delay is slightly randomized. stale_lock_time - Limit the time after which a stale lockfile is - removed (applicable to UNIX-style mailboxes only). + Limit the time after which a stale lockfile is + removed (applicable to UNIX-style mailboxes only). Resource controls virtual_destination_concurrency_limit Limit the number of parallel deliveries to the same domain via the virtual delivery agent. The default limit is taken from the default_destination_concur- - rency_limit parameter. The limit is enforced by + rency_limit parameter. The limit is enforced by the Postfix queue manager. virtual_destination_recipient_limit Limit the number of recipients per message delivery - via the virtual delivery agent. The default limit - is taken from the default_destination_recipi- - ent_limit parameter. The limit is enforced by the + via the virtual delivery agent. The default limit + is taken from the default_destination_recipi- + ent_limit parameter. The limit is enforced by the Postfix queue manager. virtual_mailbox_limit - The maximal size in bytes of a mailbox or maildir + The maximal size in bytes of a mailbox or maildir file. Set to zero to disable the limit. HISTORY - This agent was originally based on the Postfix local + This agent was originally based on the Postfix local delivery agent. Modifications mainly consisted of removing - code that either was not applicable or that was not safe - in this context: aliases, ~user/.forward files, delivery + code that either was not applicable or that was not safe + in this context: aliases, ~user/.forward files, delivery to "|command" or to /file/name. - The Delivered-To: header appears in the qmail system by + The Delivered-To: header appears in the qmail system by Daniel Bernstein. - The maildir structure appears in the qmail system by + The maildir structure appears in the qmail system by Daniel Bernstein. SEE ALSO + regexp_table(5) POSIX regular expression table format + pcre_table(5) Perl Compatible Regular Expression table format bounce(8) non-delivery status reports syslogd(8) system logging qmgr(8) queue manager LICENSE - The Secure Mailer license must be distributed with this + The Secure Mailer license must be distributed with this software. AUTHOR(S) diff --git a/postfix/man/man1/postfix.1 b/postfix/man/man1/postfix.1 index 1b498e5e4..7e4ce0b95 100644 --- a/postfix/man/man1/postfix.1 +++ b/postfix/man/man1/postfix.1 @@ -124,7 +124,16 @@ $\fBconfig_directory/master.cf\fR, Postfix daemon processes .SH SEE ALSO .na .nf -master(8) Postfix master program +postconf(1) Postfix configuration management +postsuper(1) Postfix housekeeping +sendmail(1) Sendmail-compatible interface +postmap(1) Postfix lookup table management +master(8) Postfix master daemon +.ad +.fi +The respective manual pages for the daemon processes +specified in the \fBmaster.cf\fR file, and the manual +pages referenced by those manual pages. .SH LICENSE .na .nf diff --git a/postfix/man/man5/aliases.5 b/postfix/man/man5/aliases.5 index 394ad1178..959f12e12 100644 --- a/postfix/man/man5/aliases.5 +++ b/postfix/man/man5/aliases.5 @@ -118,6 +118,12 @@ Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR addresses. .IP \fBrecipient_delimiter\fR Delimiter that separates recipients from address extensions. +.SH BUGS +.ad +.fi +Regular expression alias lookup tables are allowed, but +substitution of $1 etc. is forbidden because that would +open a security loophole. .SH STANDARDS .na .nf @@ -126,7 +132,9 @@ RFC 822 (ARPA Internet Text Messages) .na .nf local(8) local delivery agent -postalias(1) alias database management +newaliases(1) alias database management +regexp_table(5) POSIX regular expression table format +pcre_table(5) Perl Compatible Regular Expression table format .SH LICENSE .na .nf diff --git a/postfix/man/man5/transport.5 b/postfix/man/man5/transport.5 index b883920a8..dc4ce468d 100644 --- a/postfix/man/man5/transport.5 +++ b/postfix/man/man5/transport.5 @@ -59,13 +59,34 @@ specifies where and how to deliver mail. A null \fItransport\fR or \fInexthop\fR field means "do not change": use the delivery transport and nexthop information that would be used if no match were found. -.PP -The interpretation of the \fInexthop\fR field is transport +.SH TRANSPORT FIELD +.ad +.fi +The transport field specifies the name of a mail delivery transport +(the first name of a mail delivery service entry in the Postfix +\fBmaster.cf\fR file). + +When a null transport field is specified, Postfix uses one of the +following transports: +.IP \fB$local_transport\fR +The domain matches \fB$mydestination\fR or \fB$inet_interfaces\fR. +.IP \fB$virtual_transport\fR +The domain matches \fB$virtual_mailbox_domains\fR. +.IP \fB$relay_transport\fR +The domain matches \fB$relay_transport\fR. +.IP \fB$default_transport\fR +All other non-local, non-virtual destinations. +.SH NEXTHOP FIELD +.ad +.fi +The interpretation of the nexthop field is transport dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR in order to disable MX (mail exchanger) DNS lookups. The [] form can also be used with IP addresses instead of hostnames. -.PP +.SH LOOKUP ORDER +.ad +.fi With lookups from indexed files such as DB or DBM, or from networked tables such as NIS, LDAP or SQL, patterns are tried in the order as listed below: @@ -121,7 +142,7 @@ via the \fBuucp\fR transport to the UUCP host named \fBfoo\fR: .ti +5 \fB\&.foo.org uucp:foo\fR -When no \fInexthop\fR host name is specified, the destination domain +When no nexthop host name is specified, the destination domain name is used instead. For example, the following directs mail for \fIuser\fR@\fBfoo.org\fR via the \fBslow\fR transport to a mail exchanger for \fBfoo.org\fR. The \fBslow\fR transport could be @@ -130,10 +151,9 @@ something that runs at most one delivery process at a time: .ti +5 \fBfoo.org slow:\fR -When no \fItransport\fR is specified, Postfix uses either -\fB$local_transport\fR or \fB$default_transport\fR, depending -on whether the destination matches \fB$mydestination\fR. -The following sends all mail for \fBfoo.org\fR and its +When no transport is specified, Postfix uses the transport that +matches the address domain class (see TRANSPORT FIELD discussion +above). The following sends all mail for \fBfoo.org\fR and its subdomains to host \fBgateway.foo.org\fR: .ti +5 @@ -199,17 +219,24 @@ List of transport lookup tables. .PP Other parameters of interest: .IP \fBlocal_transport\fR -The mail delivery transport to use when no transport is explicitly -specified, and the destination matches \fB$mydestination\fR. +The default mail delivery transport when the destination matches +\fB$mydestination\fR or \fB$inet_interfaces\fR. +.IP \fBvirtual_transport\fR +The default mail delivery transport when the destination matches +\fBvirtual_mailbox_domains\fR. +.IP \fBrelay_transport\fR +The default mail delivery transport when the destination matches +\fBrelay_domains\fR. .IP \fBdefault_transport\fR -The mail delivery transport to use when no transport is explicitly -specified, and the destination does not match \fB$mydestination\fR. +The default mail delivery transport when the destination does not +match a local, virtual or relay destination. .IP \fBmydestination\fR The destinations that are given to \fB$local_transport\fR by default. .IP \fBrelayhost\fR The default host for destinations that do not match -\fB$mydestination\fR. +\fB$mydestination\fR, \fB$inet_interfaces\fR, +\fBvirtual_alias_domains\fR or \fBvirtual_mailbox_domains\fR. .SH SEE ALSO .na .nf diff --git a/postfix/man/man5/virtual.5 b/postfix/man/man5/virtual.5 index f58126800..a51e79426 100644 --- a/postfix/man/man5/virtual.5 +++ b/postfix/man/man5/virtual.5 @@ -17,9 +17,16 @@ format of Postfix virtual alias table .ad .fi The optional \fBvirtual\fR alias table specifies address aliasing -for local and non-local recipients. Virtual aliasing is used -by the \fBcleanup\fR(8) daemon. Virtual aliasing is recursive. +for arbitrary local or non-local recipient addresses. Virtual aliasing +is recursive, and is done by the Postfix \fBcleanup\fR(8) daemon. +The main applications of virtual aliasing are: +.IP \(bu +To redirect mail from one address to one or more other addresses. +.IP \(bu +To simulate virtual domains where all virtual addresses are aliased +to non-virtual addresses. +.PP Virtual aliasing is applied only to recipient envelope addresses, and does not affect message headers. Think Sendmail rule set \fBS0\fR, if you like. Use \fBcanonical\fR(5) @@ -56,8 +63,8 @@ have its own mailbox. With a simulated virtual domain, the virtual domain has its own user name space. Local (i.e. non-virtual) usernames are not visible in a simulated virtual domain. In particular, local -\fBaliases\fR(5) and mailing lists are not visible as -\fIlocalname@virtual.domain\fR. +\fBaliases\fR(5) and local mailing lists are not visible as +\fIlocalname@simulated.domain\fR. Support for a simulated virtual domain looks like: @@ -72,16 +79,16 @@ See the output from \fBpostconf -m\fR for available database types. /etc/postfix/virtual: .nf .na -\fIvirtual.domain anything\fR (right-hand content does not matter) -\fIpostmaster@virtual.domain postmaster\fR -\fIuser1@virtual.domain address1\fR -\fIuser2@virtual.domain address2, address3\fR +\fIsimulated.domain anything\fR (right-hand content does not matter) +\fIpostmaster@simulated.domain postmaster\fR +\fIuser1@simulated.domain address1\fR +\fIuser2@simulated.domain address2, address3\fR .fi .in -4 .ad .fi .sp -The \fIvirtual.domain anything\fR entry is required for a +The \fIsimulated.domain anything\fR entry is required for a simulated virtual domain. Without this entry, mail will be rejected with a "relay access denied" error condition. @@ -89,8 +96,8 @@ Do not list a simulated virtual domain name in the \fBmain.cf mydestination\fR configuration parameter. With a simulated virtual domain, the Postfix SMTP server -accepts mail for \fIknown-user@virtual.domain\fR, and rejects -mail for \fIunknown-user\fR@\fIvirtual.domain\fR as undeliverable. +accepts mail for \fIknown-user@simulated.domain\fR, and rejects +mail for \fIunknown-user\fR@\fIsimulated.domain\fR as undeliverable. Instead of specifying the simulated virtual domain name via the \fBvirtual_alias_maps\fR table, you may also specify it via @@ -192,7 +199,7 @@ You need to stop and start Postfix when this parameter changes. .IP \fBmydestination\fR List of domains that this mail system considers local. .IP \fBmyorigin\fR -The domain that is appended to locally-posted mail. +The domain that is appended to any address that does not have a domain. .IP \fBowner_request_special\fR Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR addresses. @@ -201,8 +208,8 @@ addresses. .nf cleanup(8) canonicalize and enqueue mail postmap(1) create mapping table -pcre_table(5) format of PCRE tables -regexp_table(5) format of POSIX regular expression tables +regexp_table(5) POSIX regular expression table format +pcre_table(5) Perl Compatible Regular Expression table format .SH LICENSE .na .nf diff --git a/postfix/man/man8/cleanup.8 b/postfix/man/man8/cleanup.8 index 23a94f409..6f5e8f747 100644 --- a/postfix/man/man8/cleanup.8 +++ b/postfix/man/man8/cleanup.8 @@ -179,7 +179,7 @@ canonical(5) canonical address lookup table format qmgr(8) queue manager daemon syslogd(8) system logging trivial-rewrite(8) address rewriting -virtual(5) virtual address lookup table format +virtual(5) virtual alias lookup table format .SH FILES .na .nf diff --git a/postfix/man/man8/smtpd.8 b/postfix/man/man8/smtpd.8 index 3ba9a76bd..8914156c0 100644 --- a/postfix/man/man8/smtpd.8 +++ b/postfix/man/man8/smtpd.8 @@ -136,6 +136,10 @@ Limit the number of \fBReceived:\fR message headers. List of maps with user names that are local to \fB$myorigin\fR or \fB$inet_interfaces\fR. If this parameter is defined, then the SMTP server rejects mail for unknown local users. +.IP \fBrelay_recipient_maps\fR +List of maps that define all the email addresses in the domains +that match \fB$relay_domains\fR. If this parameter is defined, +then the SMTP server rejects mail for unknown relay recipients. .IP \fBnotify_classes\fR List of error classes. Of special interest are: .RS @@ -237,8 +241,9 @@ restriction. Only domains whose primary MX hosts match the listed networks are eligible for the \fBpermit_mx_backup\fR feature. .IP \fBrelay_domains\fR -Restrict what domains or networks this mail system will relay -mail from or to. +Restrict what domains this mail system will relay +mail to. The domains are routed to the delivery agent +specified with the \fBrelay_transport\fR setting. .SH "UCE control responses" .ad .fi @@ -279,6 +284,7 @@ restriction. .SH SEE ALSO .na .nf +trivial-rewrite(8) address resolver cleanup(8) message canonicalization master(8) process manager syslogd(8) system logging diff --git a/postfix/man/man8/virtual.8 b/postfix/man/man8/virtual.8 index 0111b3cae..802764920 100644 --- a/postfix/man/man8/virtual.8 +++ b/postfix/man/man8/virtual.8 @@ -135,7 +135,7 @@ Specifies a path that is prepended to all mailbox or maildir paths. This is a safety measure to ensure that an out of control map in \fBvirtual_mailbox_maps\fR doesn't litter the filesystem with mailboxes. While it could be set to "/", this setting isn't recommended. -.IP "\fBvirtual_mailbox_maps\fR (regexp maps disallowed)" +.IP \fBvirtual_mailbox_maps\fR Recipients are looked up in these maps to determine the path to their mailbox or maildir. If the returned path ends in a slash ("/"), maildir-style delivery is carried out, otherwise the @@ -150,6 +150,10 @@ specific \fIuser@domain.tld\fR entry. Note that \fBvirtual_mailbox_base\fR is unconditionally prepended to this path. + +For security reasons, regular expression maps are allowed but +regular expression substitution of $1 etc. is disallowed, +because that would open a security hole. .IP \fBvirtual_mailbox_domains\fR The list of domains that should be delivered via the Postfix virtual delivery agent. This uses the same syntax as the \fBmydestination\fR @@ -159,7 +163,7 @@ Specifies a minimum uid that will be accepted as a return from a \fBvirtual_owner_maps\fR or \fBvirtual_uid_maps\fR lookup. Returned values less than this will be rejected, and the message will be deferred. -.IP "\fBvirtual_uid_maps\fR (regexp maps disallowed)" +.IP \fBvirtual_uid_maps\fR Recipients are looked up in these maps to determine the user ID to be used when writing to the target mailbox. @@ -169,7 +173,11 @@ While searching a lookup table, an address extension In a lookup table, specify a left-hand side of \fI@domain.tld\fR to match any user in the specified domain that does not have a specific \fIuser@domain.tld\fR entry. -.IP "\fBvirtual_gid_maps\fR (regexp maps disallowed)" + +For security reasons, regular expression maps are allowed but +regular expression substitution of $1 etc. is disallowed, +because that would open a security hole. +.IP \fBvirtual_gid_maps\fR Recipients are looked up in these maps to determine the group ID to be used when writing to the target mailbox. @@ -179,6 +187,10 @@ While searching a lookup table, an address extension In a lookup table, specify a left-hand side of \fI@domain.tld\fR to match any user in the specified domain that does not have a specific \fIuser@domain.tld\fR entry. + +For security reasons, regular expression maps are allowed but +regular expression substitution of $1 etc. is disallowed, +because that would open a security hole. .SH "Locking controls" .ad .fi @@ -239,6 +251,8 @@ by Daniel Bernstein. .SH SEE ALSO .na .nf +regexp_table(5) POSIX regular expression table format +pcre_table(5) Perl Compatible Regular Expression table format bounce(8) non-delivery status reports syslogd(8) system logging qmgr(8) queue manager diff --git a/postfix/proto/Makefile.in b/postfix/proto/Makefile.in index fadc14678..503ae4368 100644 --- a/postfix/proto/Makefile.in +++ b/postfix/proto/Makefile.in @@ -22,25 +22,25 @@ clobber: rm -f $(CONFIG) ../conf/access: access - srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../mantools/srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ ../conf/aliases: aliases0 aliases - (cat aliases0; srctoman - aliases | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /') >$@ + (cat aliases0; ../mantools/srctoman - aliases | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /') >$@ ../conf/canonical: canonical - srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../mantools/srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ ../conf/pcre_table: pcre_table - srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../mantools/srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ ../conf/regexp_table: regexp_table - srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../mantools/srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ ../conf/relocated: relocated - srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../mantools/srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ ../conf/transport: transport - srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../mantools/srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ ../conf/virtual: virtual - srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ + ../mantools/srctoman - $? | $(AWK) | nroff -man | col -bx | uniq | sed 's/^/# /' >$@ diff --git a/postfix/proto/aliases b/postfix/proto/aliases index 4a53b7987..9d36381b5 100644 --- a/postfix/proto/aliases +++ b/postfix/proto/aliases @@ -108,11 +108,17 @@ # addresses. # .IP \fBrecipient_delimiter\fR # Delimiter that separates recipients from address extensions. +# BUGS +# Regular expression alias lookup tables are allowed, but +# substitution of $1 etc. is forbidden because that would +# open a security loophole. # STANDARDS # RFC 822 (ARPA Internet Text Messages) # SEE ALSO # local(8) local delivery agent -# postalias(1) alias database management +# newaliases(1) alias database management +# regexp_table(5) POSIX regular expression table format +# pcre_table(5) Perl Compatible Regular Expression table format # LICENSE # .ad # .fi diff --git a/postfix/proto/aliases0 b/postfix/proto/aliases0 index 9fcd48f7a..b00a3e1c8 100644 --- a/postfix/proto/aliases0 +++ b/postfix/proto/aliases0 @@ -8,6 +8,9 @@ # >>>>>>>>>> show through to Postfix. # +# Person who should get root's mail. Don't receive mail as root! +#root: you + # Basic system aliases -- these MUST be present MAILER-DAEMON: postmaster postmaster: root @@ -33,6 +36,3 @@ abuse: postmaster # trap decode to catch security attacks decode: root -# Person who should get root's mail -#root: you - diff --git a/postfix/proto/transport b/postfix/proto/transport index f17e39514..24de9edae 100644 --- a/postfix/proto/transport +++ b/postfix/proto/transport @@ -51,13 +51,34 @@ # or \fInexthop\fR field means "do not change": use the delivery # transport and nexthop information that would be used if no # match were found. -# .PP -# The interpretation of the \fInexthop\fR field is transport +# .SH TRANSPORT FIELD +# .ad +# .fi +# The transport field specifies the name of a mail delivery transport +# (the first name of a mail delivery service entry in the Postfix +# \fBmaster.cf\fR file). +# +# When a null transport field is specified, Postfix uses one of the +# following transports: +# .IP \fB$local_transport\fR +# The domain matches \fB$mydestination\fR or \fB$inet_interfaces\fR. +# .IP \fB$virtual_transport\fR +# The domain matches \fB$virtual_mailbox_domains\fR. +# .IP \fB$relay_transport\fR +# The domain matches \fB$relay_transport\fR. +# .IP \fB$default_transport\fR +# All other non-local, non-virtual destinations. +# .SH NEXTHOP FIELD +# .ad +# .fi +# The interpretation of the nexthop field is transport # dependent. In the case of SMTP, specify \fIhost\fR:\fIservice\fR for a # non-default server port, and use [\fIhost\fR] or [\fIhost\fR]:\fIport\fR # in order to disable MX (mail exchanger) DNS lookups. The [] form # can also be used with IP addresses instead of hostnames. -# .PP +# .SH LOOKUP ORDER +# .ad +# .fi # With lookups from indexed files such as DB or DBM, or from networked # tables such as NIS, LDAP or SQL, patterns are tried in the order as # listed below: @@ -109,7 +130,7 @@ # .ti +5 # \fB\&.foo.org uucp:foo\fR # -# When no \fInexthop\fR host name is specified, the destination domain +# When no nexthop host name is specified, the destination domain # name is used instead. For example, the following directs mail for # \fIuser\fR@\fBfoo.org\fR via the \fBslow\fR transport to a mail # exchanger for \fBfoo.org\fR. The \fBslow\fR transport could be @@ -118,10 +139,9 @@ # .ti +5 # \fBfoo.org slow:\fR # -# When no \fItransport\fR is specified, Postfix uses either -# \fB$local_transport\fR or \fB$default_transport\fR, depending -# on whether the destination matches \fB$mydestination\fR. -# The following sends all mail for \fBfoo.org\fR and its +# When no transport is specified, Postfix uses the transport that +# matches the address domain class (see TRANSPORT FIELD discussion +# above). The following sends all mail for \fBfoo.org\fR and its # subdomains to host \fBgateway.foo.org\fR: # # .ti +5 @@ -183,17 +203,24 @@ # .PP # Other parameters of interest: # .IP \fBlocal_transport\fR -# The mail delivery transport to use when no transport is explicitly -# specified, and the destination matches \fB$mydestination\fR. +# The default mail delivery transport when the destination matches +# \fB$mydestination\fR or \fB$inet_interfaces\fR. +# .IP \fBvirtual_transport\fR +# The default mail delivery transport when the destination matches +# \fBvirtual_mailbox_domains\fR. +# .IP \fBrelay_transport\fR +# The default mail delivery transport when the destination matches +# \fBrelay_domains\fR. # .IP \fBdefault_transport\fR -# The mail delivery transport to use when no transport is explicitly -# specified, and the destination does not match \fB$mydestination\fR. +# The default mail delivery transport when the destination does not +# match a local, virtual or relay destination. # .IP \fBmydestination\fR # The destinations that are given to \fB$local_transport\fR # by default. # .IP \fBrelayhost\fR # The default host for destinations that do not match -# \fB$mydestination\fR. +# \fB$mydestination\fR, \fB$inet_interfaces\fR, +# \fBvirtual_alias_domains\fR or \fBvirtual_mailbox_domains\fR. # SEE ALSO # postmap(1) create mapping table # trivial-rewrite(8) rewrite and resolve addresses diff --git a/postfix/proto/virtual b/postfix/proto/virtual index c1b4a6525..bfbd13103 100644 --- a/postfix/proto/virtual +++ b/postfix/proto/virtual @@ -11,9 +11,16 @@ # \fBpostmap -q - /etc/postfix/virtual <\fIinputfile\fR # DESCRIPTION # The optional \fBvirtual\fR alias table specifies address aliasing -# for local and non-local recipients. Virtual aliasing is used -# by the \fBcleanup\fR(8) daemon. Virtual aliasing is recursive. +# for arbitrary local or non-local recipient addresses. Virtual aliasing +# is recursive, and is done by the Postfix \fBcleanup\fR(8) daemon. # +# The main applications of virtual aliasing are: +# .IP \(bu +# To redirect mail from one address to one or more other addresses. +# .IP \(bu +# To simulate virtual domains where all virtual addresses are aliased +# to non-virtual addresses. +# .PP # Virtual aliasing is applied only to recipient # envelope addresses, and does not affect message headers. # Think Sendmail rule set \fBS0\fR, if you like. Use \fBcanonical\fR(5) @@ -48,8 +55,8 @@ # With a simulated virtual domain, the virtual domain has its # own user name space. Local (i.e. non-virtual) usernames are not # visible in a simulated virtual domain. In particular, local -# \fBaliases\fR(5) and mailing lists are not visible as -# \fIlocalname@virtual.domain\fR. +# \fBaliases\fR(5) and local mailing lists are not visible as +# \fIlocalname@simulated.domain\fR. # # Support for a simulated virtual domain looks like: # @@ -64,16 +71,16 @@ # /etc/postfix/virtual: # .nf # .na -# \fIvirtual.domain anything\fR (right-hand content does not matter) -# \fIpostmaster@virtual.domain postmaster\fR -# \fIuser1@virtual.domain address1\fR -# \fIuser2@virtual.domain address2, address3\fR +# \fIsimulated.domain anything\fR (right-hand content does not matter) +# \fIpostmaster@simulated.domain postmaster\fR +# \fIuser1@simulated.domain address1\fR +# \fIuser2@simulated.domain address2, address3\fR # .fi # .in -4 # .ad # .fi # .sp -# The \fIvirtual.domain anything\fR entry is required for a +# The \fIsimulated.domain anything\fR entry is required for a # simulated virtual domain. Without this entry, mail will # be rejected with a "relay access denied" error condition. # @@ -81,8 +88,8 @@ # mydestination\fR configuration parameter. # # With a simulated virtual domain, the Postfix SMTP server -# accepts mail for \fIknown-user@virtual.domain\fR, and rejects -# mail for \fIunknown-user\fR@\fIvirtual.domain\fR as undeliverable. +# accepts mail for \fIknown-user@simulated.domain\fR, and rejects +# mail for \fIunknown-user\fR@\fIsimulated.domain\fR as undeliverable. # # Instead of specifying the simulated virtual domain name via # the \fBvirtual_alias_maps\fR table, you may also specify it via @@ -174,15 +181,15 @@ # .IP \fBmydestination\fR # List of domains that this mail system considers local. # .IP \fBmyorigin\fR -# The domain that is appended to locally-posted mail. +# The domain that is appended to any address that does not have a domain. # .IP \fBowner_request_special\fR # Give special treatment to \fBowner-\fIxxx\fR and \fIxxx\fB-request\fR # addresses. # SEE ALSO # cleanup(8) canonicalize and enqueue mail # postmap(1) create mapping table -# pcre_table(5) format of PCRE tables -# regexp_table(5) format of POSIX regular expression tables +# regexp_table(5) POSIX regular expression table format +# pcre_table(5) Perl Compatible Regular Expression table format # LICENSE # .ad # .fi diff --git a/postfix/src/cleanup/cleanup.c b/postfix/src/cleanup/cleanup.c index ced120f2a..21438aa5b 100644 --- a/postfix/src/cleanup/cleanup.c +++ b/postfix/src/cleanup/cleanup.c @@ -163,7 +163,7 @@ /* qmgr(8) queue manager daemon /* syslogd(8) system logging /* trivial-rewrite(8) address rewriting -/* virtual(5) virtual address lookup table format +/* virtual(5) virtual alias lookup table format /* FILES /* /etc/postfix/canonical*, canonical mapping table /* /etc/postfix/virtual*, virtual mapping table diff --git a/postfix/src/dns/dns_lookup.c b/postfix/src/dns/dns_lookup.c index f5a62013a..4ff4fe2bd 100644 --- a/postfix/src/dns/dns_lookup.c +++ b/postfix/src/dns/dns_lookup.c @@ -400,7 +400,7 @@ static int dns_get_answer(DNS_REPLY *reply, int type, DNS_RR *rr; int resource_found = 0; int cname_found = 0; - int default_status = DNS_NOTFOUND; + int not_found_status = DNS_NOTFOUND; /* * Initialize. Skip over the name server query if we haven't yet. @@ -466,7 +466,7 @@ static int dns_get_answer(DNS_REPLY *reply, int type, resource_found++; *rrlist = dns_rr_append(*rrlist, rr); } else - default_status = DNS_RETRY; + not_found_status = DNS_RETRY; } else resource_found++; } else if (fixed.type == T_CNAME) { /* cname resource */ @@ -487,7 +487,7 @@ static int dns_get_answer(DNS_REPLY *reply, int type, return (DNS_OK); if (cname_found) return (DNS_RECURSE); - return (default_status); + return (not_found_status); } /* dns_lookup - DNS lookup user interface */ @@ -543,7 +543,9 @@ int dns_lookup(const char *name, unsigned type, unsigned flags, switch (status) { default: if (why) - vstring_sprintf(why, "%s: Malformed name server reply", name); + vstring_sprintf(why, "Name service error for name=%s type=%s: " + "Malformed name server reply", + name, dns_strtype(type)); case DNS_NOTFOUND: case DNS_OK: return (status); diff --git a/postfix/src/global/mail_params.c b/postfix/src/global/mail_params.c index 02a666a44..fd27b82d4 100644 --- a/postfix/src/global/mail_params.c +++ b/postfix/src/global/mail_params.c @@ -64,7 +64,6 @@ /* char *var_syslog_facility; /* char *var_relay_domains; /* char *var_fflush_domains; -/* char *var_def_transport; /* char *var_mynetworks_style; /* char *var_verp_delims; /* char *var_verp_filter; @@ -218,7 +217,6 @@ int var_daemon_timeout; char *var_syslog_facility; char *var_relay_domains; char *var_fflush_domains; -char *var_def_transport; char *var_mynetworks_style; char *var_verp_delims; char *var_verp_filter; @@ -452,7 +450,6 @@ void mail_params_init() VAR_FFLUSH_DOMAINS, DEF_FFLUSH_DOMAINS, &var_fflush_domains, 0, 0, VAR_EXPORT_ENVIRON, DEF_EXPORT_ENVIRON, &var_export_environ, 0, 0, VAR_IMPORT_ENVIRON, DEF_IMPORT_ENVIRON, &var_import_environ, 0, 0, - VAR_DEF_TRANSPORT, DEF_DEF_TRANSPORT, &var_def_transport, 0, 0, VAR_MYNETWORKS_STYLE, DEF_MYNETWORKS_STYLE, &var_mynetworks_style, 1, 0, VAR_DEBUG_PEER_LIST, DEF_DEBUG_PEER_LIST, &var_debug_peer_list, 0, 0, VAR_VERP_DELIMS, DEF_VERP_DELIMS, &var_verp_delims, 2, 2, diff --git a/postfix/src/global/mail_params.h b/postfix/src/global/mail_params.h index 0d6809c31..43ff78bf0 100644 --- a/postfix/src/global/mail_params.h +++ b/postfix/src/global/mail_params.h @@ -1115,6 +1115,10 @@ extern char *var_relay_domains; #define DEF_RELAY_TRANSPORT MAIL_SERVICE_RELAY extern char *var_relay_transport; +#define VAR_RELAY_RCPT_MAPS "relay_recipient_maps" +#define DEF_RELAY_RCPT_MAPS "" +extern char *var_relay_rcpt_maps; + #define VAR_CLIENT_CHECKS "smtpd_client_restrictions" #define DEF_CLIENT_CHECKS "" extern char *var_client_checks; diff --git a/postfix/src/global/mail_version.h b/postfix/src/global/mail_version.h index faff171ec..297ee6d68 100644 --- a/postfix/src/global/mail_version.h +++ b/postfix/src/global/mail_version.h @@ -20,7 +20,7 @@ * Patches change the patchlevel and the release date. Snapshots change the * release date only, unless they include the same bugfix as a patch release. */ -#define MAIL_RELEASE_DATE "20021207" +#define MAIL_RELEASE_DATE "20021208" #define VAR_MAIL_VERSION "mail_version" #define DEF_MAIL_VERSION "1.1.12-" MAIL_RELEASE_DATE diff --git a/postfix/src/global/maps.c b/postfix/src/global/maps.c index 84e8c4db3..82edbb0cc 100644 --- a/postfix/src/global/maps.c +++ b/postfix/src/global/maps.c @@ -29,6 +29,8 @@ /* locking. Dictionaries are opened read-only, and in-memory /* dictionary instances are shared. /* +/* Lookups are case sensitive. +/* /* maps_create() takes list of type:name pairs and opens the /* named dictionaries. /* The result is a handle that must be specified along with all diff --git a/postfix/src/global/resolve_clnt.c b/postfix/src/global/resolve_clnt.c index 229444de9..219f678bd 100644 --- a/postfix/src/global/resolve_clnt.c +++ b/postfix/src/global/resolve_clnt.c @@ -52,6 +52,28 @@ /* The address resolved to something that has invalid syntax. /* .IP RESOLVE_FLAG_FAIL /* The request could not be completed. +/* .PP +/* In addition, the address domain class is returned by setting +/* one of the following flags (this is preliminary code awaiting +/* more permanent implementation of address domain class handling): +/* .IP RESOLVE_CLASS_LOCAL +/* The address domain matches $mydestination or $inet_interfaces. +/* .IP RESOLVE_CLASS_ALIAS +/* The address domain matches $virtual_alias_domains (simulated +/* virtual domains, where each address is redirected to a real +/* local or remote address). +/* .IP RESOLVE_CLASS_VIRTUAL +/* The address domain matches $virtual_mailbox_domains (true +/* virtual domains where each address can have its own mailbox). +/* .IP RESOLVE_CLASS_RELAY +/* The address domain matches $relay_domains, i.e. this is an +/* authorized mail relay destination. +/* .IP RESOLVE_CLASS_DEFAULT +/* The address matches none of the above. Access to this domain +/* should be limited to authorized senders only. +/* .PP +/* For convenience, the constant RESOLVE_CLASS_FINAL includes all +/* cases where the local machine is the final destination. /* DIAGNOSTICS /* Warnings: communication failure. Fatal error: mail system is down. /* SEE ALSO diff --git a/postfix/src/global/resolve_clnt.h b/postfix/src/global/resolve_clnt.h index 739abee7d..6f7264b0b 100644 --- a/postfix/src/global/resolve_clnt.h +++ b/postfix/src/global/resolve_clnt.h @@ -27,11 +27,14 @@ #define RESOLVE_FLAG_FAIL (1<<3) /* request failed */ #define RESOLVE_CLASS_LOCAL (1<<8) /* mydestination/inet_interfaces */ -#define RESOLVE_CLASS_ERROR (1<<9) /* virtual_alias_domains */ +#define RESOLVE_CLASS_ALIAS (1<<9) /* virtual_alias_domains */ #define RESOLVE_CLASS_VIRTUAL (1<<10) /* virtual_mailbox_domains */ #define RESOLVE_CLASS_RELAY (1<<11) /* relay_domains */ #define RESOLVE_CLASS_DEFAULT (1<<12) /* raise reject_unauth_destination */ +#define RESOLVE_CLASS_FINAL \ + (RESOLVE_CLASS_LOCAL | RESOLVE_CLASS_ALIAS | RESOLVE_CLASS_VIRTUAL) + typedef struct RESOLVE_REPLY { VSTRING *transport; VSTRING *nexthop; diff --git a/postfix/src/global/virtual8_maps_find.c b/postfix/src/global/virtual8_maps_find.c index 135507472..321e0fb4c 100644 --- a/postfix/src/global/virtual8_maps_find.c +++ b/postfix/src/global/virtual8_maps_find.c @@ -22,6 +22,8 @@ /* agent. The code is made available as a library module so that /* other programs can perform compatible queries. /* +/* Lookups are case sensitive. +/* /* virtual8_maps_create() takes list of type:name pairs and opens the /* named dictionaries. /* The result is a handle that must be specified along with all @@ -111,7 +113,7 @@ const char *virtual8_maps_find(MAPS *maps, const char *recipient) } /* - * Look up the full address. + * Look up the full address. Allow regexp table searches. */ if (bare == 0) { result = maps_find(maps, recipient, DICT_FLAG_NONE); @@ -147,7 +149,7 @@ int main(int argc, char **argv) var_rcpt_delim = "+"; var_double_bounce_sender = DEF_DOUBLE_BOUNCE; - maps = maps_create("testmap", argv[1], DICT_FLAG_LOCK); + maps = virtual8_maps_create("testmap", argv[1], DICT_FLAG_LOCK); buffer = vstring_alloc(1); while (vstring_fgets_nonl(buffer, VSTREAM_IN)) { @@ -155,7 +157,7 @@ int main(int argc, char **argv) vstream_printf("%s -> %s\n", STR(buffer), result ? result : "(none)"); vstream_fflush(VSTREAM_OUT); } - maps_free(maps); + virtual8_maps_free(maps); vstring_free(buffer); return (0); } diff --git a/postfix/src/local/alias.c b/postfix/src/local/alias.c index 814af40cc..362b26df8 100644 --- a/postfix/src/local/alias.c +++ b/postfix/src/local/alias.c @@ -183,8 +183,6 @@ int deliver_alias(LOCAL_STATE state, USER_ATTR usr_attr, * With aliases that have an owner- alias, the latter is used to set the * sender and owner attributes. Otherwise, the owner attribute is reset * (the alias is globally visible and could be sent to by anyone). - * - * Don't allow regexp substitutions. */ for (cpp = alias_maps->argv->argv; *cpp; cpp++) { if ((dict = dict_handle(*cpp)) == 0) diff --git a/postfix/src/local/resolve.c b/postfix/src/local/resolve.c index fbc633f7f..e718ddb26 100644 --- a/postfix/src/local/resolve.c +++ b/postfix/src/local/resolve.c @@ -114,10 +114,18 @@ int deliver_resolve_tree(LOCAL_STATE state, USER_ATTR usr_attr, TOK822 *addr tok822_rewrite(addr, REWRITE_CANON); tok822_resolve(addr, &reply); + /* + * First, a healthy portion of error handling. + */ if (reply.flags & RESOLVE_FLAG_FAIL) { status = defer_append(BOUNCE_FLAG_KEEP, /* XXX */ BOUNCE_ATTR(state.msg_attr), "address resolver failure"); + } else if (reply.flags & RESOLVE_FLAG_ERROR) { + status = bounce_append(BOUNCE_FLAG_KEEP,/* XXX */ + BOUNCE_ATTR(state.msg_attr), + "bad recipient address syntax: %s", + STR(reply.recipient)); } else { /* diff --git a/postfix/src/master/multi_server.c b/postfix/src/master/multi_server.c index d22de4b13..927aa94d2 100644 --- a/postfix/src/master/multi_server.c +++ b/postfix/src/master/multi_server.c @@ -249,15 +249,15 @@ static void multi_server_execute(int unused_event, char *context) /* * Do not bother the application when the client disconnected. */ - if (master_notify(var_pid, MASTER_STAT_TAKEN) < 0) - multi_server_abort(EVENT_NULL_TYPE, EVENT_NULL_CONTEXT); if (peekfd(vstream_fileno(stream)) > 0) { + if (master_notify(var_pid, MASTER_STAT_TAKEN) < 0) + multi_server_abort(EVENT_NULL_TYPE, EVENT_NULL_CONTEXT); multi_server_service(stream, multi_server_name, multi_server_argv); + if (master_notify(var_pid, MASTER_STAT_AVAIL) < 0) + multi_server_abort(EVENT_NULL_TYPE, EVENT_NULL_CONTEXT); } else { multi_server_disconnect(stream); } - if (master_notify(var_pid, MASTER_STAT_AVAIL) < 0) - multi_server_abort(EVENT_NULL_TYPE, EVENT_NULL_CONTEXT); if (client_count == 0 && var_idle_limit > 0) event_request_timer(multi_server_timeout, (char *) 0, var_idle_limit); } @@ -572,6 +572,12 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...) * Illustrated volume 2 page 532. We avoid select() collisions with an * external lock file. */ + + /* + * XXX Can't compete for exclusive access to the listen socket because we + * also have to monitor existing client connections for service requests. + */ +#if 0 if (stream == 0 && !alone) { lock_path = concatenate(DEF_PID_DIR, "/", transport, ".", service_name, (char *) 0); @@ -583,6 +589,7 @@ NORETURN multi_server_main(int argc, char **argv, MULTI_SERVER_FN service,...) myfree(lock_path); vstring_free(why); } +#endif /* * Set up call-back info. diff --git a/postfix/src/postfix/postfix.c b/postfix/src/postfix/postfix.c index 5b42c30ec..91ac5be64 100644 --- a/postfix/src/postfix/postfix.c +++ b/postfix/src/postfix/postfix.c @@ -110,7 +110,16 @@ /* $\fBconfig_directory/main.cf\fR, configuration parameters /* $\fBconfig_directory/master.cf\fR, Postfix daemon processes /* SEE ALSO -/* master(8) Postfix master program +/* postconf(1) Postfix configuration management +/* postsuper(1) Postfix housekeeping +/* sendmail(1) Sendmail-compatible interface +/* postmap(1) Postfix lookup table management +/* master(8) Postfix master daemon +/* .ad +/* .fi +/* The respective manual pages for the daemon processes +/* specified in the \fBmaster.cf\fR file, and the manual +/* pages referenced by those manual pages. /* LICENSE /* .ad /* .fi diff --git a/postfix/src/qmgr/qmgr_message.c b/postfix/src/qmgr/qmgr_message.c index b827dc7ea..534f2bc56 100644 --- a/postfix/src/qmgr/qmgr_message.c +++ b/postfix/src/qmgr/qmgr_message.c @@ -671,7 +671,7 @@ static void qmgr_message_resolve(QMGR_MESSAGE *message) if (defer_xport_argv == 0) defer_xport_argv = argv_split(var_defer_xports, " \t\r\n,"); for (cpp = defer_xport_argv->argv; *cpp; cpp++) - if (strcasecmp(*cpp, STR(reply.transport)) == 0) + if (strcmp(*cpp, STR(reply.transport)) == 0) break; if (*cpp) { qmgr_defer_recipient(message, recipient, "deferred transport"); diff --git a/postfix/src/smtp/Makefile.in b/postfix/src/smtp/Makefile.in index c518690ac..205767d76 100644 --- a/postfix/src/smtp/Makefile.in +++ b/postfix/src/smtp/Makefile.in @@ -1,9 +1,9 @@ SHELL = /bin/sh SRCS = smtp.c smtp_connect.c smtp_proto.c smtp_chat.c smtp_session.c \ - smtp_addr.c smtp_trouble.c smtp_unalias.c smtp_state.c \ + smtp_addr.c smtp_trouble.c smtp_state.c \ smtp_sasl_proto.c smtp_sasl_glue.c OBJS = smtp.o smtp_connect.o smtp_proto.o smtp_chat.o smtp_session.o \ - smtp_addr.o smtp_trouble.o smtp_unalias.o smtp_state.o \ + smtp_addr.o smtp_trouble.o smtp_state.o \ smtp_sasl_proto.o smtp_sasl_glue.o HDRS = smtp.h smtp_sasl.h TESTSRC = diff --git a/postfix/src/smtpd/smtpd.c b/postfix/src/smtpd/smtpd.c index 63cad59a0..d11151466 100644 --- a/postfix/src/smtpd/smtpd.c +++ b/postfix/src/smtpd/smtpd.c @@ -122,6 +122,10 @@ /* List of maps with user names that are local to \fB$myorigin\fR /* or \fB$inet_interfaces\fR. If this parameter is defined, /* then the SMTP server rejects mail for unknown local users. +/* .IP \fBrelay_recipient_maps\fR +/* List of maps that define all the email addresses in the domains +/* that match \fB$relay_domains\fR. If this parameter is defined, +/* then the SMTP server rejects mail for unknown relay recipients. /* .IP \fBnotify_classes\fR /* List of error classes. Of special interest are: /* .RS @@ -223,8 +227,9 @@ /* Only domains whose primary MX hosts match the listed networks /* are eligible for the \fBpermit_mx_backup\fR feature. /* .IP \fBrelay_domains\fR -/* Restrict what domains or networks this mail system will relay -/* mail from or to. +/* Restrict what domains this mail system will relay +/* mail to. The domains are routed to the delivery agent +/* specified with the \fBrelay_transport\fR setting. /* .SH "UCE control responses" /* .ad /* .fi @@ -263,6 +268,7 @@ /* Response code when a client violates the \fBreject_unknown_hostname\fR /* restriction. /* SEE ALSO +/* trivial-rewrite(8) address resolver /* cleanup(8) message canonicalization /* master(8) process manager /* syslogd(8) system logging @@ -390,10 +396,8 @@ bool var_disable_vrfy_cmd; char *var_canonical_maps; char *var_rcpt_canon_maps; char *var_virt_alias_maps; -char *var_virt_alias_doms; char *var_virt_mailbox_maps; char *var_virt_mailbox_doms; -char *var_relocated_maps; char *var_alias_maps; char *var_local_rcpt_maps; bool var_allow_untrust_route; @@ -410,6 +414,12 @@ char *var_smtpd_null_key; int var_smtpd_hist_thrsh; char *var_smtpd_exp_filter; char *var_def_rbl_reply; +char *var_def_transport; +char *var_error_transport; +char *var_local_transport; +char *var_relay_transport; +char *var_virt_transport; +char *var_relay_rcpt_maps; /* * Silly little macros. @@ -1644,10 +1654,8 @@ int main(int argc, char **argv) VAR_CANONICAL_MAPS, DEF_CANONICAL_MAPS, &var_canonical_maps, 0, 0, VAR_RCPT_CANON_MAPS, DEF_RCPT_CANON_MAPS, &var_rcpt_canon_maps, 0, 0, VAR_VIRT_ALIAS_MAPS, DEF_VIRT_ALIAS_MAPS, &var_virt_alias_maps, 0, 0, - VAR_VIRT_ALIAS_DOMS, DEF_VIRT_ALIAS_DOMS, &var_virt_alias_doms, 0, 0, VAR_VIRT_MAILBOX_MAPS, DEF_VIRT_MAILBOX_MAPS, &var_virt_mailbox_maps, 0, 0, VAR_VIRT_MAILBOX_DOMS, DEF_VIRT_MAILBOX_DOMS, &var_virt_mailbox_doms, 0, 0, - VAR_RELOCATED_MAPS, DEF_RELOCATED_MAPS, &var_relocated_maps, 0, 0, VAR_ALIAS_MAPS, DEF_ALIAS_MAPS, &var_alias_maps, 0, 0, VAR_LOCAL_RCPT_MAPS, DEF_LOCAL_RCPT_MAPS, &var_local_rcpt_maps, 0, 0, VAR_SMTPD_SASL_OPTS, DEF_SMTPD_SASL_OPTS, &var_smtpd_sasl_opts, 0, 0, @@ -1657,6 +1665,12 @@ int main(int argc, char **argv) VAR_SMTPD_SND_AUTH_MAPS, DEF_SMTPD_SND_AUTH_MAPS, &var_smtpd_snd_auth_maps, 0, 0, VAR_SMTPD_NOOP_CMDS, DEF_SMTPD_NOOP_CMDS, &var_smtpd_noop_cmds, 0, 0, VAR_SMTPD_NULL_KEY, DEF_SMTPD_NULL_KEY, &var_smtpd_null_key, 0, 0, + VAR_DEF_TRANSPORT, DEF_DEF_TRANSPORT, &var_def_transport, 1, 0, + VAR_ERROR_TRANSPORT, DEF_ERROR_TRANSPORT, &var_error_transport, 1, 0, + VAR_LOCAL_TRANSPORT, DEF_LOCAL_TRANSPORT, &var_local_transport, 1, 0, + VAR_RELAY_TRANSPORT, DEF_RELAY_TRANSPORT, &var_relay_transport, 1, 0, + VAR_VIRT_TRANSPORT, DEF_VIRT_TRANSPORT, &var_virt_transport, 1, 0, + VAR_RELAY_RCPT_MAPS, DEF_RELAY_RCPT_MAPS, &var_relay_rcpt_maps, 0, 0, 0, }; static CONFIG_RAW_TABLE raw_table[] = { diff --git a/postfix/src/smtpd/smtpd_check.c b/postfix/src/smtpd/smtpd_check.c index dfad3a6ff..30ebe052e 100644 --- a/postfix/src/smtpd/smtpd_check.c +++ b/postfix/src/smtpd/smtpd_check.c @@ -108,11 +108,6 @@ /* default template is used. The \fImaps_rbl_reject_code\fR /* configuration parameter specifies the reject status code used in /* the default template (default: 554). -/* .IP reject_maps_rbl -/* Look up the reversed client network address in the real-time blackhole -/* DNS zones below the domains listed in the "maps_rbl_domains" -/* configuration parameter. This is equivalent to using -/* "reject_rbl_client" once for each such domain. /* .IP permit_naked_ip_address /* Permit the use of a naked IP address (without enclosing []) /* in HELO/EHLO commands. @@ -353,11 +348,16 @@ static MAPS *rcpt_canon_maps; static MAPS *canonical_maps; static MAPS *virt_alias_maps; static MAPS *virt_mailbox_maps; +static MAPS *relay_rcpt_maps; + +#ifdef TEST static MAPS *relocated_maps; static STRING_LIST *virt_alias_doms; static STRING_LIST *virt_mailbox_doms; +#endif + /* * Response templates for various rbl domains. */ @@ -641,11 +641,16 @@ void smtpd_check_init(void) virt_mailbox_maps = virtual8_maps_create(VAR_VIRT_MAILBOX_MAPS, var_virt_mailbox_maps, DICT_FLAG_LOCK); + relay_rcpt_maps = maps_create(VAR_RELAY_RCPT_MAPS, var_relay_rcpt_maps, + DICT_FLAG_LOCK); + +#ifdef TEST relocated_maps = maps_create(VAR_RELOCATED_MAPS, var_relocated_maps, DICT_FLAG_LOCK); virt_alias_doms = string_list_init(MATCH_FLAG_NONE, var_virt_alias_doms); virt_mailbox_doms = string_list_init(MATCH_FLAG_NONE, var_virt_mailbox_doms); +#endif access_parent_style = match_parent_style(SMTPD_ACCESS_MAPS); @@ -869,20 +874,6 @@ static void reject_dict_retry(SMTPD_STATE *state, const char *reply_name) 451, reply_name)); } -/* check_str_match - reject with temporary failure if dict lookup fails */ - -static int check_str_match(SMTPD_STATE *state, const char *reply_name, - STRING_LIST *list, const char *key) -{ - int result; - - dict_errno = 0; - if ((result = string_list_match(list, key)) == 0 - && dict_errno == DICT_ERR_RETRY) - reject_dict_retry(state, reply_name); - return (result); -} - /* checkv8_maps_find - reject with temporary failure if dict lookup fails */ static const char *checkv8_maps_find(SMTPD_STATE *state, const char *reply_name, @@ -913,37 +904,6 @@ static const char *check_mail_addr_find(SMTPD_STATE *state, return (result); } -/* resolve_final - do we do final delivery for the domain? */ - -static int resolve_final(SMTPD_STATE *state, const char *reply_name, - const char *domain) -{ - - /* If matches $mydestination or $inet_interfaces. */ - if (resolve_local(domain)) { - if (*var_virt_alias_doms - && check_str_match(state, reply_name, virt_alias_doms, domain)) - msg_warn("list domain %s in only one of $%s and $%s", - domain, VAR_MYDEST, VAR_VIRT_ALIAS_DOMS); - if (*var_virt_mailbox_doms - && check_str_match(state, reply_name, virt_mailbox_doms, domain)) - msg_warn("list domain %s in only one of $%s and $%s", - domain, VAR_MYDEST, VAR_VIRT_MAILBOX_DOMS); - return (1); - } - /* If Postfix-style virtual domain. */ - if (*var_virt_alias_doms - && check_str_match(state, reply_name, virt_alias_doms, domain)) - return (1); - - /* If virtual mailbox domain. */ - if (*var_virt_mailbox_doms - && check_str_match(state, reply_name, virt_mailbox_doms, domain)) - return (1); - - return (0); -} - /* reject_unknown_client - fail if client hostname is unknown */ static int reject_unknown_client(SMTPD_STATE *state) @@ -1212,7 +1172,6 @@ static int permit_auth_destination(SMTPD_STATE *state, char *recipient) { char *myname = "permit_auth_destination"; const RESOLVE_REPLY *reply; - const char *domain; if (msg_verbose) msg_info("%s: %s", myname, recipient); @@ -1222,13 +1181,14 @@ static int permit_auth_destination(SMTPD_STATE *state, char *recipient) */ reply = (const RESOLVE_REPLY *) ctable_locate(smtpd_resolve_cache, recipient); + if (reply->flags & RESOLVE_FLAG_FAIL) + reject_dict_retry(state, recipient); /* * Handle special case that is not supposed to happen. */ - if ((domain = strrchr(CONST_STR(reply->recipient), '@')) == 0) + if (strrchr(CONST_STR(reply->recipient), '@') == 0) return (SMTPD_CHECK_OK); - domain += 1; /* * Skip source-routed non-local or virtual mail (uncertain destination). @@ -1240,13 +1200,13 @@ static int permit_auth_destination(SMTPD_STATE *state, char *recipient) * Permit final delivery: the destination matches mydestination, * virtual_alias_domains, or virtual_mailbox_domains. */ - if (resolve_final(state, recipient, domain)) + if (reply->flags & RESOLVE_CLASS_FINAL) return (SMTPD_CHECK_OK); /* * Permit if the destination matches the relay_domains list. */ - if (domain_list_match(relay_domains, domain)) + if (reply->flags & RESOLVE_CLASS_RELAY) return (SMTPD_CHECK_OK); /* @@ -1492,6 +1452,8 @@ static int permit_mx_backup(SMTPD_STATE *state, const char *recipient, */ reply = (const RESOLVE_REPLY *) ctable_locate(smtpd_resolve_cache, recipient); + if (reply->flags & RESOLVE_FLAG_FAIL) + reject_dict_retry(state, recipient); /* * If the destination is local, it is acceptable, because we are @@ -1510,7 +1472,7 @@ static int permit_mx_backup(SMTPD_STATE *state, const char *recipient, /* * The destination is local, or it is a local virtual destination. */ - if (resolve_final(state, recipient, domain)) + if (reply->flags & RESOLVE_CLASS_FINAL) return (SMTPD_CHECK_OK); if (msg_verbose) @@ -1519,8 +1481,7 @@ static int permit_mx_backup(SMTPD_STATE *state, const char *recipient, /* * Skip numerical forms that didn't match the local system. */ - if (domain[0] == '#' - || (domain[0] == '[' && domain[strlen(domain) - 1] == ']')) + if (domain[0] == '[' && domain[strlen(domain) - 1] == ']') return (SMTPD_CHECK_DUNNO); /* @@ -1590,8 +1551,6 @@ static int reject_non_fqdn_address(SMTPD_STATE *state, char *addr, /* * Skip forms that we can't handle yet. */ - if (domain[0] == '#') - return (SMTPD_CHECK_DUNNO); if (domain[0] == '[' && domain[strlen(domain) - 1] == ']') return (SMTPD_CHECK_DUNNO); @@ -1635,6 +1594,8 @@ static int reject_unknown_address(SMTPD_STATE *state, const char *addr, * Resolve the address. */ reply = (const RESOLVE_REPLY *) ctable_locate(smtpd_resolve_cache, addr); + if (reply->flags & RESOLVE_FLAG_FAIL) + reject_dict_retry(state, addr); /* * Skip local destinations and non-DNS forms. @@ -1642,9 +1603,7 @@ static int reject_unknown_address(SMTPD_STATE *state, const char *addr, if ((domain = strrchr(CONST_STR(reply->recipient), '@')) == 0) return (SMTPD_CHECK_DUNNO); domain += 1; - if (resolve_final(state, reply_name, domain)) - return (SMTPD_CHECK_DUNNO); - if (domain[0] == '#') + if (reply->flags & RESOLVE_CLASS_FINAL) return (SMTPD_CHECK_DUNNO); if (domain[0] == '[' && domain[strlen(domain) - 1] == ']') return (SMTPD_CHECK_DUNNO); @@ -2017,6 +1976,8 @@ static int check_mail_access(SMTPD_STATE *state, const char *table, * Resolve the address. */ reply = (const RESOLVE_REPLY *) ctable_locate(smtpd_resolve_cache, addr); + if (reply->flags & RESOLVE_FLAG_FAIL) + reject_dict_retry(state, addr); /* * Garbage in, garbage out. Every address from canon_addr_internal() and @@ -2439,7 +2400,7 @@ static int reject_rbl_domain(SMTPD_STATE *state, const char *rbl_domain, */ if ((domain = strrchr(what, '@')) != 0) { domain += 1; - if (domain[0] == '#' || domain[0] == '[') + if (domain[0] == '[') return (SMTPD_CHECK_DUNNO); } else domain = what; @@ -2470,10 +2431,16 @@ static int reject_maps_rbl(SMTPD_STATE *state) char *bp = saved_domains; char *rbl_domain; int result = SMTPD_CHECK_DUNNO; + static int warned; if (msg_verbose) msg_info("%s: %s", myname, state->addr); + if (warned == 0) { + warned++; + msg_warn("restriction %s is going away. Please use %s instead", + REJECT_MAPS_RBL, REJECT_RBL_CLIENT); + } while ((rbl_domain = mystrtok(&bp, " \t\r\n,")) != 0) { result = reject_rbl_addr(state, rbl_domain, state->addr, SMTPD_NAME_CLIENT); @@ -2503,6 +2470,8 @@ static int reject_sender_login_mismatch(SMTPD_STATE *state, const char *sender) * the sender address. */ reply = (const RESOLVE_REPLY *) ctable_locate(smtpd_resolve_cache, sender); + if (reply->flags & RESOLVE_FLAG_FAIL) + reject_dict_retry(state, sender); owner = check_mail_addr_find(state, sender, smtpd_sender_login_maps, STR(reply->recipient), (char **) 0); #ifdef USE_SASL_AUTH @@ -3116,7 +3085,6 @@ char *smtpd_check_rcptmap(SMTPD_STATE *state, char *recipient) char *myname = "smtpd_check_rcptmap"; char *saved_recipient; const RESOLVE_REPLY *reply; - const char *domain; int status; /* @@ -3145,71 +3113,94 @@ char *smtpd_check_rcptmap(SMTPD_STATE *state, char *recipient) */ reply = (const RESOLVE_REPLY *) ctable_locate(smtpd_resolve_cache, recipient); + if (reply->flags & RESOLVE_FLAG_FAIL) + reject_dict_retry(state, recipient); /* - * Skip non-DNS forms. Skip non-local numerical forms. + * Make complex expressions more readable? */ - if ((domain = strrchr(CONST_STR(reply->recipient), '@')) == 0) - SMTPD_CHECK_RCPT_RETURN(0); - domain += 1; - if (domain[0] == '#' || domain[0] == '[') - if (!resolve_local(domain)) - SMTPD_CHECK_RCPT_RETURN(0); +#define MATCH(map, rcpt) \ + check_mail_addr_find(state, recipient, map, rcpt, (char **) 0) -#define NOMATCH(map, rcpt) \ - (check_mail_addr_find(state, recipient, map, rcpt, (char **) 0) == 0) +#define NOMATCH(map, rcpt) (MATCH(map, rcpt) == 0) #define NOMATCHV8(map, rcpt) \ (checkv8_maps_find(state, recipient, map, rcpt) == 0) /* - * Reject mail to unknown addresses in Postfix-style virtual domains. + * XXX We throw up our hands if the address matches a canonical or + * virtual alias map. Eventually, the address resolver should give us the + * final resolved recipient address, and the SMTP server should write the + * final recipient address to the output record stream. See also the next + * comment block on recipients in simulated virtual domains. */ - if (*var_virt_alias_doms - && (check_str_match(state, recipient, virt_alias_doms, domain))) { - if (NOMATCH(rcpt_canon_maps, CONST_STR(reply->recipient)) - && NOMATCH(canonical_maps, CONST_STR(reply->recipient)) - && NOMATCH(relocated_maps, CONST_STR(reply->recipient)) - && NOMATCHV8(virt_mailbox_maps, CONST_STR(reply->recipient)) - && NOMATCH(virt_alias_maps, CONST_STR(reply->recipient))) { - (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE, - "%d <%s>: User unknown", 550, recipient); - SMTPD_CHECK_RCPT_RETURN(STR(error_text)); - } - } + if (MATCH(rcpt_canon_maps, CONST_STR(reply->recipient)) + || MATCH(canonical_maps, CONST_STR(reply->recipient)) + || MATCH(virt_alias_maps, CONST_STR(reply->recipient))) + SMTPD_CHECK_RCPT_RETURN(0); /* - * Reject mail to unknown addresses in Postfix-style virtual domains. + * At this point, anything that resolves to the error mailer is known to + * be undeliverable. + * + * XXX Until the address resolver does final address resolution, known and + * unknown recipients in simulated virtual domains will both resolve to + * "error:user unknown". */ - if (*var_virt_mailbox_doms - && (check_str_match(state, recipient, virt_mailbox_doms, domain))) { - if (NOMATCH(rcpt_canon_maps, CONST_STR(reply->recipient)) - && NOMATCH(canonical_maps, CONST_STR(reply->recipient)) - && NOMATCH(relocated_maps, CONST_STR(reply->recipient)) - && NOMATCHV8(virt_mailbox_maps, CONST_STR(reply->recipient)) - && NOMATCH(virt_alias_maps, CONST_STR(reply->recipient))) { - (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE, - "%d <%s>: User unknown", 550, recipient); - SMTPD_CHECK_RCPT_RETURN(STR(error_text)); - } + if (strcmp(STR(reply->transport), var_error_transport) == 0) { + (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE, + "%d <%s>: %s", 550, + recipient, STR(reply->nexthop)); + SMTPD_CHECK_RCPT_RETURN(STR(error_text)); } /* * Reject mail to unknown addresses in local domains (domains that match - * $mydestination or $inet_interfaces). Accept mail for addresses in - * Sendmail-style virtual domains. + * $mydestination or $inet_interfaces). + * + * XXX For now, we throw up our hands when a transport mapping overrides the + * default local delivery transport. + * + * XXX Use the less expensive maps_find() (case is already folded) instead + * of the baroque mail_addr_find(). But then we have to strip the domain + * and deal with address extensions ourselves. */ - if (*var_local_rcpt_maps && resolve_local(domain)) { - if (NOMATCH(rcpt_canon_maps, CONST_STR(reply->recipient)) - && NOMATCH(canonical_maps, CONST_STR(reply->recipient)) - && NOMATCH(relocated_maps, CONST_STR(reply->recipient)) - && NOMATCHV8(virt_mailbox_maps, CONST_STR(reply->recipient)) - && NOMATCH(virt_alias_maps, CONST_STR(reply->recipient)) - && NOMATCH(local_rcpt_maps, CONST_STR(reply->recipient))) { - (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE, - "%d <%s>: User unknown", 550, recipient); - SMTPD_CHECK_RCPT_RETURN(STR(error_text)); - } + if ((reply->flags & RESOLVE_CLASS_LOCAL) + && *var_local_rcpt_maps + && strcmp(STR(reply->transport), var_local_transport) == 0 + && NOMATCH(local_rcpt_maps, CONST_STR(reply->recipient))) { + (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE, + "%d <%s>: User unknown", 550, recipient); + SMTPD_CHECK_RCPT_RETURN(STR(error_text)); + } + + /* + * Reject mail to unknown addresses in virtual mailbox domains. + * + * XXX For now, we throw up our hands when a transport mapping overrides the + * default virtual delivery transport. + */ + if ((reply->flags & RESOLVE_CLASS_VIRTUAL) + && strcmp(STR(reply->transport), var_virt_transport) == 0 + && NOMATCHV8(virt_mailbox_maps, CONST_STR(reply->recipient))) { + (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE, + "%d <%s>: User unknown", 550, recipient); + SMTPD_CHECK_RCPT_RETURN(STR(error_text)); + } + + /* + * Reject mail to unknown addresses in relay domains. + * + * XXX For now, we throw up our hands when a transport mapping overrides the + * default relay transport. + */ + if ((reply->flags & RESOLVE_CLASS_RELAY) + && *var_relay_rcpt_maps + && strcmp(STR(reply->transport), var_relay_transport) == 0 + && NOMATCH(relay_rcpt_maps, CONST_STR(reply->recipient))) { + (void) smtpd_check_reject(state, MAIL_ERROR_BOUNCE, + "%d <%s>: User unknown", 550, recipient); + SMTPD_CHECK_RCPT_RETURN(STR(error_text)); } /* @@ -3368,6 +3359,12 @@ char *var_double_bounce_sender; char *var_rbl_reply_maps; char *var_smtpd_exp_filter; char *var_def_rbl_reply; +char *var_local_transport; +char *var_error_transport; +char *var_virt_transport; +char *var_relay_transport; +char *var_def_transport; +char *var_relay_rcpt_maps; typedef struct { char *name; @@ -3375,6 +3372,9 @@ typedef struct { char **target; } STRING_TABLE; +#undef DEF_VIRT_ALIAS_MAPS +#define DEF_VIRT_ALIAS_MAPS "" + static STRING_TABLE string_table[] = { VAR_MAPS_RBL_DOMAINS, DEF_MAPS_RBL_DOMAINS, &var_maps_rbl_domains, VAR_MYORIGIN, DEF_MYORIGIN, &var_myorigin, @@ -3399,6 +3399,12 @@ static STRING_TABLE string_table[] = { VAR_RBL_REPLY_MAPS, DEF_RBL_REPLY_MAPS, &var_rbl_reply_maps, VAR_SMTPD_EXP_FILTER, DEF_SMTPD_EXP_FILTER, &var_smtpd_exp_filter, VAR_DEF_RBL_REPLY, DEF_DEF_RBL_REPLY, &var_def_rbl_reply, + VAR_LOCAL_TRANSPORT, DEF_LOCAL_TRANSPORT, &var_local_transport, + VAR_ERROR_TRANSPORT, DEF_ERROR_TRANSPORT, &var_error_transport, + VAR_VIRT_TRANSPORT, DEF_VIRT_TRANSPORT, &var_virt_transport, + VAR_RELAY_TRANSPORT, DEF_RELAY_TRANSPORT, &var_relay_transport, + VAR_DEF_TRANSPORT, DEF_DEF_TRANSPORT, &var_def_transport, + VAR_RELAY_RCPT_MAPS, DEF_RELAY_RCPT_MAPS, &var_relay_rcpt_maps, 0, }; @@ -3409,7 +3415,7 @@ static void string_init(void) STRING_TABLE *sp; for (sp = string_table; sp->name; sp++) - sp->target[0] = mystrdup(sp->defval[0] == '$' ? "" : sp->defval); + sp->target[0] = mystrdup(sp->defval); } /* string_update - update string parameter */ @@ -3607,12 +3613,36 @@ VSTRING *canon_addr_internal(VSTRING *result, const char *addr) void resolve_clnt_query(const char *addr, RESOLVE_REPLY *reply) { + const char *domain; + if (addr == CONST_STR(reply->recipient)) msg_panic("resolve_clnt_query: result clobbers input"); - vstring_strcpy(reply->transport, "foo"); - vstring_strcpy(reply->nexthop, "foo"); if (strchr(addr, '%')) msg_fatal("%s: address rewriting is disabled", addr); + if ((domain = strrchr(addr, '@')) == 0) + msg_fatal("%s: unqualified address", addr); + domain += 1; + if (resolve_local(domain)) { + reply->flags = RESOLVE_CLASS_LOCAL; + vstring_strcpy(reply->transport, var_local_transport); + vstring_strcpy(reply->nexthop, domain); + } else if (string_list_match(virt_alias_doms, domain)) { + reply->flags = RESOLVE_CLASS_ALIAS; + vstring_strcpy(reply->transport, var_error_transport); + vstring_strcpy(reply->nexthop, "user unknown"); + } else if (string_list_match(virt_mailbox_doms, domain)) { + reply->flags = RESOLVE_CLASS_VIRTUAL; + vstring_strcpy(reply->transport, var_virt_transport); + vstring_strcpy(reply->nexthop, domain); + } else if (domain_list_match(relay_domains, domain)) { + reply->flags = RESOLVE_CLASS_RELAY; + vstring_strcpy(reply->transport, var_relay_transport); + vstring_strcpy(reply->nexthop, domain); + } else { + reply->flags = RESOLVE_CLASS_DEFAULT; + vstring_strcpy(reply->transport, var_def_transport); + vstring_strcpy(reply->nexthop, domain); + } vstring_strcpy(reply->recipient, addr); } @@ -3746,6 +3776,13 @@ int main(int argc, char **argv) resp = 0; break; } + if (strcasecmp(args->argv[0], "relay_recipient_maps") == 0) { + UPDATE_STRING(var_relay_rcpt_maps, args->argv[1]); + UPDATE_MAPS(relay_rcpt_maps, VAR_LOCAL_RCPT_MAPS, + var_relay_rcpt_maps, DICT_FLAG_LOCK); + resp = 0; + break; + } if (strcasecmp(args->argv[0], "canonical_maps") == 0) { UPDATE_STRING(var_canonical_maps, args->argv[1]); UPDATE_MAPS(canonical_maps, VAR_CANONICAL_MAPS, diff --git a/postfix/src/smtpd/smtpd_check.ref b/postfix/src/smtpd/smtpd_check.ref index d3ebec823..451790f7d 100644 --- a/postfix/src/smtpd/smtpd_check.ref +++ b/postfix/src/smtpd/smtpd_check.ref @@ -139,6 +139,7 @@ OK >>> client foo 123.123.123.123 OK >>> rcpt foo@watson.ibm.com +./smtpd_check: warning: the "check_relay_domains" restriction is going away; use "reject_unauth_destination" instead ./smtpd_check: : reject: RCPT from foo[123.123.123.123]: 554 : Recipient address rejected: Relay access denied; from= to= proto=SMTP helo=<123.123.123.123> 554 : Recipient address rejected: Relay access denied >>> rcpt foo@porcupine.org @@ -182,6 +183,7 @@ OK >>> client_restrictions reject_maps_rbl OK >>> client spike.porcupine.org 168.100.189.2 +./smtpd_check: warning: restriction reject_maps_rbl is going away. Please use reject_rbl_client instead OK >>> client foo 127.0.0.2 ./smtpd_check: : reject: CONNECT from foo[127.0.0.2]: 554 Service unavailable; Client host [127.0.0.2] blocked using blackholes.mail-abuse.org; Blackholed - see ; from= proto=SMTP helo=<123.123.123.123> diff --git a/postfix/src/smtpd/smtpd_check.ref2 b/postfix/src/smtpd/smtpd_check.ref2 index 64cffa686..e8b92345e 100644 --- a/postfix/src/smtpd/smtpd_check.ref2 +++ b/postfix/src/smtpd/smtpd_check.ref2 @@ -129,6 +129,7 @@ OK >>> client foo 123.123.123.123 OK >>> rcpt foo@watson.ibm.com +./smtpd_check: warning: the "check_relay_domains" restriction is going away; use "reject_unauth_destination" instead ./smtpd_check: : reject: RCPT from foo[123.123.123.123]: 554 : Recipient address rejected: Relay access denied; from= to= proto=SMTP helo= 554 : Recipient address rejected: Relay access denied >>> rcpt foo@porcupine.org @@ -172,6 +173,7 @@ OK >>> client_restrictions reject_maps_rbl OK >>> client spike.porcupine.org 168.100.189.2 +./smtpd_check: warning: restriction reject_maps_rbl is going away. Please use reject_rbl_client instead OK >>> client foo 127.0.0.2 ./smtpd_check: : reject: CONNECT from foo[127.0.0.2]: 554 Service unavailable; Client host [127.0.0.2] blocked using blackholes.mail-abuse.org; Blackholed - see ; from= proto=SMTP helo= diff --git a/postfix/src/smtpd/smtpd_exp.ref b/postfix/src/smtpd/smtpd_exp.ref index 8ed2c20d3..ea9e9a2f3 100644 --- a/postfix/src/smtpd/smtpd_exp.ref +++ b/postfix/src/smtpd/smtpd_exp.ref @@ -25,6 +25,7 @@ OK >>> client spike.porcupine.org 168.100.189.2 OK >>> rcpt rname@rdomain +./smtpd_check: warning: restriction reject_maps_rbl is going away. Please use reject_rbl_client instead OK >>> client foo 127.0.0.2 OK diff --git a/postfix/src/trivial-rewrite/resolve.c b/postfix/src/trivial-rewrite/resolve.c index eaf1c4e78..29603e5b5 100644 --- a/postfix/src/trivial-rewrite/resolve.c +++ b/postfix/src/trivial-rewrite/resolve.c @@ -103,7 +103,7 @@ void resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop, TOK822 *saved_domain = 0; TOK822 *domain = 0; char *destination; - const char *blame; + const char *blame = 0; *flags = 0; @@ -239,9 +239,9 @@ void resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop, if (virt_alias_doms && string_list_match(virt_alias_doms, STR(nexthop))) { vstring_strcpy(channel, var_error_transport); - vstring_strcpy(nexthop, "unknown user"); + vstring_strcpy(nexthop, "User unknown"); blame = VAR_ERROR_TRANSPORT; - *flags |= RESOLVE_CLASS_ERROR; + *flags |= RESOLVE_CLASS_ALIAS; } else if (dict_errno != 0) { msg_warn("%s lookup failure", VAR_VIRT_ALIAS_DOMS); *flags |= RESOLVE_FLAG_FAIL; @@ -291,11 +291,17 @@ void resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop, /* * Sanity checks. */ - if (*STR(channel) == 0) - msg_fatal("file %s/%s: parameter %s: null transport is not allowed", - var_config_dir, MAIN_CONF_FILE, blame); - if (*STR(nexthop) == 0) - msg_panic("%s: null nexthop", myname); + if ((*flags & RESOLVE_FLAG_FAIL) == 0) { + if (*STR(channel) == 0) { + if (blame == 0) + msg_panic("%s: null blame", myname); + msg_warn("file %s/%s: parameter %s: null transport is not allowed", + var_config_dir, MAIN_CONF_FILE, blame); + *flags |= RESOLVE_FLAG_FAIL; + } + if (*STR(nexthop) == 0) + msg_panic("%s: null nexthop", myname); + } /* * Bounce recipients that have moved. We do it here instead of in the @@ -315,7 +321,6 @@ void resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop, IGNORE_ADDR_EXTENSION)) != 0) { vstring_strcpy(channel, var_error_transport); vstring_sprintf(nexthop, "user has moved to %s", newloc); - *flags |= RESOLVE_CLASS_ERROR; } else if (dict_errno != 0) { msg_warn("%s lookup failure", VAR_RELOCATED_MAPS); *flags |= RESOLVE_FLAG_FAIL; @@ -328,9 +333,9 @@ void resolve_addr(char *addr, VSTRING *channel, VSTRING *nexthop, * * XXX Don't override the error transport :-( */ - if ((*flags & RESOLVE_FLAG_FAIL) == 0 - && (*flags & RESOLVE_CLASS_ERROR) != 0 - && *var_transport_maps) { + if ((*flags & RESOLVE_FLAG_FAIL) == 0 + && *var_transport_maps + && strcmp(STR(channel), var_error_transport) != 0) { if (transport_lookup(STR(nextrcpt), channel, nexthop) == 0 && dict_errno != 0) { msg_warn("%s lookup failure", VAR_TRANSPORT_MAPS); diff --git a/postfix/src/trivial-rewrite/transport.c b/postfix/src/trivial-rewrite/transport.c index d6dc0ad7f..77e1129b0 100644 --- a/postfix/src/trivial-rewrite/transport.c +++ b/postfix/src/trivial-rewrite/transport.c @@ -104,6 +104,8 @@ static int find_transport_entry(const char *key, int flags, /* * Look up an entry with extreme prejedice. + * + * XXX Should report lookup failure status to caller instead of aborting. */ if ((value = maps_find(transport_path, key, flags)) == 0) { if (dict_errno != 0) diff --git a/postfix/src/trivial-rewrite/trivial-rewrite.c b/postfix/src/trivial-rewrite/trivial-rewrite.c index 790ef5e3c..d5ca7a177 100644 --- a/postfix/src/trivial-rewrite/trivial-rewrite.c +++ b/postfix/src/trivial-rewrite/trivial-rewrite.c @@ -218,6 +218,7 @@ char *var_virt_mailbox_maps; /* XXX virtual_mailbox_domains */ char *var_virt_alias_doms; char *var_virt_mailbox_doms; char *var_relocated_maps; +char *var_def_transport; /* rewrite_service - read request and send reply */ @@ -282,15 +283,16 @@ int main(int argc, char **argv) { static CONFIG_STR_TABLE str_table[] = { VAR_TRANSPORT_MAPS, DEF_TRANSPORT_MAPS, &var_transport_maps, 0, 0, - VAR_LOCAL_TRANSPORT, DEF_LOCAL_TRANSPORT, &var_local_transport, 0, 0, - VAR_ERROR_TRANSPORT, DEF_ERROR_TRANSPORT, &var_error_transport, 0, 0, - VAR_VIRT_TRANSPORT, DEF_VIRT_TRANSPORT, &var_virt_transport, 0, 0, - VAR_RELAY_TRANSPORT, DEF_RELAY_TRANSPORT, &var_relay_transport, 0, 0, + VAR_LOCAL_TRANSPORT, DEF_LOCAL_TRANSPORT, &var_local_transport, 1, 0, + VAR_ERROR_TRANSPORT, DEF_ERROR_TRANSPORT, &var_error_transport, 1, 0, + VAR_VIRT_TRANSPORT, DEF_VIRT_TRANSPORT, &var_virt_transport, 1, 0, + VAR_RELAY_TRANSPORT, DEF_RELAY_TRANSPORT, &var_relay_transport, 1, 0, VAR_XPORT_NULL_KEY, DEF_XPORT_NULL_KEY, &var_xport_null_key, 1, 0, VAR_VIRT_ALIAS_MAPS, DEF_VIRT_ALIAS_MAPS, &var_virt_alias_maps, 0, 0, VAR_VIRT_ALIAS_DOMS, DEF_VIRT_ALIAS_DOMS, &var_virt_alias_doms, 0, 0, VAR_VIRT_MAILBOX_MAPS, DEF_VIRT_MAILBOX_MAPS, &var_virt_mailbox_maps, 0, 0, VAR_VIRT_MAILBOX_DOMS, DEF_VIRT_MAILBOX_DOMS, &var_virt_mailbox_doms, 0, 0, + VAR_DEF_TRANSPORT, DEF_DEF_TRANSPORT, &var_def_transport, 1, 0, VAR_VIRT_TRANSPORT, DEF_VIRT_TRANSPORT, &var_virt_transport, 1, 0, VAR_RELAY_TRANSPORT, DEF_RELAY_TRANSPORT, &var_relay_transport, 1, 0, VAR_RELOCATED_MAPS, DEF_RELOCATED_MAPS, &var_relocated_maps, 0, 0, diff --git a/postfix/src/util/dict_pcre.c b/postfix/src/util/dict_pcre.c index a1977f99a..38c77b902 100644 --- a/postfix/src/util/dict_pcre.c +++ b/postfix/src/util/dict_pcre.c @@ -433,7 +433,7 @@ static int dict_pcre_prescan(int type, VSTRING *buf, char *context) if (type == MAC_PARSE_VARNAME) { if (ctxt->flags & DICT_FLAG_NO_REGSUB) { msg_warn("pcre map %s, line %d: " - "regular expression substitution is not allowed" + "regular expression substitution is not allowed", ctxt->mapname, ctxt->lineno); return (MAC_PARSE_ERROR); } diff --git a/postfix/src/virtual/virtual.c b/postfix/src/virtual/virtual.c index 6290babd0..29c1b1bfd 100644 --- a/postfix/src/virtual/virtual.c +++ b/postfix/src/virtual/virtual.c @@ -111,7 +111,7 @@ /* This is a safety measure to ensure that an out of control map in /* \fBvirtual_mailbox_maps\fR doesn't litter the filesystem with mailboxes. /* While it could be set to "/", this setting isn't recommended. -/* .IP "\fBvirtual_mailbox_maps\fR (regexp maps disallowed)" +/* .IP \fBvirtual_mailbox_maps\fR /* Recipients are looked up in these maps to determine the path to /* their mailbox or maildir. If the returned path ends in a slash /* ("/"), maildir-style delivery is carried out, otherwise the @@ -126,6 +126,10 @@ /* /* Note that \fBvirtual_mailbox_base\fR is unconditionally prepended /* to this path. +/* +/* For security reasons, regular expression maps are allowed but +/* regular expression substitution of $1 etc. is disallowed, +/* because that would open a security hole. /* .IP \fBvirtual_mailbox_domains\fR /* The list of domains that should be delivered via the Postfix virtual /* delivery agent. This uses the same syntax as the \fBmydestination\fR @@ -135,7 +139,7 @@ /* a \fBvirtual_owner_maps\fR or \fBvirtual_uid_maps\fR lookup. /* Returned values less than this will be rejected, and the message /* will be deferred. -/* .IP "\fBvirtual_uid_maps\fR (regexp maps disallowed)" +/* .IP \fBvirtual_uid_maps\fR /* Recipients are looked up in these maps to determine the user ID to be /* used when writing to the target mailbox. /* @@ -145,7 +149,11 @@ /* In a lookup table, specify a left-hand side of \fI@domain.tld\fR /* to match any user in the specified domain that does not have a /* specific \fIuser@domain.tld\fR entry. -/* .IP "\fBvirtual_gid_maps\fR (regexp maps disallowed)" +/* +/* For security reasons, regular expression maps are allowed but +/* regular expression substitution of $1 etc. is disallowed, +/* because that would open a security hole. +/* .IP \fBvirtual_gid_maps\fR /* Recipients are looked up in these maps to determine the group ID to be /* used when writing to the target mailbox. /* @@ -155,6 +163,10 @@ /* In a lookup table, specify a left-hand side of \fI@domain.tld\fR /* to match any user in the specified domain that does not have a /* specific \fIuser@domain.tld\fR entry. +/* +/* For security reasons, regular expression maps are allowed but +/* regular expression substitution of $1 etc. is disallowed, +/* because that would open a security hole. /* .SH "Locking controls" /* .ad /* .fi @@ -211,6 +223,8 @@ /* The \fBmaildir\fR structure appears in the \fBqmail\fR system /* by Daniel Bernstein. /* SEE ALSO +/* regexp_table(5) POSIX regular expression table format +/* pcre_table(5) Perl Compatible Regular Expression table format /* bounce(8) non-delivery status reports /* syslogd(8) system logging /* qmgr(8) queue manager