1 <!doctype html public
"-//W3C//DTD HTML 4.01 Transitional//EN"
2 "http://www.w3.org/TR/html4/loose.dtd">
8 <title>Postfix SASL Howto
</title>
10 <meta http-equiv=
"Content-Type" content=
"text/html; charset=us-ascii">
16 <h1><img src=
"postfix-logo.jpg" width=
"203" height=
"98" ALT=
"">Postfix SASL Howto
</h1>
22 <p> People who go to the trouble of installing Postfix may have the
23 expectation that Postfix is more secure than some other mailers.
24 The Cyrus SASL library is a lot of code. With this, Postfix becomes
25 as secure as other mail systems that use the Cyrus SASL library.
26 Dovecot provides an alternative that may be worth considering.
29 <h2><a name=
"intro">How Postfix uses SASL authentication information
</a></h2>
31 <p> Postfix SASL support (
<a href=
"http://tools.ietf.org/html/rfc4954">RFC
4954</a>, formerly RFC
2554) can be used
33 remote SMTP clients to the Postfix SMTP server, and to authenticate
34 the Postfix SMTP client to a remote SMTP server.
</p>
36 <p> When receiving mail, the Postfix SMTP server logs the client-provided
38 authentication method, and sender address to the maillog file, and
39 optionally grants mail access via the
<a href=
"postconf.5.html#permit_sasl_authenticated">permit_sasl_authenticated
</a>
42 <p> When sending mail, the Postfix SMTP client can look up the
43 remote SMTP server hostname or
44 destination domain (the address right-hand part) in a SASL password
45 table, and if a username/password is found, it will use that username
46 and password to authenticate to the remote SMTP server. And as of
48 Postfix can be configured to search its SASL password table by the
49 sender email address.
</p>
51 <p>This document covers the following topics:
</p>
55 <li><a href=
"#versions">What SASL implementations are supported
</a>
57 <li><a href=
"#build_dovecot">Building Postfix with Dovecot SASL
60 <li><a href=
"#build_sasl">Building the Cyrus SASL library
</a>
62 <li><a href=
"#build_postfix">Building Postfix with Cyrus SASL
65 <li><a href=
"#server_sasl">Enabling SASL authentication in the
66 Postfix SMTP server
</a></li>
68 <li><a href=
"#server_dovecot">Dovecot SASL configuration for the Postfix
71 <li><a href=
"#server_cyrus">Cyrus SASL configuration for the Postfix
74 <li><a href=
"#server_test">Testing SASL authentication in the
75 Postfix SMTP server
</a></li>
77 <li><a href=
"#debugging">Trouble shooting the SASL internals
</a>
79 <li><a href=
"#client_sasl">Enabling SASL authentication in the
80 Postfix SMTP client
</a></li>
82 <li><a href=
"#client_sasl_sender">Supporting multiple ISP accounts
83 in the Postfix SMTP client
</a></li>
85 <li><a href=
"#credits">Credits
</a>
89 <h2><a name=
"versions">What SASL implementations are supported
</a></h2>
91 <p> This document describes Postfix with the following SASL
96 <li> <p> Cyrus SASL version
1 (client and server).
</p>
98 <li> <p> Cyrus SASL version
2 (client and server).
</p>
100 <li> <p> Dovecot protocol version
1 (server only, Postfix version
105 <p> Postfix version
2.3 introduces a plug-in mechanism that provides
106 support for multiple SASL implementations. To find out what
107 implementations are built into Postfix, use the following commands:
112 % postconf -a (SASL support in the SMTP server)
113 % postconf -A (SASL support in the SMTP+LMTP client)
117 <p> Needless to say, these commands are not available in earlier
118 Postfix versions.
</p>
120 <h2><a name=
"build_dovecot">Building Postfix with Dovecot SASL
123 <p> These instructions assume that you build Postfix from source
124 code as described in the
<a href=
"INSTALL.html">INSTALL
</a> document. Some modification may
125 be required if you build Postfix from a vendor-specific source
128 <p> Support for the Dovecot version
1 SASL protocol is available
129 in Postfix
2.3 and later. At the time
130 of writing, only server-side SASL support is available, so you can't
131 use it to authenticate to your network provider's server. Dovecot
132 uses its own daemon process for authentication. This keeps the
133 Postfix build process simple, because there is no need to link extra
134 libraries into Postfix.
</p>
136 <p> To generate the necessary Makefiles, execute the following
137 in the Postfix top-level directory:
</p>
141 % make makefiles CCARGS='-DUSE_SASL_AUTH -DDEF_SERVER_SASL_TYPE=\
"dovecot\"'
145 <p> After this, proceed with
"<tt>make</tt>" as described in the
146 <a href=
"INSTALL.html">INSTALL
</a> document.
</p>
152 <li> <p> The
"-DDEF_SERVER_SASL_TYPE" stuff is not necessary; it just
153 makes Postfix configuration a little more convenient because you
154 don't have to specify the SASL plug-in type in the Postfix
<a href=
"postconf.5.html">main.cf
</a>
157 <li> <p> If you also want support for LDAP or TLS, you will have to merge
158 their CCARGS and AUXLIBS into the above command line.
</p>
162 <h2><a name=
"build_sasl">Building the Cyrus SASL library
</a></h2>
164 <p> Postfix appears to work with cyrus-sasl-
1.5.x or cyrus-sasl-
2.1.x,
165 which are available from:
</p>
169 <a href=
"ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/">ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/
</a>
173 <p> IMPORTANT: if you install the Cyrus SASL libraries as per the
174 default, you will have to symlink /usr/lib/sasl -
> /usr/local/lib/sasl
175 for version
1.5.x or /usr/lib/sasl2 -
> /usr/local/lib/sasl2 for
178 <p> Reportedly, Microsoft Outlook (Express) requires the
179 non-standard LOGIN authentication method. To enable this
180 authentication method, specify ``./configure --enable-login''.
</p>
182 <h2><a name=
"build_postfix">Building Postfix with Cyrus SASL support
</a></h2>
184 <p> These instructions assume that you build Postfix from source
185 code as described in the
<a href=
"INSTALL.html">INSTALL
</a> document. Some modification may
186 be required if you build Postfix from a vendor-specific source
190 assumes that the Cyrus SASL include files are in /usr/local/include,
191 and that the Cyrus SASL libraries are in /usr/local/lib.
</p>
193 <p> On some systems this generates the necessary Makefile definitions:
198 <dt> (for Cyrus SASL version
1.5.x):
201 % make tidy # if you have left-over files from a previous build
202 % make makefiles
CCARGS=
"-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
203 -I/usr/local/include" AUXLIBS=
"-L/usr/local/lib -lsasl"
206 <dt> (for Cyrus SASL version
2.1.x):
209 % make tidy # if you have left-over files from a previous build
210 % make makefiles
CCARGS=
"-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
211 -I/usr/local/include/sasl" AUXLIBS=
"-L/usr/local/lib -lsasl2"
216 <p> On Solaris
2.x you need to specify run-time link information,
217 otherwise ld.so will not find the SASL shared library:
</p>
221 <dt> (for Cyrus SASL version
1.5.x):
224 % make tidy # if you have left-over files from a previous build
225 % make makefiles
CCARGS=
"-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
226 -I/usr/local/include" AUXLIBS=
"-L/usr/local/lib \
227 -R/usr/local/lib -lsasl"
230 <dt> (for Cyrus SASL version
2.1.x):
233 % make tidy # if you have left-over files from a previous build
234 % make makefiles
CCARGS=
"-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
235 -I/usr/local/include/sasl" AUXLIBS=
"-L/usr/local/lib \
236 -R/usr/local/lib -lsasl2"
241 <h2><a name=
"server_sasl">Enabling SASL authentication in the Postfix
244 <p> In order to enable SASL support in the Postfix SMTP server:
</p>
248 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
249 <a href=
"postconf.5.html#smtpd_sasl_auth_enable">smtpd_sasl_auth_enable
</a> = yes
253 <p> In order to allow mail relaying by authenticated remote SMTP
258 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
259 <a href=
"postconf.5.html#smtpd_recipient_restrictions">smtpd_recipient_restrictions
</a> =
260 <a href=
"postconf.5.html#permit_mynetworks">permit_mynetworks
</a>
261 <a href=
"postconf.5.html#permit_sasl_authenticated">permit_sasl_authenticated
</a>
262 <a href=
"postconf.5.html#reject_unauth_destination">reject_unauth_destination
</a>
266 <p> To report SASL login names in Received: message headers
267 (Postfix version
2.3 and later):
</p>
271 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
272 <a href=
"postconf.5.html#smtpd_sasl_authenticated_header">smtpd_sasl_authenticated_header
</a> = yes
276 <p> Note: the SASL login names will be shared with the entire world.
279 <p> Older Microsoft SMTP client software implements a non-standard
280 version of the AUTH protocol syntax, and expects that the SMTP
281 server replies to EHLO with
"250 AUTH=mechanism-list" instead of
282 "250 AUTH mechanism-list". To accommodate such clients (in addition
284 clients) use the following:
</p>
288 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
289 <a href=
"postconf.5.html#broken_sasl_auth_clients">broken_sasl_auth_clients
</a> = yes
293 <h2><a name=
"server_dovecot">Dovecot SASL configuration for the
294 Postfix SMTP server
</a></h2>
296 <p> Dovecot SASL support is available in Postfix
2.3 and later. On
297 the Postfix side you need to specify the location of the
298 Dovecot authentication daemon socket. We use a pathname relative
299 to the Postfix queue directory, so that it will work whether or not
300 the Postfix SMTP server runs chrooted:
</p>
304 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
305 <a href=
"postconf.5.html#smtpd_sasl_type">smtpd_sasl_type
</a> = dovecot
306 <a href=
"postconf.5.html#smtpd_sasl_path">smtpd_sasl_path
</a> = private/auth
310 <p> On the Dovecot side you also need to specify the Dovecot
311 authentication daemon socket. In this case we specify an
312 absolute pathname. In the example we assume that the
313 Postfix queue is under /var/spool/postfix/.
</p>
317 /some/where/dovecot.conf:
319 mechanisms = plain login
326 path = /var/spool/postfix/private/auth
336 <p> See the Dovecot documentation for how to configure and operate
337 the Dovecot authentication server.
</p>
339 <h2><a name=
"server_cyrus">Cyrus SASL configuration for the Postfix
342 <p> You need to configure how the Cyrus SASL library should
343 authenticate a remote SMTP client's username and password. These
345 be stored in a separate configuration file.
</p>
347 <p> The name of the configuration file (default: smtpd.conf) will
348 be constructed from a value that the Postfix SMTP server sends to
350 library, which adds the suffix .conf. The value is configured using
351 one of the following variables:
</p>
355 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
356 # Postfix
2.3 and later
357 <a href=
"postconf.5.html#smtpd_sasl_path">smtpd_sasl_path
</a> = smtpd
359 smtpd_sasl_application_name = smtpd
363 <p> Cyrus SASL searches for the configuration file in /usr/local/lib/sasl/
364 (Cyrus SASL version
1.5.5) or /usr/local/lib/sasl2/ (Cyrus SASL
367 <p> Note: some Postfix distributions are modified and look for
368 the smtpd.conf file in /etc/postfix/sasl.
</p>
370 <p> Note: some Cyrus SASL distributions look for the smtpd.conf
371 file in /etc/sasl2.
</p>
375 <li> <p> To authenticate against the UNIX password database, use:
</p>
378 <dt> (Cyrus SASL version
1.5.x)
381 /usr/local/lib/sasl/smtpd.conf:
382 pwcheck_method: pwcheck
386 <p> IMPORTANT: pwcheck establishes a UNIX domain socket in /var/pwcheck
387 and waits for authentication requests. The Postfix SMTP server must have
388 read+execute permission to this directory or authentication attempts
391 <p> The pwcheck daemon is contained in the cyrus-sasl source tarball.
</p>
393 <dt> (Cyrus SASL version
1.5.26)
396 /usr/local/lib/sasl/smtpd.conf:
397 pwcheck_method: saslauthd
400 <dt> (Cyrus SASL version
2.1.x)
403 /usr/local/lib/sasl2/smtpd.conf:
404 pwcheck_method: saslauthd
405 mech_list: PLAIN LOGIN
410 <p> The saslauthd daemon is also contained in the cyrus-sasl source
411 tarball. It is more flexible than the pwcheck daemon, in that it
412 can authenticate against PAM and various other sources. To use PAM,
413 start saslauthd with
"-a pam".
</p>
415 <p> IMPORTANT: saslauthd usually establishes a UNIX domain socket
416 in /var/run/saslauthd and waits for authentication requests. The Postfix
417 SMTP server must have read+execute permission to this directory or
418 authentication attempts will fail.
</p>
420 <p> Note: The directory where saslauthd puts the socket is configurable.
421 See the command-line option
"-m /path/to/socket" in the saslauthd
424 <li> <p> To authenticate against Cyrus SASL's own password database:
</p>
427 <dt> (Cyrus SASL version
1.5.x)
430 /usr/local/lib/sasl/smtpd.conf:
431 pwcheck_method: sasldb
434 <dt> (Cyrus SASL version
2.1.x)
437 /usr/local/lib/sasl2/smtpd.conf:
438 pwcheck_method: auxprop
439 auxprop_plugin: sasldb
440 mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5
445 <p> This will use the Cyrus SASL password file (default: /etc/sasldb in
446 version
1.5.x, or /etc/sasldb2 in version
2.1.x), which is maintained
447 with the saslpasswd or saslpasswd2 command (part of the Cyrus SASL
448 software). On some poorly-supported systems the saslpasswd command needs
449 to be run multiple times before it stops complaining. The Postfix SMTP
450 server needs read access to the sasldb file - you may have to play games
451 with group access permissions. With the OTP authentication mechanism,
452 the Postfix SMTP server also needs WRITE access to /etc/sasldb2 or
454 (or the back end SQL database, if used).
</p>
456 <p> IMPORTANT: To get sasldb running, make sure that you set the SASL
457 domain (realm) to a fully qualified domain name.
</p>
462 <dt> (Cyrus SASL version
1.5.x)
465 % saslpasswd -c -u `postconf -h
<a href=
"postconf.5.html#myhostname">myhostname
</a>` exampleuser
468 <dt> (Cyrus SASL version
2.1.x)
471 % saslpasswd2 -c -u `postconf -h
<a href=
"postconf.5.html#myhostname">myhostname
</a>` exampleuser
476 <p> You can find out SASL's idea about the realms of the users
477 in sasldb with
<i>sasldblistusers
</i> (Cyrus SASL version
1.5.x) or
478 <i>sasldblistusers2
</i> (Cyrus SASL version
2.1.x).
</p>
480 <p> On the Postfix side, you can have only one realm per
<a href=
"smtpd.8.html">smtpd(
8)
</a>
481 instance, and only the users belonging to that realm would be able to
482 authenticate. The Postfix variable
<a href=
"postconf.5.html#smtpd_sasl_local_domain">smtpd_sasl_local_domain
</a> controls the
483 realm used by
<a href=
"smtpd.8.html">smtpd(
8)
</a>:
</p>
487 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
488 <a href=
"postconf.5.html#smtpd_sasl_local_domain">smtpd_sasl_local_domain
</a> = $
<a href=
"postconf.5.html#myhostname">myhostname
</a>
494 <p> IMPORTANT: The Cyrus SASL password verification services pwcheck
495 and saslauthd can only support the plaintext mechanisms PLAIN or
496 LOGIN. However, the Cyrus SASL library doesn't know this, and will
497 happily advertise other authentication mechanisms that the SASL
498 library implements, such as DIGEST-MD5. As a result, if a remote SMTP
499 client chooses any mechanism other than PLAIN or LOGIN while pwcheck
500 or saslauthd are used, authentication will fail. Thus you may need
501 to limit the list of mechanisms advertised by the Postfix SMTP
506 <li> <p> With older Cyrus SASL versions you remove the corresponding
507 library files from the SASL plug-in directory (and again whenever
508 the system is updated).
</p>
510 <li> <p> With Cyrus SASL version
2.1.x or later the mech_list variable
511 can specify a list of authentication mechanisms that Cyrus SASL may
516 /usr/local/lib/sasl2/smtpd.conf:
517 mech_list: plain login
523 <p> For the same reasons you might want to limit the list of plugins
524 used for authentication.
</p>
528 <li> <p> With Cyrus SASL version
1.5.x your only choice is to
529 delete the corresponding library files from the SASL plug-in
532 <li> <p> With SASL version
2.1.x:
</p>
536 /usr/local/lib/sasl2/smtpd.conf:
537 pwcheck_method: auxprop
544 <p> To run software chrooted with SASL support is an interesting
545 exercise. It probably is not worth the trouble.
</p>
547 <h2><a name=
"server_test">Testing SASL authentication in the Postfix
550 <p> To test the server side, connect (for example, with telnet) to the
551 Postfix SMTP server port and you should
552 be able to have a conversation as shown below. Information sent by the
553 client (that is, you) is shown in bold font.
</p>
557 $
<b>telnet server.example.com
25</b>
559 220 server.example.com ESMTP Postfix
560 <b>EHLO client.example.com
</b>
561 250-server.example.com
565 250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
567 <b>AUTH PLAIN AHRlc3QAdGVzdHBhc3M=
</b>
568 235 Authentication successful
572 <p> Instead of AHRlc3QAdGVzdHBhc3M=, specify the base64 encoded
573 form of \
0username\
0password (the \
0 is a null byte). The
574 example above is for a user named `test' with password `testpass'.
577 <p> In order to generate base64 encoded authentication information
578 you can use one of the following commands:
</p>
582 % printf '\
0username\
0password' | mmencode
588 % perl -MMIME::Base64 -e \
589 'print encode_base64(
"\0username\0password");'
593 <p> The mmencode command is part of the metamail software.
594 MIME::Base64 is available from
<a href=
"http://www.cpan.org/">http://www.cpan.org/
</a>.
</p>
596 <p> Caution: when posting logs of the SASL negotiations to public
598 please keep in mind that username/password information is trivial
599 to recover from the base64-encoded form.
</p>
601 <h2><a name=
"debugging">Trouble shooting the SASL internals
</a></h2>
603 <p> In the Cyrus SASL sources you'll find a subdirectory named
604 "sample". Run make there, then create a symbolic link from sample.conf
605 to smtpd.conf in your Cyrus SASL library directory /usr/local/lib/sasl2.
606 "su" to the user
<i>postfix
</i> (or whatever your
<i><a href=
"postconf.5.html#mail_owner">mail_owner
</a></i>
607 directive is set to):
</p>
615 <p> then run the resulting sample Cyrus SASL server and client in
616 separate terminals. The sample applications send log messages to
618 facility auth. Check the log to fix the problem or run strace /
619 ktrace / truss on the server to see what makes it unhappy. Repeat
620 the previous step until you can successfully authenticate with the
621 sample Cyrus SASL client. Only then get back to Postfix.
</p>
623 <h2><a name=
"client_sasl">Enabling SASL authentication in the
624 Postfix SMTP client
</a></h2>
626 <p> Turn on client-side SASL authentication, and specify a table
627 with per-host or per-destination username and password information.
628 The Postfix SMTP client first searches the table for an entry with
629 the remote SMTP server hostname; if no entry is found, then the
630 Postfix SMTP client searches the table for
631 an entry with the next-hop destination. Usually, that is the
632 right-hand part of an email address, but it can also be the information
633 that is specified with the
<a href=
"postconf.5.html#relayhost">relayhost
</a> parameter or with a
<a href=
"transport.5.html">transport(
5)
</a>
638 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
639 <a href=
"postconf.5.html#smtp_sasl_auth_enable">smtp_sasl_auth_enable
</a> = yes
640 <a href=
"postconf.5.html#smtp_sasl_password_maps">smtp_sasl_password_maps
</a> = hash:/etc/postfix/sasl_passwd
641 <a href=
"postconf.5.html#smtp_sasl_type">smtp_sasl_type
</a> = cyrus
642 <a href=
"postconf.5.html#relayhost">relayhost
</a> = [mail.myisp.net]
644 #
<a href=
"postconf.5.html#relayhost">relayhost
</a> = [mail.myisp.net]:submission
646 /etc/postfix/sasl_passwd:
647 [mail.myisp.net] username:password
648 [mail.myisp.net]:submission username:password
656 <li> <p> The
"submission" destination port tells Postfix to send
657 mail via TCP network port
587, which is normally reserved for email
658 clients. The default is to send mail to the
"smtp" destination port
659 (TCP port
25), which is used for receiving mail across the internet.
660 If you use an explicit destination port in
<a href=
"postconf.5.html">main.cf
</a>, then you must
661 use the same form also in the
<a href=
"postconf.5.html#smtp_sasl_password_maps">smtp_sasl_password_maps
</a> file.
</p>
663 <li> <p> Postfix does not deliver mail via TCP port
465 (the obsolete
664 "wrappermode" protocol). See
<a href=
"TLS_README.html">TLS_README
</a> for a solution that uses the
665 "stunnel" command.
</p>
667 <li> <p> The
"[" and
"]" prevent Postfix from looking up the MX
668 (mail exchanger) records for the enclosed name. If you use this
669 form in
<a href=
"postconf.5.html">main.cf
</a>, then you must use the same form also in the
670 <a href=
"postconf.5.html#smtp_sasl_password_maps">smtp_sasl_password_maps
</a> file.
</p>
672 <li> <p> The Postfix SMTP client opens the SASL client password
673 file before entering the optional chroot jail, so you can keep the
674 file in /etc/postfix and set permissions read / write only for root
675 to keep the username:password combinations away from other system
678 <li> <p> Specify
<b>dbm
</b> instead of
<b>hash
</b> if your system
679 uses
<b>dbm
</b> files instead of
<b>db
</b> files. To find out what
680 lookup tables Postfix supports, use the command
"<b>postconf -m</b>".
683 <li> <p> Execute the command
"<b>postmap /etc/postfix/sasl_passwd</b>"
684 whenever you change the sasl_passwd table.
</p>
688 <p> Workarounds:
</p>
692 <li> <p> Some remote SMTP servers support PLAIN or LOGIN authentication only.
693 By default, the Postfix SMTP client does not use authentication
694 methods that send plaintext passwords, and defers delivery with
695 the following error message:
"Authentication failed: cannot SASL
696 authenticate to server". To enable plaintext authentication specify,
701 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
702 <a href=
"postconf.5.html#smtp_sasl_security_options">smtp_sasl_security_options
</a> = noanonymous
706 <li> <p> Some remote SMTP servers announce authentication mechanisms
707 that don't actually work. It is possible via the
<a href=
"postconf.5.html#smtp_sasl_mechanism_filter">smtp_sasl_mechanism_filter
</a>
708 parameter to restrict the list of server mechanisms that the Postfix
709 SMTP client will take into consideration:
</p>
713 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
714 <a href=
"postconf.5.html#smtp_sasl_mechanism_filter">smtp_sasl_mechanism_filter
</a> = !gssapi, !external, static:all
718 <p> In the above example, the Postfix SMTP client will decline to
720 that require special infrastructure such as Kerberos or TLS.
</p>
722 <li> <p> The Postfix SMTP client is backwards compatible with SMTP
723 servers that use the non-standard
"AUTH=method..." syntax in response
724 to the EHLO command; there is no Postfix client configuration needed
725 to work around it.
</p>
729 <h2><a name=
"client_sasl_sender">Supporting multiple ISP accounts
730 in the Postfix SMTP client
</a></h2>
732 <p> Postfix version
2.3 supports multiple ISP accounts. This can
733 be useful when one person uses the same machine for work and for
734 personal use, or when people with different ISP accounts share the
735 same Postfix server. To make this possible, Postfix
2.3 supports
736 per-sender SASL passwords and per-sender relay hosts. In the example
737 below, Postfix will search the SASL password file by sender before
738 it searches that same file by destination. Likewise, Postfix will
739 search the per-sender
<a href=
"postconf.5.html#relayhost">relayhost
</a> file, and use the default
<a href=
"postconf.5.html#relayhost">relayhost
</a>
740 only as a final resort.
</p>
744 /etc/postfix/
<a href=
"postconf.5.html">main.cf
</a>:
745 <a href=
"postconf.5.html#smtp_sender_dependent_authentication">smtp_sender_dependent_authentication
</a> = yes
746 <a href=
"postconf.5.html#sender_dependent_relayhost_maps">sender_dependent_relayhost_maps
</a> = hash:/etc/postfix/sender_relay
747 <a href=
"postconf.5.html#smtp_sasl_auth_enable">smtp_sasl_auth_enable
</a> = yes
748 <a href=
"postconf.5.html#smtp_sasl_password_maps">smtp_sasl_password_maps
</a> = hash:/etc/postfix/sasl_passwd
749 <a href=
"postconf.5.html#relayhost">relayhost
</a> = [mail.myisp.net]
751 #
<a href=
"postconf.5.html#relayhost">relayhost
</a> = [mail.myisp.net]:submission
753 /etc/postfix/sasl_passwd:
754 # Per-sender authentication; see also /etc/postfix/sender_relay.
755 user1@example.com username2:password2
756 user2@example.net username2:password2
757 # Login information for the default
<a href=
"postconf.5.html#relayhost">relayhost
</a>.
758 [mail.myisp.net] username:password
759 [mail.myisp.net]:submission username:password
761 /etc/postfix/sender_relay:
762 # Per-sender provider; see also /etc/postfix/sasl_passwd.
763 user1@example.com [mail.example.com]:submission
764 user2@example.net [mail.example.net]
772 <li> <p> If you are creative, then you can try to combine the two
773 tables into one single MySQL database, and configure different
774 Postfix queries to extract the appropriate information.
</p>
776 <li> <p> Specify
<b>dbm
</b> instead of
<b>hash
</b> if your system
777 uses
<b>dbm
</b> files instead of
<b>db
</b> files. To find out what
778 lookup tables Postfix supports, use the command
"<b>postconf -m</b>".
781 <li> <p> Execute the command
"<b>postmap /etc/postfix/sasl_passwd</b>"
782 whenever you change the sasl_passwd table.
</p>
784 <li> <p> Execute the command
"<b>postmap /etc/postfix/sender_relay</b>"
785 whenever you change the sender_relay table.
</p>
789 <h2><a name=
"credits">Credits
</a></h2>
793 <li> Postfix SASL support was originally implemented by Till Franke
794 of SuSE Rhein/Main AG.
796 <li> Wietse trimmed down the code to only the bare necessities.
798 <li> Support for Cyrus SASL version
2 was contributed by Jason Hoos.
800 <li> Liviu Daia added smtpd_sasl_application_name, split
801 <a href=
"postconf.5.html#reject_sender_login_mismatch">reject_sender_login_mismatch
</a> into
802 <a href=
"postconf.5.html#reject_authenticated_sender_login_mismatch">reject_authenticated_sender_login_mismatch
</a> and
803 <a href=
"postconf.5.html#reject_unauthenticated_sender_login_mismatch">reject_unauthenticated_sender_login_mismatch
</a>, and revised the docs.
805 <li> Wietse made another iteration through the code to add plug-in
806 support for multiple SASL implementations, and changed
807 smtpd_sasl_application_name into
<a href=
"postconf.5.html#smtpd_sasl_path">smtpd_sasl_path
</a>.
809 <li> The Dovecot SMTP server-only plug-in was originally implemented by
810 Timo Sirainen of Procontrol, Finland.
812 <li> Patrick Ben Koetter revised this document for Postfix
2.4 and
813 made much needed updates.