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