xref: /minix3/crypto/external/bsd/libsaslc/dist/man/libsaslc.3 (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1*0a6a1f1dSLionel Sambuc.\"	$NetBSD: libsaslc.3,v 1.16 2015/07/13 13:57:44 shm Exp $
2ebfedea0SLionel Sambuc.\"
3ebfedea0SLionel Sambuc.\" Copyright (c) 2010 The NetBSD Foundation, Inc.
4ebfedea0SLionel Sambuc.\" All rights reserved.
5ebfedea0SLionel Sambuc.\"
6ebfedea0SLionel Sambuc.\" This code is derived from software contributed to The NetBSD Foundation
7ebfedea0SLionel Sambuc.\" by Mateusz Kocielski.
8ebfedea0SLionel Sambuc.\"
9ebfedea0SLionel Sambuc.\" Redistribution and use in source and binary forms, with or without
10ebfedea0SLionel Sambuc.\" modification, are permitted provided that the following conditions
11ebfedea0SLionel Sambuc.\" are met:
12ebfedea0SLionel Sambuc.\" 1. Redistributions of source code must retain the above copyright
13ebfedea0SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer.
14ebfedea0SLionel Sambuc.\" 2. Redistributions in binary form must reproduce the above copyright
15ebfedea0SLionel Sambuc.\"    notice, this list of conditions and the following disclaimer in the
16ebfedea0SLionel Sambuc.\"    documentation and/or other materials provided with the distribution.
17ebfedea0SLionel Sambuc.\" 3. All advertising materials mentioning features or use of this software
18ebfedea0SLionel Sambuc.\"    must display the following acknowledgement:
19ebfedea0SLionel Sambuc.\"        This product includes software developed by the NetBSD
20ebfedea0SLionel Sambuc.\"        Foundation, Inc. and its contributors.
21ebfedea0SLionel Sambuc.\" 4. Neither the name of The NetBSD Foundation nor the names of its
22ebfedea0SLionel Sambuc.\"    contributors may be used to endorse or promote products derived
23ebfedea0SLionel Sambuc.\"    from this software without specific prior written permission.
24ebfedea0SLionel Sambuc.\"
25ebfedea0SLionel Sambuc.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
26ebfedea0SLionel Sambuc.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
27ebfedea0SLionel Sambuc.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
28ebfedea0SLionel Sambuc.\" PURPOSE ARE DISCLAIMED.	IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
29ebfedea0SLionel Sambuc.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
30ebfedea0SLionel Sambuc.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
31ebfedea0SLionel Sambuc.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
32ebfedea0SLionel Sambuc.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
33ebfedea0SLionel Sambuc.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
34ebfedea0SLionel Sambuc.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35ebfedea0SLionel Sambuc.\" POSSIBILITY OF SUCH DAMAGE.
36ebfedea0SLionel Sambuc.\"
37*0a6a1f1dSLionel Sambuc.Dd May 3, 2015
38ebfedea0SLionel Sambuc.Dt LIBSASLC 3
39ebfedea0SLionel Sambuc.Os
40ebfedea0SLionel Sambuc.Sh NAME
41ebfedea0SLionel Sambuc.Nm libsaslc ,
42ebfedea0SLionel Sambuc.Nm saslc.d ,
43ebfedea0SLionel Sambuc.Nm saslc_alloc ,
44ebfedea0SLionel Sambuc.Nm saslc_end ,
45ebfedea0SLionel Sambuc.Nm saslc_init ,
46ebfedea0SLionel Sambuc.Nm saslc_sess_init ,
47ebfedea0SLionel Sambuc.Nm saslc_sess_end ,
48ebfedea0SLionel Sambuc.Nm saslc_sess_getprop ,
49ebfedea0SLionel Sambuc.Nm saslc_sess_setprop ,
50ebfedea0SLionel Sambuc.Nm saslc_sess_cont ,
51ebfedea0SLionel Sambuc.Nm saslc_sess_decode ,
52ebfedea0SLionel Sambuc.Nm saslc_sess_encode ,
53ebfedea0SLionel Sambuc.Nm saslc_sess_getmech ,
54ebfedea0SLionel Sambuc.Nm saslc_sess_strerror ,
55ebfedea0SLionel Sambuc.Nm saslc_strerror
56ebfedea0SLionel Sambuc.Nd Simple Authentication and Security Layer client library
57ebfedea0SLionel Sambuc.Sh LIBRARY
58ebfedea0SLionel Sambuc.Lb libsaslc
59ebfedea0SLionel Sambuc.Sh SYNOPSIS
60ebfedea0SLionel Sambuc.In saslc.h
61ebfedea0SLionel Sambuc.Ft saslc_t *
62ebfedea0SLionel Sambuc.Fn saslc_alloc "void"
63ebfedea0SLionel Sambuc.Ft int
64ebfedea0SLionel Sambuc.Fn saslc_end "saslc_t *ctx"
65ebfedea0SLionel Sambuc.Ft int
66ebfedea0SLionel Sambuc.Fn saslc_init "saslc_t *ctx" "const char *appname" "const char *cfgpath"
67ebfedea0SLionel Sambuc.Ft saslc_sess_t *
68ebfedea0SLionel Sambuc.Fn saslc_sess_init "saslc_t *ctx" "const char *mechs" "const char *secopts"
69ebfedea0SLionel Sambuc.Ft void
70ebfedea0SLionel Sambuc.Fn saslc_sess_end "saslc_sess_t *sess"
71ebfedea0SLionel Sambuc.Ft const char *
72ebfedea0SLionel Sambuc.Fn saslc_sess_getprop "saslc_sess_t *sess" "const char *key"
73ebfedea0SLionel Sambuc.Ft int
74ebfedea0SLionel Sambuc.Fn saslc_sess_setprop "saslc_sess_t *sess" "const char *key" \
75ebfedea0SLionel Sambuc"const char *value"
76ebfedea0SLionel Sambuc.Ft int
77ebfedea0SLionel Sambuc.Fn saslc_sess_cont "saslc_sess_t *sess" "const void *in" "size_t inlen" \
78ebfedea0SLionel Sambuc"void* *out" "size_t *outlen"
79ebfedea0SLionel Sambuc.Ft ssize_t
80ebfedea0SLionel Sambuc.Fn saslc_sess_decode "saslc_sess_t *sess" "const void *in" "size_t inlen" \
81ebfedea0SLionel Sambuc"void* *out" "size_t *outlen"
82ebfedea0SLionel Sambuc.Ft ssize_t
83ebfedea0SLionel Sambuc.Fn saslc_sess_encode "saslc_sess_t *sess" "const void *in" "size_t inlen" \
84ebfedea0SLionel Sambuc"void* *out" "size_t *outlen"
85ebfedea0SLionel Sambuc.Ft const char *
86ebfedea0SLionel Sambuc.Fn saslc_sess_getmech "saslc_sess_t *sess"
87ebfedea0SLionel Sambuc.Ft const char *
88ebfedea0SLionel Sambuc.Fn saslc_sess_strerror "saslc_sess_t *sess"
89ebfedea0SLionel Sambuc.Ft const char *
90ebfedea0SLionel Sambuc.Fn saslc_strerror "saslc_t *ctx"
91ebfedea0SLionel Sambuc.Sh DESCRIPTION
92ebfedea0SLionel SambucThe
93ebfedea0SLionel Sambuc.Nm libsaslc
94ebfedea0SLionel Sambuclibrary offers a client interface for the
95ebfedea0SLionel SambucSimple Authentication and Security Layer
96ebfedea0SLionel Sambuc.Pq Tn SASL .
97ebfedea0SLionel SambucThe library is heavily influenced by its use with
98ebfedea0SLionel Sambuc.Xr postfix 1 .
99ebfedea0SLionel Sambuc.Sh FUNCTIONS
100ebfedea0SLionel SambucThe following functions are available in the library.
101ebfedea0SLionel Sambuc.Bl -tag -width compact
102ebfedea0SLionel Sambuc.It Fn saslc_alloc ""
103ebfedea0SLionel SambucThe
104ebfedea0SLionel Sambuc.Fn saslc_alloc
105ebfedea0SLionel Sambucfunction allocates and returns a new saslc context.
106ebfedea0SLionel SambucThe context is uninitialized: see
107ebfedea0SLionel Sambuc.Fn saslc_init .
108ebfedea0SLionel SambucReturns
109ebfedea0SLionel Sambuc.Dv NULL
110ebfedea0SLionel Sambucon error.
111ebfedea0SLionel Sambuc.It Fn saslc_end "ctx"
112ebfedea0SLionel SambucThe
113ebfedea0SLionel Sambuc.Fn saslc_end
114ebfedea0SLionel Sambucfunction destroys and deallocate resources used by the context
115ebfedea0SLionel Sambuc.Ar ctx .
116ebfedea0SLionel SambucThe context shouldn't have any sessions assigned to it.
117ebfedea0SLionel SambucReturns 0 on success and \-1 if the context has active sessions and
118ebfedea0SLionel Sambuccannot be deallocated.
119ebfedea0SLionel Sambuc.It Fn saslc_init "ctx" "appname" "cfgpath"
120ebfedea0SLionel SambucThe
121ebfedea0SLionel Sambuc.Fn saslc_init
122ebfedea0SLionel Sambucfunction initializes the saslc context
123ebfedea0SLionel Sambuc.Ar ctx .
124ebfedea0SLionel SambucBased on the application name
125ebfedea0SLionel Sambuc.Ar appname ,
126ebfedea0SLionel Sambucit also parses the configuration files as indicated by
127ebfedea0SLionel Sambuc.Ar cfgpath ,
128ebfedea0SLionel Sambucsets up the context and mechanism dictionaries, and creates mechanism
129ebfedea0SLionel Sambuclist for the context.
130ebfedea0SLionel SambucIf
131ebfedea0SLionel Sambuc.Ar cfgpath
132ebfedea0SLionel Sambucis
133ebfedea0SLionel Sambuc.Dv NULL ,
134ebfedea0SLionel Sambucit checks the environment variable
135ebfedea0SLionel Sambuc.Ev SASLC_CONFIG
136ebfedea0SLionel Sambucfor a location and if that is not found it uses the default path
137ebfedea0SLionel Sambuc.Pa /etc/saslc.d .
138ebfedea0SLionel SambucReturns 0 on success and \-1 on failure.
139ebfedea0SLionel Sambuc.It Fn saslc_sess_init "ctx" "mechs" "secopts"
140ebfedea0SLionel SambucThe
141ebfedea0SLionel Sambuc.Fn saslc_sess_init
142ebfedea0SLionel Sambucfunction creates new session assigned to the
143ebfedea0SLionel Sambuc.Ar ctx
144ebfedea0SLionel Sambuccontext.
145ebfedea0SLionel SambucThe function chooses the mechanism to use for authentication from the
146ebfedea0SLionel Sambuc.Ar mechs
147ebfedea0SLionel Sambuclist taking into account the requirements from the
148ebfedea0SLionel Sambuc.Ar secopts
149ebfedea0SLionel Sambuclist.
150ebfedea0SLionel SambucBoth lists may be space or comma delimited.
151ebfedea0SLionel SambucThe first matching mechanism from the
152ebfedea0SLionel Sambuc.Ar mechs
153ebfedea0SLionel Sambuclist is used.
154ebfedea0SLionel SambucSee
155ebfedea0SLionel Sambuc.Sx CONFIGURATION
156ebfedea0SLionel Sambucbelow for the supported mechanisms.
157ebfedea0SLionel SambucThe valid security options are
158ebfedea0SLionel Sambuc.Pp
159ebfedea0SLionel Sambuc.Bl -tag -width "nodictionaryxxx" -offset indent -compact
160ebfedea0SLionel Sambuc.It Qo noanonymous Qc
161ebfedea0SLionel Sambucreject anonymous mechanisms
162ebfedea0SLionel Sambuc.It Qo noplaintext Qc
163ebfedea0SLionel Sambucreject plaintext mechanisms
164ebfedea0SLionel Sambuc.It Qo nodictionary Qc
165ebfedea0SLionel Sambucreject mechanisms prone to dictionary attack
166ebfedea0SLionel Sambuc.It Qo noactive Qc
167ebfedea0SLionel Sambucreject mechanisms prone to active non-dictionary attacks
168ebfedea0SLionel Sambuc.It Qo mutual Qc
169ebfedea0SLionel Sambucrequire mutual authentication mechanisms
170ebfedea0SLionel Sambuc.El
171ebfedea0SLionel Sambuc.Pp
172ebfedea0SLionel SambucUnknown security options are ignored.
173ebfedea0SLionel SambucReturns a session handle or
174ebfedea0SLionel Sambuc.Dv NULL
175ebfedea0SLionel Sambucon error or no match.
176ebfedea0SLionel Sambuc.It Fn saslc_sess_end "sess"
177ebfedea0SLionel SambucThe
178ebfedea0SLionel Sambuc.Fn saslc_sess_end
179ebfedea0SLionel Sambucfunction ends the sasl session
180ebfedea0SLionel Sambuc.Ar sess .
181ebfedea0SLionel SambucIt destroys and deallocates all internal resources.
182ebfedea0SLionel SambucThis does not fail.
183ebfedea0SLionel Sambuc.It Fn saslc_sess_getprop "sess" "key"
184ebfedea0SLionel SambucThe
185ebfedea0SLionel Sambuc.Fn saslc_sess_getprop
186ebfedea0SLionel Sambucfunction gets the property indicated by the
187ebfedea0SLionel Sambuc.Ar key
188ebfedea0SLionel Sambucfrom the saslc dictionaries.
189ebfedea0SLionel SambucDictionaries are searched in following order: session
190ebfedea0SLionel Sambuc.Ar sess
191ebfedea0SLionel Sambucdictionary,
192ebfedea0SLionel Sambuccontext dictionary (global configuration), and mechanism dictionary.
193ebfedea0SLionel SambucReturns the property value or
194ebfedea0SLionel Sambuc.Dv NULL
195ebfedea0SLionel Sambucif the property is not found.
196ebfedea0SLionel Sambuc.It Fn saslc_sess_setprop "sess" "key" "value"
197ebfedea0SLionel SambucThe
198ebfedea0SLionel Sambuc.Fn saslc_sess_setprop
199ebfedea0SLionel Sambucfunction sets the property indexed by
200ebfedea0SLionel Sambuc.Ar key
201ebfedea0SLionel Sambucto the value
202ebfedea0SLionel Sambuc.Ar value
203ebfedea0SLionel Sambucin the session
204ebfedea0SLionel Sambuc.Ar sess
205ebfedea0SLionel Sambucdictionary.
206ebfedea0SLionel SambucIf the property already exists in the session dictionary, then the
207ebfedea0SLionel Sambucprevious value is replaced by the new value.
208ebfedea0SLionel SambucIf
209ebfedea0SLionel Sambuc.Ar value
210ebfedea0SLionel Sambucis
211ebfedea0SLionel Sambuc.Dv NULL ,
212ebfedea0SLionel Sambucthen any previous value in the session dictionary is removed.
213ebfedea0SLionel SambucReturns 0 on success or \-1 on failure.
214ebfedea0SLionel Sambuc.It Fn saslc_sess_cont "sess" "in" "inlen" "out" "outlen"
215ebfedea0SLionel SambucThe
216ebfedea0SLionel Sambuc.Fn saslc_sess_cont
217ebfedea0SLionel Sambucfunction performs one step of the sasl authentication.
218ebfedea0SLionel SambucIt reads
219ebfedea0SLionel Sambuc.Ar inlen
220ebfedea0SLionel Sambucbytes of input data
221ebfedea0SLionel Sambuc.Pq from the server
222ebfedea0SLionel Sambucfrom the
223ebfedea0SLionel Sambuc.Ar in
224ebfedea0SLionel Sambucbuffer and stores
225ebfedea0SLionel Sambuc.Ar outlen
226ebfedea0SLionel Sambucbytes of output data in
227ebfedea0SLionel Sambuc.Ar out
228ebfedea0SLionel Sambuc.Pq for the server .
229ebfedea0SLionel SambucThe user is responsible for freeing memory allocated for
230ebfedea0SLionel Sambuc.Ar out .
231ebfedea0SLionel SambucIt returns 0 if the authentication process is completed, 1 if another
232ebfedea0SLionel Sambucstep is required, and \-1 on error.
233ebfedea0SLionel SambucNote that the completion of authentication process does not mean the
234ebfedea0SLionel Sambucclient is authenticated; that is determined by the server.
235ebfedea0SLionel Sambuc.It Fn saslc_sess_decode "sess" "in" "inlen" "out" "outlen"
236ebfedea0SLionel SambucThe
237ebfedea0SLionel Sambuc.Fn saslc_sess_encode
238ebfedea0SLionel Sambucand
239ebfedea0SLionel Sambuc.Fn saslc_sess_decode
240ebfedea0SLionel Sambucfunctions are used to provide the integrity
241ebfedea0SLionel Sambuc.Pq Qq auth-int
242ebfedea0SLionel Sambucand  confidentiality
243*0a6a1f1dSLionel Sambuc.Pq Qq auth-conf
244ebfedea0SLionel Sambuclayers for mechanisms that provide them.
245ebfedea0SLionel SambucThey encode and, respectively, decode
246ebfedea0SLionel Sambuc.Ar inlen
247ebfedea0SLionel Sambucbytes of data from the
248ebfedea0SLionel Sambuc.Ar in
249ebfedea0SLionel Sambucbuffer using the method negotiated during authentication.
250ebfedea0SLionel SambucOn error they return \-1.
251ebfedea0SLionel SambucOtherwise, they return the number of bytes consumed from
252ebfedea0SLionel Sambuc.Ar in
253ebfedea0SLionel Sambucand output
254ebfedea0SLionel Sambuc.Ar outlen
255ebfedea0SLionel Sambucbytes of data in the
256ebfedea0SLionel Sambuc.Ar out
257ebfedea0SLionel Sambucbuffer.
258ebfedea0SLionel SambucThe user is responsible for freeing memory allocated for
259ebfedea0SLionel Sambuc.Ar out .
260ebfedea0SLionel SambucIf
261ebfedea0SLionel Sambuc.Ar outlen
262ebfedea0SLionel Sambucis 0, more data is needed before anything can be output.
263ebfedea0SLionel SambucUnused input data is stored internally for use in subsequent calls.
264ebfedea0SLionel Sambuc.Pp
265ebfedea0SLionel SambucWhen decoding, the internal buffers can only be flushed by providing
266ebfedea0SLionel Sambucthe missing packet data and it is an error to call
267ebfedea0SLionel Sambuc.Fn ssalc_sess_decode
268ebfedea0SLionel Sambucwith
269ebfedea0SLionel Sambuc.Ar inlen
270ebfedea0SLionel Sambuc= 0.
271ebfedea0SLionel SambucThe first call of
272ebfedea0SLionel Sambuc.Fn saslc_sess_decode
273ebfedea0SLionel Sambucin a session must begin at the start of a packet.
274ebfedea0SLionel SambucSubsequent calls need not be aligned on packet boundaries.
275ebfedea0SLionel Sambuc.It Fn saslc_sess_encode "sess" "in" "inlen" "out" "outlen"
276ebfedea0SLionel SambucAs described above,
277ebfedea0SLionel Sambuc.Fn saslc_sess_encode
278ebfedea0SLionel Sambucencodes
279ebfedea0SLionel Sambuc.Ar inlen
280ebfedea0SLionel Sambucbytes of data from the
281ebfedea0SLionel Sambuc.Ar in
282ebfedea0SLionel Sambucbuffer.
283ebfedea0SLionel SambucNote that unlike when decoding,
284ebfedea0SLionel Sambucthe internal buffer may be flushed through the encoder
285ebfedea0SLionel Sambucby calling
286ebfedea0SLionel Sambuc.Fn saslc_sess_encode
287ebfedea0SLionel Sambucwith
288ebfedea0SLionel Sambuc.Ar inlen
289ebfedea0SLionel Sambuc= 0.
290ebfedea0SLionel SambucIn this case,
291ebfedea0SLionel Sambuc.Fn saslc_sess_encode
292ebfedea0SLionel Sambucreturns the number of bytes that were flushed from the internal buffer.
293ebfedea0SLionel Sambuc.It Fn saslc_sess_getmech "sess"
294ebfedea0SLionel SambucThe
295ebfedea0SLionel Sambuc.Fn saslc_sess_getmech
296ebfedea0SLionel Sambucfunction returns the name of the mechanism used in the session
297ebfedea0SLionel Sambuc.Fa sess .
298ebfedea0SLionel SambucThe function does not fail.
299ebfedea0SLionel Sambuc.It Fn saslc_sess_strerror "sess"
300ebfedea0SLionel SambucThe
301ebfedea0SLionel Sambuc.Fn saslc_sess_strerror
302ebfedea0SLionel Sambucreturns the error message associated with the session
303ebfedea0SLionel Sambuc.Fa sess .
304ebfedea0SLionel Sambuc.It Fn saslc_strerror "ctx"
305ebfedea0SLionel SambucThe
306ebfedea0SLionel Sambuc.Fn saslc_strerror
307ebfedea0SLionel Sambucfunction operates as
308ebfedea0SLionel Sambuc.Fn saslc_sess_strerror ,
309ebfedea0SLionel Sambucbut instead returns the error message string for the last error in the context
310ebfedea0SLionel Sambuc.Fa ctx .
311ebfedea0SLionel SambucNeither function will ever return
312ebfedea0SLionel Sambuc.Dv NULL .
313ebfedea0SLionel Sambuc.El
314ebfedea0SLionel Sambuc.Sh CONFIGURATION
315ebfedea0SLionel SambucThe library uses three types of dictionaries: context (or global),
316ebfedea0SLionel Sambucsession, and mechanism, and they are searched in that order by
317ebfedea0SLionel Sambuc.Fn saslc_getprop
318ebfedea0SLionel Sambucand the first matching entry is taken.
319ebfedea0SLionel SambucThe context and mechanism dictionaries are loaded from configuration
320ebfedea0SLionel Sambucfiles, while the session dictionary is loaded by the caller via
321ebfedea0SLionel Sambuc.Fn saslc_setprop .
322ebfedea0SLionel Sambuc.Pp
323ebfedea0SLionel SambucThe configuration file
324ebfedea0SLionel Sambuc.Pa <cfgpath>/<appname>/saslc.conf
325*0a6a1f1dSLionel Sambucis used for the context configuration.
326ebfedea0SLionel SambucThe
327ebfedea0SLionel Sambuc.Pa <cfgpath>/<appname>/mech/<mechanism>.conf
328ebfedea0SLionel Sambucfile is used for the mechanism configuration.
329ebfedea0SLionel SambucThe
330ebfedea0SLionel Sambuc.Pa <cfgpath>
331ebfedea0SLionel Sambucis
332ebfedea0SLionel Sambuc.Pa /etc/saslc.d
333ebfedea0SLionel Sambucby default, but this may be overridden by the environment variable
334ebfedea0SLionel Sambuc.Ev SASLC_CONFIG ,
335ebfedea0SLionel Sambucwhich in turn may be overridden by
336ebfedea0SLionel Sambuc.Fn saslc_init .
337ebfedea0SLionel SambucThe
338ebfedea0SLionel Sambuc.Pa <appname>
339ebfedea0SLionel Sambucis
340ebfedea0SLionel Sambuc.Pa saslc
341ebfedea0SLionel Sambucby default, but may also be overridden by
342ebfedea0SLionel Sambuc.Fn saslc_init .
343ebfedea0SLionel SambucFinally, the
344ebfedea0SLionel Sambuc.Pa <mechanism>
345ebfedea0SLionel Sambucis the mechanism in use by the session as returned by
346ebfedea0SLionel Sambuc.Fn saslc_sess_getmech .
347ebfedea0SLionel SambucNote that this name is case sensitive.
348ebfedea0SLionel SambucThe currently supported mechanisms are
349ebfedea0SLionel Sambuc.Bl -tag -width DIGEST-MD5 -offset indent
350ebfedea0SLionel Sambuc.It ANONYMOUS
351ebfedea0SLionel SambucSee RFC 2245 and RFC 4505.
352ebfedea0SLionel Sambuc.It CRAM-MD5
353ebfedea0SLionel SambucSee RFC 2195.
354ebfedea0SLionel Sambuc.It DIGEST-MD5
355ebfedea0SLionel SambucSee RFC 2831.
356ebfedea0SLionel Sambuc.It EXTERNAL
357ebfedea0SLionel SambucSee RFC 2222 section 7.4 and RFC 4422 appendix A.
358ebfedea0SLionel Sambuc.It GSSAPI
359ebfedea0SLionel SambucSee RFC 2222 section 7.2 and RFC 4752.
360ebfedea0SLionel SambucThis requires GSS, Heimdal, or MIT Kerberos.
361ebfedea0SLionel Sambuc.It LOGIN
362ebfedea0SLionel SambucNon-standard, but common.
363ebfedea0SLionel Sambuc.It PLAIN
364ebfedea0SLionel SambucSee RFC 2595 and RFC 4616.
365ebfedea0SLionel Sambuc.El
366ebfedea0SLionel Sambuc.Pp
367ebfedea0SLionel SambucIf any of the mechanism files are missing they are silently ignored,
368ebfedea0SLionel Sambucunless debugging is enabled.
369ebfedea0SLionel Sambuc.Pp
370ebfedea0SLionel SambucThe configuration files consists of lines of the form:
371ebfedea0SLionel Sambuc.Bd -literal -offset indent
372ebfedea0SLionel Sambuc\fB#\fP comment line
373ebfedea0SLionel Sambuc.Ao key Ac \~\~ Ao value Ac \~\~ Bo \fB#\fP comment Bc
374ebfedea0SLionel Sambuc.Ed
375ebfedea0SLionel Sambuc.Pp
376ebfedea0SLionel SambucThe
377ebfedea0SLionel Sambuc.Aq key
378ebfedea0SLionel Sambucis a string beginning with an alpha character
379ebfedea0SLionel Sambuc.Pq Xr isalpha 3
380ebfedea0SLionel Sambucfollowed by any number of alpha numeric
381ebfedea0SLionel Sambuc.Pq Xr isalnum 3
382ebfedea0SLionel Sambucor underscore
383ebfedea0SLionel Sambuc.Sq _
384ebfedea0SLionel Sambuccharacters; this is case sensitive.
385ebfedea0SLionel SambucThe
386ebfedea0SLionel Sambuc.Aq value
387ebfedea0SLionel Sambucis a number or a quoted string.
388ebfedea0SLionel SambucMore than one
389ebfedea0SLionel Sambuc.Aq key
390ebfedea0SLionel Sambucand
391ebfedea0SLionel Sambuc.Aq value
392ebfedea0SLionel Sambucpair may occur on a single line, but they may not be broken across
393ebfedea0SLionel Sambuclines.
394ebfedea0SLionel SambucA
395ebfedea0SLionel Sambuc.Sq \fB#\fP
396ebfedea0SLionel Sambuccharacter
397ebfedea0SLionel Sambuc.Pq outside a quoted string
398ebfedea0SLionel Sambucindicates that the rest of the line is a comment.
399ebfedea0SLionel Sambuc.Pp
400ebfedea0SLionel SambucNOTE: Currently, no escaping is supported in strings, so they may not
401ebfedea0SLionel Sambuccontain quotes.
402ebfedea0SLionel SambucNumbers must be between 0 and
403ebfedea0SLionel Sambuc.Dv LLONG_MAX ,
404ebfedea0SLionel Sambucinclusive.
405ebfedea0SLionel SambucAny base supported by
406ebfedea0SLionel Sambuc.Xr strtoll 3
407ebfedea0SLionel Sambucis allowed.
408ebfedea0SLionel Sambuc.Sh PROPERTIES
409ebfedea0SLionel SambucMost of the control of the library
410ebfedea0SLionel Sambucbehavior is done via setting various properties in the context or
411ebfedea0SLionel Sambucmechanism dictionaries via the configuration files or in the session
412ebfedea0SLionel Sambucdictionary with
413ebfedea0SLionel Sambuc.Fn saslc_setprop .
414ebfedea0SLionel SambucThe following properties are currently used, as defined in
415ebfedea0SLionel Sambuc.Pa saslc.h :
416ebfedea0SLionel Sambuc.Bl -tag -width indent
417ebfedea0SLionel Sambuc.It SASLC_PROP_AUTHCID Po Qo AUTHCID Qc Pc
418ebfedea0SLionel SambucThe authentication name
419ebfedea0SLionel Sambuc.Pq or username
420ebfedea0SLionel Sambucto authenticate with.
421ebfedea0SLionel SambucUsed by all mechanisms except EXTERNAL.
422ebfedea0SLionel Sambuc.It SASLC_PROP_AUTHZID Po Qo AUTHZID Qc Pc
423ebfedea0SLionel SambucThe authorization string to use.
424ebfedea0SLionel SambucBy default, this string is empty.
425ebfedea0SLionel SambucUsed by the DIGEST-MD5, EXTERNAL, and PLAIN mechanisms.
426ebfedea0SLionel Sambuc.It SASLC_PROP_BASE64IO Po Qo BASE64IO Qc Pc
427ebfedea0SLionel SambucIf true ("true", "yes", or nonzero), then input and output strings are
428ebfedea0SLionel Sambucbase64 encoded.
429ebfedea0SLionel SambucAny other value is false and the input and output strings are not
430ebfedea0SLionel Sambucbase64 encoded.
431ebfedea0SLionel SambucBy default, this is assumed true.
432ebfedea0SLionel SambucUsed by all mechanisms.
433ebfedea0SLionel Sambuc.It SASLC_PROP_CIPHERMASK Po Qo CIPHERMASK Qc Pc
434ebfedea0SLionel SambucThe mask of ciphers to use with the DIGEST-MD5 mechanism when using
435ebfedea0SLionel Sambucthe
436ebfedea0SLionel Sambuc.Qq auth-conf
437ebfedea0SLionel SambucQOP.
438ebfedea0SLionel SambucBy default all supported ciphers are used, but they may be limited by
439ebfedea0SLionel Sambuca comma delimited list of cipher names.
440ebfedea0SLionel SambucThe recognized cipher names for DIGEST-MD5 are:
441ebfedea0SLionel Sambuc.Pp
442ebfedea0SLionel Sambuc.Bl -tag -offset indent -compact
443ebfedea0SLionel Sambuc.It Li "3des"
444ebfedea0SLionel SambucTriple-DES Cipher in CBC "two keys" mode with 112 bit key
445ebfedea0SLionel Sambuc.It Li "aes"
446ebfedea0SLionel SambucAES Cipher in CBC mode with 128 bit key
447ebfedea0SLionel Sambuc.It Li "des"
448ebfedea0SLionel SambucDES Cipher in CBC mode with 56 bit key
449ebfedea0SLionel Sambuc.It Li "rc4"
450ebfedea0SLionel SambucRC4 Cipher with 128 bit key
451ebfedea0SLionel Sambuc.It Li "rc4-40"
452ebfedea0SLionel SambucRC4 Cipher with 40 bit key
453ebfedea0SLionel Sambuc.It Li "rc4-56"
454ebfedea0SLionel SambucRC4 Cipher with 56 bit key
455ebfedea0SLionel Sambuc.El
456ebfedea0SLionel Sambuc.Pp
457ebfedea0SLionel SambucThe default value is
458ebfedea0SLionel Sambuc.Qq des,3des,rc4,rc4_40,rc4_56,aes .
459ebfedea0SLionel Sambuc.Po
460ebfedea0SLionel SambucNote that
461ebfedea0SLionel Sambuc.Qq aes
462ebfedea0SLionel Sambucis not part of the official standard.
463ebfedea0SLionel Sambuc.Pc
464ebfedea0SLionel SambucUsed by the DIGEST-MD5 mechanism.
465ebfedea0SLionel Sambuc.It SASLC_PROP_DEBUG Po Qo DEBUG Qc Pc
466ebfedea0SLionel SambucIf true, then enable debug messages.
467ebfedea0SLionel SambucThis is implemented as a global variable so it will affect all
468ebfedea0SLionel Sambucsessions.
469ebfedea0SLionel SambucIf set via
470ebfedea0SLionel Sambuc.Fn saslc_sess_setprop ,
471ebfedea0SLionel Sambucit should be set before the first call to
472ebfedea0SLionel Sambuc.Fn saslc_sess_cont .
473ebfedea0SLionel Sambuc.Po
474ebfedea0SLionel SambucAlso see the environment variable
475ebfedea0SLionel Sambuc.Ev SASLC_ENV_DEBUG
476ebfedea0SLionel Sambucin the
477ebfedea0SLionel Sambuc.Sx ENVIRONMENT
478ebfedea0SLionel Sambucsection below.
479ebfedea0SLionel Sambuc.Pc
480ebfedea0SLionel Sambuc.It SASLC_PROP_HOSTNAME Po Qo HOSTNAME Qc Pc
481ebfedea0SLionel SambucThe fully qualified domain name of the server host.
482ebfedea0SLionel SambucUsed by the DIGEST-MD5 and GSSAPI mechanisms.
483ebfedea0SLionel Sambuc.It SASLC_PROP_MAXBUF Po Qo MAXBUF Qc Pc
484ebfedea0SLionel SambucThe size of the decode buffer.
485ebfedea0SLionel SambucThis info is sent to the server so that it doesn't send packets that
486ebfedea0SLionel Sambucwon't fit in the decode buffer when decoded.
487ebfedea0SLionel SambucUsed by the DIGEST-MD5 and GSSAPI mechanisms.
488ebfedea0SLionel Sambuc.It SASLC_PROP_PASSWD Po Qo PASSWD Qc Pc
489ebfedea0SLionel SambucThe password to authenticate with.
490ebfedea0SLionel SambucUsed by the CRAM-MD5, DIGEST-MD5, LOGIN, and PLAIN mechanisms.
491ebfedea0SLionel Sambuc.It SASLC_PROP_QOPMASK Po Qo QOPMASK Qc Pc
492ebfedea0SLionel SambucThe mask of QOP (quality of protection) to use with the DIGEST-MD5
493ebfedea0SLionel Sambucand GSSAPI mechanisms.
494ebfedea0SLionel SambucBy default all supported QOP values are allowed, but they may be
495ebfedea0SLionel Sambuclimited by a comma delimited list of QOP values.
496ebfedea0SLionel SambucThe recognized QOP values are:
497ebfedea0SLionel Sambuc.Pp
498ebfedea0SLionel Sambuc.Bl -tag -offset indent -compact
499ebfedea0SLionel Sambuc.It Li "auth"
500ebfedea0SLionel Sambucauthentication only
501ebfedea0SLionel Sambuc.It Li "auth-int"
502ebfedea0SLionel Sambucauthentication with integrity
503ebfedea0SLionel Sambuc.It Li "auth-conf"
504ebfedea0SLionel Sambucauthentication with confidentiality
505ebfedea0SLionel Sambuc.El
506ebfedea0SLionel Sambuc.Pp
507ebfedea0SLionel Sambucso the default value of the mask is
508ebfedea0SLionel Sambuc.Qq auth,auth-int,auth-conf .
509ebfedea0SLionel SambucUsed by the DIGEST-MD5 and GSSAPI mechanisms.
510ebfedea0SLionel Sambuc.It SASLC_PROP_REALM Po Qo REALM Qc Pc
511ebfedea0SLionel SambucA comma delimited list of possible realms to use for authentication.
512ebfedea0SLionel SambucThe format of each element in the list is
513ebfedea0SLionel Sambuc.Qq Oo Ao hostname Ac : Oc Ns Ao realm Ac .
514ebfedea0SLionel SambucThe user specified realm is the first realm in the list with a
515ebfedea0SLionel Sambucmatching hostname or, if none is found, the first realm in the list
516ebfedea0SLionel Sambucwith no hostname.
517ebfedea0SLionel SambucIf the server provides a list of realms, the one matching the user
518ebfedea0SLionel Sambucspecified realm is selected.
519ebfedea0SLionel SambucIf no match is found or if the user didn't provide a realm, the first
520ebfedea0SLionel Sambucrealm provided by the server is selected.
521ebfedea0SLionel SambucIf the server doesn't provide any realms, use the user specified realm
522ebfedea0SLionel Sambucif there is one, or the hostname if not.
523ebfedea0SLionel SambucThis is useful when the server provides multiple realms or no realm.
524ebfedea0SLionel SambucUsed by the DIGEST-MD5 mechanism.
525ebfedea0SLionel Sambuc.It SASLC_PROP_SECURITY Po Qo SECURITY Qc Pc
526ebfedea0SLionel SambucA comma delimited list of extra security option flags that will be
527ebfedea0SLionel Sambuc.Qo or Qc Ns -ed
528ebfedea0SLionel Sambuctogether with those passed to
529ebfedea0SLionel Sambuc.Fn saslc_sess_init .
530ebfedea0SLionel SambucSince these flags are used to choose the session mechanism, they are
531ebfedea0SLionel Sambuconly effective if they are in the context configuration file.
532ebfedea0SLionel Sambuc.Po
533ebfedea0SLionel SambucSee the
534ebfedea0SLionel Sambuc.Sx CONFIGURATION
535ebfedea0SLionel Sambucsection and the
536ebfedea0SLionel Sambuc.Fn saslc_sess_init
537ebfedea0SLionel Sambucfunction.
538ebfedea0SLionel Sambuc.Pc
539ebfedea0SLionel Sambuc.It SASLC_PROP_SERVICE Po Qo SERVICE Qc Pc
540ebfedea0SLionel SambucThe service being used, e.g., smtp, imap, etc.
541ebfedea0SLionel SambucUsed by the DIGEST-MD5 and GSSAPI mechanisms.
542ebfedea0SLionel Sambuc.It SASLC_PROP_SERVNAME Po Qo SERVNAME Qc Pc
543ebfedea0SLionel SambucA comma delimited list of possible service names with elements of the
544ebfedea0SLionel Sambucform
545ebfedea0SLionel Sambuc.Qq Oo Ao hostname Ac : Oc Ns Ao serv-name Ac
546ebfedea0SLionel Sambucand with the same rules as for the SASLC_PROP_REALM list.
547ebfedea0SLionel SambucThis should only be used if the client uses a DNS name for the service
548ebfedea0SLionel Sambucthat is different from the FQDN of the server.
549ebfedea0SLionel SambucFor example, the service name
550ebfedea0SLionel Sambuc.Em example.com
551ebfedea0SLionel Sambucmight resolve
552ebfedea0SLionel Sambuc.Pq via SRV or MX records
553ebfedea0SLionel Sambucinto a set of other DNS names, one of which,
554ebfedea0SLionel Sambuc.Em mail3.example.com ,
555ebfedea0SLionel Sambucis the FQDN of the server.
556ebfedea0SLionel Sambuc.Po
557ebfedea0SLionel SambucSee RFC 2831 section 2.1.2
558ebfedea0SLionel Sambuc.Qq serv-name .
559ebfedea0SLionel Sambuc.Pc
560ebfedea0SLionel SambucUsed by the DIGEST-MD5 mechanism.
561ebfedea0SLionel Sambuc.El
562ebfedea0SLionel Sambuc.Pp
563ebfedea0SLionel SambucThe defines in
564ebfedea0SLionel Sambuc.Pa saslc.h
565ebfedea0SLionel Sambucshould be used in code, but their values need to be used in the config
566ebfedea0SLionel Sambucfiles.
567ebfedea0SLionel Sambuc.Sh ENVIRONMENT
568ebfedea0SLionel SambucThe following environment variables
569ebfedea0SLionel Sambuc.Pq defined in Pa saslc.h
570ebfedea0SLionel Sambucaffect the behavior of the library:
571ebfedea0SLionel Sambuc.Bl -tag -width indent
572ebfedea0SLionel Sambuc.It Ev SASLC_ENV_CONFIG Po Qo SASLC_CONFIG Qc Pc
573ebfedea0SLionel SambucIf the environment variable
574ebfedea0SLionel Sambuc.Ev SASLC_CONFIG
575ebfedea0SLionel Sambucis set it overrides the default configuration file location of
576ebfedea0SLionel Sambuc.Pa /etc/saslc.d .
577ebfedea0SLionel SambucThis may be overridden by
578ebfedea0SLionel Sambuc.Fn saslc_init .
579ebfedea0SLionel Sambuc.It Ev SASLC_ENV_DEBUG Po Qo SASLC_DEBUG Qc Pc
580ebfedea0SLionel SambucIf set, turn on debugging messages.
581ebfedea0SLionel SambucThis turns on debugging as early as possible and is a global setting.
582ebfedea0SLionel Sambuc.El
583ebfedea0SLionel Sambuc.Sh GSSAPI AND KERBEROS
584ebfedea0SLionel SambucThe following is a minimal
585ebfedea0SLionel Sambuc.Pq Heimdal
586ebfedea0SLionel SambucKerberos 5 setup for use with an smtp server that has been configured
587ebfedea0SLionel Sambucto support
588ebfedea0SLionel Sambuc.Em SASL
589ebfedea0SLionel Sambucwith the
590ebfedea0SLionel Sambuc.Em GSSAPI
591ebfedea0SLionel Sambucmechanism.
592ebfedea0SLionel SambucIt assumes that Kerberos and the smtp server will both run on
593ebfedea0SLionel Sambuc.Em server.my.domain
594ebfedea0SLionel Sambucand that the client is on
595ebfedea0SLionel Sambuc.Em client.my.domain .
596ebfedea0SLionel SambucIt also assumes that the smtp server runs as user
597ebfedea0SLionel Sambuc.Em postfix
598ebfedea0SLionel Sambucand group
599ebfedea0SLionel Sambuc.Em mail ,
600ebfedea0SLionel Sambucand that it is not chrooted.
601ebfedea0SLionel Sambuc.Pp
602ebfedea0SLionel SambucOn
603ebfedea0SLionel Sambuc.Em server.my.domain
604ebfedea0SLionel Sambucrun the following script as
605ebfedea0SLionel Sambuc.Em root
606ebfedea0SLionel Sambucand then start the Kerberos server
607ebfedea0SLionel Sambuc.Xr kdc 8 .
608ebfedea0SLionel SambucYou will be prompted for a master password for Kerberos and a password
609ebfedea0SLionel Sambucfor the
610ebfedea0SLionel Sambuc.Em postfix
611ebfedea0SLionel Sambucprincipal.
612ebfedea0SLionel Sambuc.Bd -literal -offset indent
613ebfedea0SLionel Sambuc#/bin/sh
614ebfedea0SLionel Sambuc.Pp
615ebfedea0SLionel Sambuccat <<- EOF >> /etc/krb5.conf
616ebfedea0SLionel Sambuc[libdefaults]
617ebfedea0SLionel Sambuc	default_realm = MY.DOMAIN
618ebfedea0SLionel Sambuc[realms]
619ebfedea0SLionel Sambuc	MY.DOMAIN = {
620ebfedea0SLionel Sambuc		kdc = server.my.domain
621ebfedea0SLionel Sambuc		admin_servers = server.my.domain
622ebfedea0SLionel Sambuc	}
623ebfedea0SLionel Sambuc[domain_realm]
624ebfedea0SLionel Sambuc	.my.domain = MY.DOMAIN
625ebfedea0SLionel SambucEOF
626ebfedea0SLionel Sambuc.Pp
627ebfedea0SLionel Sambucmkdir /var/heimdal
628ebfedea0SLionel Sambucchown root:wheel /var/heimdal
629ebfedea0SLionel Sambucchmod 755 /var/heimdal
630ebfedea0SLionel Sambuc.Pp
631ebfedea0SLionel Sambuckstash
632ebfedea0SLionel Sambuckadmin -l init --realm-max-ticket-life=unlimited \\
633ebfedea0SLionel Sambuc               --realm-max-renewable-life=unlimited \\
634ebfedea0SLionel Sambuc               MY.DOMAIN
635ebfedea0SLionel Sambuckadmin -l add  --max-ticket-life="1 day" \\
636ebfedea0SLionel Sambuc               --max-renewable-life="1 week" \\
637ebfedea0SLionel Sambuc               --expiration-time=never \\
638ebfedea0SLionel Sambuc               --pw-expiration-time=never \\
639ebfedea0SLionel Sambuc               --attributes="" \\
640ebfedea0SLionel Sambuc               postfix
641ebfedea0SLionel Sambuckadmin -l add  --random-key \\
642ebfedea0SLionel Sambuc               --max-ticket-life="1 day" \\
643ebfedea0SLionel Sambuc               --max-renewable-life="1 week" \\
644ebfedea0SLionel Sambuc               --expiration-time=never \\
645ebfedea0SLionel Sambuc               --pw-expiration-time=never \\
646ebfedea0SLionel Sambuc               --attributes="" \\
647ebfedea0SLionel Sambuc               smtp/server.my.domain
648ebfedea0SLionel Sambuckadmin -l ext -k /etc/krb5.keytab smtp/server.my.domain
649ebfedea0SLionel Sambucchown root:mail /etc/krb5.keytab
650ebfedea0SLionel Sambucchmod 640 /etc/krb5.keytab
651ebfedea0SLionel Sambuc.Ed
652ebfedea0SLionel Sambuc.Pp
653ebfedea0SLionel SambucNote that the keytab
654ebfedea0SLionel Sambuc.Pa /etc/krb5.keytab
655ebfedea0SLionel Sambucmust be readable by the smtp server or authentication will fail.
656ebfedea0SLionel SambucThe location of this keytab file may be changed with the environment
657ebfedea0SLionel Sambucvariable
658ebfedea0SLionel Sambuc.Ev KRB5_KTNAME .
659ebfedea0SLionel SambucIf postfix is the smtp server, note the
660ebfedea0SLionel Sambuc.Em import_environment
661ebfedea0SLionel Sambucparameter
662ebfedea0SLionel Sambuc.Pq see Xr postconf 5 .
663ebfedea0SLionel Sambuc.Pp
664ebfedea0SLionel SambucOn
665ebfedea0SLionel Sambuc.Em client.my.domain
666ebfedea0SLionel Sambuccopy the keytab file from
667ebfedea0SLionel Sambuc.Pa server.my.domain:/etc/krb5.keytab
668ebfedea0SLionel Sambucto
669ebfedea0SLionel Sambuc.Pa /etc/krb5.keytab .
670ebfedea0SLionel SambucSetup the
671ebfedea0SLionel Sambuc.Pa /etc/saslc.d
672ebfedea0SLionel Sambucconfiguration directory
673ebfedea0SLionel Sambuc.Po see Sx CONFIGURATION
674ebfedea0SLionel Sambucabove
675ebfedea0SLionel Sambuc.Pc .
676ebfedea0SLionel SambucAdd the line
677ebfedea0SLionel Sambuc.Bd -literal -offset indent
678ebfedea0SLionel SambucAUTHCID		"postfix"
679ebfedea0SLionel Sambuc.Ed
680ebfedea0SLionel Sambuc.Pp
681ebfedea0SLionel Sambucto the file
682ebfedea0SLionel Sambuc.Pa /etc/saslc.d/postfix/mech/GSSAPI.conf
683ebfedea0SLionel Sambucso that the
684ebfedea0SLionel Sambuc.Em postfix
685ebfedea0SLionel Sambucprincipal will be used for authentication.
686ebfedea0SLionel SambucEnable
687ebfedea0SLionel Sambuc.Em SASL
688ebfedea0SLionel Sambucin the smtp client.
689ebfedea0SLionel SambucAssuming the smtp client is postfix, you will need to add the
690ebfedea0SLionel Sambucfollowing to the
691ebfedea0SLionel Sambuc.Pa /etc/postfix/main.cf
692ebfedea0SLionel Sambucfile to do this:
693ebfedea0SLionel Sambuc.Bd -literal -offset indent
694ebfedea0SLionel Sambucsmtp_sasl_auth_enable = yes
695ebfedea0SLionel Sambucsmtp_sasl_type = saslc
696ebfedea0SLionel Sambucsmtp_sasl_mechanism_filter = GSSAPI
697ebfedea0SLionel Sambucrelayhost = [server.my.domain]:submission
698ebfedea0SLionel Sambuc.Ed
699ebfedea0SLionel Sambuc.Pp
700ebfedea0SLionel SambucHere we have assumed the
701ebfedea0SLionel Sambuc.Em submission
702ebfedea0SLionel Sambucport is the port the server is listening to.
703ebfedea0SLionel SambucFinally, as
704ebfedea0SLionel Sambuc.Em root ,
705ebfedea0SLionel Sambucrun the command
706ebfedea0SLionel Sambuc.Bd -literal -offset indent
707ebfedea0SLionel Sambucsu -m postfix -c kinit
708ebfedea0SLionel Sambuc.Ed
709ebfedea0SLionel Sambuc.Pp
710ebfedea0SLionel Sambucto obtain a ticket for the postfix user with the postfix credential
711ebfedea0SLionel Sambucand you should be good to go!
712ebfedea0SLionel Sambuc.Sh FILES
713ebfedea0SLionel Sambuc.Bl -tag -width /etc/saslc.d
714ebfedea0SLionel Sambuc.It Pa /etc/saslc.d
715ebfedea0SLionel Sambuc.El
716ebfedea0SLionel Sambuc.Sh EXAMPLES
717ebfedea0SLionel SambucThe following code fragments illustrate the possible use of the
718ebfedea0SLionel Sambucfunctions described above.
719ebfedea0SLionel Sambuc.Bd -literal
720ebfedea0SLionel Sambucint
721ebfedea0SLionel Sambucdecode_stream(saslc_sess_t *sess, int fdin, int fdout)
722ebfedea0SLionel Sambuc{
723ebfedea0SLionel Sambuc	uint8_t buf[BUFSIZE];
724ebfedea0SLionel Sambuc	uint8_t *in;
725ebfedea0SLionel Sambuc	void *out;
726ebfedea0SLionel Sambuc	size_t inlen, outlen;
727ebfedea0SLionel Sambuc	ssize_t n, rval;
728ebfedea0SLionel Sambuc.Pp
729ebfedea0SLionel Sambuc	for (;;) {
730ebfedea0SLionel Sambuc		if ((rval = read(fdin, buf, sizeof(buf))) == \-1)
731ebfedea0SLionel Sambuc			return \-1;
732ebfedea0SLionel Sambuc		if (rval == 0)
733ebfedea0SLionel Sambuc			break;
734ebfedea0SLionel Sambuc		in = buf;
735ebfedea0SLionel Sambuc		inlen = rval;
736ebfedea0SLionel Sambuc		while (inlen > 0) {
737ebfedea0SLionel Sambuc			rval = saslc_sess_decode(sess, in, inlen, &out,
738ebfedea0SLionel Sambuc			    &outlen);
739ebfedea0SLionel Sambuc			if (rval == \-1)
740ebfedea0SLionel Sambuc				return \-1;
741ebfedea0SLionel Sambuc			if (outlen > 0) {
742ebfedea0SLionel Sambuc				n = write(fdout, out, outlen);
743ebfedea0SLionel Sambuc				free(out);
744ebfedea0SLionel Sambuc				if (n == \-1)
745ebfedea0SLionel Sambuc					return \-1;
746ebfedea0SLionel Sambuc			}
747ebfedea0SLionel Sambuc			in += rval;
748ebfedea0SLionel Sambuc			inlen -= rval;
749ebfedea0SLionel Sambuc		}
750ebfedea0SLionel Sambuc	}
751ebfedea0SLionel Sambuc	return 0;
752ebfedea0SLionel Sambuc}
753ebfedea0SLionel Sambuc.Pp
754ebfedea0SLionel Sambucint
755ebfedea0SLionel Sambucencode_stream(saslc_sess_t *sess, int fdin, int fdout)
756ebfedea0SLionel Sambuc{
757ebfedea0SLionel Sambuc	uint8_t buf[BUFSIZE];
758ebfedea0SLionel Sambuc	uint8_t *in;
759ebfedea0SLionel Sambuc	void *out;
760ebfedea0SLionel Sambuc	size_t inlen, outlen;
761ebfedea0SLionel Sambuc	ssize_t n, rval;
762ebfedea0SLionel Sambuc.Pp
763ebfedea0SLionel Sambuc	for (;;) {
764ebfedea0SLionel Sambuc		if ((rval = read(fdin, buf, sizeof(buf))) == \-1)
765ebfedea0SLionel Sambuc			return \-1;
766ebfedea0SLionel Sambuc		if (rval == 0)
767ebfedea0SLionel Sambuc			break;
768ebfedea0SLionel Sambuc		in = buf;
769ebfedea0SLionel Sambuc		inlen = rval;
770ebfedea0SLionel Sambuc		while (inlen > 0) {
771ebfedea0SLionel Sambuc			rval = saslc_sess_encode(sess, in, inlen, &out,
772ebfedea0SLionel Sambuc			    &outlen);
773ebfedea0SLionel Sambuc			if (rval == \-1)
774ebfedea0SLionel Sambuc				return \-1;
775ebfedea0SLionel Sambuc			if (outlen > 0) {
776ebfedea0SLionel Sambuc				n = write(fdout, out, outlen);
777ebfedea0SLionel Sambuc				free(out);
778ebfedea0SLionel Sambuc				if (n == \-1)
779ebfedea0SLionel Sambuc					return \-1;
780ebfedea0SLionel Sambuc			}
781ebfedea0SLionel Sambuc			in += rval;
782ebfedea0SLionel Sambuc			inlen -= rval;
783ebfedea0SLionel Sambuc		}
784ebfedea0SLionel Sambuc	}
785ebfedea0SLionel Sambuc	/* flush internal encoder buffer */
786ebfedea0SLionel Sambuc	if (saslc_sess_encode(sess, NULL, 0, &out, &outlen) == \-1)
787ebfedea0SLionel Sambuc		return \-1;
788ebfedea0SLionel Sambuc	if (outlen > 0)
789ebfedea0SLionel Sambuc		if (write(fdout, out, outlen) == \-1)
790ebfedea0SLionel Sambuc			return \-1;
791ebfedea0SLionel Sambuc	return 0;
792ebfedea0SLionel Sambuc}
793ebfedea0SLionel Sambuc.Ed
794ebfedea0SLionel Sambuc.Sh COMPATIBILITY
795ebfedea0SLionel SambucThere exist other SASL client library implementations including Cyrus SASL
796ebfedea0SLionel Sambuc(http://asg.web.cmu.edu/sasl/sasl-library.html) and GNU SASL
797ebfedea0SLionel Sambuc(http://www.gnu.org/software/gsasl/).
798ebfedea0SLionel Sambuc.Sh STANDARDS
799ebfedea0SLionel SambucRFC 2195, RFC 2222, RFC 2245, RFC 2595, RFC 2831, RFC 4422, RFC 4505,
800ebfedea0SLionel SambucRFC 4616, RFC 4752.
801ebfedea0SLionel Sambuc.Sh HISTORY
802ebfedea0SLionel SambucThe
803ebfedea0SLionel Sambuc.Nm
804ebfedea0SLionel Sambuclibrary appeared in
805ebfedea0SLionel Sambuc.Nx 6.0 .
806ebfedea0SLionel Sambuc.Sh CAVEATS
807ebfedea0SLionel SambucThe API was heavily influenced by its use with
808ebfedea0SLionel Sambuc.Xr postfix 1 .
809ebfedea0SLionel Sambuc.Pp
810ebfedea0SLionel SambucCurrently the ANONYMOUS, LOGIN, PLAIN, CRAM-MD5, DIGEST-MD5, and
811ebfedea0SLionel SambucGSSAPI mechanisms have been tested and shown to work for
812ebfedea0SLionel Sambucauthentication with a
813ebfedea0SLionel Sambuc.Xr postfix 1
814ebfedea0SLionel SambucSMTP server using the cyrus-sasl library.
815ebfedea0SLionel SambucLOGIN, PLAIN, CRAM-MD5, and DIGEST-MD5 have also been tested and shown
816ebfedea0SLionel Sambucto work with a
817ebfedea0SLionel Sambuc.Xr postfix 1
818ebfedea0SLionel SambucSMTP server using a dovecot backend for authentication.
819ebfedea0SLionel SambucThe DIGEST-MD5 and GSSAPI specs also provide for integrity and
820ebfedea0SLionel Sambucconfidentiality layers via the
821ebfedea0SLionel Sambuc.Fn saslc_sess_encode
822ebfedea0SLionel Sambucand
823ebfedea0SLionel Sambuc.Fn saslc_sess_decode
824ebfedea0SLionel Sambucroutines, but these have not yet been tested against any servers.
825