1 /*++
2 /* NAME
3 /* smtp 8
4 /* SUMMARY
5 /* Postfix SMTP+LMTP client
6 /* SYNOPSIS
7 /* \fBsmtp\fR [generic Postfix daemon options] [flags=DORX]
8 /* DESCRIPTION
9 /* The Postfix SMTP+LMTP client implements the SMTP and LMTP mail
10 /* delivery protocols. It processes message delivery requests from
11 /* the queue manager. Each request specifies a queue file, a sender
12 /* address, a domain or host to deliver to, and recipient information.
13 /* This program expects to be run from the \fBmaster\fR(8) process
14 /* manager.
15 /*
16 /* The SMTP+LMTP client updates the queue file and marks recipients
17 /* as finished, or it informs the queue manager that delivery should
18 /* be tried again at a later time. Delivery status reports are sent
19 /* to the \fBbounce\fR(8), \fBdefer\fR(8) or \fBtrace\fR(8) daemon as
20 /* appropriate.
21 /*
22 /* The SMTP+LMTP client looks up a list of mail exchanger addresses for
23 /* the destination host, sorts the list by preference, and connects
24 /* to each listed address until it finds a server that responds.
25 /*
26 /* When a server is not reachable, or when mail delivery fails due
27 /* to a recoverable error condition, the SMTP+LMTP client will try to
28 /* deliver the mail to an alternate host.
29 /*
30 /* After a successful mail transaction, a connection may be saved
31 /* to the \fBscache\fR(8) connection cache server, so that it
32 /* may be used by any SMTP+LMTP client for a subsequent transaction.
33 /*
34 /* By default, connection caching is enabled temporarily for
35 /* destinations that have a high volume of mail in the active
36 /* queue. Connection caching can be enabled permanently for
37 /* specific destinations.
38 /* SMTP DESTINATION SYNTAX
39 /* .ad
40 /* .fi
41 /* The Postfix SMTP+LMTP client supports multiple destinations
42 /* separated by comma or whitespace (Postfix 3.5 and later).
43 /* SMTP destinations have the following form:
44 /* .IP \fIdomainname\fR
45 /* .IP \fIdomainname\fR:\fIport\fR
46 /* Look up the mail exchangers for the specified domain, and
47 /* connect to the specified port (default: \fBsmtp\fR).
48 /* .IP [\fIhostname\fR]
49 /* .IP [\fIhostname\fR]:\fIport\fR
50 /* Look up the address(es) of the specified host, and connect to
51 /* the specified port (default: \fBsmtp\fR).
52 /* .IP [\fIaddress\fR]
53 /* .IP [\fIaddress\fR]:\fIport\fR
54 /* Connect to the host at the specified address, and connect
55 /* to the specified port (default: \fBsmtp\fR). An IPv6 address
56 /* must be formatted as [\fBipv6\fR:\fIaddress\fR].
57 /* LMTP DESTINATION SYNTAX
58 /* .ad
59 /* .fi
60 /* The Postfix SMTP+LMTP client supports multiple destinations
61 /* separated by comma or whitespace (Postfix 3.5 and later).
62 /* LMTP destinations have the following form:
63 /* .IP \fBunix\fR:\fIpathname\fR
64 /* Connect to the local UNIX-domain server that is bound to the specified
65 /* \fIpathname\fR. If the process runs chrooted, an absolute pathname
66 /* is interpreted relative to the Postfix queue directory.
67 /* .IP \fBinet\fR:\fIhostname\fR
68 /* .IP \fBinet\fR:\fIhostname\fR:\fIport\fR
69 /* .IP \fBinet\fR:[\fIaddress\fR]
70 /* .IP \fBinet\fR:[\fIaddress\fR]:\fIport\fR
71 /* Connect to the specified TCP port on the specified local or
72 /* remote host. If no port is specified, connect to the port defined as
73 /* \fBlmtp\fR in \fBservices\fR(4).
74 /* If no such service is found, the \fBlmtp_tcp_port\fR configuration
75 /* parameter (default value of 24) will be used.
76 /* An IPv6 address must be formatted as [\fBipv6\fR:\fIaddress\fR].
77 /* SINGLE-RECIPIENT DELIVERY
78 /* .ad
79 /* .fi
80 /* By default, the Postfix SMTP+LMTP client delivers mail to
81 /* multiple recipients per delivery request. This is undesirable
82 /* when prepending a \fBDelivered-to:\fR or \fBX-Original-To:\fR
83 /* message header. To prevent Postfix from sending multiple
84 /* recipients per delivery request, specify
85 /* .sp
86 /* .nf
87 /* \fItransport\fB_destination_recipient_limit = 1\fR
88 /* .fi
89 /*
90 /* in the Postfix \fBmain.cf\fR file, where \fItransport\fR
91 /* is the name in the first column of the Postfix \fBmaster.cf\fR
92 /* entry for this mail delivery service.
93 /* COMMAND ATTRIBUTE SYNTAX
94 /* .ad
95 /* .fi
96 /* .IP "\fBflags=DORX\fR (optional)"
97 /* Optional message processing flags.
98 /* .RS
99 /* .IP \fBD\fR
100 /* Prepend a "\fBDelivered-To: \fIrecipient\fR" message header
101 /* with the envelope recipient address. Note: for this to work,
102 /* the \fItransport\fB_destination_recipient_limit\fR must be
103 /* 1 (see SINGLE-RECIPIENT DELIVERY above for details).
104 /* .sp
105 /* The \fBD\fR flag also enforces loop detection: if a message
106 /* already contains a \fBDelivered-To:\fR header with the same
107 /* recipient address, then the message is returned as
108 /* undeliverable. The address comparison is case insensitive.
109 /* .sp
110 /* This feature is available as of Postfix 3.5.
111 /* .IP \fBO\fR
112 /* Prepend an "\fBX-Original-To: \fIrecipient\fR" message
113 /* header with the recipient address as given to Postfix. Note:
114 /* for this to work, the
115 /* \fItransport\fB_destination_recipient_limit\fR must be 1
116 /* (see SINGLE-RECIPIENT DELIVERY above for details).
117 /* .sp
118 /* This feature is available as of Postfix 3.5.
119 /* .IP \fBR\fR
120 /* Prepend a "\fBReturn-Path: <\fIsender\fB>\fR" message header
121 /* with the envelope sender address.
122 /* .sp
123 /* This feature is available as of Postfix 3.5.
124 /* .IP \fBX\fR
125 /* Indicates that the delivery is final. This flag affects
126 /* the status reported in "success" DSN (delivery status
127 /* notification) messages, and changes it from "relayed" into
128 /* "delivered".
129 /* .sp
130 /* This feature is available as of Postfix 3.5.
131 /* .RE
132 /* SECURITY
133 /* The SMTP+LMTP client is moderately security-sensitive. It
134 /* talks to SMTP or LMTP servers and to DNS servers on the
135 /* network. The SMTP+LMTP client can be run chrooted at fixed
136 /* low privilege.
137 /* STANDARDS
138 /* RFC 821 (SMTP protocol)
139 /* RFC 822 (ARPA Internet Text Messages)
140 /* RFC 1651 (SMTP service extensions)
141 /* RFC 1652 (8bit-MIME transport)
142 /* RFC 1870 (Message Size Declaration)
143 /* RFC 2033 (LMTP protocol)
144 /* RFC 2034 (SMTP Enhanced Error Codes)
145 /* RFC 2045 (MIME: Format of Internet Message Bodies)
146 /* RFC 2046 (MIME: Media Types)
147 /* RFC 2554 (AUTH command)
148 /* RFC 2821 (SMTP protocol)
149 /* RFC 2920 (SMTP Pipelining)
150 /* RFC 3207 (STARTTLS command)
151 /* RFC 3461 (SMTP DSN Extension)
152 /* RFC 3463 (Enhanced Status Codes)
153 /* RFC 4954 (AUTH command)
154 /* RFC 5321 (SMTP protocol)
155 /* RFC 6531 (Internationalized SMTP)
156 /* RFC 6533 (Internationalized Delivery Status Notifications)
157 /* RFC 7672 (SMTP security via opportunistic DANE TLS)
158 /* DIAGNOSTICS
159 /* Problems and transactions are logged to \fBsyslogd\fR(8)
160 /* or \fBpostlogd\fR(8).
161 /* Corrupted message files are marked so that the queue manager can
162 /* move them to the \fBcorrupt\fR queue for further inspection.
163 /*
164 /* Depending on the setting of the \fBnotify_classes\fR parameter,
165 /* the postmaster is notified of bounces, protocol problems, and of
166 /* other trouble.
167 /* BUGS
168 /* SMTP and LMTP connection reuse for TLS (without closing the
169 /* SMTP or LMTP connection) is not supported before Postfix 3.4.
170 /*
171 /* SMTP and LMTP connection reuse assumes that SASL credentials
172 /* are valid for all destinations that map onto the same IP
173 /* address and TCP port.
174 /* CONFIGURATION PARAMETERS
175 /* .ad
176 /* .fi
177 /* Before Postfix version 2.3, the LMTP client is a separate
178 /* program that implements only a subset of the functionality
179 /* available with SMTP: there is no support for TLS, and
180 /* connections are cached in-process, making it ineffective
181 /* when the client is used for multiple domains.
182 /*
183 /* Most smtp_\fIxxx\fR configuration parameters have an
184 /* lmtp_\fIxxx\fR "mirror" parameter for the equivalent LMTP
185 /* feature. This document describes only those LMTP-related
186 /* parameters that aren't simply "mirror" parameters.
187 /*
188 /* Changes to \fBmain.cf\fR are picked up automatically, as \fBsmtp\fR(8)
189 /* processes run for only a limited amount of time. Use the command
190 /* "\fBpostfix reload\fR" to speed up a change.
191 /*
192 /* The text below provides only a parameter summary. See
193 /* \fBpostconf\fR(5) for more details including examples.
194 /* COMPATIBILITY CONTROLS
195 /* .ad
196 /* .fi
197 /* .IP "\fBignore_mx_lookup_error (no)\fR"
198 /* Ignore DNS MX lookups that produce no response.
199 /* .IP "\fBsmtp_always_send_ehlo (yes)\fR"
200 /* Always send EHLO at the start of an SMTP session.
201 /* .IP "\fBsmtp_never_send_ehlo (no)\fR"
202 /* Never send EHLO at the start of an SMTP session.
203 /* .IP "\fBsmtp_defer_if_no_mx_address_found (no)\fR"
204 /* Defer mail delivery when no MX record resolves to an IP address.
205 /* .IP "\fBsmtp_line_length_limit (998)\fR"
206 /* The maximal length of message header and body lines that Postfix
207 /* will send via SMTP.
208 /* .IP "\fBsmtp_pix_workaround_delay_time (10s)\fR"
209 /* How long the Postfix SMTP client pauses before sending
210 /* ".<CR><LF>" in order to work around the PIX firewall
211 /* "<CR><LF>.<CR><LF>" bug.
212 /* .IP "\fBsmtp_pix_workaround_threshold_time (500s)\fR"
213 /* How long a message must be queued before the Postfix SMTP client
214 /* turns on the PIX firewall "<CR><LF>.<CR><LF>"
215 /* bug workaround for delivery through firewalls with "smtp fixup"
216 /* mode turned on.
217 /* .IP "\fBsmtp_pix_workarounds (disable_esmtp, delay_dotcrlf)\fR"
218 /* A list that specifies zero or more workarounds for CISCO PIX
219 /* firewall bugs.
220 /* .IP "\fBsmtp_pix_workaround_maps (empty)\fR"
221 /* Lookup tables, indexed by the remote SMTP server address, with
222 /* per-destination workarounds for CISCO PIX firewall bugs.
223 /* .IP "\fBsmtp_quote_rfc821_envelope (yes)\fR"
224 /* Quote addresses in Postfix SMTP client MAIL FROM and RCPT TO commands
225 /* as required
226 /* by RFC 5321.
227 /* .IP "\fBsmtp_reply_filter (empty)\fR"
228 /* A mechanism to transform replies from remote SMTP servers one
229 /* line at a time.
230 /* .IP "\fBsmtp_skip_5xx_greeting (yes)\fR"
231 /* Skip remote SMTP servers that greet with a 5XX status code.
232 /* .IP "\fBsmtp_skip_quit_response (yes)\fR"
233 /* Do not wait for the response to the SMTP QUIT command.
234 /* .PP
235 /* Available in Postfix version 2.0 and earlier:
236 /* .IP "\fBsmtp_skip_4xx_greeting (yes)\fR"
237 /* Skip SMTP servers that greet with a 4XX status code (go away, try
238 /* again later).
239 /* .PP
240 /* Available in Postfix version 2.2 and later:
241 /* .IP "\fBsmtp_discard_ehlo_keyword_address_maps (empty)\fR"
242 /* Lookup tables, indexed by the remote SMTP server address, with
243 /* case insensitive lists of EHLO keywords (pipelining, starttls, auth,
244 /* etc.) that the Postfix SMTP client will ignore in the EHLO response from a
245 /* remote SMTP server.
246 /* .IP "\fBsmtp_discard_ehlo_keywords (empty)\fR"
247 /* A case insensitive list of EHLO keywords (pipelining, starttls,
248 /* auth, etc.) that the Postfix SMTP client will ignore in the EHLO
249 /* response from a remote SMTP server.
250 /* .IP "\fBsmtp_generic_maps (empty)\fR"
251 /* Optional lookup tables that perform address rewriting in the
252 /* Postfix SMTP client, typically to transform a locally valid address into
253 /* a globally valid address when sending mail across the Internet.
254 /* .PP
255 /* Available in Postfix version 2.2.9 and later:
256 /* .IP "\fBsmtp_cname_overrides_servername (version dependent)\fR"
257 /* When the remote SMTP servername is a DNS CNAME, replace the
258 /* servername with the result from CNAME expansion for the purpose of
259 /* logging, SASL password lookup, TLS
260 /* policy decisions, or TLS certificate verification.
261 /* .PP
262 /* Available in Postfix version 2.3 and later:
263 /* .IP "\fBlmtp_discard_lhlo_keyword_address_maps (empty)\fR"
264 /* Lookup tables, indexed by the remote LMTP server address, with
265 /* case insensitive lists of LHLO keywords (pipelining, starttls,
266 /* auth, etc.) that the Postfix LMTP client will ignore in the LHLO
267 /* response
268 /* from a remote LMTP server.
269 /* .IP "\fBlmtp_discard_lhlo_keywords (empty)\fR"
270 /* A case insensitive list of LHLO keywords (pipelining, starttls,
271 /* auth, etc.) that the Postfix LMTP client will ignore in the LHLO
272 /* response
273 /* from a remote LMTP server.
274 /* .PP
275 /* Available in Postfix version 2.4.4 and later:
276 /* .IP "\fBsend_cyrus_sasl_authzid (no)\fR"
277 /* When authenticating to a remote SMTP or LMTP server with the
278 /* default setting "no", send no SASL authoriZation ID (authzid); send
279 /* only the SASL authentiCation ID (authcid) plus the authcid's password.
280 /* .PP
281 /* Available in Postfix version 2.5 and later:
282 /* .IP "\fBsmtp_header_checks (empty)\fR"
283 /* Restricted \fBheader_checks\fR(5) tables for the Postfix SMTP client.
284 /* .IP "\fBsmtp_mime_header_checks (empty)\fR"
285 /* Restricted \fBmime_header_checks\fR(5) tables for the Postfix SMTP
286 /* client.
287 /* .IP "\fBsmtp_nested_header_checks (empty)\fR"
288 /* Restricted \fBnested_header_checks\fR(5) tables for the Postfix SMTP
289 /* client.
290 /* .IP "\fBsmtp_body_checks (empty)\fR"
291 /* Restricted \fBbody_checks\fR(5) tables for the Postfix SMTP client.
292 /* .PP
293 /* Available in Postfix version 2.6 and later:
294 /* .IP "\fBtcp_windowsize (0)\fR"
295 /* An optional workaround for routers that break TCP window scaling.
296 /* .PP
297 /* Available in Postfix version 2.8 and later:
298 /* .IP "\fBsmtp_dns_resolver_options (empty)\fR"
299 /* DNS Resolver options for the Postfix SMTP client.
300 /* .PP
301 /* Available in Postfix version 2.9 - 3.6:
302 /* .IP "\fBsmtp_per_record_deadline (no)\fR"
303 /* Change the behavior of the smtp_*_timeout time limits, from a
304 /* time limit per read or write system call, to a time limit to send
305 /* or receive a complete record (an SMTP command line, SMTP response
306 /* line, SMTP message content line, or TLS protocol message).
307 /* .PP
308 /* Available in Postfix version 2.9 and later:
309 /* .IP "\fBsmtp_send_dummy_mail_auth (no)\fR"
310 /* Whether or not to append the "AUTH=<>" option to the MAIL
311 /* FROM command in SASL-authenticated SMTP sessions.
312 /* .PP
313 /* Available in Postfix version 2.11 and later:
314 /* .IP "\fBsmtp_dns_support_level (empty)\fR"
315 /* Level of DNS support in the Postfix SMTP client.
316 /* .PP
317 /* Available in Postfix version 3.0 and later:
318 /* .IP "\fBsmtp_delivery_status_filter ($default_delivery_status_filter)\fR"
319 /* Optional filter for the \fBsmtp\fR(8) delivery agent to change the
320 /* delivery status code or explanatory text of successful or unsuccessful
321 /* deliveries.
322 /* .IP "\fBsmtp_dns_reply_filter (empty)\fR"
323 /* Optional filter for Postfix SMTP client DNS lookup results.
324 /* .PP
325 /* Available in Postfix version 3.3 and later:
326 /* .IP "\fBsmtp_balance_inet_protocols (yes)\fR"
327 /* When a remote destination resolves to a combination of IPv4 and
328 /* IPv6 addresses, ensure that the Postfix SMTP client can try both
329 /* address types before it runs into the smtp_mx_address_limit.
330 /* .PP
331 /* Available in Postfix 3.5 and later:
332 /* .IP "\fBinfo_log_address_format (external)\fR"
333 /* The email address form that will be used in non-debug logging
334 /* (info, warning, etc.).
335 /* .PP
336 /* Available in Postfix 3.6 and later:
337 /* .IP "\fBdnssec_probe (ns:.)\fR"
338 /* The DNS query type (default: "ns") and DNS query name (default:
339 /* ".") that Postfix may use to determine whether DNSSEC validation
340 /* is available.
341 /* .IP "\fBknown_tcp_ports (lmtp=24, smtp=25, smtps=submissions=465, submission=587)\fR"
342 /* Optional setting that avoids lookups in the \fBservices\fR(5) database.
343 /* .PP
344 /* Available in Postfix version 3.7 and later:
345 /* .IP "\fBsmtp_per_request_deadline (no)\fR"
346 /* Change the behavior of the smtp_*_timeout time limits, from a
347 /* time limit per plaintext or TLS read or write call, to a combined
348 /* time limit for sending a complete SMTP request and for receiving a
349 /* complete SMTP response.
350 /* .IP "\fBsmtp_min_data_rate (500)\fR"
351 /* The minimum plaintext data transfer rate in bytes/second for
352 /* DATA requests, when deadlines are enabled with smtp_per_request_deadline.
353 /* .IP "\fBheader_from_format (standard)\fR"
354 /* The format of the Postfix-generated \fBFrom:\fR header.
355 /* MIME PROCESSING CONTROLS
356 /* .ad
357 /* .fi
358 /* Available in Postfix version 2.0 and later:
359 /* .IP "\fBdisable_mime_output_conversion (no)\fR"
360 /* Disable the conversion of 8BITMIME format to 7BIT format.
361 /* .IP "\fBmime_boundary_length_limit (2048)\fR"
362 /* The maximal length of MIME multipart boundary strings.
363 /* .IP "\fBmime_nesting_limit (100)\fR"
364 /* The maximal recursion level that the MIME processor will handle.
365 /* EXTERNAL CONTENT INSPECTION CONTROLS
366 /* .ad
367 /* .fi
368 /* Available in Postfix version 2.1 and later:
369 /* .IP "\fBsmtp_send_xforward_command (no)\fR"
370 /* Send the non-standard XFORWARD command when the Postfix SMTP server
371 /* EHLO response announces XFORWARD support.
372 /* SASL AUTHENTICATION CONTROLS
373 /* .ad
374 /* .fi
375 /* .IP "\fBsmtp_sasl_auth_enable (no)\fR"
376 /* Enable SASL authentication in the Postfix SMTP client.
377 /* .IP "\fBsmtp_sasl_password_maps (empty)\fR"
378 /* Optional Postfix SMTP client lookup tables with one username:password
379 /* entry per sender, remote hostname or next-hop domain.
380 /* .IP "\fBsmtp_sasl_security_options (noplaintext, noanonymous)\fR"
381 /* Postfix SMTP client SASL security options; as of Postfix 2.3
382 /* the list of available
383 /* features depends on the SASL client implementation that is selected
384 /* with \fBsmtp_sasl_type\fR.
385 /* .PP
386 /* Available in Postfix version 2.2 and later:
387 /* .IP "\fBsmtp_sasl_mechanism_filter (empty)\fR"
388 /* If non-empty, a Postfix SMTP client filter for the remote SMTP
389 /* server's list of offered SASL mechanisms.
390 /* .PP
391 /* Available in Postfix version 2.3 and later:
392 /* .IP "\fBsmtp_sender_dependent_authentication (no)\fR"
393 /* Enable sender-dependent authentication in the Postfix SMTP client; this is
394 /* available only with SASL authentication, and disables SMTP connection
395 /* caching to ensure that mail from different senders will use the
396 /* appropriate credentials.
397 /* .IP "\fBsmtp_sasl_path (empty)\fR"
398 /* Implementation-specific information that the Postfix SMTP client
399 /* passes through to
400 /* the SASL plug-in implementation that is selected with
401 /* \fBsmtp_sasl_type\fR.
402 /* .IP "\fBsmtp_sasl_type (cyrus)\fR"
403 /* The SASL plug-in type that the Postfix SMTP client should use
404 /* for authentication.
405 /* .PP
406 /* Available in Postfix version 2.5 and later:
407 /* .IP "\fBsmtp_sasl_auth_cache_name (empty)\fR"
408 /* An optional table to prevent repeated SASL authentication
409 /* failures with the same remote SMTP server hostname, username and
410 /* password.
411 /* .IP "\fBsmtp_sasl_auth_cache_time (90d)\fR"
412 /* The maximal age of an smtp_sasl_auth_cache_name entry before it
413 /* is removed.
414 /* .IP "\fBsmtp_sasl_auth_soft_bounce (yes)\fR"
415 /* When a remote SMTP server rejects a SASL authentication request
416 /* with a 535 reply code, defer mail delivery instead of returning
417 /* mail as undeliverable.
418 /* .PP
419 /* Available in Postfix version 2.9 and later:
420 /* .IP "\fBsmtp_send_dummy_mail_auth (no)\fR"
421 /* Whether or not to append the "AUTH=<>" option to the MAIL
422 /* FROM command in SASL-authenticated SMTP sessions.
423 /* STARTTLS SUPPORT CONTROLS
424 /* .ad
425 /* .fi
426 /* Detailed information about STARTTLS configuration may be found
427 /* in the TLS_README document.
428 /* .IP "\fBsmtp_tls_security_level (empty)\fR"
429 /* The default SMTP TLS security level for the Postfix SMTP client;
430 /* when a non-empty value is specified, this overrides the obsolete
431 /* parameters smtp_use_tls, smtp_enforce_tls, and smtp_tls_enforce_peername.
432 /* .IP "\fBsmtp_sasl_tls_security_options ($smtp_sasl_security_options)\fR"
433 /* The SASL authentication security options that the Postfix SMTP
434 /* client uses for TLS encrypted SMTP sessions.
435 /* .IP "\fBsmtp_starttls_timeout (300s)\fR"
436 /* Time limit for Postfix SMTP client write and read operations
437 /* during TLS startup and shutdown handshake procedures.
438 /* .IP "\fBsmtp_tls_CAfile (empty)\fR"
439 /* A file containing CA certificates of root CAs trusted to sign
440 /* either remote SMTP server certificates or intermediate CA certificates.
441 /* .IP "\fBsmtp_tls_CApath (empty)\fR"
442 /* Directory with PEM format Certification Authority certificates
443 /* that the Postfix SMTP client uses to verify a remote SMTP server
444 /* certificate.
445 /* .IP "\fBsmtp_tls_cert_file (empty)\fR"
446 /* File with the Postfix SMTP client RSA certificate in PEM format.
447 /* .IP "\fBsmtp_tls_mandatory_ciphers (medium)\fR"
448 /* The minimum TLS cipher grade that the Postfix SMTP client will
449 /* use with
450 /* mandatory TLS encryption.
451 /* .IP "\fBsmtp_tls_exclude_ciphers (empty)\fR"
452 /* List of ciphers or cipher types to exclude from the Postfix
453 /* SMTP client cipher
454 /* list at all TLS security levels.
455 /* .IP "\fBsmtp_tls_mandatory_exclude_ciphers (empty)\fR"
456 /* Additional list of ciphers or cipher types to exclude from the
457 /* Postfix SMTP client cipher list at mandatory TLS security levels.
458 /* .IP "\fBsmtp_tls_dcert_file (empty)\fR"
459 /* File with the Postfix SMTP client DSA certificate in PEM format.
460 /* .IP "\fBsmtp_tls_dkey_file ($smtp_tls_dcert_file)\fR"
461 /* File with the Postfix SMTP client DSA private key in PEM format.
462 /* .IP "\fBsmtp_tls_key_file ($smtp_tls_cert_file)\fR"
463 /* File with the Postfix SMTP client RSA private key in PEM format.
464 /* .IP "\fBsmtp_tls_loglevel (0)\fR"
465 /* Enable additional Postfix SMTP client logging of TLS activity.
466 /* .IP "\fBsmtp_tls_note_starttls_offer (no)\fR"
467 /* Log the hostname of a remote SMTP server that offers STARTTLS,
468 /* when TLS is not already enabled for that server.
469 /* .IP "\fBsmtp_tls_policy_maps (empty)\fR"
470 /* Optional lookup tables with the Postfix SMTP client TLS security
471 /* policy by next-hop destination; when a non-empty value is specified,
472 /* this overrides the obsolete smtp_tls_per_site parameter.
473 /* .IP "\fBsmtp_tls_mandatory_protocols (see 'postconf -d' output)\fR"
474 /* TLS protocols that the Postfix SMTP client will use with mandatory
475 /* TLS encryption.
476 /* .IP "\fBsmtp_tls_scert_verifydepth (9)\fR"
477 /* The verification depth for remote SMTP server certificates.
478 /* .IP "\fBsmtp_tls_secure_cert_match (nexthop, dot-nexthop)\fR"
479 /* How the Postfix SMTP client verifies the server certificate
480 /* peername for the "secure" TLS security level.
481 /* .IP "\fBsmtp_tls_session_cache_database (empty)\fR"
482 /* Name of the file containing the optional Postfix SMTP client
483 /* TLS session cache.
484 /* .IP "\fBsmtp_tls_session_cache_timeout (3600s)\fR"
485 /* The expiration time of Postfix SMTP client TLS session cache
486 /* information.
487 /* .IP "\fBsmtp_tls_verify_cert_match (hostname)\fR"
488 /* How the Postfix SMTP client verifies the server certificate
489 /* peername for the
490 /* "verify" TLS security level.
491 /* .IP "\fBtls_daemon_random_bytes (32)\fR"
492 /* The number of pseudo-random bytes that an \fBsmtp\fR(8) or \fBsmtpd\fR(8)
493 /* process requests from the \fBtlsmgr\fR(8) server in order to seed its
494 /* internal pseudo random number generator (PRNG).
495 /* .IP "\fBtls_high_cipherlist (see 'postconf -d' output)\fR"
496 /* The OpenSSL cipherlist for "high" grade ciphers.
497 /* .IP "\fBtls_medium_cipherlist (see 'postconf -d' output)\fR"
498 /* The OpenSSL cipherlist for "medium" or higher grade ciphers.
499 /* .IP "\fBtls_low_cipherlist (see 'postconf -d' output)\fR"
500 /* The OpenSSL cipherlist for "low" or higher grade ciphers.
501 /* .IP "\fBtls_export_cipherlist (see 'postconf -d' output)\fR"
502 /* The OpenSSL cipherlist for "export" or higher grade ciphers.
503 /* .IP "\fBtls_null_cipherlist (eNULL:!aNULL)\fR"
504 /* The OpenSSL cipherlist for "NULL" grade ciphers that provide
505 /* authentication without encryption.
506 /* .PP
507 /* Available in Postfix version 2.4 and later:
508 /* .IP "\fBsmtp_sasl_tls_verified_security_options ($smtp_sasl_tls_security_options)\fR"
509 /* The SASL authentication security options that the Postfix SMTP
510 /* client uses for TLS encrypted SMTP sessions with a verified server
511 /* certificate.
512 /* .PP
513 /* Available in Postfix version 2.5 and later:
514 /* .IP "\fBsmtp_tls_fingerprint_cert_match (empty)\fR"
515 /* List of acceptable remote SMTP server certificate fingerprints for
516 /* the "fingerprint" TLS security level (\fBsmtp_tls_security_level\fR =
517 /* fingerprint).
518 /* .IP "\fBsmtp_tls_fingerprint_digest (see 'postconf -d' output)\fR"
519 /* The message digest algorithm used to construct remote SMTP server
520 /* certificate fingerprints.
521 /* .PP
522 /* Available in Postfix version 2.6 and later:
523 /* .IP "\fBsmtp_tls_protocols (see postconf -d output)\fR"
524 /* TLS protocols that the Postfix SMTP client will use with
525 /* opportunistic TLS encryption.
526 /* .IP "\fBsmtp_tls_ciphers (medium)\fR"
527 /* The minimum TLS cipher grade that the Postfix SMTP client
528 /* will use with opportunistic TLS encryption.
529 /* .IP "\fBsmtp_tls_eccert_file (empty)\fR"
530 /* File with the Postfix SMTP client ECDSA certificate in PEM format.
531 /* .IP "\fBsmtp_tls_eckey_file ($smtp_tls_eccert_file)\fR"
532 /* File with the Postfix SMTP client ECDSA private key in PEM format.
533 /* .PP
534 /* Available in Postfix version 2.7 and later:
535 /* .IP "\fBsmtp_tls_block_early_mail_reply (no)\fR"
536 /* Try to detect a mail hijacking attack based on a TLS protocol
537 /* vulnerability (CVE-2009-3555), where an attacker prepends malicious
538 /* HELO, MAIL, RCPT, DATA commands to a Postfix SMTP client TLS session.
539 /* .PP
540 /* Available in Postfix version 2.8 and later:
541 /* .IP "\fBtls_disable_workarounds (see 'postconf -d' output)\fR"
542 /* List or bit-mask of OpenSSL bug work-arounds to disable.
543 /* .PP
544 /* Available in Postfix version 2.11-3.1:
545 /* .IP "\fBtls_dane_digest_agility (on)\fR"
546 /* Configure RFC7671 DANE TLSA digest algorithm agility.
547 /* .IP "\fBtls_dane_trust_anchor_digest_enable (yes)\fR"
548 /* Enable support for RFC 6698 (DANE TLSA) DNS records that contain
549 /* digests of trust-anchors with certificate usage "2".
550 /* .PP
551 /* Available in Postfix version 2.11 and later:
552 /* .IP "\fBsmtp_tls_trust_anchor_file (empty)\fR"
553 /* Zero or more PEM-format files with trust-anchor certificates
554 /* and/or public keys.
555 /* .IP "\fBsmtp_tls_force_insecure_host_tlsa_lookup (no)\fR"
556 /* Lookup the associated DANE TLSA RRset even when a hostname is
557 /* not an alias and its address records lie in an unsigned zone.
558 /* .IP "\fBtlsmgr_service_name (tlsmgr)\fR"
559 /* The name of the \fBtlsmgr\fR(8) service entry in master.cf.
560 /* .PP
561 /* Available in Postfix version 3.0 and later:
562 /* .IP "\fBsmtp_tls_wrappermode (no)\fR"
563 /* Request that the Postfix SMTP client connects using the
564 /* legacy SMTPS protocol instead of using the STARTTLS command.
565 /* .PP
566 /* Available in Postfix version 3.1 and later:
567 /* .IP "\fBsmtp_tls_dane_insecure_mx_policy (see 'postconf -d' output)\fR"
568 /* The TLS policy for MX hosts with "secure" TLSA records when the
569 /* nexthop destination security level is \fBdane\fR, but the MX
570 /* record was found via an "insecure" MX lookup.
571 /* .PP
572 /* Available in Postfix version 3.4 and later:
573 /* .IP "\fBsmtp_tls_connection_reuse (no)\fR"
574 /* Try to make multiple deliveries per TLS-encrypted connection.
575 /* .IP "\fBsmtp_tls_chain_files (empty)\fR"
576 /* List of one or more PEM files, each holding one or more private keys
577 /* directly followed by a corresponding certificate chain.
578 /* .IP "\fBsmtp_tls_servername (empty)\fR"
579 /* Optional name to send to the remote SMTP server in the TLS Server
580 /* Name Indication (SNI) extension.
581 /* .PP
582 /* Available in Postfix 3.5, 3.4.6, 3.3.5, 3.2.10, 3.1.13 and later:
583 /* .IP "\fBtls_fast_shutdown_enable (yes)\fR"
584 /* A workaround for implementations that hang Postfix while shutting
585 /* down a TLS session, until Postfix times out.
586 /* OBSOLETE STARTTLS CONTROLS
587 /* .ad
588 /* .fi
589 /* The following configuration parameters exist for compatibility
590 /* with Postfix versions before 2.3. Support for these will
591 /* be removed in a future release.
592 /* .IP "\fBsmtp_use_tls (no)\fR"
593 /* Opportunistic mode: use TLS when a remote SMTP server announces
594 /* STARTTLS support, otherwise send the mail in the clear.
595 /* .IP "\fBsmtp_enforce_tls (no)\fR"
596 /* Enforcement mode: require that remote SMTP servers use TLS
597 /* encryption, and never send mail in the clear.
598 /* .IP "\fBsmtp_tls_enforce_peername (yes)\fR"
599 /* With mandatory TLS encryption, require that the remote SMTP
600 /* server hostname matches the information in the remote SMTP server
601 /* certificate.
602 /* .IP "\fBsmtp_tls_per_site (empty)\fR"
603 /* Optional lookup tables with the Postfix SMTP client TLS usage
604 /* policy by next-hop destination and by remote SMTP server hostname.
605 /* .IP "\fBsmtp_tls_cipherlist (empty)\fR"
606 /* Obsolete Postfix < 2.3 control for the Postfix SMTP client TLS
607 /* cipher list.
608 /* RESOURCE AND RATE CONTROLS
609 /* .ad
610 /* .fi
611 /* .IP "\fBsmtp_connect_timeout (30s)\fR"
612 /* The Postfix SMTP client time limit for completing a TCP connection, or
613 /* zero (use the operating system built-in time limit).
614 /* .IP "\fBsmtp_helo_timeout (300s)\fR"
615 /* The Postfix SMTP client time limit for sending the HELO or EHLO command,
616 /* and for receiving the initial remote SMTP server response.
617 /* .IP "\fBlmtp_lhlo_timeout (300s)\fR"
618 /* The Postfix LMTP client time limit for sending the LHLO command,
619 /* and for receiving the initial remote LMTP server response.
620 /* .IP "\fBsmtp_xforward_timeout (300s)\fR"
621 /* The Postfix SMTP client time limit for sending the XFORWARD command,
622 /* and for receiving the remote SMTP server response.
623 /* .IP "\fBsmtp_mail_timeout (300s)\fR"
624 /* The Postfix SMTP client time limit for sending the MAIL FROM command,
625 /* and for receiving the remote SMTP server response.
626 /* .IP "\fBsmtp_rcpt_timeout (300s)\fR"
627 /* The Postfix SMTP client time limit for sending the SMTP RCPT TO
628 /* command, and for receiving the remote SMTP server response.
629 /* .IP "\fBsmtp_data_init_timeout (120s)\fR"
630 /* The Postfix SMTP client time limit for sending the SMTP DATA command,
631 /* and for receiving the remote SMTP server response.
632 /* .IP "\fBsmtp_data_xfer_timeout (180s)\fR"
633 /* The Postfix SMTP client time limit for sending the SMTP message content.
634 /* .IP "\fBsmtp_data_done_timeout (600s)\fR"
635 /* The Postfix SMTP client time limit for sending the SMTP ".", and
636 /* for receiving the remote SMTP server response.
637 /* .IP "\fBsmtp_quit_timeout (300s)\fR"
638 /* The Postfix SMTP client time limit for sending the QUIT command,
639 /* and for receiving the remote SMTP server response.
640 /* .PP
641 /* Available in Postfix version 2.1 and later:
642 /* .IP "\fBsmtp_mx_address_limit (5)\fR"
643 /* The maximal number of MX (mail exchanger) IP addresses that can
644 /* result from Postfix SMTP client mail exchanger lookups, or zero (no
645 /* limit).
646 /* .IP "\fBsmtp_mx_session_limit (2)\fR"
647 /* The maximal number of SMTP sessions per delivery request before
648 /* the Postfix SMTP client
649 /* gives up or delivers to a fall-back relay host, or zero (no
650 /* limit).
651 /* .IP "\fBsmtp_rset_timeout (20s)\fR"
652 /* The Postfix SMTP client time limit for sending the RSET command,
653 /* and for receiving the remote SMTP server response.
654 /* .PP
655 /* Available in Postfix version 2.2 and earlier:
656 /* .IP "\fBlmtp_cache_connection (yes)\fR"
657 /* Keep Postfix LMTP client connections open for up to $max_idle
658 /* seconds.
659 /* .PP
660 /* Available in Postfix version 2.2 and later:
661 /* .IP "\fBsmtp_connection_cache_destinations (empty)\fR"
662 /* Permanently enable SMTP connection caching for the specified
663 /* destinations.
664 /* .IP "\fBsmtp_connection_cache_on_demand (yes)\fR"
665 /* Temporarily enable SMTP connection caching while a destination
666 /* has a high volume of mail in the active queue.
667 /* .IP "\fBsmtp_connection_reuse_time_limit (300s)\fR"
668 /* The amount of time during which Postfix will use an SMTP
669 /* connection repeatedly.
670 /* .IP "\fBsmtp_connection_cache_time_limit (2s)\fR"
671 /* When SMTP connection caching is enabled, the amount of time that
672 /* an unused SMTP client socket is kept open before it is closed.
673 /* .PP
674 /* Available in Postfix version 2.3 and later:
675 /* .IP "\fBconnection_cache_protocol_timeout (5s)\fR"
676 /* Time limit for connection cache connect, send or receive
677 /* operations.
678 /* .PP
679 /* Available in Postfix version 2.9 - 3.6:
680 /* .IP "\fBsmtp_per_record_deadline (no)\fR"
681 /* Change the behavior of the smtp_*_timeout time limits, from a
682 /* time limit per read or write system call, to a time limit to send
683 /* or receive a complete record (an SMTP command line, SMTP response
684 /* line, SMTP message content line, or TLS protocol message).
685 /* .PP
686 /* Available in Postfix version 2.11 and later:
687 /* .IP "\fBsmtp_connection_reuse_count_limit (0)\fR"
688 /* When SMTP connection caching is enabled, the number of times
689 /* that an SMTP session may be reused before it is closed, or zero (no
690 /* limit).
691 /* .PP
692 /* Available in Postfix version 3.4 and later:
693 /* .IP "\fBsmtp_tls_connection_reuse (no)\fR"
694 /* Try to make multiple deliveries per TLS-encrypted connection.
695 /* .PP
696 /* Available in Postfix version 3.7 and later:
697 /* .IP "\fBsmtp_per_request_deadline (no)\fR"
698 /* Change the behavior of the smtp_*_timeout time limits, from a
699 /* time limit per plaintext or TLS read or write call, to a combined
700 /* time limit for sending a complete SMTP request and for receiving a
701 /* complete SMTP response.
702 /* .IP "\fBsmtp_min_data_rate (500)\fR"
703 /* The minimum plaintext data transfer rate in bytes/second for
704 /* DATA requests, when deadlines are enabled with smtp_per_request_deadline.
705 /* .PP
706 /* Implemented in the qmgr(8) daemon:
707 /* .IP "\fBtransport_destination_concurrency_limit ($default_destination_concurrency_limit)\fR"
708 /* A transport-specific override for the
709 /* default_destination_concurrency_limit parameter value, where
710 /* \fItransport\fR is the master.cf name of the message delivery
711 /* transport.
712 /* .IP "\fBtransport_destination_recipient_limit ($default_destination_recipient_limit)\fR"
713 /* A transport-specific override for the
714 /* default_destination_recipient_limit parameter value, where
715 /* \fItransport\fR is the master.cf name of the message delivery
716 /* transport.
717 /* SMTPUTF8 CONTROLS
718 /* .ad
719 /* .fi
720 /* Preliminary SMTPUTF8 support is introduced with Postfix 3.0.
721 /* .IP "\fBsmtputf8_enable (yes)\fR"
722 /* Enable preliminary SMTPUTF8 support for the protocols described
723 /* in RFC 6531..6533.
724 /* .IP "\fBsmtputf8_autodetect_classes (sendmail, verify)\fR"
725 /* Detect that a message requires SMTPUTF8 support for the specified
726 /* mail origin classes.
727 /* .PP
728 /* Available in Postfix version 3.2 and later:
729 /* .IP "\fBenable_idna2003_compatibility (no)\fR"
730 /* Enable 'transitional' compatibility between IDNA2003 and IDNA2008,
731 /* when converting UTF-8 domain names to/from the ASCII form that is
732 /* used for DNS lookups.
733 /* TROUBLE SHOOTING CONTROLS
734 /* .ad
735 /* .fi
736 /* .IP "\fBdebug_peer_level (2)\fR"
737 /* The increment in verbose logging level when a nexthop destination,
738 /* remote client or server name or network address matches a pattern
739 /* given with the debug_peer_list parameter.
740 /* .IP "\fBdebug_peer_list (empty)\fR"
741 /* Optional list of nexthop destination, remote client or server
742 /* name or network address patterns that, if matched, cause the verbose
743 /* logging level to increase by the amount specified in $debug_peer_level.
744 /* .IP "\fBerror_notice_recipient (postmaster)\fR"
745 /* The recipient of postmaster notifications about mail delivery
746 /* problems that are caused by policy, resource, software or protocol
747 /* errors.
748 /* .IP "\fBinternal_mail_filter_classes (empty)\fR"
749 /* What categories of Postfix-generated mail are subject to
750 /* before-queue content inspection by non_smtpd_milters, header_checks
751 /* and body_checks.
752 /* .IP "\fBnotify_classes (resource, software)\fR"
753 /* The list of error classes that are reported to the postmaster.
754 /* MISCELLANEOUS CONTROLS
755 /* .ad
756 /* .fi
757 /* .IP "\fBbest_mx_transport (empty)\fR"
758 /* Where the Postfix SMTP client should deliver mail when it detects
759 /* a "mail loops back to myself" error condition.
760 /* .IP "\fBconfig_directory (see 'postconf -d' output)\fR"
761 /* The default location of the Postfix main.cf and master.cf
762 /* configuration files.
763 /* .IP "\fBdaemon_timeout (18000s)\fR"
764 /* How much time a Postfix daemon process may take to handle a
765 /* request before it is terminated by a built-in watchdog timer.
766 /* .IP "\fBdelay_logging_resolution_limit (2)\fR"
767 /* The maximal number of digits after the decimal point when logging
768 /* sub-second delay values.
769 /* .IP "\fBdisable_dns_lookups (no)\fR"
770 /* Disable DNS lookups in the Postfix SMTP and LMTP clients.
771 /* .IP "\fBinet_interfaces (all)\fR"
772 /* The network interface addresses that this mail system receives
773 /* mail on.
774 /* .IP "\fBinet_protocols (see 'postconf -d output')\fR"
775 /* The Internet protocols Postfix will attempt to use when making
776 /* or accepting connections.
777 /* .IP "\fBipc_timeout (3600s)\fR"
778 /* The time limit for sending or receiving information over an internal
779 /* communication channel.
780 /* .IP "\fBlmtp_assume_final (no)\fR"
781 /* When a remote LMTP server announces no DSN support, assume that
782 /* the
783 /* server performs final delivery, and send "delivered" delivery status
784 /* notifications instead of "relayed".
785 /* .IP "\fBlmtp_tcp_port (24)\fR"
786 /* The default TCP port that the Postfix LMTP client connects to.
787 /* .IP "\fBmax_idle (100s)\fR"
788 /* The maximum amount of time that an idle Postfix daemon process waits
789 /* for an incoming connection before terminating voluntarily.
790 /* .IP "\fBmax_use (100)\fR"
791 /* The maximal number of incoming connections that a Postfix daemon
792 /* process will service before terminating voluntarily.
793 /* .IP "\fBprocess_id (read-only)\fR"
794 /* The process ID of a Postfix command or daemon process.
795 /* .IP "\fBprocess_name (read-only)\fR"
796 /* The process name of a Postfix command or daemon process.
797 /* .IP "\fBproxy_interfaces (empty)\fR"
798 /* The network interface addresses that this mail system receives mail
799 /* on by way of a proxy or network address translation unit.
800 /* .IP "\fBsmtp_address_preference (any)\fR"
801 /* The address type ("ipv6", "ipv4" or "any") that the Postfix
802 /* SMTP client will try first, when a destination has IPv6 and IPv4
803 /* addresses with equal MX preference.
804 /* .IP "\fBsmtp_bind_address (empty)\fR"
805 /* An optional numerical network address that the Postfix SMTP client
806 /* should bind to when making an IPv4 connection.
807 /* .IP "\fBsmtp_bind_address6 (empty)\fR"
808 /* An optional numerical network address that the Postfix SMTP client
809 /* should bind to when making an IPv6 connection.
810 /* .IP "\fBsmtp_helo_name ($myhostname)\fR"
811 /* The hostname to send in the SMTP HELO or EHLO command.
812 /* .IP "\fBlmtp_lhlo_name ($myhostname)\fR"
813 /* The hostname to send in the LMTP LHLO command.
814 /* .IP "\fBsmtp_host_lookup (dns)\fR"
815 /* What mechanisms the Postfix SMTP client uses to look up a host's
816 /* IP address.
817 /* .IP "\fBsmtp_randomize_addresses (yes)\fR"
818 /* Randomize the order of equal-preference MX host addresses.
819 /* .IP "\fBsyslog_facility (mail)\fR"
820 /* The syslog facility of Postfix logging.
821 /* .IP "\fBsyslog_name (see 'postconf -d' output)\fR"
822 /* A prefix that is prepended to the process name in syslog
823 /* records, so that, for example, "smtpd" becomes "prefix/smtpd".
824 /* .PP
825 /* Available with Postfix 2.2 and earlier:
826 /* .IP "\fBfallback_relay (empty)\fR"
827 /* Optional list of relay hosts for SMTP destinations that can't be
828 /* found or that are unreachable.
829 /* .PP
830 /* Available with Postfix 2.3 and later:
831 /* .IP "\fBsmtp_fallback_relay ($fallback_relay)\fR"
832 /* Optional list of relay hosts for SMTP destinations that can't be
833 /* found or that are unreachable.
834 /* .PP
835 /* Available with Postfix 3.0 and later:
836 /* .IP "\fBsmtp_address_verify_target (rcpt)\fR"
837 /* In the context of email address verification, the SMTP protocol
838 /* stage that determines whether an email address is deliverable.
839 /* .PP
840 /* Available with Postfix 3.1 and later:
841 /* .IP "\fBlmtp_fallback_relay (empty)\fR"
842 /* Optional list of relay hosts for LMTP destinations that can't be
843 /* found or that are unreachable.
844 /* .PP
845 /* Available with Postfix 3.2 and later:
846 /* .IP "\fBsmtp_tcp_port (smtp)\fR"
847 /* The default TCP port that the Postfix SMTP client connects to.
848 /* .PP
849 /* Available in Postfix 3.3 and later:
850 /* .IP "\fBservice_name (read-only)\fR"
851 /* The master.cf service name of a Postfix daemon process.
852 /* .PP
853 /* Available in Postfix 3.7 and later:
854 /* .IP "\fBsmtp_bind_address_enforce (no)\fR"
855 /* Defer delivery when the Postfix SMTP client cannot apply the
856 /* smtp_bind_address or smtp_bind_address6 setting.
857 /* SEE ALSO
858 /* generic(5), output address rewriting
859 /* header_checks(5), message header content inspection
860 /* body_checks(5), body parts content inspection
861 /* qmgr(8), queue manager
862 /* bounce(8), delivery status reports
863 /* scache(8), connection cache server
864 /* postconf(5), configuration parameters
865 /* master(5), generic daemon options
866 /* master(8), process manager
867 /* tlsmgr(8), TLS session and PRNG management
868 /* postlogd(8), Postfix logging
869 /* syslogd(8), system logging
870 /* README FILES
871 /* .ad
872 /* .fi
873 /* Use "\fBpostconf readme_directory\fR" or
874 /* "\fBpostconf html_directory\fR" to locate this information.
875 /* .na
876 /* .nf
877 /* SASL_README, Postfix SASL howto
878 /* TLS_README, Postfix STARTTLS howto
879 /* LICENSE
880 /* .ad
881 /* .fi
882 /* The Secure Mailer license must be distributed with this software.
883 /* AUTHOR(S)
884 /* Wietse Venema
885 /* IBM T.J. Watson Research
886 /* P.O. Box 704
887 /* Yorktown Heights, NY 10598, USA
888 /*
889 /* Wietse Venema
890 /* Google, Inc.
891 /* 111 8th Avenue
892 /* New York, NY 10011, USA
893 /*
894 /* Command pipelining in cooperation with:
895 /* Jon Ribbens
896 /* Oaktree Internet Solutions Ltd.,
897 /* Internet House,
898 /* Canal Basin,
899 /* Coventry,
900 /* CV1 4LY, United Kingdom.
901 /*
902 /* SASL support originally by:
903 /* Till Franke
904 /* SuSE Rhein/Main AG
905 /* 65760 Eschborn, Germany
906 /*
907 /* TLS support originally by:
908 /* Lutz Jaenicke
909 /* BTU Cottbus
910 /* Allgemeine Elektrotechnik
911 /* Universitaetsplatz 3-4
912 /* D-03044 Cottbus, Germany
913 /*
914 /* Revised TLS and SMTP connection cache support by:
915 /* Victor Duchovni
916 /* Morgan Stanley
917 /*--*/
918
919 /* System library. */
920
921 #include <sys_defs.h>
922 #include <unistd.h>
923 #include <stdlib.h>
924 #include <string.h>
925 #include <fcntl.h>
926 #include <dict.h>
927 #include <stringops.h>
928
929 /* Utility library. */
930
931 #include <msg.h>
932 #include <mymalloc.h>
933 #include <name_mask.h>
934 #include <name_code.h>
935 #include <byte_mask.h>
936
937 /* Global library. */
938
939 #include <deliver_request.h>
940 #include <delivered_hdr.h>
941 #include <mail_proto.h>
942 #include <mail_params.h>
943 #include <mail_version.h>
944 #include <mail_conf.h>
945 #include <debug_peer.h>
946 #include <flush_clnt.h>
947 #include <scache.h>
948 #include <string_list.h>
949 #include <maps.h>
950 #include <ext_prop.h>
951 #include <hfrom_format.h>
952
953 /* DNS library. */
954
955 #include <dns.h>
956
957 /* Single server skeleton. */
958
959 #include <mail_server.h>
960
961 /* Application-specific. */
962
963 #include "smtp.h"
964 #include "smtp_sasl.h"
965
966 /*
967 * Tunable parameters. These have compiled-in defaults that can be overruled
968 * by settings in the global Postfix configuration file.
969 */
970 int var_smtp_conn_tmout;
971 int var_smtp_helo_tmout;
972 int var_smtp_xfwd_tmout;
973 int var_smtp_mail_tmout;
974 int var_smtp_rcpt_tmout;
975 int var_smtp_data0_tmout;
976 int var_smtp_data1_tmout;
977 int var_smtp_data2_tmout;
978 int var_smtp_rset_tmout;
979 int var_smtp_quit_tmout;
980 char *var_notify_classes;
981 int var_smtp_skip_5xx_greeting;
982 int var_ign_mx_lookup_err;
983 int var_skip_quit_resp;
984 char *var_fallback_relay;
985 char *var_bestmx_transp;
986 char *var_error_rcpt;
987 int var_smtp_always_ehlo;
988 int var_smtp_never_ehlo;
989 char *var_smtp_sasl_opts;
990 char *var_smtp_sasl_path;
991 char *var_smtp_sasl_passwd;
992 bool var_smtp_sasl_enable;
993 char *var_smtp_sasl_mechs;
994 char *var_smtp_sasl_type;
995 char *var_smtp_bind_addr;
996 char *var_smtp_bind_addr6;
997 char *var_smtp_vrfy_tgt;
998 bool var_smtp_rand_addr;
999 int var_smtp_pix_thresh;
1000 int var_queue_run_delay;
1001 int var_min_backoff_time;
1002 int var_smtp_pix_delay;
1003 int var_smtp_line_limit;
1004 char *var_smtp_helo_name;
1005 char *var_smtp_host_lookup;
1006 bool var_smtp_quote_821_env;
1007 bool var_smtp_defer_mxaddr;
1008 bool var_smtp_send_xforward;
1009 int var_smtp_mxaddr_limit;
1010 int var_smtp_mxsess_limit;
1011 int var_smtp_cache_conn;
1012 int var_smtp_reuse_time;
1013 int var_smtp_reuse_count;
1014 char *var_smtp_cache_dest;
1015 char *var_scache_service; /* You can now leave this here. */
1016 bool var_smtp_cache_demand;
1017 char *var_smtp_ehlo_dis_words;
1018 char *var_smtp_ehlo_dis_maps;
1019 char *var_smtp_addr_pref;
1020
1021 char *var_smtp_tls_level;
1022 bool var_smtp_use_tls;
1023 bool var_smtp_enforce_tls;
1024 char *var_smtp_tls_per_site;
1025 char *var_smtp_tls_policy;
1026 bool var_smtp_tls_wrappermode;
1027 bool var_smtp_tls_conn_reuse;
1028 char *var_tlsproxy_service;
1029
1030 #ifdef USE_TLS
1031 char *var_smtp_sasl_tls_opts;
1032 char *var_smtp_sasl_tlsv_opts;
1033 int var_smtp_starttls_tmout;
1034 char *var_smtp_tls_CAfile;
1035 char *var_smtp_tls_CApath;
1036 char *var_smtp_tls_chain_files;
1037 char *var_smtp_tls_cert_file;
1038 char *var_smtp_tls_mand_ciph;
1039 char *var_smtp_tls_excl_ciph;
1040 char *var_smtp_tls_mand_excl;
1041 char *var_smtp_tls_dcert_file;
1042 char *var_smtp_tls_dkey_file;
1043 bool var_smtp_tls_enforce_peername;
1044 char *var_smtp_tls_key_file;
1045 char *var_smtp_tls_loglevel;
1046 bool var_smtp_tls_note_starttls_offer;
1047 char *var_smtp_tls_mand_proto;
1048 char *var_smtp_tls_sec_cmatch;
1049 int var_smtp_tls_scert_vd;
1050 char *var_smtp_tls_vfy_cmatch;
1051 char *var_smtp_tls_fpt_cmatch;
1052 char *var_smtp_tls_fpt_dgst;
1053 char *var_smtp_tls_tafile;
1054 char *var_smtp_tls_proto;
1055 char *var_smtp_tls_ciph;
1056 char *var_smtp_tls_eccert_file;
1057 char *var_smtp_tls_eckey_file;
1058 char *var_smtp_tls_sni;
1059 bool var_smtp_tls_blk_early_mail_reply;
1060 bool var_smtp_tls_force_tlsa;
1061 char *var_smtp_tls_insecure_mx_policy;
1062
1063 #endif
1064
1065 char *var_smtp_generic_maps;
1066 char *var_prop_extension;
1067 bool var_smtp_sender_auth;
1068 char *var_smtp_tcp_port;
1069 int var_scache_proto_tmout;
1070 bool var_smtp_cname_overr;
1071 char *var_smtp_pix_bug_words;
1072 char *var_smtp_pix_bug_maps;
1073 char *var_cyrus_conf_path;
1074 char *var_smtp_head_chks;
1075 char *var_smtp_mime_chks;
1076 char *var_smtp_nest_chks;
1077 char *var_smtp_body_chks;
1078 char *var_smtp_resp_filter;
1079 bool var_lmtp_assume_final;
1080 char *var_smtp_dns_res_opt;
1081 char *var_smtp_dns_support;
1082 bool var_smtp_dummy_mail_auth;
1083 char *var_smtp_dsn_filter;
1084 char *var_smtp_dns_re_filter;
1085 bool var_smtp_balance_inet_proto;
1086 bool var_smtp_req_deadline;
1087 int var_smtp_min_data_rate;
1088
1089 /* Special handling of 535 AUTH errors. */
1090 char *var_smtp_sasl_auth_cache_name;
1091 int var_smtp_sasl_auth_cache_time;
1092 bool var_smtp_sasl_auth_soft_bounce;
1093
1094 char *var_hfrom_format;
1095 bool var_smtp_bind_addr_enforce;
1096
1097 /*
1098 * Global variables.
1099 */
1100 int smtp_mode;
1101 int smtp_host_lookup_mask;
1102 int smtp_dns_support;
1103 STRING_LIST *smtp_cache_dest;
1104 SCACHE *smtp_scache;
1105 MAPS *smtp_ehlo_dis_maps;
1106 MAPS *smtp_generic_maps;
1107 int smtp_ext_prop_mask;
1108 unsigned smtp_dns_res_opt;
1109 MAPS *smtp_pix_bug_maps;
1110 HBC_CHECKS *smtp_header_checks; /* limited header checks */
1111 HBC_CHECKS *smtp_body_checks; /* limited body checks */
1112 SMTP_CLI_ATTR smtp_cli_attr; /* parsed command-line */
1113 int smtp_hfrom_format; /* postmaster notifications */
1114
1115 #ifdef USE_TLS
1116
1117 /*
1118 * OpenSSL client state (opaque handle)
1119 */
1120 TLS_APPL_STATE *smtp_tls_ctx;
1121 int smtp_tls_insecure_mx_policy;
1122
1123 #endif
1124
1125 /*
1126 * IPv6 preference.
1127 */
1128 static int smtp_addr_pref;
1129
1130 /* get_cli_attr - get command-line attributes */
1131
get_cli_attr(SMTP_CLI_ATTR * attr,char ** argv)1132 static void get_cli_attr(SMTP_CLI_ATTR *attr, char **argv)
1133 {
1134 const char myname[] = "get_cli_attr";
1135 const char *last_flags = "flags="; /* i.e. empty */
1136 static const BYTE_MASK flags_map[] = {
1137 'D', SMTP_CLI_FLAG_DELIVERED_TO,
1138 'O', SMTP_CLI_FLAG_ORIG_RCPT,
1139 'R', SMTP_CLI_FLAG_RETURN_PATH,
1140 'X', SMTP_CLI_FLAG_FINAL_DELIVERY,
1141 0,
1142 };
1143
1144 /*
1145 * Initialize.
1146 */
1147 attr->flags = 0;
1148
1149 /*
1150 * Iterate over the command-line attribute list. Errors are fatal.
1151 */
1152 for ( /* void */ ; *argv != 0; argv++) {
1153
1154 /*
1155 * flags=stuff. Errors are fatal.
1156 */
1157 if (strncasecmp("flags=", *argv, sizeof("flags=") - 1) == 0) {
1158 last_flags = *argv;
1159 if (msg_verbose)
1160 msg_info("%s: %s", myname, last_flags);
1161 attr->flags = byte_mask(*argv, flags_map,
1162 *argv + sizeof("flags=") - 1);
1163 }
1164
1165 /*
1166 * Bad.
1167 */
1168 else
1169 msg_fatal("unknown attribute name: %s", *argv);
1170 }
1171
1172 /*
1173 * Backwards compatibility, redundancy, and obsolescence.
1174 */
1175 if (!smtp_mode && var_lmtp_assume_final
1176 && (attr->flags & SMTP_CLI_FLAG_FINAL_DELIVERY) == 0) {
1177 attr->flags |= SMTP_CLI_FLAG_FINAL_DELIVERY;
1178 msg_warn("%s is obsolete; instead, specify \"%sX\" in %s",
1179 VAR_LMTP_ASSUME_FINAL, last_flags, MASTER_CONF_FILE);
1180 }
1181 }
1182
1183 /* deliver_message - deliver message with extreme prejudice */
1184
deliver_message(const char * service,DELIVER_REQUEST * request)1185 static int deliver_message(const char *service, DELIVER_REQUEST *request)
1186 {
1187 SMTP_STATE *state;
1188 int result;
1189
1190 if (msg_verbose)
1191 msg_info("deliver_message: from %s", request->sender);
1192
1193 /*
1194 * Sanity checks. The smtp server is unprivileged and chrooted, so we can
1195 * afford to distribute the data censoring code, instead of having it all
1196 * in one place.
1197 */
1198 if (request->nexthop[0] == 0)
1199 msg_fatal("empty nexthop hostname");
1200 if (request->rcpt_list.len <= 0)
1201 msg_fatal("recipient count: %d", request->rcpt_list.len);
1202
1203 /*
1204 * D flag checks.
1205 */
1206 if (smtp_cli_attr.flags & SMTP_CLI_FLAG_DELIVERED_TO) {
1207
1208 /*
1209 * The D flag cannot be specified for multi-recipient deliveries.
1210 */
1211 if (request->rcpt_list.len > 1) {
1212 msg_warn("flag `D' requires %s_destination_recipient_limit = 1",
1213 service);
1214 return (reject_deliver_request(service, request, "4.3.5",
1215 "mail system configuration error"));
1216 }
1217
1218 /*
1219 * The recipient cannot appear in a Delivered-To: header.
1220 */
1221 else {
1222 DELIVERED_HDR_INFO *delivered_info = delivered_hdr_init(
1223 request->fp, request->data_offset, FOLD_ADDR_ALL);
1224 VSTRING *generic_rcpt = vstring_alloc(100);
1225 int have_delivered_loop;
1226
1227 smtp_rewrite_generic_internal(generic_rcpt,
1228 request->rcpt_list.info->address);
1229 have_delivered_loop = delivered_hdr_find(
1230 delivered_info, STR(generic_rcpt));
1231 vstring_free(generic_rcpt);
1232 delivered_hdr_free(delivered_info);
1233 if (have_delivered_loop) {
1234 return (reject_deliver_request(service, request, "5.4.6",
1235 "mail forwarding loop for %s",
1236 request->rcpt_list.info->address));
1237 }
1238 }
1239 }
1240
1241 /*
1242 * The O flag cannot be specified for multi-recipient deliveries.
1243 */
1244 if ((smtp_cli_attr.flags & SMTP_CLI_FLAG_ORIG_RCPT)
1245 && request->rcpt_list.len > 1) {
1246 msg_warn("flag `O' requires %s_destination_recipient_limit = 1",
1247 service);
1248 return (reject_deliver_request(service, request, "4.3.5",
1249 "mail system configuration error"));
1250 }
1251
1252 /*
1253 * Initialize. Bundle all information about the delivery request, so that
1254 * we can produce understandable diagnostics when something goes wrong
1255 * many levels below. The alternative would be to make everything global.
1256 */
1257 state = smtp_state_alloc();
1258 state->request = request;
1259 state->src = request->fp;
1260 state->service = service;
1261 state->misc_flags |= smtp_addr_pref;
1262 state->debug_peer_per_nexthop =
1263 debug_peer_check(request->nexthop, "noaddr");
1264 SMTP_RCPT_INIT(state);
1265
1266 /*
1267 * Establish an SMTP session and deliver this message to all requested
1268 * recipients. At the end, notify the postmaster of any protocol errors.
1269 * Optionally deliver mail locally when this machine is the best mail
1270 * exchanger.
1271 */
1272 result = smtp_connect(state);
1273
1274 /*
1275 * Clean up.
1276 */
1277 smtp_state_free(state);
1278
1279 return (result);
1280 }
1281
1282 /* smtp_service - perform service for client */
1283
smtp_service(VSTREAM * client_stream,char * service,char ** unused_argv)1284 static void smtp_service(VSTREAM *client_stream, char *service,
1285 char **unused_argv)
1286 {
1287 DELIVER_REQUEST *request;
1288 int status;
1289
1290 /*
1291 * This routine runs whenever a client connects to the UNIX-domain socket
1292 * dedicated to remote SMTP delivery service. What we see below is a
1293 * little protocol to (1) tell the queue manager that we are ready, (2)
1294 * read a request from the queue manager, and (3) report the completion
1295 * status of that request. All connection-management stuff is handled by
1296 * the common code in single_server.c.
1297 */
1298 if ((request = deliver_request_read(client_stream)) != 0) {
1299 status = deliver_message(service, request);
1300 deliver_request_done(client_stream, request, status);
1301 }
1302 }
1303
1304 /* post_init - post-jail initialization */
1305
post_init(char * unused_name,char ** argv)1306 static void post_init(char *unused_name, char **argv)
1307 {
1308 static const NAME_MASK lookup_masks[] = {
1309 SMTP_HOST_LOOKUP_DNS, SMTP_HOST_FLAG_DNS,
1310 SMTP_HOST_LOOKUP_NATIVE, SMTP_HOST_FLAG_NATIVE,
1311 0,
1312 };
1313 static const NAME_MASK dns_res_opt_masks[] = {
1314 SMTP_DNS_RES_OPT_DEFNAMES, RES_DEFNAMES,
1315 SMTP_DNS_RES_OPT_DNSRCH, RES_DNSRCH,
1316 0,
1317 };
1318 static const NAME_CODE dns_support[] = {
1319 SMTP_DNS_SUPPORT_DISABLED, SMTP_DNS_DISABLED,
1320 SMTP_DNS_SUPPORT_ENABLED, SMTP_DNS_ENABLED,
1321 #if (RES_USE_DNSSEC != 0) && (RES_USE_EDNS0 != 0)
1322 SMTP_DNS_SUPPORT_DNSSEC, SMTP_DNS_DNSSEC,
1323 #endif
1324 0, SMTP_DNS_INVALID,
1325 };
1326
1327 if (*var_smtp_dns_support == 0) {
1328 /* Backwards compatible empty setting */
1329 smtp_dns_support =
1330 var_disable_dns ? SMTP_DNS_DISABLED : SMTP_DNS_ENABLED;
1331 } else {
1332 smtp_dns_support =
1333 name_code(dns_support, NAME_CODE_FLAG_NONE, var_smtp_dns_support);
1334 if (smtp_dns_support == SMTP_DNS_INVALID)
1335 msg_fatal("invalid %s: \"%s\"", VAR_LMTP_SMTP(DNS_SUPPORT),
1336 var_smtp_dns_support);
1337 var_disable_dns = (smtp_dns_support == SMTP_DNS_DISABLED);
1338 }
1339
1340 #ifdef USE_TLS
1341 if (smtp_mode) {
1342 smtp_tls_insecure_mx_policy =
1343 tls_level_lookup(var_smtp_tls_insecure_mx_policy);
1344 switch (smtp_tls_insecure_mx_policy) {
1345 case TLS_LEV_MAY:
1346 case TLS_LEV_ENCRYPT:
1347 case TLS_LEV_DANE:
1348 break;
1349 default:
1350 msg_fatal("invalid %s: \"%s\"", VAR_SMTP_TLS_INSECURE_MX_POLICY,
1351 var_smtp_tls_insecure_mx_policy);
1352 }
1353 }
1354 #endif
1355
1356 /*
1357 * Select hostname lookup mechanisms.
1358 */
1359 if (smtp_dns_support == SMTP_DNS_DISABLED)
1360 smtp_host_lookup_mask = SMTP_HOST_FLAG_NATIVE;
1361 else
1362 smtp_host_lookup_mask =
1363 name_mask(VAR_LMTP_SMTP(HOST_LOOKUP), lookup_masks,
1364 var_smtp_host_lookup);
1365 if (msg_verbose)
1366 msg_info("host name lookup methods: %s",
1367 str_name_mask(VAR_LMTP_SMTP(HOST_LOOKUP), lookup_masks,
1368 smtp_host_lookup_mask));
1369
1370 /*
1371 * Session cache instance.
1372 */
1373 if (*var_smtp_cache_dest || var_smtp_cache_demand)
1374 #if 0
1375 smtp_scache = scache_multi_create();
1376 #else
1377 smtp_scache = scache_clnt_create(var_scache_service,
1378 var_scache_proto_tmout,
1379 var_ipc_idle_limit,
1380 var_ipc_ttl_limit);
1381 #endif
1382
1383 /*
1384 * Select DNS query flags.
1385 */
1386 smtp_dns_res_opt = name_mask(VAR_LMTP_SMTP(DNS_RES_OPT), dns_res_opt_masks,
1387 var_smtp_dns_res_opt);
1388
1389 /*
1390 * Address verification.
1391 */
1392 smtp_vrfy_init();
1393
1394 /*
1395 * Look up service command-line attributes; these do not change during
1396 * the process lifetime.
1397 */
1398 get_cli_attr(&smtp_cli_attr, argv);
1399
1400 /*
1401 * header_from format, for postmaster notifications.
1402 */
1403 smtp_hfrom_format = hfrom_format_parse(VAR_HFROM_FORMAT, var_hfrom_format);
1404 }
1405
1406 /* pre_init - pre-jail initialization */
1407
pre_init(char * unused_name,char ** unused_argv)1408 static void pre_init(char *unused_name, char **unused_argv)
1409 {
1410 int use_tls;
1411 static const NAME_CODE addr_pref_map[] = {
1412 INET_PROTO_NAME_IPV6, SMTP_MISC_FLAG_PREF_IPV6,
1413 INET_PROTO_NAME_IPV4, SMTP_MISC_FLAG_PREF_IPV4,
1414 INET_PROTO_NAME_ANY, 0,
1415 0, -1,
1416 };
1417
1418 /*
1419 * Turn on per-peer debugging.
1420 */
1421 debug_peer_init();
1422
1423 /*
1424 * SASL initialization.
1425 */
1426 if (var_smtp_sasl_enable)
1427 #ifdef USE_SASL_AUTH
1428 smtp_sasl_initialize();
1429 #else
1430 msg_warn("%s is true, but SASL support is not compiled in",
1431 VAR_LMTP_SMTP(SASL_ENABLE));
1432 #endif
1433
1434 if (*var_smtp_tls_level != 0)
1435 switch (tls_level_lookup(var_smtp_tls_level)) {
1436 case TLS_LEV_SECURE:
1437 case TLS_LEV_VERIFY:
1438 case TLS_LEV_DANE_ONLY:
1439 case TLS_LEV_FPRINT:
1440 case TLS_LEV_ENCRYPT:
1441 var_smtp_use_tls = var_smtp_enforce_tls = 1;
1442 break;
1443 case TLS_LEV_DANE:
1444 case TLS_LEV_MAY:
1445 var_smtp_use_tls = 1;
1446 var_smtp_enforce_tls = 0;
1447 break;
1448 case TLS_LEV_NONE:
1449 var_smtp_use_tls = var_smtp_enforce_tls = 0;
1450 break;
1451 default:
1452 /* tls_level_lookup() logs no warning. */
1453 /* session_tls_init() assumes that var_smtp_tls_level is sane. */
1454 msg_fatal("Invalid TLS level \"%s\"", var_smtp_tls_level);
1455 }
1456 use_tls = (var_smtp_use_tls || var_smtp_enforce_tls);
1457
1458 /*
1459 * Initialize the TLS data before entering the chroot jail
1460 */
1461 if (use_tls || var_smtp_tls_per_site[0] || var_smtp_tls_policy[0]) {
1462 #ifdef USE_TLS
1463 TLS_CLIENT_INIT_PROPS props;
1464
1465 tls_pre_jail_init(TLS_ROLE_CLIENT);
1466
1467 /*
1468 * We get stronger type safety and a cleaner interface by combining
1469 * the various parameters into a single tls_client_props structure.
1470 *
1471 * Large parameter lists are error-prone, so we emulate a language
1472 * feature that C does not have natively: named parameter lists.
1473 *
1474 * With tlsproxy(8) turned on, this is still needed for DANE-related
1475 * initializations.
1476 */
1477 smtp_tls_ctx =
1478 TLS_CLIENT_INIT(&props,
1479 log_param = VAR_LMTP_SMTP(TLS_LOGLEVEL),
1480 log_level = var_smtp_tls_loglevel,
1481 verifydepth = var_smtp_tls_scert_vd,
1482 cache_type = LMTP_SMTP_SUFFIX(TLS_MGR_SCACHE),
1483 chain_files = var_smtp_tls_chain_files,
1484 cert_file = var_smtp_tls_cert_file,
1485 key_file = var_smtp_tls_key_file,
1486 dcert_file = var_smtp_tls_dcert_file,
1487 dkey_file = var_smtp_tls_dkey_file,
1488 eccert_file = var_smtp_tls_eccert_file,
1489 eckey_file = var_smtp_tls_eckey_file,
1490 CAfile = var_smtp_tls_CAfile,
1491 CApath = var_smtp_tls_CApath,
1492 mdalg = var_smtp_tls_fpt_dgst);
1493 smtp_tls_list_init();
1494 tls_dane_loglevel(VAR_LMTP_SMTP(TLS_LOGLEVEL), var_smtp_tls_loglevel);
1495 #else
1496 msg_warn("TLS has been selected, but TLS support is not compiled in");
1497 #endif
1498 }
1499
1500 /*
1501 * Flush client.
1502 */
1503 flush_init();
1504
1505 /*
1506 * Session cache domain list.
1507 */
1508 if (*var_smtp_cache_dest)
1509 smtp_cache_dest = string_list_init(VAR_SMTP_CACHE_DEST,
1510 MATCH_FLAG_RETURN,
1511 var_smtp_cache_dest);
1512
1513 /*
1514 * EHLO keyword filter.
1515 */
1516 if (*var_smtp_ehlo_dis_maps)
1517 smtp_ehlo_dis_maps = maps_create(VAR_LMTP_SMTP(EHLO_DIS_MAPS),
1518 var_smtp_ehlo_dis_maps,
1519 DICT_FLAG_LOCK);
1520
1521 /*
1522 * PIX bug workarounds.
1523 */
1524 if (*var_smtp_pix_bug_maps)
1525 smtp_pix_bug_maps = maps_create(VAR_LMTP_SMTP(PIX_BUG_MAPS),
1526 var_smtp_pix_bug_maps,
1527 DICT_FLAG_LOCK);
1528
1529 /*
1530 * Generic maps.
1531 */
1532 if (*var_prop_extension)
1533 smtp_ext_prop_mask =
1534 ext_prop_mask(VAR_PROP_EXTENSION, var_prop_extension);
1535 if (*var_smtp_generic_maps)
1536 smtp_generic_maps =
1537 maps_create(VAR_LMTP_SMTP(GENERIC_MAPS), var_smtp_generic_maps,
1538 DICT_FLAG_LOCK | DICT_FLAG_FOLD_FIX
1539 | DICT_FLAG_UTF8_REQUEST);
1540
1541 /*
1542 * Header/body checks.
1543 */
1544 smtp_header_checks = hbc_header_checks_create(
1545 VAR_LMTP_SMTP(HEAD_CHKS), var_smtp_head_chks,
1546 VAR_LMTP_SMTP(MIME_CHKS), var_smtp_mime_chks,
1547 VAR_LMTP_SMTP(NEST_CHKS), var_smtp_nest_chks,
1548 smtp_hbc_callbacks);
1549 smtp_body_checks = hbc_body_checks_create(
1550 VAR_LMTP_SMTP(BODY_CHKS), var_smtp_body_chks,
1551 smtp_hbc_callbacks);
1552
1553 /*
1554 * Server reply filter.
1555 */
1556 if (*var_smtp_resp_filter)
1557 smtp_chat_resp_filter =
1558 dict_open(var_smtp_resp_filter, O_RDONLY,
1559 DICT_FLAG_LOCK | DICT_FLAG_FOLD_FIX);
1560
1561 /*
1562 * Address family preference.
1563 */
1564 if (*var_smtp_addr_pref) {
1565 smtp_addr_pref = name_code(addr_pref_map, NAME_CODE_FLAG_NONE,
1566 var_smtp_addr_pref);
1567 if (smtp_addr_pref < 0)
1568 msg_fatal("bad %s value: %s", VAR_LMTP_SMTP(ADDR_PREF),
1569 var_smtp_addr_pref);
1570 }
1571
1572 /*
1573 * DNS reply filter.
1574 */
1575 if (*var_smtp_dns_re_filter)
1576 dns_rr_filter_compile(VAR_LMTP_SMTP(DNS_RE_FILTER),
1577 var_smtp_dns_re_filter);
1578 }
1579
1580 /* pre_accept - see if tables have changed */
1581
pre_accept(char * unused_name,char ** unused_argv)1582 static void pre_accept(char *unused_name, char **unused_argv)
1583 {
1584 const char *table;
1585
1586 if ((table = dict_changed_name()) != 0) {
1587 msg_info("table %s has changed -- restarting", table);
1588 exit(0);
1589 }
1590 }
1591
1592 MAIL_VERSION_STAMP_DECLARE;
1593
1594 /* main - pass control to the single-threaded skeleton */
1595
main(int argc,char ** argv)1596 int main(int argc, char **argv)
1597 {
1598 char *sane_procname;
1599
1600 #include "smtp_params.c"
1601 #include "lmtp_params.c"
1602
1603 /*
1604 * Fingerprint executables and core dumps.
1605 */
1606 MAIL_VERSION_STAMP_ALLOCATE;
1607
1608 /*
1609 * XXX At this point, var_procname etc. are not initialized.
1610 *
1611 * The process name, "smtp" or "lmtp", determines the protocol, the DSN
1612 * server reply type, SASL service information lookup, and more. Prepare
1613 * for the possibility there may be another personality.
1614 */
1615 sane_procname = sane_basename((VSTRING *) 0, argv[0]);
1616 if (strcmp(sane_procname, "smtp") == 0)
1617 smtp_mode = 1;
1618 else if (strcmp(sane_procname, "lmtp") == 0)
1619 smtp_mode = 0;
1620 else
1621 /* TODO: logging is not initialized. */
1622 msg_fatal("unexpected process name \"%s\" - "
1623 "specify \"smtp\" or \"lmtp\"", var_procname);
1624
1625 /*
1626 * Initialize with the LMTP or SMTP parameter name space.
1627 */
1628 single_server_main(argc, argv, smtp_service,
1629 CA_MAIL_SERVER_TIME_TABLE(smtp_mode ?
1630 smtp_time_table : lmtp_time_table),
1631 CA_MAIL_SERVER_INT_TABLE(smtp_mode ?
1632 smtp_int_table : lmtp_int_table),
1633 CA_MAIL_SERVER_STR_TABLE(smtp_mode ?
1634 smtp_str_table : lmtp_str_table),
1635 CA_MAIL_SERVER_BOOL_TABLE(smtp_mode ?
1636 smtp_bool_table : lmtp_bool_table),
1637 CA_MAIL_SERVER_NBOOL_TABLE(smtp_mode ?
1638 smtp_nbool_table : lmtp_nbool_table),
1639 CA_MAIL_SERVER_PRE_INIT(pre_init),
1640 CA_MAIL_SERVER_POST_INIT(post_init),
1641 CA_MAIL_SERVER_PRE_ACCEPT(pre_accept),
1642 CA_MAIL_SERVER_BOUNCE_INIT(VAR_SMTP_DSN_FILTER,
1643 &var_smtp_dsn_filter),
1644 0);
1645 }
1646