xref: /netbsd-src/external/ibm-public/postfix/dist/proto/SASL_README.html (revision af56d1fe9956bd7c616e18c1b7f025f464618471)
1<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"
2        "http://www.w3.org/TR/html4/loose.dtd">
3
4<head>
5
6<title>Postfix SASL Howto</title>
7
8<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
9
10</head>
11
12<body>
13
14<h1><img src="postfix-logo.jpg" width="203" height="98" ALT="">Postfix SASL Howto</h1>
15
16<hr>
17
18<h2>Warning</h2>
19
20<p> People who go to the trouble of installing Postfix may have the
21expectation that Postfix is more secure than some other mailers.
22The Cyrus SASL library contains a lot of code. With this, Postfix
23becomes as secure as other mail systems that use the Cyrus SASL
24library.  Dovecot provides an alternative that may be worth
25considering. </p>
26
27<h2><a name="intro">How Postfix uses SASL authentication</a></h2>
28
29<p> SMTP servers need to decide whether an SMTP client is authorized
30to send mail to remote destinations, or only to destinations that
31the server itself is responsible for.  Usually, SMTP servers accept
32mail to remote destinations when the client's IP address is in the
33"same network" as the server's IP address.  </p>
34
35<p> SMTP clients outside the SMTP server's network need a different
36way to get "same network" privileges.  To address this need, Postfix
37supports SASL authentication (RFC 4954, formerly RFC 2554).  With
38this a remote SMTP client can authenticate to the Postfix SMTP
39server, and the Postfix SMTP client can authenticate to a remote
40SMTP server.  Once a client is authenticated, a server can give it
41"same network" privileges.  </p>
42
43<p> Postfix does not implement SASL itself, but instead uses existing
44implementations as building blocks.  This means that some SASL-related
45configuration files will belong to Postfix, while other
46configuration files belong to the specific SASL
47implementation that Postfix will use. This document covers both the
48Postfix and non-Postfix configuration.  </p>
49
50<p> You can read more about the following topics: </p>
51
52<ul>
53
54<li><a href="#server_sasl">Configuring SASL authentication in the
55Postfix SMTP server</a></li>
56
57<li><a href="#client_sasl">Configuring SASL authentication in the Postfix SMTP/LMTP client</a></li>
58
59<li><a href="#postfix_build">Building Postfix with SASL support</a></li>
60
61<li><a href="#cyrus_legacy">Using Cyrus SASL version 1.5.x</a></li>
62
63<li><a href="#credits">Credits</a></li>
64
65</ul>
66
67<h2><a name="server_sasl">Configuring SASL authentication in the
68Postfix SMTP server</a></h2>
69
70<p> As mentioned earlier, SASL is implemented separately from
71Postfix. For this reason, configuring SASL authentication in the
72Postfix SMTP server involves two different steps: </p>
73
74<ul>
75
76<li> <p> Configuring the SASL implementation to offer a list of
77mechanisms that are suitable for SASL authentication and, depending
78on the SASL implementation used, configuring authentication backends
79that verify the remote SMTP client's authentication data against
80the system password file or some other database.  </p> </li>
81
82<li> <p> Configuring the Postfix SMTP server to enable SASL
83authentication, and to authorize clients to relay mail or to control
84what envelope sender addresses the client may use. </p> </li>
85
86</ul>
87
88<p> Successful authentication in the Postfix SMTP server requires
89a functional SASL framework. Configuring SASL should therefore
90always be the first step. </p>
91
92<p> You can read more about the following topics: </p>
93
94<ul>
95
96<li><a href="#server_which">Which SASL Implementations are
97supported?</a></li>
98
99<li><a href="#server_dovecot">Configuring Dovecot SASL</a>
100
101<ul>
102
103<li><a href="#server_dovecot_comm">Postfix to Dovecot SASL
104communication</a></li>
105
106</ul> </li>
107
108<li><a href="#server_cyrus">Configuring Cyrus SASL</a>
109
110<ul>
111
112<li><a href="#server_cyrus_name">Cyrus SASL configuration file
113name</a></li>
114
115<li><a href="#server_cyrus_location">Cyrus SASL configuration
116file location</a></li>
117
118<li><a href="#server_cyrus_comm">Postfix to Cyrus SASL
119communication</a></li>
120
121</ul> </li>
122
123<li><a href="#server_sasl_enable">Enabling SASL authentication and
124authorization in the Postfix SMTP server</a>
125
126<ul>
127
128<li><a href="#server_sasl_authc">Enabling SASL authentication in
129the Postfix SMTP server</a></li>
130
131<li><a href="#smtpd_sasl_security_options">Postfix SMTP Server
132policy - SASL mechanism properties</a></li>
133
134<li><a href="#server_sasl_authz">Enabling SASL authorization in the
135Postfix SMTP server</a></li>
136
137<li><a href="#server_sasl_other">Additional SMTP Server SASL
138options</a></li>
139
140</ul></li>
141
142<li><a href="#server_test">Testing SASL authentication in the Postfix
143SMTP server</a></li>
144
145</ul>
146
147
148<h3><a name="server_which">Which SASL Implementations are
149supported?</a></h3>
150
151<p> Currently the Postfix SMTP server supports the Cyrus SASL and
152Dovecot SASL implementations. </p>
153
154<blockquote>
155
156<strong>Note</strong>
157
158<p> Current Postfix versions have a plug-in architecture that can
159support multiple SASL implementations. Before Postfix version 2.3,
160Postfix had support only for Cyrus SASL.  </p>
161
162</blockquote>
163
164<p> To find out what SASL implementations are compiled into Postfix,
165use the following commands: </p>
166
167<blockquote>
168<pre>
169% <strong><code>postconf -a</code></strong> (SASL support in the SMTP server)
170% <strong><code>postconf -A</code></strong> (SASL support in the SMTP+LMTP client)
171</pre>
172</blockquote>
173
174<p> These commands are available only with Postfix version 2.3 and
175later. </p>
176
177<h3><a name="server_dovecot">Configuring Dovecot SASL</a></h3>
178
179<p> Dovecot is a POP/IMAP server that has its own configuration to
180authenticate POP/IMAP clients. When the Postfix SMTP server uses
181Dovecot SASL, it reuses parts of this configuration.  Consult the
182<a href="http://wiki.dovecot.org">Dovecot documentation</a> for how
183to configure and operate the Dovecot authentication server.  </p>
184
185<h4><a name="server_dovecot_comm">Postfix to Dovecot SASL communication</a></h4>
186
187<p> Communication between the Postfix SMTP server and Dovecot SASL
188happens over a UNIX-domain socket or over a TCP socket.  Dovecot 1
189supports UNIX-domain socket communication only. </p>
190
191<h5>UNIX-domain socket communication</h5>
192
193<p> The socket
194pathname and the list of mechanisms offered to Postfix need to be
195specified on the Dovecot server side in <code>dovecot.conf</code>.
196</p>
197
198<p> The following example assumes that the Postfix queue is under
199<code>/var/spool/postfix/</code>. </p>
200
201<blockquote>
202<pre>
203 1 /etc/dovecot.conf:
204 2     auth default {
205 3       mechanisms = plain login
206 4         passdb pam {
207 5         }
208 6         userdb passwd {
209 7         }
210 8         socket listen {
211 9         client {
21210           path = /var/spool/postfix/private/auth
21311           mode = 0660
21412           user = postfix
21513           group = postfix
21614         }
21715       }
21816     }
219</pre>
220</blockquote>
221
222<p> Line 3 provides <code>plain</code> and <code>login</code> as
223mechanisms for the Postfix SMTP server, line 10 places the Dovecot
224SASL socket in <code>/var/spool/postfix/private/auth</code>, and
225lines 11-13 limit read+write permissions to user and group
226<code>postfix</code> only. </p>
227
228<p> Proceed with the section "<a href="#server_sasl_enable">Enabling
229SASL authentication and authorization in the Postfix SMTP server</a>"
230to turn on and use SASL in the Postfix SMTP server.  </p>
231
232<h5>TCP socket communication</h5>
233
234<p> The TCP port and the list of mechanisms offered to Postfix need
235to be specified on the Dovecot server side in <code>10-auth.conf</code>
236and <code>10-master.conf</code>. </p>
237
238<p> The following examples assume that Postfix should communicate
239with Dovecot on TCP port 12345. </p>
240
241<blockquote>
242<pre>
2431 /etc/dovecot/conf.d/10-auth.conf:
2442     auth_mechanisms = plain login
245</pre>
246</blockquote>
247
248<p> Line 2 provides plain and login as mechanisms for the Postfix
249SMTP server. </p>
250
251<blockquote>
252<pre>
2531 /etc/dovecot/conf.d/10-master.conf:
2542     service auth {
2553       unix_listener auth-userdb {
2564       }
2575       inet_listener {
2586         port = 12345
2597       }
2608     }
261</pre>
262</blockquote>
263
264<p> Line 5 creates a new TCP socket and line 6 specifies port 12345
265where Dovecot SASL should wait for Postfix authentication requests.
266</p>
267
268<p> Proceed with the section "<a href="#server_sasl_enable">Enabling
269SASL authentication and authorization in the Postfix SMTP server</a>"
270to turn on and use SASL in the Postfix SMTP server.  </p>
271
272<h3><a name="server_cyrus">Configuring Cyrus SASL</a></h3>
273
274<p> The Cyrus SASL framework supports a wide variety of applications
275(POP, IMAP, SMTP, etc.).  Different applications may require different
276configurations. As a consequence each application may have its own
277configuration file.  </p>
278
279<p> The first step configuring Cyrus SASL is to determine name and
280location of a configuration file that describes how the Postfix
281SMTP server will use the SASL framework. </p>
282
283<h4><a name="server_cyrus_name">Cyrus SASL configuration file name</a></h4>
284
285<p> The name of the configuration file (default: <code>smtpd.conf</code>)
286is configurable. It is a concatenation from a value that the Postfix
287SMTP server sends to the Cyrus SASL library, and the suffix
288<code>.conf</code>, added by Cyrus SASL. </p>
289
290<p> The value sent by Postfix is the name of the server component
291that will use Cyrus SASL. It defaults to <code>smtpd</code> and
292is configured with one of the following variables: </p>
293
294<blockquote>
295<pre>
296/etc/postfix/main.cf:
297    # Postfix 2.3 and later
298    smtpd_sasl_path = smtpd
299
300    # Postfix &lt; 2.3
301    smtpd_sasl_application_name = smtpd
302</pre>
303</blockquote>
304
305<h4><a name="server_cyrus_location">Cyrus SASL configuration file
306location</a></h4>
307
308<p> The location where Cyrus SASL searches for the named file depends
309on the Cyrus SASL version and the OS/distribution used. </p>
310
311<p> You can read more about the following topics: </p>
312
313<ul>
314
315<li> <p> Cyrus SASL version 2.x searches for the configuration file
316in <code>/usr/lib/sasl2/</code>. </p> </li>
317
318<li> <p> Cyrus SASL version 2.1.22 and newer additionally search
319in <code>/etc/sasl2/</code>. </p> </li>
320
321<li> <p> Some Postfix distributions are modified and look for the
322Cyrus SASL configuration file in <code>/etc/postfix/sasl/</code>,
323<code>/var/lib/sasl2/</code> etc. See the distribution-specific
324documentation to determine the expected location. </p> </li>
325
326</ul>
327
328<blockquote>
329
330<strong>Note</strong>
331
332<p> Cyrus SASL searches <code>/usr/lib/sasl2/</code> first. If it
333finds the specified configuration file there, it will not examine
334other locations. </p>
335
336</blockquote>
337
338<h4><a name="server_cyrus_comm">Postfix to Cyrus SASL communication</a></h4>
339
340<p> As the Postfix SMTP server is linked with the Cyrus SASL library
341<code>libsasl</code>, communication between Postfix and Cyrus SASL
342takes place by calling functions in the SASL library. </p>
343
344<p> The SASL library may use an external password verification
345service, or an internal plugin to connect to authentication backends
346and verify the SMTP client's authentication data against the system
347password file or other databases. </p>
348
349<p> The following table shows typical combinations discussed in
350this document: </p>
351
352<blockquote>
353
354<table border="1">
355
356<tr>
357
358<th align="center">authentication backend</th>
359
360<th align="center">password verification service / plugin</th>
361
362</tr>
363
364<tr>
365
366<td>/etc/shadow</td>
367
368<td><a href="#saslauthd">saslauthd</a></td>
369
370</tr>
371
372<tr>
373
374<td>PAM</td>
375
376<td><a href="#saslauthd">saslauthd</a></td>
377
378</tr>
379
380<tr>
381
382<td>IMAP server</td>
383
384<td><a href="#saslauthd">saslauthd</a></td>
385
386</tr>
387
388<tr>
389
390<td>sasldb</td>
391
392<td><a href="#auxprop_sasldb">sasldb</a></td>
393
394</tr>
395
396<tr>
397
398<td>MySQL, PostgreSQL, SQLite</td>
399
400<td><a href="#auxprop_sql">sql</a></td>
401
402</tr>
403
404<tr>
405
406<td>LDAP</td>
407
408<td><a href="#auxprop_ldapdb">ldapdb</a></td>
409
410</tr>
411
412</table>
413
414</blockquote>
415
416<blockquote>
417
418<strong>Note</strong>
419
420<p> Read the Cyrus SASL documentation for other backends it can
421use. </p>
422
423</blockquote>
424
425<h4><a name="saslauthd">saslauthd - Cyrus SASL password verification service</a></h4>
426
427<p> Communication between the Postfix SMTP server (read: Cyrus SASL's
428<code>libsasl</code>) and the <code>saslauthd</code> server takes
429place over a UNIX-domain socket. </p>
430
431<p> <code>saslauthd</code> usually establishes the UNIX domain
432socket in <code>/var/run/saslauthd/</code> and waits for authentication
433requests. The Postfix SMTP server must have read+execute permission
434to this directory or authentication attempts will fail. </p>
435
436<blockquote>
437
438<strong>Important</strong>
439
440<p> Some distributions require the user <code>postfix</code> to be
441member of a special group e.g.  <code>sasl</code>, otherwise it
442will not be able to access the <code>saslauthd</code> socket
443directory.  </p>
444
445</blockquote>
446
447<p> The following example configures the Cyrus SASL library to
448contact <code>saslauthd</code> as its password verification service:
449</p>
450
451<blockquote>
452<pre>
453/etc/sasl2/smtpd.conf:
454    pwcheck_method: saslauthd
455    mech_list: PLAIN LOGIN
456</pre>
457</blockquote>
458
459<blockquote>
460
461<strong>Important</strong>
462
463<p> Do not specify any other mechanisms in <code>mech_list</code>
464than <code>PLAIN</code> or <code>LOGIN</code> when using
465<code>saslauthd</code>!  It can only handle these two mechanisms,
466and authentication will fail if clients are allowed to choose other
467mechanisms. </p>
468
469</blockquote>
470
471<blockquote>
472
473<strong>Important</strong>
474
475<p> Plaintext mechanisms (<code>PLAIN</code>, <code>LOGIN</code>)
476send credentials unencrypted. This information should be protected
477by an additional security layer such as a TLS-encrypted SMTP session
478(see: TLS_README). </p>
479
480</blockquote>
481
482<p> Additionally the <code>saslauthd</code> server itself must be
483configured. It must be told which authentication backend to turn
484to for password verification. The backend is selected with a
485<code>saslauthd</code> command-line option and will be shown in the
486following examples. </p>
487
488<blockquote>
489
490<strong>Note</strong>
491
492<p> Some distributions use a configuration file to provide saslauthd
493command line options to set e.g. the authentication backend. Typical
494locations are <code>/etc/sysconfig/saslauthd</code> or
495<code>/etc/default/saslauthd</code>. </p>
496
497</blockquote>
498
499<h4><a name="saslauthd_shadow">Using saslauthd with /etc/shadow</a></h4>
500
501<p> Access to the <code>/etc/shadow</code> system password file
502requires <code>root</code> privileges.  The Postfix SMTP server
503(and in consequence <code>libsasl</code> linked to the server) runs
504with the least privilege possible. Direct access to
505<code>/etc/shadow</code> would not be possible without breaking the
506Postfix security architecture.  </p>
507
508<p> The <code>saslauthd</code> socket builds a safe bridge. Postfix,
509running as limited user <code>postfix</code>, can access the
510UNIX-domain socket that <code>saslauthd</code> receives commands
511on; <code>saslauthd</code>, running as privileged user <code>root</code>,
512has the privileges required to access the shadow file. </p>
513
514<p> The <code>saslauthd</code> server verifies passwords against the
515authentication backend <code>/etc/shadow</code> if started like this: </p>
516
517<blockquote>
518<pre>
519% <strong><code>saslauthd -a shadow</code></strong>
520</pre>
521</blockquote>
522
523<p> See section "<a href="#testing_saslauthd">Testing saslauthd
524authentication</a>" for test instructions. </p>
525
526<h4><a name="saslauthd_pam">Using saslauthd with PAM</a></h4>
527
528<p> Cyrus SASL can use the PAM framework to authenticate credentials.
529<code>saslauthd</code> uses the PAM framework when started like
530this: </p>
531
532<blockquote>
533<pre>
534% <strong><code>saslauthd -a pam</code></strong>
535</pre>
536</blockquote>
537
538<blockquote>
539
540<strong>Note</strong>
541
542<p> PAM configuration for the Postfix SMTP server is usually given
543in <code>/etc/pam.d/smtp</code> and is beyond the scope of this
544document. </p>
545
546</blockquote>
547
548<p> See section "<a href="#testing_saslauthd">Testing saslauthd
549authentication</a>" for test instructions. </p>
550
551<h4><a name="saslauthd_imap">Using saslauthd with an IMAP server</a></h4>
552
553<p> <code>saslauthd</code> can verify the SMTP client credentials
554by using them to log into an IMAP server.  If the login succeeds,
555SASL authentication also succeeds. <code>saslauthd</code> contacts
556an IMAP server when started like this: </p>
557
558<blockquote>
559<pre>
560% <strong><code>saslauthd -a rimap -O imap.example.com</code></strong>
561</pre>
562</blockquote>
563
564<blockquote>
565
566<strong>Note</strong>
567
568<p> The option "<code>-O imap.example.com</code>" specifies the
569IMAP server <code>saslauthd</code> should contact when it verifies
570credentials. </p>
571
572</blockquote>
573
574<blockquote>
575
576<strong>Important</strong>
577
578<p> <code>saslauthd</code> sends IMAP login information unencrypted.
579Any IMAP session leaving the local host should be protected by an
580additional security layer such as an SSL tunnel. </p>
581
582</blockquote>
583
584<p> See section "<a href="#testing_saslauthd">Testing saslauthd
585authentication</a>" for test instructions. </p>
586
587<h4><a name="testing_saslauthd">Testing saslauthd authentication</a></h4>
588
589<p> Cyrus SASL provides the <code>testsaslauthd</code> utility to
590test <code>saslauthd</code> authentication. The username and password
591are given as command line arguments. The example shows the response
592when authentication is successful: </p>
593
594<blockquote>
595<pre>
596% <strong><code>testsaslauthd -u <em>username</em> -p <em>password</em></code></strong>
5970: OK "Success."
598</pre>
599</blockquote>
600
601<blockquote>
602
603<strong>Note</strong>
604
605<p> Sometimes the <code>testsaslauthd</code> program is not distributed
606with a the Cyrus SASL main package.  In that case, it may be
607distributed with <code>-devel</code>, <code>-dev</code> or
608<code>-debug</code> packages. </p>
609
610</blockquote>
611
612<p> Specify an additional "<code>-s smtp</code>" if <code>saslauthd</code>
613was configured to contact the PAM authentication framework, and
614specify an additional "<code>-f <em>/path/to/socketdir/mux</em></code>"
615if <code>saslauthd</code> establishes the UNIX-domain socket in a
616non-default location. </p>
617
618<p> If authentication succeeds, proceed with the section "<a
619href="#server_sasl_enable">Enabling SASL authentication and authorization
620in the Postfix SMTP server</a>". </p>
621
622<h4><a name="auxprop">Cyrus SASL Plugins - auxiliary property
623plugins</a></h4>
624
625<p> Cyrus SASL uses a plugin infrastructure (called <code>auxprop</code>)
626to expand <code>libsasl</code>'s capabilities.  Currently Cyrus
627SASL sources provide three authentication plugins. </p>
628
629<blockquote>
630
631<table border="1">
632
633<tr> <th>Plugin </th> <th>Description </th> </tr>
634
635<tr> <td><a href="#auxprop_sasldb">sasldb</a></td> <td> Accounts
636are stored stored in a Cyrus SASL Berkeley DB database </td> </tr>
637
638<tr> <td><a href="#auxprop_sql">sql</a></td> <td> Accounts are
639stored in a SQL database </td> </tr>
640
641<tr> <td><a href="#auxprop_ldapdb">ldapdb</a></td> <td> Accounts
642are stored stored in an LDAP database </td> </tr>
643
644</table>
645
646</blockquote>
647
648<blockquote>
649
650<strong>Important</strong>
651
652<p> These three plugins support shared-secret mechanisms i.e.
653CRAM-MD5, DIGEST-MD5 and NTLM. These mechanisms send credentials
654encrypted but their verification process requires the password to
655be available in plaintext.  Consequently passwords cannot (!) be
656stored in encrypted form. </p>
657
658</blockquote>
659
660<h4><a name="auxprop_sasldb">The sasldb plugin</a></h4>
661
662<p> The sasldb auxprop plugin authenticates SASL clients against
663credentials that are stored in a Berkeley DB database. The database
664schema is specific to Cyrus SASL.  The database is usually located
665at <code>/etc/sasldb2</code>. </p>
666
667<blockquote>
668
669<strong>Note</strong>
670
671<p> The <code>sasldb2</code> file contains passwords in
672plaintext, and should have read+write access only to user
673<code>postfix</code> or a group that <code>postfix</code> is member
674of. </p>
675
676</blockquote>
677
678<p> The <code>saslpasswd2</code> command-line utility creates
679and maintains the database: </p>
680
681<blockquote>
682<pre>
683% <strong>saslpasswd2 -c -u <em>example.com</em> <em>username</em></strong>
684Password:
685Again (for verification):
686</pre>
687</blockquote>
688
689<p> This command creates an account
690<code><em>username@example.com</em></code>.  </p>
691
692<blockquote>
693
694<strong>Important</strong>
695
696<p> users must specify <code><em>username@example.com</em></code>
697as login name, not <code><em>username</em></code>. </p>
698
699</blockquote>
700
701<p> Run the following command to reuse the Postfix <code>mydomain</code>
702parameter value as the login domain: </p>
703
704<blockquote>
705<pre>
706% <strong>saslpasswd2 -c -u `postconf -h mydomain` <em>username</em></strong>
707Password:
708Again (for verification):
709</pre>
710</blockquote>
711
712<blockquote>
713
714<strong>Note</strong>
715
716<p> Run <code>saslpasswd2</code> without any options for further
717help on how to use the command. </p>
718
719</blockquote>
720
721<p> The <code>sasldblistusers2</code> command lists all existing
722users in the sasldb database: </p>
723
724<blockquote>
725<pre>
726% <strong>sasldblistusers2</strong>
727username1@example.com: password1
728username2@example.com: password2
729</pre>
730</blockquote>
731
732<p> Configure libsasl to use sasldb with the following instructions: </p>
733
734<blockquote>
735<pre>
736/etc/sasl2/smtpd.conf:
737    pwcheck_method: auxprop
738    auxprop_plugin: sasldb
739    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
740</pre>
741</blockquote>
742
743<blockquote>
744
745<strong>Note</strong>
746
747<p> In the above example adjust <code>mech_list</code> to the
748mechanisms that are applicable for your environment. </p>
749
750</blockquote>
751
752<h4><a name="auxprop_sql">The sql plugin</a></h4>
753
754<p> The sql auxprop plugin is a generic SQL plugin. It provides
755access to credentials stored in a MySQL, PostgreSQL or SQLite
756database. This plugin requires that SASL client passwords are
757stored as plaintext. </p>
758
759<blockquote>
760
761<strong>Tip</strong>
762
763<p> If you must store encrypted passwords, you cannot use the sql
764auxprop plugin. Instead, see section "<a href="#saslauthd_pam">Using
765saslauthd with PAM</a>", and configure PAM to look up the encrypted
766passwords with, for example, the <code>pam_mysql</code> module.
767You will not be able to use any of the methods that require access
768to plaintext passwords, such as the shared-secret methods CRAM-MD5
769and DIGEST-MD5.  </p>
770
771</blockquote>
772
773<p> The following example configures libsasl to use the sql plugin
774and connects it to a PostgreSQL server: </p>
775
776<blockquote>
777<pre>
778/etc/sasl2/smtpd.conf:
779    pwcheck_method: auxprop
780    auxprop_plugin: sql
781    mech_list: PLAIN LOGIN CRAM-MD5 DIGEST-MD5 NTLM
782    sql_engine: pgsql
783    sql_hostnames: 127.0.0.1, 192.0.2.1
784    sql_user: username
785    sql_passwd: secret
786    sql_database: dbname
787    sql_select: SELECT password FROM users WHERE user = '%u'@'%r'
788</pre>
789</blockquote>
790
791<blockquote>
792
793<strong>Note</strong>
794
795<p> Set appropriate permissions if <code>smtpd.conf</code> contains
796a password. The file should be readable by the <code>postfix</code>
797user. </p>
798
799</blockquote>
800
801<blockquote>
802
803<strong>Note</strong>
804
805<p> In the above example, adjust <code>mech_list</code> to the
806mechanisms that are applicable for your environment. </p>
807
808</blockquote>
809
810<p> The sql plugin has the following configuration options: </p>
811
812<blockquote>
813
814<dl>
815
816<dt>sql_engine</dt>
817
818<dd>
819
820<p> Specify <code>mysql</code> to connect to a MySQL server,
821<code>pgsql</code> for a PostgreSQL server or <code>sqlite</code>
822for an SQLite database </p>
823
824</dd>
825
826<dt>sql_hostnames</dt>
827
828<dd>
829
830<p> Specify one or more servers (hostname or hostname:port) separated
831by commas. </p>
832
833<blockquote>
834
835<strong>Note</strong>
836
837<p> With MySQL servers, specify <code>localhost</code> to connect
838over a UNIX-domain socket, and specify <code>127.0.0.1</code> to
839connect over a TCP socket.  </p>
840
841</blockquote>
842
843</dd>
844
845<dt>sql_user</dt>
846
847<dd>
848
849<p> The login name to gain access to the database. </p>
850
851</dd>
852
853<dt>sql_passwd</dt>
854
855<dd>
856
857<p> The password to gain access to the database. </p>
858
859</dd>
860
861<dt>sql_database</dt>
862
863<dd>
864
865<p> The name of the database to connect to. </p>
866
867</dd>
868
869<dt>sql_select</dt>
870
871<dd>
872
873<p> The SELECT statement that should retrieve the plaintext password
874from a database table. </p>
875
876<blockquote>
877
878<strong>Important</strong>
879
880<p> Do not enclose the statement in quotes! Use single quotes to
881escape macros! </p>
882
883</blockquote>
884
885</dd>
886
887</dl>
888
889</blockquote>
890
891<p> The sql plugin provides macros to build <code>sql_select</code>
892statements. They will be replaced with arguments sent from the client. The
893following macros are available: </p>
894
895<blockquote>
896
897<dl>
898
899<dt>%u</dt>
900
901<dd>
902
903<p> The name of the user whose properties are being selected. </p>
904
905</dd>
906
907<dt>%p</dt>
908
909<dd>
910
911<p> The name of the property being selected. While this could technically be
912anything, Cyrus SASL will try userPassword and cmusaslsecretMECHNAME (where
913MECHNAME is the name of a SASL mechanism). </p>
914
915</dd>
916
917<dt>%r</dt>
918
919<dd>
920
921<p> The name of the realm to which the user belongs. This could be
922the KERBEROS realm, the fully-qualified domain name of the computer
923the SASL application is running on, or the domain after the "@" in a
924username. </p>
925
926</dd>
927
928</dl>
929
930</blockquote>
931
932<h4><a name="auxprop_ldapdb">The ldapdb plugin</a></h4>
933
934<p> The ldapdb auxprop plugin provides access to credentials stored
935in an LDAP server. This plugin requires that SASL client passwords are
936stored as plaintext. </p>
937
938<blockquote>
939
940<strong>Tip</strong>
941
942<p> If you must store encrypted passwords, you cannot use the ldapdb
943auxprop plugin. Instead, you can use "<code>saslauthd -a ldap</code>"
944to query the LDAP database directly, with appropriate configuration
945in <code>saslauthd.conf</code>. This may be documented in a later
946version of this document.  You will not be able to use any of the
947methods that require access to plaintext passwords, such as the
948shared-secret methods CRAM-MD5 and DIGEST-MD5.  </p>
949
950</blockquote>
951
952<p> The ldapdb plugin implements proxy authorization. This means
953that the ldapdb plugin uses its own username and password to
954authenticate with the LDAP server, before it asks the LDAP server
955for the remote SMTP client's password.  The LDAP server then decides
956if the ldapdb plugin is authorized to read the remote SMTP client's
957password.  </p>
958
959<p> In a nutshell: Configuring ldapdb means authentication and
960authorization must be configured twice - once in the Postfix SMTP
961server to authenticate and authorize the remote SMTP client, and
962once in the LDAP server to authenticate and authorize the ldapdb
963plugin. </p>
964
965<p> This example configures libsasl to use the ldapdb plugin and
966the plugin to connect to an LDAP server: </p>
967
968<blockquote>
969<pre>
970/etc/sasl2/smtpd.conf:
971    pwcheck_method: auxprop
972    auxprop_plugin: ldapdb
973    mech_list: PLAIN LOGIN NTLM CRAM-MD5 DIGEST-MD5
974    ldapdb_uri: ldap://localhost
975    ldapdb_id: proxyuser
976    ldapdb_pw: password
977    ldapdb_mech: DIGEST-MD5
978</pre>
979</blockquote>
980
981<blockquote>
982
983<strong>Important</strong>
984
985<p> Set appropriate permissions if <code>smtpd.conf</code> contains a
986password. The file should be readable by the <code>postfix</code>
987user. </p>
988
989</blockquote>
990
991<blockquote>
992
993<strong>Note</strong>
994
995<p> The shared-secret mechanisms (CRAM-MD5, etc.) require that the
996SASL client passwords are stored as plaintext.  </p>
997
998</blockquote>
999
1000<p> The following is a summary of applicable <code>smtpd.conf</code>
1001file entries: </p>
1002
1003<blockquote>
1004
1005<dl>
1006
1007<dt>auxprop_plugin</dt>
1008
1009<dd> <p> Specify <code>ldapdb</code> to enable the plugin. </p> </dd>
1010
1011<dt>ldapdb_uri</dt>
1012
1013<dd> <p> Specify either <code>ldapi://</code> for to connect over
1014a UNIX-domain socket, <code>ldap://</code> for an unencrypted TCP
1015connection or <code>ldaps://</code> for an encrypted TCP connection.
1016</p> </dd>
1017
1018<dt>ldapdb_id</dt>
1019
1020<dd> <p> The login name to authenticate the ldapdb plugin to the
1021LDAP server (proxy authorization). </p> </dd>
1022
1023<dt>ldapdb_pw</dt>
1024
1025<dd> <p> The password (in plaintext) to authenticate the ldapdb
1026plugin to the LDAP server (proxy authorization). </p> </dd>
1027
1028<dt>ldapdb_mech</dt>
1029
1030<dd> <p> The mechanism to authenticate the ldapdb plugin to the
1031LDAP server. </p>
1032
1033<blockquote>
1034
1035<strong>Note</strong>
1036
1037<p> Specify a mechanism here that is supported by the LDAP server.
1038</p>
1039
1040</blockquote>
1041
1042</dd>
1043
1044<dt>ldapdb_rc (optional)</dt>
1045
1046<dd> <p> The path to a file containing individual configuration
1047options for the ldapdb LDAP client (libldap).  This allows to specify
1048a TLS client certificate which in turn can be used to use the SASL
1049EXTERNAL mechanism. </p>
1050
1051<blockquote>
1052
1053<strong>Note</strong>
1054
1055<p> This mechanism supports authentication over an encrypted transport
1056layer, which is recommended if the plugin must connect to an OpenLDAP
1057server on a remote machine. </p>
1058
1059</blockquote>
1060
1061</dd>
1062
1063<dt>ldapdb_starttls (optional)</dt>
1064
1065<dd> <p> The TLS policy for connecting to the LDAP server. Specify
1066either <code>try</code> or <code>demand</code>. If the option is
1067<code>try</code> the plugin will attempt to establish a TLS-encrypted
1068connection with the LDAP server, and will fallback to an unencrypted
1069connection if TLS fails. If the policy is <code>demand</code> and
1070a TLS-encrypted connection cannot be established, the connection
1071fails immediately.  </p> </dd>
1072
1073</dl>
1074
1075</blockquote>
1076
1077<p> When the ldapdb plugin connects to the OpenLDAP server and
1078successfully authenticates, the OpenLDAP server decides if the
1079plugin user is authorized to read SASL account information.  </p>
1080
1081<p> The following configuration gives an example of authorization configuration
1082in the OpenLDAP slapd server: </p>
1083
1084<blockquote>
1085<pre>
1086/etc/openldap/slapd.conf:
1087    authz-regexp
1088    uid=(.*),cn=.*,cn=auth
1089    ldap:///dc=example,dc=com??sub?cn=$1
1090    authz-policy to
1091</pre>
1092</blockquote>
1093
1094<p> Here, the <code>authz-regexp</code> option serves for authentication
1095of the ldapdb user. It maps its login name to a DN in the LDAP
1096directory tree where <code>slapd</code> can look up the SASL account
1097information. The <code>authz-policy</code> options defines the
1098authentication policy. In this case it grants authentication
1099privileges "<code>to</code>" the ldapdb plugin. </p>
1100
1101<p> The last configuration step is to tell the OpenLDAP <code>slapd</code>
1102server where ldapdb may search for usernames matching the one given
1103by the mail client. The example below adds an additional attribute
1104ldapdb user object (here: <code>authzTo</code> because the authz-policy
1105is "<code>to</code>") and configures the scope where the login name
1106"proxyuser" may search: </p>
1107
1108<blockquote>
1109<pre>
1110dn: cn=proxyuser,dc=example,dc=com
1111changetype: modify
1112add: authzTo
1113authzTo: dn.regex:uniqueIdentifier=(.*),ou=people,dc=example,dc=com
1114</pre>
1115</blockquote>
1116
1117<p> Use the <code>ldapmodify</code> or <code>ldapadd</code> command
1118to add the above attribute. </p>
1119
1120<blockquote>
1121
1122<strong>Note</strong>
1123
1124<p> Read the chapter "Using SASL" in the <a
1125href="http://www.openldap.org/doc/admin">OpenLDAP Admin Guide</a>
1126for more detailed instructions to set up SASL authentication in
1127OpenLDAP. </p>
1128
1129</blockquote>
1130
1131<h3><a name="server_sasl_enable">Enabling SASL authentication and
1132authorization in the Postfix SMTP server</a></h3>
1133
1134<p> By default the Postfix SMTP server uses the Cyrus SASL
1135implementation.  If the Dovecot SASL implementation should be used,
1136specify an <code>smtpd_sasl_type</code> value of <code>dovecot</code>
1137instead of <code>cyrus</code>: </p>
1138
1139<blockquote>
1140<pre>
1141/etc/postfix/main.cf:
1142    smtpd_sasl_type = dovecot
1143</pre>
1144</blockquote>
1145
1146<p> Additionally specify how Postfix SMTP server can find the Dovecot
1147authentication server. This depends on the settings that you have
1148selected in the section "<a href="#server_dovecot_comm">Postfix to
1149Dovecot SASL communication</a>". </p>
1150
1151<ul>
1152
1153<li> <p> If you configured Dovecot for UNIX-domain socket communication,
1154configure Postfix as follows: </p>
1155
1156<pre>
1157/etc/postfix/main.cf:
1158    smtpd_sasl_path = private/auth
1159</pre>
1160
1161<strong>Note</strong>
1162
1163<p> This example uses a pathname relative to the Postfix queue
1164directory, so that it will work whether or not the Postfix SMTP
1165server runs chrooted. </p>
1166
1167<li> <p> If you configured Dovecot for TCP socket communication,
1168configure Postfix as follows. If Dovecot runs on a different machine,
1169replace 127.0.0.1 by that machine's IP address. </p>
1170
1171<pre>
1172/etc/postfix/main.cf:
1173    smtpd_sasl_path = inet:127.0.0.1:12345
1174</pre>
1175
1176<strong>Note</strong>
1177
1178<p> If you specify a remote IP address, information
1179will be sent as plaintext over the network. </p>
1180
1181</ul>
1182
1183<h4><a name="server_sasl_authc">Enabling SASL authentication
1184in the Postfix SMTP server</a></h4>
1185
1186<p> Regardless of the SASL implementation type, enabling SMTP
1187authentication in the Postfix SMTP server always requires setting
1188the <code>smtpd_sasl_auth_enable</code> option: </p>
1189
1190<blockquote>
1191<pre>
1192/etc/postfix/main.cf:
1193    smtpd_sasl_auth_enable = yes
1194</pre>
1195</blockquote>
1196
1197<p> After a "postfix reload", SMTP clients will see the additional
1198capability AUTH in an SMTP session, followed by a list of
1199authentication mechanisms the server supports: </p>
1200
1201<blockquote>
1202<pre>
1203% <strong>telnet server.example.com 25</strong>
1204...
1205220 server.example.com ESMTP Postfix
1206<strong>EHLO client.example.com</strong>
1207250-server.example.com
1208250-PIPELINING
1209250-SIZE 10240000
1210250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
1211...
1212</pre>
1213</blockquote>
1214
1215<p> However not all clients recognize the AUTH capability as defined
1216by the SASL authentication RFC. Some historical implementations expect the
1217server to send an "<code>=</code>" as separator between the AUTH
1218verb and the list of mechanisms that follows it.  </p>
1219
1220<p> The <code>broken_sasl_auth_clients</code> configuration option
1221lets Postfix repeat the AUTH statement in a form that these broken
1222clients understand: </p>
1223
1224<blockquote>
1225<pre>
1226/etc/postfix/main.cf:
1227    broken_sasl_auth_clients = yes
1228</pre>
1229</blockquote>
1230
1231<blockquote>
1232
1233<strong>Note</strong>
1234
1235<p> Enable this option for Outlook up to and including version 2003
1236and Outlook Express up to version 6. This option does not hurt other
1237clients. </p>
1238
1239</blockquote>
1240
1241<p> After "postfix reload", the Postfix SMTP server will propagate
1242the AUTH capability twice - once for compliant and once for broken
1243clients: </p>
1244
1245<blockquote>
1246<pre>
1247% <strong>telnet server.example.com 25</strong>
1248...
1249220 server.example.com ESMTP Postfix
1250<strong>EHLO client.example.com</strong>
1251250-server.example.com
1252250-PIPELINING
1253250-SIZE 10240000
1254250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
1255250-AUTH=DIGEST-MD5 PLAIN CRAM-MD5
1256...
1257</pre>
1258</blockquote>
1259
1260<h4><a name="smtpd_sasl_security_options">Postfix SMTP Server policy
1261- SASL mechanism properties</a></h4>
1262
1263<p> The Postfix SMTP server supports policies that limit the SASL
1264mechanisms that it makes available to clients, based on the properties
1265of those mechanisms.  The next two sections give examples of how
1266these policies are used. </p>
1267
1268<blockquote>
1269
1270<table border="1">
1271
1272<tr> <th>Property</th> <th>Description</th> </tr>
1273
1274<tr> <td>noanonymous</td> <td> Don't use mechanisms that permit
1275anonymous authentication.  </td> </tr>
1276
1277<tr> <td>noplaintext</td> <td> Don't use mechanisms that transmit
1278unencrypted username and password information.  </td> </tr>
1279
1280<tr> <td>nodictionary</td> <td> Don't use mechanisms that are
1281vulnerable to dictionary attacks. </td> </tr>
1282
1283<tr> <td>forward_secrecy</td> <td> Require forward secrecy between
1284sessions (breaking one session does not break earlier sessions).
1285</td> </tr>
1286
1287<tr> <td>mutual_auth</td> <td> Use only mechanisms that authenticate
1288both the client and the server to each other. </td> </tr>
1289
1290</table>
1291
1292</blockquote>
1293
1294<h4><a name="id396877">Unencrypted SMTP session</a></h4>
1295
1296<p> The default policy is to allow any mechanism in the Postfix SMTP server
1297except for those based on anonymous authentication: </p>
1298
1299<blockquote>
1300<pre>
1301/etc/postfix/main.cf:
1302    # Specify a list of properties separated by comma or whitespace
1303    smtpd_sasl_security_options = noanonymous
1304</pre>
1305</blockquote>
1306
1307<blockquote>
1308
1309<strong>Important</strong>
1310
1311<p> Always set at least the <code>noanonymous</code> option.
1312Otherwise, the Postfix SMTP server can give strangers the same
1313authorization as a properly-authenticated client. </p>
1314
1315</blockquote>
1316
1317<h4><a name="id396969">Encrypted SMTP session (TLS)</a></h4>
1318
1319<p> A separate parameter controls Postfix SASL mechanism policy
1320during a TLS-encrypted SMTP session. The default is to copy the
1321settings from the unencrypted session: </p>
1322
1323<blockquote>
1324<pre>
1325/etc/postfix/main.cf:
1326    smtpd_sasl_tls_security_options = $smtpd_sasl_security_options
1327</pre>
1328</blockquote>
1329
1330<p> A more sophisticated policy allows plaintext mechanisms, but
1331only over a TLS-encrypted connection: </p>
1332
1333<blockquote>
1334<pre>
1335/etc/postfix/main.cf:
1336    smtpd_sasl_security_options = noanonymous, noplaintext
1337    smtpd_sasl_tls_security_options = noanonymous
1338</pre>
1339</blockquote>
1340
1341<p> To offer SASL authentication only after a TLS-encrypted session has been
1342established specify this: </p>
1343
1344<blockquote>
1345<pre>
1346/etc/postfix/main.cf:
1347    smtpd_tls_auth_only = yes
1348</pre>
1349</blockquote>
1350
1351<h4><a name="server_sasl_authz">Enabling SASL authorization in the Postfix
1352SMTP server</a></h4>
1353
1354<p> After the client has authenticated with SASL, the Postfix SMTP
1355server decides what the remote SMTP client will be authorized
1356for. Examples of possible SMTP clients authorizations are: </p>
1357
1358<ul>
1359
1360<li> <p> Send a message to a remote recipient. </p> </li>
1361
1362<li> <p> Use a specific envelope sender in the MAIL FROM command. </p> </li>
1363
1364</ul>
1365
1366<p> These permissions are not enabled by default. </p>
1367
1368<h4><a name="server_sasl_authz_relay">Mail relay authorization</a></h4>
1369
1370<p> The <code>permit_sasl_authenticated</code> restriction allows
1371SASL-authenticated SMTP clients to send mail to remote destinations.
1372Add it to the list of <code>smtpd_recipient_restrictions</code> as
1373follows: </p>
1374
1375<blockquote>
1376<pre>
1377/etc/postfix/main.cf:
1378    smtpd_recipient_restrictions =
1379    ...
1380    permit_mynetworks
1381    <strong>permit_sasl_authenticated</strong>
1382    reject_unauth_destination
1383    ...
1384</pre>
1385</blockquote>
1386
1387<h4><a name="server_sasl_authz_envelope">Envelope sender address
1388authorization</a></h4>
1389
1390<p> By default an SMTP client may specify any envelope sender address
1391in the MAIL FROM command.  That is because the Postfix SMTP server
1392only knows the remote SMTP client hostname and IP address, but not
1393the user who controls the remote SMTP client.  </p>
1394
1395<p> This changes the moment an SMTP client uses SASL authentication.
1396Now, the Postfix SMTP server knows who the sender is. Given a table
1397of envelope sender addresses and SASL login names, the Postfix SMTP
1398server can decide if the SASL authenticated client is allowed to
1399use a particular envelope sender address: </p>
1400
1401<blockquote>
1402<pre>
1403/etc/postfix/main.cf:
1404    <strong>smtpd_sender_login_maps = hash:/etc/postfix/controlled_envelope_senders</strong>
1405
1406    smtpd_recipient_restrictions =
1407        ...
1408        <strong>reject_sender_login_mismatch</strong>
1409        permit_sasl_authenticated
1410        permit_mynetworks
1411        reject_unauth_destination
1412        ...
1413</pre>
1414</blockquote>
1415
1416<p> The <code>controlled_envelope_senders</code> table specifies
1417the binding between a sender envelope address and the SASL login
1418names that own that address: </p>
1419
1420<blockquote>
1421<pre>
1422/etc/postfix/controlled_envelope_senders
1423    # envelope sender           owners (SASL login names)
1424    john@example.com            john@example.com
1425    helpdesk@example.com        john@example.com, mary@example.com
1426    postmaster                  admin@example.com
1427    @example.net                barney, fred, john@example.com, mary@example.com
1428</pre>
1429</blockquote>
1430
1431<p> With this, the <code>reject_sender_login_mismatch</code>
1432restriction above will reject the sender address in the MAIL FROM
1433command if <code>smtpd_sender_login_maps</code> does not specify
1434the SMTP client's login name as an owner of that address. </p>
1435
1436<p> See also <code>reject_authenticated_sender_login_mismatch</code> and
1437<code>reject_unauthenticated_sender_login_mismatch</code> for additional
1438control over the SASL login name and the envelope sender. </p>
1439
1440<h4><a name="server_sasl_other">Additional SMTP Server SASL options</a></h4>
1441
1442<p> Postfix provides a wide range of SASL authentication configuration
1443options.  The next section lists a few that are discussed frequently.
1444See postconf(5) for a complete list. </p>
1445
1446<h4><a name="id397172">Default  authentication domain</a></h4>
1447
1448<p> Postfix can append a domain name (or any other string) to a
1449SASL login name that does not have a domain part, e.g.  "<code>john</code>"
1450instead of "<code>john@example.com</code>": </p>
1451
1452<blockquote>
1453<pre>
1454/etc/postfix/main.cf:
1455    smtpd_sasl_local_domain = example.com
1456</pre>
1457</blockquote>
1458
1459<p> This is useful as a default setting and safety net for misconfigured
1460clients, or during a migration to an authentication method/backend
1461that requires an authentication REALM or domain name, before all
1462SMTP clients are configured to send such information. </p>
1463
1464<h4><a name="id397205">Hiding SASL authentication from clients or
1465networks</a></h4>
1466
1467<p> Some clients insist on using SASL authentication if it is offered, even
1468when they are not configured to send credentials - and therefore
1469they will always fail and disconnect.  </p>
1470
1471<p> Postfix can hide the AUTH capability from these clients/networks: </p>
1472
1473<blockquote>
1474<pre>
1475/etc/postfix/main.cf:
1476    smtpd_sasl_exceptions_networks = !192.0.2.171/32, 192.0.2.0/24
1477</pre>
1478</blockquote>
1479
1480<h4><a name="id397226">Adding the SASL login name to mail headers</a></h4>
1481
1482<p> To report SASL login names in Received: message headers (Postfix
1483version 2.3 and later): </p>
1484
1485<blockquote>
1486<pre>
1487/etc/postfix/main.cf:
1488    smtpd_sasl_authenticated_header = yes
1489</pre>
1490</blockquote>
1491
1492<blockquote>
1493
1494<strong>Note</strong>
1495
1496<p> The SASL login names will be shared with the entire world. </p>
1497
1498</blockquote>
1499
1500<h3><a name="server_test">Testing SASL authentication in the Postfix SMTP Server</a></h3>
1501
1502<p> To test the server side, connect (for example, with
1503<code>telnet</code>) to the Postfix SMTP server port and you should
1504be able to have a conversation as shown below. Information sent by
1505the client (that is, you) is shown in <strong>bold</strong> font.
1506</p>
1507
1508<blockquote>
1509<pre>
1510% <strong>telnet server.example.com 25</strong>
1511...
1512220 server.example.com ESMTP Postfix
1513<strong>EHLO client.example.com</strong>
1514250-server.example.com
1515250-PIPELINING
1516250-SIZE 10240000
1517250-ETRN
1518250-AUTH DIGEST-MD5 PLAIN CRAM-MD5
1519250 8BITMIME
1520<strong>AUTH PLAIN AHRlc3QAdGVzdHBhc3M=</strong>
1521235 Authentication successful
1522</pre>
1523</blockquote>
1524
1525<p> To test this over a connection that is encrypted with TLS, use
1526<code>openssl s_client</code> instead of <code>telnet</code>:
1527
1528<blockquote>
1529<pre>
1530% <strong>openssl s_client -connect server.example.com:25 -starttls smtp</strong>
1531...
1532220 server.example.com ESMTP Postfix
1533<strong>EHLO client.example.com</strong>
1534...see above example for more...
1535</pre>
1536</blockquote>
1537
1538<p> Instead of <code>AHRlc3QAdGVzdHBhc3M=</code>, specify the
1539base64-encoded form of <code>\0username\0password</code> (the \0
1540is a null byte). The example above is for a user named `<code>test</code>'
1541with password `<code>testpass</code>'. </p>
1542<blockquote>
1543
1544<strong>Caution</strong>
1545
1546<p> When posting logs of the SASL negotiations to public lists,
1547please keep in mind that username/password information is trivial
1548to recover from the base64-encoded form. </p>
1549
1550</blockquote>
1551
1552<p> You can use one of the following commands to generate base64
1553encoded authentication information: </p>
1554
1555<ul>
1556
1557<li> <p> Using a recent version of the <b>bash</b> shell: </p>
1558
1559<blockquote>
1560<pre>
1561% <strong>echo -ne '\000username\000password' | openssl base64</strong>
1562</pre>
1563</blockquote>
1564
1565<p> Some other shells support similar syntax. </p>
1566
1567<li> <p> Using the <b>printf</b> command: </p>
1568
1569<blockquote>
1570<pre>
1571% <strong>printf '\0%s\0%s' '<em>username</em>' '<em>password</em>' | openssl base64</strong>
1572% <strong>printf '\0%s\0%s' '<em>username</em>' '<em>password</em>' | mmencode</strong>
1573</pre>
1574</blockquote>
1575
1576<p> The <strong>mmencode</strong> command is part of the metamail
1577software. </p>
1578
1579<li> <p> Using Perl <b>MIME::Base64</b>: </p>
1580
1581<blockquote>
1582<pre>
1583% <strong>perl -MMIME::Base64 -e \
1584    'print encode_base64("\0<em>username</em>\0<em>password</em>");'</strong>
1585</pre>
1586</blockquote>
1587
1588<p> MIME::Base64 is available from http://www.cpan.org/. </p>
1589
1590<li> <p> Using the <b>gen-auth</b> script: </p>
1591
1592<blockquote>
1593<pre>
1594% <strong>gen-auth plain</strong>
1595username: <strong><em>username</em></strong>
1596password:
1597</pre>
1598</blockquote>
1599
1600<p> The <strong>gen-auth</strong> Perl script was written by John
1601Jetmore and can be found at http://jetmore.org/john/code/gen-auth. </p>
1602
1603</ul>
1604
1605<h2><a name="client_sasl">Configuring SASL authentication in the Postfix SMTP/LMTP client</a></h2>
1606
1607<p> The Postfix SMTP and the LMTP client can authenticate with a
1608remote SMTP server via the Cyrus SASL framework. At this time, the
1609Dovecot SASL implementation does not provide client functionality.
1610</p>
1611
1612<blockquote>
1613
1614<strong>Note</strong>
1615
1616<p> The examples in this section discuss only the SMTP client.
1617Replace <code>smtp_</code> with <code>lmtp_</code> to get the
1618corresponding LMTP client configuration. </p>
1619
1620</blockquote>
1621
1622<p> You can read more about the following topics: </p>
1623
1624<ul>
1625
1626<li><a href="#client_sasl_enable">Enabling SASL authentication in
1627the Postfix SMTP/LMTP client</a></li>
1628
1629<li><a href="#client_sasl_sender">Configuring sender-dependent SASL
1630authentication</a></li>
1631
1632<li><a href="#client_sasl_policy">Postfix SMTP/LMTP client policy
1633- SASL mechanism <em>properties</em></a></li>
1634
1635<li><a href="#client_sasl_filter">Postfix SMTP/LMTP client policy
1636- SASL mechanism <em>names</em></a></li>
1637
1638</ul>
1639
1640<h3><a name="client_sasl_enable">Enabling SASL authentication in the
1641Postfix SMTP/LMTP client</a></h3>
1642
1643<p> This section shows a typical scenario where the Postfix SMTP
1644client sends all messages via a mail gateway server that requires
1645SASL authentication. </p>
1646
1647<blockquote>
1648
1649<strong> Trouble solving tips: </strong>
1650
1651<ul>
1652
1653<li> <p> If your SASL logins fail with "SASL authentication failure:
1654No worthy mechs found" in the mail logfile, then see the section
1655"<a href="SASL_README.html#client_sasl_policy">Postfix SMTP/LMTP
1656client policy - SASL mechanism <em>properties</em></a>".
1657
1658<li> <p> For a solution to a more obscure class of SASL authentication
1659failures, see "<a href="SASL_README.html#client_sasl_filter">Postfix
1660SMTP/LMTP client policy - SASL mechanism <em>names</em></a>".
1661
1662</ul>
1663
1664</blockquote>
1665
1666<p> To make the example more readable we introduce it in two parts.
1667The first part takes care of the basic configuration, while the
1668second part sets up the username/password information.  </p>
1669
1670<blockquote>
1671<pre>
1672/etc/postfix/main.cf:
1673    smtp_sasl_auth_enable = yes
1674    relayhost = [mail.isp.example]
1675    # Alternative form:
1676    # relayhost = [mail.isp.example]:submission
1677    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
1678</pre>
1679</blockquote>
1680
1681<ul>
1682
1683<li> <p> The <code>smtp_sasl_auth_enable</code> setting enables
1684client-side authentication. We will configure the client's username
1685and password information in the second part of the example. </p>
1686</li>
1687
1688<li> <p> The <code>relayhost</code> setting forces the Postfix SMTP
1689to send all remote messages to the specified mail server instead
1690of trying to deliver them directly to their destination. </p> </li>
1691
1692<li> <p> In the <code>relayhost</code> setting, the "<code>[</code>"
1693and "<code>]</code>" prevent the Postfix SMTP client from looking
1694up MX (mail exchanger) records for the enclosed name.  </p> </li>
1695
1696<li> <p> The <code>relayhost</code> destination may also specify a
1697non-default TCP port. For example, the alternative form
1698<code>[mail.isp.example]:submission</code> tells Postfix to connect
1699to TCP network port 587, which is reserved for email client
1700applications.  </p> </li>
1701
1702<li> <p> The Postfix SMTP client is compatible with SMTP servers
1703that use the non-standard "<code>AUTH=<em>method.</em>...</code>"
1704syntax in response to the EHLO command; this requires no additional
1705Postfix client configuration. </p> </li>
1706
1707<li> <p> The Postfix SMTP client does not support the obsolete
1708"wrappermode" protocol, which uses TCP port <code>465</code> on the
1709SMTP server.  See TLS_README for a solution that uses the
1710<code>stunnel</code> command.  </p> </li>
1711
1712<li> <p> With the <code>smtp_sasl_password_maps</code> parameter,
1713we configure the Postfix SMTP client to send username and password
1714information to the mail gateway server. As discussed in the next
1715section, the Postfix SMTP client supports multiple ISP accounts.
1716For this reason the username and password are stored in a table
1717that contains one username/password combination for each mail gateway
1718server.  </p>
1719
1720</ul>
1721
1722<blockquote>
1723<pre>
1724/etc/postfix/sasl_passwd:
1725    # destination                   credentials
1726    [mail.isp.example]              username:password
1727    # Alternative form:
1728    # [mail.isp.example]:submission username:password
1729</pre>
1730</blockquote>
1731
1732<blockquote>
1733
1734<strong>Important</strong>
1735
1736<p> Keep the SASL client password file in <code>/etc/postfix</code>,
1737and make the file read+write only for <code>root</code> to protect
1738the username/password combinations against other users. The Postfix
1739SMTP client will still be able to read the SASL client passwords.
1740It opens the file as user <code>root</code> before it drops privileges,
1741and before entering an optional chroot jail. </p>
1742
1743</blockquote>
1744
1745<ul>
1746
1747<li> <p> Use the <code>postmap</code> command whenever you
1748change the <code>/etc/postfix/sasl_passwd</code> file. </p> </li>
1749
1750<li> <p> If you specify the "<code>[</code>" and "<code>]</code>"
1751in the <code>relayhost</code> destination, then you must use the
1752same form in the <code>smtp_sasl_password_maps</code> file.  </p>
1753</li>
1754
1755<li> <p> If you specify a non-default TCP Port (such as
1756"<code>:submission</code>" or "<code>:587</code>") in the
1757<code>relayhost</code> destination, then you must use the same form
1758in the <code>smtp_sasl_password_maps</code> file.  </p> </li>
1759
1760</ul>
1761
1762<h3><a name="client_sasl_sender">Configuring Sender-Dependent SASL
1763authentication</a></h3>
1764
1765<p> Postfix supports different ISP accounts for different sender
1766addresses (version 2.3 and later).  This can be useful when one
1767person uses the same machine for work and for personal use, or when
1768people with different ISP accounts share the same Postfix server.
1769</p>
1770
1771<p> To make this possible, Postfix supports per-sender SASL passwords
1772and per-sender relay hosts. In the example below, the Postfix SMTP
1773client will search the SASL password file by sender address before
1774it searches that same file by destination.  Likewise, the Postfix
1775trivial-rewrite(8) daemon will search the per-sender relayhost file,
1776and use the default <code>relayhost</code> setting only as a final
1777resort.  </p>
1778
1779<blockquote>
1780<pre>
1781/etc/postfix/main.cf:
1782    smtp_sender_dependent_authentication = yes
1783    sender_dependent_relayhost_maps = hash:/etc/postfix/sender_relay
1784    smtp_sasl_auth_enable = yes
1785    smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
1786    relayhost = [mail.isp.example]
1787    # Alternative form:
1788    # relayhost = [mail.isp.example]:submission
1789</pre>
1790</blockquote>
1791
1792<blockquote>
1793<pre>
1794/etc/postfix/sasl_passwd:
1795    # Per-sender authentication; see also /etc/postfix/sender_relay.
1796    user1@example.com               username2:password2
1797    user2@example.net               username2:password2
1798    # Login information for the default relayhost.
1799    [mail.isp.example]              username:password
1800    # Alternative form:
1801    # [mail.isp.example]:submission username:password
1802</pre>
1803</blockquote>
1804
1805<blockquote>
1806<pre>
1807/etc/postfix/sender_relay:
1808    # Per-sender provider; see also /etc/postfix/sasl_passwd.
1809    user1@example.com               [mail.example.com]:submission
1810    user2@example.net               [mail.example.net]
1811</pre>
1812</blockquote>
1813
1814<ul>
1815
1816<li> <p> If you are creative, then you can try to combine the two
1817tables into one single MySQL database, and configure different
1818Postfix queries to extract the appropriate information. </p>
1819
1820<li> <p> Specify dbm instead of hash if your system uses dbm files
1821instead of db files. To find out what lookup tables Postfix supports,
1822use the command "postconf -m". </p>
1823
1824<li> <p> Execute the command "postmap /etc/postfix/sasl_passwd"
1825whenever you change the sasl_passwd table. </p>
1826
1827<li> <p> Execute the command "postmap /etc/postfix/sender_relay"
1828whenever you change the sender_relay table. </p>
1829
1830</ul>
1831
1832<h3><a name="client_sasl_policy">Postfix SMTP/LMTP client policy -
1833SASL mechanism <em>properties</em></a></h3>
1834
1835<p> Just like the Postfix SMTP server, the SMTP client has a policy
1836that determines which SASL mechanisms are acceptable, based on their
1837properties. The next two sections give examples of how these policies
1838are used.  </p>
1839
1840<blockquote>
1841
1842<table border="1">
1843
1844<tr> <th>Property</th> <th>Description</th> </tr>
1845
1846<tr> <td>noanonymous</td> <td> Don't use mechanisms that permit
1847anonymous authentication.  </td> </tr>
1848
1849<tr> <td>noplaintext</td> <td> Don't use mechanisms that transmit
1850unencrypted username and password information.  </td> </tr>
1851
1852<tr> <td>nodictionary</td> <td> Don't use mechanisms that are
1853vulnerable to dictionary attacks. </td> </tr>
1854
1855<tr> <td>mutual_auth</td> <td> Use only mechanisms that authenticate
1856both the client and the server to each other. </td> </tr>
1857
1858</table>
1859
1860</blockquote>
1861
1862<h4>Unencrypted SMTP session</h4>
1863
1864<p> The default policy is stricter than that of the Postfix SMTP
1865server - plaintext mechanisms are not allowed (nor is any anonymous
1866mechanism): </p>
1867
1868<blockquote>
1869<pre>
1870/etc/postfix/main.cf:
1871    smtp_sasl_security_options = noplaintext, noanonymous
1872</pre>
1873</blockquote>
1874
1875<p> This default policy, which allows no plaintext passwords, leads
1876to authentication failures if the remote server only offers plaintext
1877authentication mechanisms (the SMTP server announces "<code>AUTH
1878PLAIN LOGIN</code>").  In such cases the SMTP client will log the
1879following error message: </p>
1880
1881<blockquote>
1882<pre>
1883SASL authentication failure: No worthy mechs found
1884</pre>
1885</blockquote>
1886
1887<blockquote>
1888
1889<strong>Note</strong>
1890
1891<p> This same error message will also be logged when the
1892<code>libplain.so</code> or <code>liblogin.so</code> modules are
1893not installed in the <code>/usr/lib/sasl2</code> directory. </p>
1894
1895</blockquote>
1896
1897<p> The insecure approach is to lower the security standards and
1898permit plaintext authentication mechanisms: </p>
1899
1900<blockquote>
1901<pre>
1902/etc/postfix/main.cf:
1903    smtp_sasl_security_options = noanonymous
1904</pre>
1905</blockquote>
1906
1907<p> The more secure approach is to protect the plaintext username
1908and password with TLS session encryption. To find out if the remote
1909SMTP server supports TLS, connect to the server and see if it
1910announces STARTTLS support as shown in the example.  Information
1911sent by the client (that is, you) is shown in <strong>bold</strong>
1912font.  </p>
1913
1914<blockquote>
1915<pre>
1916% <strong>telnet server.example.com 25</strong>
1917...
1918220 server.example.com ESMTP Postfix
1919<strong>EHLO client.example.com</strong>
1920250-server.example.com
1921250-PIPELINING
1922250-SIZE 10240000
1923250-STARTTLS
1924...
1925</pre>
1926</blockquote>
1927
1928<p> Instead of port 25 (smtp), specify port 587 (submission) where
1929appriopriate. </p>
1930
1931<h4>Encrypted SMTP session (TLS)</h4>
1932
1933<p> To turn on TLS in the Postfix SMTP client, see TLS_README for
1934configuration details. </p>
1935
1936<p> The smtp_sasl_tls_security_options parameter controls Postfix
1937SASL mechanism policy during a TLS-encrypted SMTP session. The
1938default is to copy the settings from the unencrypted session: </p>
1939
1940<blockquote>
1941<pre>
1942/etc/postfix/main.cf:
1943    smtp_sasl_tls_security_options = $smtp_sasl_security_options
1944</pre>
1945</blockquote>
1946
1947<p> A more sophisticated policy allows plaintext mechanisms, but
1948only over a TLS-encrypted connection: </p>
1949
1950<blockquote>
1951<pre>
1952/etc/postfix/main.cf:
1953    smtp_sasl_security_options = noanonymous, noplaintext
1954    smtp_sasl_tls_security_options = noanonymous
1955</pre>
1956</blockquote>
1957
1958<h3><a name="client_sasl_filter">Postfix SMTP/LMTP client policy -
1959SASL mechanism <em>names</em></a></h3>
1960
1961<p> Given the SASL security options of the previous section, the
1962Cyrus SASL library will choose the most secure authentication
1963mechanism that both the SMTP client and server implement.  Unfortunately,
1964that authentication mechanism may fail because the client or server
1965is not configured to use that mechanism.</p>
1966
1967<p> To prevent this, the Postfix SMTP client can filter the names
1968of the authentication mechanisms from the remote SMTP server.  Used
1969correctly, the filter hides unwanted mechanisms from the Cyrus SASL
1970library, forcing the library to choose from the mechanisms the
1971Postfix SMTP client filter passes through.  </p>
1972
1973<p> The following example filters out everything but the mechanisms
1974<code>PLAIN</code> and <code>LOGIN</code>: </p>
1975
1976<blockquote>
1977<pre>
1978/etc/postfix/main.cf:
1979    smtp_sasl_mechanism_filter = plain, login
1980</pre>
1981</blockquote>
1982
1983<blockquote>
1984
1985<strong>Note</strong>
1986
1987<p> If the remote server does not offer any of the mechanisms on
1988the filter list, authentication will fail. </p>
1989
1990</blockquote>
1991
1992<p> We close this section with an example that passes every mechanism
1993except for <code>GSSAPI</code> and <code>LOGIN</code>: </p>
1994
1995<blockquote>
1996<pre>
1997/etc/postfix/main.cf:
1998    smtp_sasl_mechanism_filter = !gssapi, !login, static:all
1999</pre>
2000</blockquote>
2001
2002<h2><a name="postfix_build">Building Postfix with SASL support</a></h2>
2003
2004<p> As mentioned elsewhere, Postfix supports two SASL implementations:
2005Cyrus SASL (SMTP client and server) and Dovecot SASL (SMTP server
2006only). Both implementations can be built into Postfix simultaneously.
2007</p>
2008
2009<ul>
2010
2011<li><a href="#build_dovecot">Building Dovecot SASL support</a></li>
2012
2013<li><a href="#sasl_support">Building Cyrus SASL support</a></li>
2014
2015</ul>
2016
2017<h3><a name="build_dovecot">Building Dovecot SASL support</a></h3>
2018
2019<p> These instructions assume that you build Postfix from source
2020code as described in the INSTALL document. Some modification may
2021be required if you build Postfix from a vendor-specific source
2022package. </p>
2023
2024<p> Support for the Dovecot version 1 SASL protocol is available
2025in Postfix 2.3 and later. At the time of writing, only server-side
2026SASL support is available, so you can't use it to authenticate the
2027Postfix SMTP client to your network provider's server. </p>
2028
2029<p> Dovecot uses its own daemon process for authentication. This
2030keeps the Postfix build process simple, because there is no need
2031to link extra libraries into Postfix. </p>
2032
2033<p> To generate the necessary Makefiles, execute the following in
2034the Postfix top-level directory: </p>
2035
2036<blockquote>
2037<pre>
2038% <strong>make tidy</strong> # if you have left-over files from a previous build
2039% <strong>make makefiles CCARGS='-DUSE_SASL_AUTH \
2040    -DDEF_SERVER_SASL_TYPE=\"dovecot\"'</strong>
2041</pre>
2042</blockquote>
2043
2044<p> After this, proceed with "<code>make</code>" as described in
2045the INSTALL document. </p>
2046
2047<strong>Note</strong>
2048
2049<ul>
2050
2051<li>
2052
2053<p> The <code>-DDEF_SERVER_SASL_TYPE=\"dovecot\"</code> is not
2054necessary; it just makes Postfix configuration a little more
2055convenient because you don't have to specify the SASL plug-in type
2056in the Postfix main.cf file (but this may cause surprises when you
2057switch to a later Postfix version that is built with the default
2058SASL type of <code>sasl</code>). </p>
2059
2060</li>
2061
2062<li>
2063
2064<p> If you also want support for LDAP or TLS (or for Cyrus SASL),
2065you need to merge their <code>CCARGS</code> and <code>AUXLIBS</code>
2066options into the above command line; see the LDAP_README and
2067TLS_README for details.  </p>
2068
2069<blockquote>
2070<pre>
2071% <strong>make tidy</strong> # if you have left-over files from a previous build
2072% <strong>make makefiles CCARGS='-DUSE_SASL_AUTH \
2073    -DDEF_SERVER_SASL_TYPE=\"dovecot\" \
2074    ...<i>CCARGS options for LDAP or TLS etc.</i>...' \
2075   AUXLIBS='...<i>AUXLIBS options for LDAP or TLS etc.</i>...'</strong>
2076</pre>
2077</blockquote>
2078
2079</li>
2080
2081</ul>
2082
2083<h3><a name="sasl_support">Building Cyrus SASL support</a></h3>
2084
2085<h4><a name="build_sasl">Building the Cyrus SASL library</a></h4>
2086
2087<p> Postfix works with cyrus-sasl-1.5.x or cyrus-sasl-2.1.x, which are
2088available from ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/. </p>
2089
2090<blockquote>
2091
2092<strong>Important</strong>
2093
2094<p> If you install the Cyrus SASL libraries as per the default, you will have
2095to create a symlink <code>/usr/lib/sasl</code> -&gt;
2096<code>/usr/local/lib/sasl</code> for version 1.5.x or
2097<code>/usr/lib/sasl2</code> -&gt; <code>/usr/local/lib/sasl2</code>
2098for version 2.1.x. </p>
2099
2100</blockquote>
2101
2102<p> Reportedly, Microsoft Outlook (Express) requires the non-standard LOGIN
2103and/or NTLM authentication mechanism. To enable these authentication
2104mechanisms, build the Cyrus SASL libraries with: </p>
2105
2106<blockquote>
2107<pre>
2108% <strong>./configure --enable-login --enable-ntlm</strong>
2109</pre>
2110</blockquote>
2111
2112<h4><a name="build_postfix">Building Postfix with Cyrus SASL support</a></h4>
2113
2114<p> These instructions assume that you build Postfix from source
2115code as described in the INSTALL document. Some modification may
2116be required if you build Postfix from a vendor-specific source
2117package. </p>
2118
2119<p> The following assumes that the Cyrus SASL include files are in
2120<code>/usr/local/include</code>, and that the Cyrus SASL libraries are in
2121<code>/usr/local/lib</code>. </p>
2122
2123<p> On some systems this generates the necessary <code>Makefile</code>
2124definitions: </p>
2125
2126<dl>
2127
2128<dt>Cyrus SASL version 2.1.x</dt>
2129
2130<dd>
2131
2132<pre>
2133% <strong>make tidy</strong> # if you have left-over files from a previous build
2134% <strong>make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
2135    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib -lsasl2"</strong>
2136</pre>
2137
2138</dd>
2139
2140<dt>Cyrus SASL version 1.5.x</dt>
2141
2142<dd>
2143
2144<pre>
2145% <strong>make tidy</strong> # if you have left-over files from a previous build
2146% <strong>make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
2147    -I/usr/local/include" AUXLIBS="-L/usr/local/lib -lsasl"</strong>
2148</pre>
2149
2150</dd>
2151
2152</dl>
2153
2154<p> On Solaris 2.x you need to specify run-time link information,
2155otherwise the ld.so run-time linker will not find the SASL shared
2156library: </p>
2157
2158<dl>
2159
2160<dt>Cyrus SASL version 2.1.x</dt>
2161
2162<dd>
2163
2164<pre>
2165% <strong>make tidy</strong> # remove left-over files from a previous build
2166% <strong>make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
2167    -I/usr/local/include/sasl" AUXLIBS="-L/usr/local/lib \
2168    -R/usr/local/lib -lsasl2"</strong>
2169</pre>
2170
2171</dd>
2172
2173<dt>Cyrus SASL version 1.5.x</dt>
2174
2175<dd>
2176
2177<pre>
2178% <strong>make tidy</strong> # if you have left-over files from a previous build
2179% <strong>make makefiles CCARGS="-DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
2180    -I/usr/local/include" AUXLIBS="-L/usr/local/lib \
2181    -R/usr/local/lib -lsasl"</strong>
2182</pre>
2183
2184</dd>
2185
2186</dl>
2187
2188<h2><a name="cyrus_legacy">Using Cyrus SASL version 1.5.x</a></h2>
2189
2190<p> Postfix supports Cyrus SASL version 1.x, but you shouldn't use
2191it unless you are forced to. The makers of Cyrus SASL write: </p>
2192
2193<blockquote> <i> This library is being deprecated and applications
2194should transition to using the SASLv2 library</i> (source: <a
2195href="http://cyrusimap.web.cmu.edu/downloads.html">Project Cyrus:
2196Downloads</a>). </blockquote>
2197
2198<p> If you still need to set it up, here's a quick rundown: </p>
2199
2200<p> Read the regular section on SMTP server configurations for the
2201Cyrus SASL framework. The differences are: </p>
2202
2203<ul>
2204
2205<li> <p> Cyrus SASL version 1.5.x searches for configuration
2206(<code>smtpd.conf</code>) in <code>/usr/lib/sasl/</code> only. You
2207must place the configuration in that directory. Some systems may
2208have modified Cyrus SASL and put the files into e.g.
2209<code>/var/lib/sasl/</code>. </p> </li>
2210
2211<li> <p> Use the <code>saslpasswd</code> command instead of
2212<code>saslpasswd2</code> to create users in <code>sasldb</code>.
2213</p> </li>
2214
2215<li> <p> Use the <code>sasldblistusers</code> command instead of
2216<code>sasldblistusers2</code> to find users in <code>sasldb</code>.
2217</p> </li>
2218
2219<li> <p> In the <code>smtpd.conf</code> file you can't use
2220<code>mech_list</code> to limit the range of mechanisms offered.
2221Instead, remove their libraries from <code>/usr/lib/sasl/</code>
2222(and remember remove those files again when a system update
2223re-installs new versions).  </p> </li>
2224
2225</ul>
2226
2227<h2><a name="credits">Credits</a></h2>
2228
2229<ul>
2230
2231<li> Postfix SASL support was originally implemented by Till Franke
2232of SuSE Rhein/Main AG. </li>
2233
2234<li> Wietse trimmed down the code to only the bare necessities.
2235 </li>
2236
2237<li> Support for Cyrus SASL version 2 was contributed by Jason Hoos.
2238</li>
2239
2240<li> Liviu Daia added smtpd_sasl_application_name, separated
2241reject_sender_login_mismatch into
2242reject_authenticated_sender_login_mismatch and
2243reject_unauthenticated_sender_login_mismatch, and revised the docs.
2244 </li>
2245
2246<li> Wietse made another iteration through the code to add plug-in
2247support for multiple SASL implementations, and for reasons that
2248have been lost, also changed smtpd_sasl_application_name into
2249smtpd_sasl_path. </li>
2250
2251<li> The Dovecot SMTP server-only plug-in was originally implemented
2252by Timo Sirainen of Procontrol, Finland. </li>
2253
2254<li> Patrick Ben Koetter revised this document for Postfix 2.4 and
2255made much needed updates. </li>
2256
2257<li> Patrick Ben Koetter revised this document again for Postfix
22582.7 and made much needed updates. </li>
2259
2260</ul>
2261
2262</body>
2263
2264</html>
2265
2266