]> granicus.if.org Git - linux-pam/blob - doc/pam_modules.sgml
Relevant BUGIDs: 460491
[linux-pam] / doc / pam_modules.sgml
1 <!doctype linuxdoc system>
2
3 <!--
4
5  $Id$
6
7     Copyright (c) Andrew G. Morgan 1996-2001.  All rights reserved.
8
9         ** some sections, in this document, were contributed by other
10         ** authors. They carry individual copyrights.
11
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are
14 met:
15
16 1. Redistributions of source code must retain the above copyright
17    notice, and the entire permission notice in its entirety,
18    including the disclaimer of warranties.
19
20 2. Redistributions in binary form must reproduce the above copyright
21    notice, this list of conditions and the following disclaimer in the
22    documentation and/or other materials provided with the distribution.
23
24 3. The name of the author may not be used to endorse or promote
25    products derived from this software without specific prior
26    written permission.
27
28 ALTERNATIVELY, this product may be distributed under the terms of the
29 GNU General Public License, in which case the provisions of the GNU
30 GPL are required INSTEAD OF the above restrictions.  (This clause is
31 necessary due to a potential bad interaction between the GNU GPL and
32 the restrictions contained in a BSD-style copyright.)
33
34 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
35 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
36 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
37 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
38 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
39 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
40 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
41 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
42 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
43 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
44 DAMAGE.
45
46  -->
47
48 <article>
49
50 <title>The Linux-PAM Module Writers' Guide
51 <author>Andrew G. Morgan, <tt>morgan@kernel.org</tt>
52 <date>DRAFT v0.76 2001/09/12
53 <abstract>
54 This manual documents what a programmer needs to know in order to
55 write a module that conforms to the <bf/Linux-PAM/ standard. It also
56 discusses some security issues from the point of view of the module
57 programmer.
58 </abstract>
59
60 <toc>
61
62 <sect>Introduction
63
64 <sect1> Synopsis
65 <p>
66 <tscreen>
67 <verb>
68 #include <security/pam_modules.h>
69
70 gcc -fPIC -c pam_module-name.c
71 ld -x --shared -o pam_module-name.so pam_module-name.o
72 </verb>
73 </tscreen>
74
75 <sect1> Description
76
77 <p>
78 <bf/Linux-PAM/ (Pluggable Authentication Modules for Linux) is a
79 library that enables the local system administrator to choose how
80 individual applications authenticate users.  For an overview of the
81 <bf/Linux-PAM/ library see the <bf/Linux-PAM/ System Administrators'
82 Guide.
83
84 <p>
85 A <bf/Linux-PAM/ module is a single executable binary file that can be
86 loaded by the <bf/Linux-PAM/ interface library. This PAM library is
87 configured locally with a system file, <tt>/etc/pam.conf</tt>, to
88 authenticate a user request via the locally available authentication
89 modules. The modules themselves will usually be located in the
90 directory <tt>/usr/lib/security</tt> and take the form of dynamically
91 loadable object files (see dlopen(3)). Alternatively, the modules can
92 be statically linked into the <bf/Linux-PAM/ library; this is mostly to
93 allow <bf/Linux-PAM/ to be used on platforms without dynamic linking
94 available, but the two forms can be used together.  It is the
95 <bf/Linux-PAM/ interface that is called by an application and it is
96 the responsibility of the library to locate, load and call the
97 appropriate functions in a <bf/Linux-PAM/-module.
98
99 <p>
100 Except for the immediate purpose of interacting with the user
101 (entering a password etc..) the module should never call the
102 application directly. This exception requires a "conversation
103 mechanism" which is documented below.
104
105 <sect>What can be expected by the module
106
107 <p>
108 Here we list the interface that the conventions that all
109 <bf/Linux-PAM/ modules must adhere to.
110
111 <sect1>Getting and setting <tt/PAM_ITEM/s and <em/data/
112
113 <p>
114 First, we cover what the module should expect from the <bf/Linux-PAM/
115 library and a <bf/Linux-PAM/ <em/aware/ application. Essesntially this
116 is the <tt/libpam.*/ library.
117
118 <sect2>
119 Setting data
120
121 <p>
122 Synopsis:
123 <tscreen>
124 <verb>
125 extern int pam_set_data(pam_handle_t *pamh,
126                         const char *module_data_name,
127                         void *data,
128                         void (*cleanup)(pam_handle_t *pamh,
129                                         void *data, int error_status) );
130 </verb>
131 </tscreen>
132
133 <p>
134 The modules may be dynamically loadable objects. In general such files
135 should not contain <tt/static/ variables. This and the subsequent
136 function provide a mechanism for a module to associate some data with
137 the handle <tt/pamh/. Typically a module will call the
138 <tt/pam_set_data()/ function to register some data under a (hopefully)
139 unique <tt/module_data_name/. The data is available for use by other
140 modules too but <em/not/ by an application.
141
142 <p>
143 The function <tt/cleanup()/ is associated with the <tt/data/ and, if
144 non-<tt/NULL/, it is called when this data is over-written or
145 following a call to <tt/pam_end()/ (see the Linux-PAM Application
146 Developers' Guide).
147
148 <p>
149 The <tt/error_status/ argument is used to indicate to the module the
150 sort of action it is to take in cleaning this data item. As an
151 example, Kerberos creates a ticket file during the authentication
152 phase, this file might be associated with a data item. When
153 <tt/pam_end()/ is called by the module, the <tt/error_status/
154 carries the return value of the <tt/pam_authenticate()/ or other
155 <tt/libpam/ function as appropriate. Based on this value the Kerberos
156 module may choose to delete the ticket file (<em/authentication
157 failure/) or leave it in place.
158
159 <p>
160 The <tt/error_status/ may have been logically OR'd with either of the
161 following two values:
162
163 <p>
164 <descrip>
165 <tag><tt/PAM_DATA_REPLACE/</tag>
166         When a data item is being replaced (through a second call to
167 <tt/pam_set_data()/) this mask is used. Otherwise, the call is assumed
168 to be from <tt/pam_end()/.
169
170 <tag><tt/PAM_DATA_SILENT/</tag>
171         Which indicates that the process would prefer to perform the
172 <tt/cleanup()/ quietly. That is, discourages logging/messages to the
173 user.
174
175 </descrip>
176
177
178 <sect2>
179 Getting data
180
181 <p>
182 Synopsis:
183 <tscreen>
184 <verb>
185 extern int pam_get_data(const pam_handle_t *pamh,
186                         const char *module_data_name,
187                         const void **data);
188 </verb>
189 </tscreen>
190
191 <p>
192 This function together with the previous one provides a method of
193 associating module-specific data with the handle <tt/pamh/. A
194 successful call to <tt/pam_get_data/ will result in <tt/*data/
195 pointing to the data associated with the <tt/module_data_name/. Note,
196 this data is <em/not/ a copy and should be treated as <em/constant/
197 by the module.
198
199 <p>
200 Note, if there is an entry but it has the value <tt/NULL/, then this
201 call returns <tt/PAM_NO_MODULE_DATA/.
202
203 <sect2>
204 Setting items
205
206 <p>
207 Synopsis:
208 <tscreen>
209 <verb>
210 extern int pam_set_item(pam_handle_t *pamh,
211                         int item_type,
212                         const void *item);
213 </verb>
214 </tscreen>
215
216 <p>
217 This function is used to (re)set the value of one of the
218 <tt/item_type/s.  The reader is urged to read the entry for this
219 function in the <bf/Linux-PAM/ application developers' manual.
220
221 <p>
222 In addition to the <tt/item/s listed there, the module can set the
223 following two <tt/item_type/s:
224
225 <p>
226 <descrip>
227 <tag><tt/PAM_AUTHTOK/</tag>
228
229 The authentication token (often a password). This token should be
230 ignored by all module functions besides <tt/pam_sm_authenticate()/ and
231 <tt/pam_sm_chauthtok()/. In the former function it is used to pass the
232 most recent authentication token from one stacked module to
233 another. In the latter function the token is used for another
234 purpose. It contains the currently active authentication token.
235
236 <tag><tt/PAM_OLDAUTHTOK/</tag>
237
238 The old authentication token. This token should be ignored by all
239 module functions except <tt/pam_sm_chauthtok()/.
240
241 </descrip>
242
243 <p>
244 Both of these items are reset before returning to the application.
245 When resetting these items, the <bf/Linux-PAM/ library first writes
246 <tt/0/'s to the current tokens and then <tt/free()/'s the associated
247 memory.
248
249 <p>
250 The return values for this function are listed in the 
251 <bf>Linux-PAM</bf> Application Developers' Guide.
252
253 <sect2>
254 Getting items
255
256 <p>
257 Synopsis:
258 <tscreen>
259 <verb>
260 extern int pam_get_item(const pam_handle_t *pamh,
261                         int item_type,
262                         const void **item);
263 </verb>
264 </tscreen>
265
266 <p>
267 This function is used to obtain the value of the specified
268 <tt/item_type/. It is better documented in the <bf/Linux-PAM/
269 Application Developers' Guide. However, there are three things worth
270 stressing here:
271 <itemize>
272
273 <item>
274 Generally, if the module wishes to obtain the name of the user, it
275 should not use this function, but instead perform a call to
276 <tt/pam_get_user()/ (see section <ref id="pam-get-user"
277 name="below">).
278
279 <item>
280 The module is additionally privileged to read the authentication
281 tokens, <tt/PAM_AUTHTOK/ and <tt/PAM_OLDAUTHTOK/ (see the section
282 above on <tt/pam_set_data()/).
283
284 <item>
285 The module should <em/not/ <tt/free()/ or alter the data pointed to by
286 <tt/*item/ after a successful return from <tt/pam_get_item()/. This
287 pointer points directly at the data contained within the <tt/*pamh/
288 structure.  Should a module require that a change is made to the this
289 <tt/ITEM/ it should make the appropriate call to <tt/pam_set_item()/.
290 </itemize>
291
292 <sect2>The <em/conversation/ mechanism
293
294 <p>
295 Following the call <tt>pam_get_item(pamh,PAM_CONV,&amp;item)</tt>, the
296 pointer <tt/item/ points to a <em/conversation/-function that provides
297 limited but direct access to the application.  The purpose of this
298 function is to allow the module to prompt the user for their password
299 and pass other information in a manner consistent with the
300 application. For example, an X-windows based program might pop up a
301 dialog box to report a login failure. Just as the application should
302 not be concerned with the method of authentication, so the module
303 should not dictate the manner in which input (output) is
304 obtained from (presented to) to the user.
305
306 <p>
307 The reader is strongly urged to read the more complete description of
308 the <tt/pam_conv/ structure, written from the perspective of the
309 application developer, in the <bf/Linux-PAM/ Application Developers'
310 Guide.
311
312 <p>
313 The <tt/pam_response/ structure returned after a call to the
314 <tt/pam_conv/ function must be <tt/free()/'d by the module. Since the
315 call to the conversation function originates from the module, it is
316 clear that either this <tt/pam_response/ structure could be either
317 statically or dynamically (using <tt/malloc()/ etc.) allocated within
318 the application. Repeated calls to the conversation function would
319 likely overwrite static memory, so it is required that for a
320 successful return from the conversation function the memory for the
321 response structure is dynamically allocated by the application with
322 one of the <tt/malloc()/ family of commands and <em/must/ be
323 <tt/free()/'d by the module.
324
325 <p>
326 If the <tt/pam_conv/ mechanism is used to enter authentication tokens,
327 the module should either pass the result to the <tt/pam_set_item()/
328 library function, or copy it itself. In such a case, once the token
329 has been stored (by one of these methods or another one), the memory
330 returned by the application should be overwritten with <tt/0/'s, and
331 then <tt/free()/'d.
332
333 <p>
334 The return values for this function are listed in the 
335 <bf>Linux-PAM</bf> Application Developers' Guide.
336
337 <sect2>Getting the name of a user<label id="pam-get-user">
338
339 <p>
340 Synopsis:
341 <tscreen>
342 <verb>
343 extern int pam_get_user(pam_handle_t *pamh, 
344                         const char **user,
345                         const char *prompt);
346 </verb>
347 </tscreen>
348
349 <p>
350 This is a <bf/Linux-PAM/ library function that returns the
351 (prospective) name of the user. To determine the username it does the
352 following things, in this order:
353 <itemize>
354
355 <item> checks what <tt/pam_get_item(pamh, PAM_USER, ... );/ would have
356 returned. If this is not <tt/NULL/ this is what it returns. Otherwise,
357
358 <item> obtains a username from the application via the <tt/pam_conv/
359 mechanism, it prompts the user with the first non-<tt/NULL/ string in
360 the following list:
361 <itemize>
362
363 <item> The <tt/prompt/ argument passed to the function
364 <item> What is returned by <tt/pam_get_item(pamh,PAM_USER_PROMPT, ... );/
365 <item> The default prompt: ``Please enter username: ''
366
367 </itemize>
368 </itemize>
369
370 <p>
371 By whatever means the username is obtained, a pointer to it is
372 returned as the contents of <tt/*user/. Note, this memory should
373 <em/not/ be <tt/free()/'d by the module. Instead, it will be liberated
374 on the next call to <tt/pam_get_user()/, or by <tt/pam_end()/ when the
375 application ends its interaction with <bf/Linux-PAM/.
376
377 <p>
378 Also, in addition, it should be noted that this function sets the
379 <tt/PAM_USER/ item that is associated with the <tt/pam_[gs]et_item()/
380 function.
381
382 <p>
383 The return value of this function is one of the following:
384 <itemize>
385
386 <item> <tt/PAM_SUCCESS/ - username obtained.
387
388 <item> <tt/PAM_CONV_AGAIN/ - converstation did not complete and the
389 caller is required to return control to the application, until such
390 time as the application has completed the conversation process. A
391 module calling <tt/pam_get_user()/ that obtains this return code,
392 should return <tt/PAM_INCOMPLETE/ and be prepared (when invoked the
393 next time) to recall <tt/pam_get_user()/ to fill in the user's name,
394 and then pick up where it left off as if nothing had happened. This
395 procedure is needed to support an event-driven application programming
396 model.
397
398 <item> <tt/PAM_CONV_ERR/ - the conversation method supplied by the
399 application failed to obtain the username.
400
401 </itemize>
402
403 <sect2>Setting a Linux-PAM environment variable
404
405 <p>
406 Synopsis:
407 <tscreen>
408 <verb>
409 extern int pam_putenv(pam_handle_t *pamh, const char *name_value);
410 </verb>
411 </tscreen>
412
413 <p>
414 <bf/Linux-PAM/ comes equipped with a series of functions for
415 maintaining a set of <em/environment/ variables. The environment is
416 initialized by the call to <tt/pam_start()/ and is <bf/erased/ with a
417 call to <tt/pam_end()/.  This <em/environment/ is associated with the
418 <tt/pam_handle_t/ pointer returned by the former call.
419
420 <p>
421 The default environment is all but empty. It contains a single
422 <tt/NULL/ pointer, which is always required to terminate the
423 variable-list.  The <tt/pam_putenv()/ function can be used to add a
424 new environment variable, replace an existing one, or delete an old
425 one.
426
427 <p>
428 <itemize>
429 <item>Adding/replacing a variable<newline>
430
431 To add or overwrite a <bf/Linux-PAM/ environment variable the value of
432 the argument <tt/name_value/, should be of the following form:
433 <tscreen>
434 <verb>
435 name_value="VARIABLE=VALUE OF VARIABLE"
436 </verb>
437 </tscreen>
438 Here, <tt/VARIABLE/ is the environment variable's name and what
439 follows the `<tt/=/' is its (new) value. (Note, that <tt/"VARIABLE="/
440 is a valid value for <tt/name_value/, indicating that the variable is
441 set to <tt/""/.)
442
443 <item> Deleting a variable<newline>
444
445 To delete a <bf/Linux-PAM/ environment variable the value of
446 the argument <tt/name_value/, should be of the following form:
447 <tscreen>
448 <verb>
449 name_value="VARIABLE"
450 </verb>
451 </tscreen>
452 Here, <tt/VARIABLE/ is the environment variable's name and the absence
453 of an `<tt/=/' indicates that the variable should be removed.
454
455 </itemize>
456
457 <p>
458 In all cases <tt/PAM_SUCCESS/ indicates success.
459
460 <sect2>Getting a Linux-PAM environment variable
461
462 <p>
463 Synopsis:
464 <tscreen>
465 <verb>
466 extern const char *pam_getenv(pam_handle_t *pamh, const char *name);
467 </verb>
468 </tscreen>
469
470 <p>
471 This function can be used to return the value of the given
472 variable. If the returned value is <tt/NULL/, the variable is not
473 known.
474
475 <sect2>Listing the Linux-PAM environment
476
477 <p>
478 Synopsis:
479 <tscreen>
480 <verb>
481 extern char * const *pam_getenvlist(pam_handle_t *pamh);
482 </verb>
483 </tscreen>
484
485 <p>
486 This function returns a pointer to the entire <bf/Linux-PAM/
487 environment array.  At first sight the <em/type/ of the returned data
488 may appear a little confusing.  It is basically a <em/read-only/ array
489 of character pointers, that lists the <tt/NULL/ terminated list of
490 environment variables set so far.
491
492 <p>
493 Although, this is not a concern for the module programmer, we mention
494 here that an application should be careful to copy this entire array
495 before executing <tt/pam_end()/ otherwise all the variable information
496 will be lost. (There are functions in <tt/libpam_misc/ for this
497 purpose: <tt/pam_misc_copy_env()/ and <tt/pam_misc_drop_env()/.)
498
499 <sect1>Other functions provided by <tt/libpam/
500
501 <sect2>Understanding errors
502
503 <p>
504 <itemize>
505
506 <item>
507 <tt>extern const char *pam_strerror(pam_handle_t *pamh, int errnum);</tt>
508
509 <p>
510 This function returns some text describing the <bf/Linux-PAM/ error
511 associated with the argument <tt/errnum/.  If the error is not
512 recognized <tt/``Unknown Linux-PAM error''/ is returned.
513
514 </itemize>
515
516 <sect2>Planning for delays
517
518 <p>
519 <itemize>
520
521 <item>
522 <tt>extern int pam_fail_delay(pam_handle_t *pamh, unsigned int
523 micro_sec)</tt>
524
525 <p>
526 This function is offered by <bf/Linux-PAM/ to facilitate time delays
527 following a failed call to <tt/pam_authenticate()/ and before control
528 is returned to the application. When using this function the module
529 programmer should check if it is available with,
530 <tscreen>
531 <verb>
532 #ifdef PAM_FAIL_DELAY
533     ....
534 #endif /* PAM_FAIL_DELAY */
535 </verb>
536 </tscreen>
537
538 <p>
539 Generally, an application requests that a user is authenticated by
540 <bf/Linux-PAM/ through a call to <tt/pam_authenticate()/ or
541 <tt/pam_chauthtok()/.  These functions call each of the <em/stacked/
542 authentication modules listed in the <bf/Linux-PAM/ configuration
543 file.  As directed by this file, one of more of the modules may fail
544 causing the <tt/pam_...()/ call to return an error.  It is desirable
545 for there to also be a pause before the application continues. The
546 principal reason for such a delay is security: a delay acts to
547 discourage <em/brute force/ dictionary attacks primarily, but also
548 helps hinder <em/timed/ (cf. covert channel) attacks.
549
550 <p>
551 The <tt/pam_fail_delay()/ function provides the mechanism by which an
552 application or module can suggest a minimum delay (of <tt/micro_sec/
553 <em/micro-seconds/). <bf/Linux-PAM/ keeps a record of the longest time
554 requested with this function. Should <tt/pam_authenticate()/ fail,
555 the failing return to the application is delayed by an amount of time
556 randomly distributed (by up to 25%) about this longest value.
557
558 <p>
559 Independent of success, the delay time is reset to its zero default
560 value when <bf/Linux-PAM/ returns control to the application.
561
562 </itemize>
563
564 <sect>What is expected of a module
565
566 <p>
567 The module must supply a sub-set of the six functions listed
568 below. Together they define the function of a <bf/Linux-PAM
569 module/. Module developers are strongly urged to read the comments on
570 security that follow this list.
571
572 <sect1> Overview
573
574 <p>
575 The six module functions are grouped into four independent management
576 groups. These groups are as follows: <em/authentication/,
577 <em/account/, <em/session/ and <em/password/. To be properly defined,
578 a module must define all functions within at least one of these
579 groups. A single module may contain the necessary functions for
580 <em/all/ four groups.
581
582 <sect2> Functional independence
583
584 <p>
585 The independence of the four groups of service a module can offer
586 means that the module should allow for the possibility that any one of
587 these four services may legitimately be called in any order. Thus, the
588 module writer should consider the appropriateness of performing a
589 service without the prior success of some other part of the module.
590
591 <p>
592 As an informative example, consider the possibility that an
593 application applies to change a user's authentication token, without
594 having first requested that <bf/Linux-PAM/ authenticate the user. In
595 some cases this may be deemed appropriate: when <tt/root/ wants to
596 change the authentication token of some lesser user. In other cases it
597 may not be appropriate: when <tt/joe/ maliciously wants to reset
598 <tt/alice/'s password; or when anyone other than the user themself
599 wishes to reset their <em/KERBEROS/ authentication token. A policy for
600 this action should be defined by any reasonable authentication scheme,
601 the module writer should consider this when implementing a given
602 module.
603
604 <sect2> Minimizing administration problems
605
606 <p>
607 To avoid system administration problems and the poor construction of a
608 <tt>/etc/pam.conf</tt> file, the module developer may define all
609 six of the following functions. For those functions that would not be
610 called, the module should return <tt/PAM_SERVICE_ERR/ and write an
611 appropriate message to the system log. When this action is deemed
612 inappropriate, the function would simply return <tt/PAM_IGNORE/.
613
614 <sect2> Arguments supplied to the module
615
616 <p>
617 The <tt/flags/ argument of each of the following functions can be
618 logically OR'd with <tt/PAM_SILENT/, which is used to inform the
619 module to not pass any <em/text/ (errors or warnings) to the
620 application.
621
622 <p>
623 The <tt/argc/ and <tt/argv/ arguments are taken from the line
624 appropriate to this module---that is, with the <em/service_name/
625 matching that of the application---in the configuration file (see the
626 <bf/Linux-PAM/ System Administrators' Guide). Together these two
627 parameters provide the number of arguments and an array of pointers to
628 the individual argument tokens. This will be familiar to C programmers
629 as the ubiquitous method of passing command arguments to the function
630 <tt/main()/. Note, however, that the first argument (<tt/argv[0]/) is
631 a true argument and <bf/not/ the name of the module.
632
633 <sect1> Authentication management
634
635 <p>
636 To be correctly initialized, <tt/PAM_SM_AUTH/ must be <tt/#define/'d
637 prior to including <tt>&lt;security/pam_modules.h&gt;</tt>. This will
638 ensure that the prototypes for static modules are properly declared.
639
640 <p>
641 <itemize>
642
643 <item>
644 <tt>PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags,
645 int argc, const char **argv);</tt>
646
647 <p>
648 This function performs the task of authenticating the user. 
649
650 <p>
651 The <tt/flags/ argument can be a logically OR'd with <tt/PAM_SILENT/
652 and optionally take the following value:
653
654 <p><descrip>
655 <tag><tt/PAM_DISALLOW_NULL_AUTHTOK/</tag>
656         return <tt/PAM_AUTH_ERR/ if the database of authentication
657 tokens for this authentication mechanism has a <tt/NULL/ entry for the
658 user. Without this flag, such a <tt/NULL/ token will lead to a success
659 without the user being prompted.
660 </descrip>
661
662 <p>
663 Besides <tt/PAM_SUCCESS/ return values that can be sent by this
664 function are one of the following:
665
666 <descrip>
667
668 <tag><tt/PAM_AUTH_ERR/</tag>
669         The user was not authenticated
670 <tag><tt/PAM_CRED_INSUFFICIENT/</tag>
671         For some reason the application does not have sufficient
672 credentials to authenticate the user.
673 <tag><tt/PAM_AUTHINFO_UNAVAIL/</tag>
674         The modules were not able to access the authentication
675 information. This might be due to a network or hardware failure etc.
676 <tag><tt/PAM_USER_UNKNOWN/</tag>
677         The supplied username is not known to the authentication
678 service
679 <tag><tt/PAM_MAXTRIES/</tag>
680         One or more of the authentication modules has reached its
681 limit of tries authenticating the user. Do not try again.
682
683 </descrip>
684
685 <item>
686 <tt>PAM_EXTERN int pam_sm_setcred(pam_handle_t *pamh, int flags, int
687 argc, const char **argv);</tt>
688
689 <p>
690 This function performs the task of altering the credentials of the
691 user with respect to the corresponding authorization
692 scheme. Generally, an authentication module may have access to more
693 information about a user than their authentication token. This
694 function is used to make such information available to the
695 application. It should only be called <em/after/ the user has been
696 authenticated but before a session has been established.
697
698 <p>
699 Permitted flags, one of which, may be logically OR'd with
700 <tt/PAM_SILENT/ are,
701
702 <p><descrip>
703 <tag><tt/PAM_ESTABLISH_CRED/</tag>
704         Set the credentials for the authentication service,
705 <tag><tt/PAM_DELETE_CRED/</tag>
706         Delete the credentials associated with the authentication service,
707 <tag><tt/PAM_REINITIALIZE_CRED/</tag>
708         Reinitialize the user credentials, and
709 <tag><tt/PAM_REFRESH_CRED/</tag>
710         Extend the lifetime of the user credentials.
711 </descrip>
712
713 <p>
714 Prior to <bf/Linux-PAM-0.75/, and due to a deficiency with the way the
715 <tt/auth/ stack was handled in the case of the setcred stack being
716 processed, the module was required to attempt to return the same error
717 code as <tt/pam_sm_authenticate/ did.  This was necessary to preserve
718 the logic followed by libpam as it executes the stack of
719 <em/authentication/ modules, when the application called either
720 <tt/pam_authenticate()/ or <tt/pam_setcred()/.  Failing to do this,
721 led to confusion on the part of the System Administrator.
722
723 <p>
724 For <bf/Linux-PAM-0.75/ and later, libpam handles the credential stack
725 much more sanely. The way the <tt/auth/ stack is navigated in order to
726 evaluate the <tt/pam_setcred()/ function call, independent of the
727 <tt/pam_sm_setcred()/ return codes, is exactly the same way that it
728 was navigated when evaluating the <tt/pam_authenticate()/ library
729 call. Typically, if a stack entry was ignored in evaluating
730 <tt/pam_authenticate()/, it will be ignored when libpam evaluates the
731 <tt/pam_setcred()/ function call. Otherwise, the return codes from
732 each module specific <tt/pam_sm_setcred()/ call are treated as
733 <tt/required/.
734
735 <p>
736 Besides <tt/PAM_SUCCESS/, the module may return one of the following
737 errors:
738
739 <p><descrip>
740 <tag><tt/PAM_CRED_UNAVAIL/</tag>
741         This module cannot retrieve the user's credentials.
742 <tag><tt/PAM_CRED_EXPIRED/</tag>
743         The user's credentials have expired.
744 <tag><tt/PAM_USER_UNKNOWN/</tag>
745         The user is not known to this authentication module.
746 <tag><tt/PAM_CRED_ERR/</tag>
747         This module was unable to set the credentials of the user.
748 </descrip>
749
750 <p>
751 these, non-<tt/PAM_SUCCESS/, return values will typically lead to the
752 credential stack <em/failing/. The first such error will dominate in
753 the return value of <tt/pam_setcred()/.
754
755 </itemize>
756
757 <sect1> Account management
758
759 <p>
760 To be correctly initialized, <tt/PAM_SM_ACCOUNT/ must be
761 <tt/#define/'d prior to including <tt>&lt;security/pam_modules.h&gt;</tt>.
762 This will ensure that the prototype for a static module is properly
763 declared.
764
765 <p>
766 <itemize>
767
768 <item>
769 <tt>PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, int
770 argc, const char **argv);</tt>
771
772 <p>
773 This function performs the task of establishing whether the user is
774 permitted to gain access at this time. It should be understood that
775 the user has previously been validated by an authentication
776 module. This function checks for other things. Such things might be:
777 the time of day or the date, the terminal line, remote
778 hostname, etc. .
779
780 <p>
781 This function may also determine things like the expiration on
782 passwords, and respond that the user change it before continuing.
783
784 <p>
785 Valid flags, which may be logically OR'd with <tt/PAM_SILENT/, are the
786 same as those applicable to the <tt/flags/ argument of
787 <tt/pam_sm_authenticate/.
788
789 <p>
790 This function may return one of the following errors,
791
792 <descrip>
793
794 <tag><tt/PAM_ACCT_EXPIRED/</tag>
795         The user is no longer permitted access to the system.
796 <tag><tt/PAM_AUTH_ERR/</tag>
797         There was an authentication error.
798 <tag><tt/PAM_AUTHTOKEN_REQD/</tag>
799         The user's authentication token has expired. Before calling
800 this function again the application will arrange for a new one to be
801 given. This will likely result in a call to <tt/pam_sm_chauthtok()/.
802 <tag><tt/PAM_USER_UNKNOWN/</tag>
803         The user is not known to the module's account management
804 component.
805         
806 </descrip>
807
808 </itemize>
809
810 <sect1> Session management
811
812 <p>
813 To be correctly initialized, <tt/PAM_SM_SESSION/ must be
814 <tt/#define/'d prior to including
815 <tt>&lt;security/pam_modules.h&gt;</tt>.  This will ensure that the
816 prototypes for static modules are properly declared.
817
818 <p>
819 The following two functions are defined to handle the
820 initialization/termination of a session. For example, at the beginning
821 of a session the module may wish to log a message with the system
822 regarding the user. Similarly, at the end of the session the module
823 would inform the system that the user's session has ended.
824
825 <p>
826 It should be possible for sessions to be opened by one application and
827 closed by another. This either requires that the module uses only
828 information obtained from <tt/pam_get_item()/, or that information
829 regarding the session is stored in some way by the operating system
830 (in a file for example).
831
832 <p>
833 <itemize>
834
835 <item>
836 <tt>PAM_EXTERN int pam_sm_open_session(pam_handle_t *pamh, int flags, int
837 argc, const char **argv);</tt>
838
839 <p>
840 This function is called to commence a session. The only valid, but
841 optional, flag is <tt/PAM_SILENT/.
842
843 <p>
844 As a return value, <tt/PAM_SUCCESS/ signals success and
845 <tt/PAM_SESSION_ERR/ failure.
846
847 <item>
848 <tt>PAM_EXTERN int pam_sm_close_session(pam_handle_t *pamh, int flags, int
849 argc, const char **argv);</tt>
850
851 <p>
852 This function is called to terminate a session. The only valid, but
853 optional, flag is <tt/PAM_SILENT/.
854
855 <p>
856 As a return value, <tt/PAM_SUCCESS/ signals success and
857 <tt/PAM_SESSION_ERR/ failure.
858
859 </itemize>
860
861 <sect1> Password management
862
863 <p>
864 To be correctly initialized, <tt/PAM_SM_PASSWORD/ must be
865 <tt/#define/'d prior to including <tt>&lt;security/pam_modules.h&gt;</tt>.
866 This will ensure that the prototype for a static module is properly
867 declared.
868
869 <p>
870 <itemize>
871
872 <item>
873 <tt>PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags, int
874 argc, const char **argv);</tt>
875
876 <p>
877 This function is used to (re-)set the authentication token of the
878 user. A valid flag, which may be logically OR'd with <tt/PAM_SILENT/,
879 can be built from the following list,
880
881 <descrip>
882 <tag><tt/PAM_CHANGE_EXPIRED_AUTHTOK/</tag>
883         This argument indicates to the module that the users
884 authentication token (password) should only be changed if it has
885 expired. This flag is optional and <em/must/ be combined with one of
886 the following two flags. Note, however, the following two options are
887 <em/mutually exclusive/.
888
889 <tag><tt/PAM_PRELIM_CHECK/</tag>
890         This indicates that the modules are being probed as to their
891 ready status for altering the user's authentication token. If the
892 module requires access to another system over some network it should
893 attempt to verify it can connect to this system on receiving this
894 flag. If a module cannot establish it is ready to update the user's
895 authentication token it should return <tt/PAM_TRY_AGAIN/, this
896 information will be passed back to the application.
897
898 <tag><tt/PAM_UPDATE_AUTHTOK/</tag>
899         This informs the module that this is the call it should change
900 the authorization tokens. If the flag is logically OR'd with
901 <tt/PAM_CHANGE_EXPIRED_AUTHTOK/, the token is only changed if it has
902 actually expired.
903
904 </descrip>
905
906 <p>
907 Note, the <bf/Linux-PAM/ library calls this function twice in
908 succession. The first time with <tt/PAM_PRELIM_CHECK/ and then, if the
909 module does not return <tt/PAM_TRY_AGAIN/, subsequently with
910 <tt/PAM_UPDATE_AUTHTOK/. It is only on the second call that the
911 authorization token is (possibly) changed.
912
913 <p>
914 <tt/PAM_SUCCESS/ is the only successful return value, valid
915 error-returns are:
916
917 <descrip>
918 <tag><tt/PAM_AUTHTOK_ERR/</tag>
919         The module was unable to obtain the new authentication token.
920         
921 <tag><tt/PAM_AUTHTOK_RECOVERY_ERR/</tag>
922         The module was unable to obtain the old authentication token.
923
924 <tag><tt/PAM_AUTHTOK_LOCK_BUSY/</tag>
925         Cannot change the authentication token since it is currently
926 locked.
927         
928 <tag><tt/PAM_AUTHTOK_DISABLE_AGING/</tag>
929         Authentication token aging has been disabled.
930
931 <tag><tt/PAM_PERM_DENIED/</tag>
932         Permission denied.
933
934 <tag><tt/PAM_TRY_AGAIN/</tag>
935         Preliminary check was unsuccessful. Signals an immediate return
936 to the application is desired.
937
938 <tag><tt/PAM_USER_UNKNOWN/</tag>
939         The user is not known to the authentication token changing
940 service.
941
942 </descrip>
943
944 </itemize>
945
946 <sect>Generic optional arguments
947
948 <p>
949 Here we list the generic arguments that all modules can expect to
950 be passed. They are not mandatory, and their absence should be
951 accepted without comment by the module.
952
953 <p>
954 <descrip>
955 <tag><tt/debug/</tag>
956
957 Use the <tt/syslog(3)/ call to log debugging information to the system
958 log files.
959
960 <tag><tt/no_warn/</tag>
961
962 Instruct module to not give warning messages to the application.
963
964 <tag><tt/use_first_pass/</tag>
965
966 The module should not prompt the user for a password. Instead, it
967 should obtain the previously typed password (by a call to
968 <tt/pam_get_item()/ for the <tt/PAM_AUTHTOK/ item), and use that. If
969 that doesn't work, then the user will not be authenticated. (This
970 option is intended for <tt/auth/ and <tt/passwd/ modules only).
971
972 <tag><tt/try_first_pass/</tag>
973
974 The module should attempt authentication with the previously typed
975 password (by a call to <tt/pam_get_item()/ for the <tt/PAM_AUTHTOK/
976 item). If that doesn't work, then the user is prompted for a
977 password. (This option is intended for <tt/auth/ modules only).
978
979 <tag><tt/use_mapped_pass/</tag>
980
981 <bf/WARNING:/ coding this functionality may cause the module writer to
982 break <em/local/ encryption laws. For example, in the U.S. there are
983 restrictions on the export computer code that is capable of strong
984 encryption.  It has not been established whether this option is
985 affected by this law, but one might reasonably assume that it does
986 until told otherwise.  For this reason, this option is not supported
987 by any of the modules distributed with <bf/Linux-PAM/.
988
989 The intended function of this argument, however, is that the module
990 should take the existing authentication token from a previously
991 invoked module and use it as a key to retrieve the authentication
992 token for this module. For example, the module might create a strong
993 hash of the <tt/PAM_AUTHTOK/ item (established by a previously
994 executed module). Then, with logical-exclusive-or, use the result as a
995 <em/key/ to safely store/retrieve the authentication token for this
996 module in/from a local file <em/etc/. .
997
998 <tag><tt/expose_account/</tag>
999
1000 <p>
1001 In general the leakage of some information about user accounts is not
1002 a secure policy for modules to adopt. Sometimes information such as
1003 users names or home directories, or preferred shell, can be used to
1004 attack a user's account. In some circumstances, however, this sort of
1005 information is not deemed a threat: displaying a user's full name when
1006 asking them for a password in a secured environment could also be
1007 called being 'friendly'. The <tt/expose_account/ argument is a
1008 standard module argument to encourage a module to be less discrete
1009 about account information as it is deemed appropriate by the local
1010 administrator.
1011
1012 </descrip>
1013
1014 <sect>Programming notes
1015
1016 <p>
1017 Here we collect some pointers for the module writer to bear in mind
1018 when writing/developing a <bf/Linux-PAM/ compatible module.
1019
1020 <sect1>Security issues for module creation
1021
1022 <sect2>Sufficient resources
1023
1024 <p>
1025 Care should be taken to ensure that the proper execution of a module
1026 is not compromised by a lack of system resources.  If a module is
1027 unable to open sufficient files to perform its task, it should fail
1028 gracefully, or request additional resources.  Specifically, the
1029 quantities manipulated by the <tt/setrlimit(2)/ family of commands
1030 should be taken into consideration.
1031
1032 <sect2>Who's who?
1033
1034 <p>
1035 Generally, the module may wish to establish the identity of the user
1036 requesting a service.  This may not be the same as the username
1037 returned by <tt/pam_get_user()/. Indeed, that is only going to be the
1038 name of the user under whose identity the service will be given.  This
1039 is not necessarily the user that requests the service.
1040
1041 <p>
1042 In other words, user X runs a program that is setuid-Y, it grants the
1043 user to have the permissions of Z.  A specific example of this sort of
1044 service request is the <em/su/ program: user <tt/joe/ executes
1045 <em/su/ to become the user <em/jane/.  In this situation X=<tt/joe/,
1046 Y=<tt/root/ and Z=<tt/jane/.  Clearly, it is important that the module
1047 does not confuse these different users and grant an inappropriate
1048 level of privilege.
1049
1050 <p>
1051 The following is the convention to be adhered to when juggling
1052 user-identities.
1053
1054 <p>
1055 <itemize>
1056 <item>X, the identity of the user invoking the service request.
1057 This is the user identifier; returned by the function <tt/getuid(2)/.
1058
1059 <item>Y, the privileged identity of the application used to grant the
1060 requested service.  This is the <em/effective/ user identifier;
1061 returned by the function <tt/geteuid(2)/.
1062
1063 <item>Z, the user under whose identity the service will be granted.
1064 This is the username returned by <tt/pam_get_user(2)/ and also stored
1065 in the <bf/Linux-PAM/ item, <tt/PAM_USER/.
1066
1067 <item><bf/Linux-PAM/ has a place for an additional user identity that
1068 a module may care to make use of. This is the <tt/PAM_RUSER/ item.
1069 Generally, network sensitive modules/applications may wish to set/read
1070 this item to establish the identity of the user requesting a service
1071 from a remote location.
1072
1073 </itemize>
1074
1075 <p>
1076 Note, if a module wishes to modify the identity of either the <tt/uid/
1077 or <tt/euid/ of the running process, it should take care to restore
1078 the original values prior to returning control to the <bf/Linux-PAM/
1079 library.
1080
1081 <sect2>Using the conversation function
1082 <p>
1083 Prior to calling the conversation function, the module should reset
1084 the contents of the pointer that will return the applications
1085 response.  This is a good idea since the application may fail to fill
1086 the pointer and the module should be in a position to notice!
1087
1088 <p>
1089 The module should be prepared for a failure from the conversation. The
1090 generic error would be <tt/PAM_CONV_ERR/, but anything other than
1091 <tt/PAM_SUCCESS/ should be treated as indicating failure.
1092
1093 <sect2>Authentication tokens
1094
1095 <p>
1096 To ensure that the authentication tokens are not left lying around the
1097 items, <tt/PAM_AUTHTOK/ and <tt/PAM_OLDAUTHTOK/, are not available to
1098 the application: they are defined in
1099 <tt>&lt;security/pam_modules.h&gt;</tt>. This is ostensibly for
1100 security reasons, but a maliciously programmed application will always
1101 have access to all memory of the process, so it is only superficially
1102 enforced.  As a general rule the module should overwrite
1103 authentication tokens as soon as they are no longer needed.
1104 Especially before <tt/free()/'ing them. The <bf/Linux-PAM/ library is
1105 required to do this when either of these authentication token items
1106 are (re)set.
1107
1108 <p>
1109 Not to dwell too little on this concern; should the module store the
1110 authentication tokens either as (automatic) function variables or
1111 using <tt/pam_[gs]et_data()/ the associated memory should be
1112 over-written explicitly before it is released. In the case of the
1113 latter storage mechanism, the associated <tt/cleanup()/ function
1114 should explicitly overwrite the <tt/*data/ before <tt/free()/'ing it:
1115 for example,
1116
1117 <tscreen>
1118 <verb>
1119 /*
1120  * An example cleanup() function for releasing memory that was used to
1121  * store a password. 
1122  */
1123
1124 int cleanup(pam_handle_t *pamh, void *data, int error_status)
1125 {
1126     char *xx;
1127
1128     if ((xx = data)) {
1129         while (*xx)
1130             *xx++ = '\0';
1131         free(data);
1132     }
1133     return PAM_SUCCESS;
1134 }
1135 </verb>
1136 </tscreen>
1137
1138 <sect1>Use of <tt/syslog(3)/
1139
1140 <p>
1141 Only rarely should error information be directed to the user. Usually,
1142 this is to be limited to ``<em/sorry you cannot login now/'' type
1143 messages. Information concerning errors in the configuration file,
1144 <tt>/etc/pam.conf</tt>, or due to some system failure encountered by
1145 the module, should be written to <tt/syslog(3)/ with
1146 <em/facility-type/ <tt/LOG_AUTHPRIV/.
1147
1148 <p>
1149 With a few exceptions, the level of logging is, at the discretion of
1150 the module developer. Here is the recommended usage of different
1151 logging levels:
1152
1153 <p>
1154 <itemize>
1155
1156 <item>
1157 As a general rule, errors encountered by a module should be logged at
1158 the <tt/LOG_ERR/ level. However, information regarding an unrecognized
1159 argument, passed to a module from an entry in the
1160 <tt>/etc/pam.conf</tt> file, is <bf/required/ to be logged at the
1161 <tt/LOG_ERR/ level.
1162
1163 <item>
1164 Debugging information, as activated by the <tt/debug/ argument to the
1165 module in <tt>/etc/pam.conf</tt>, should be logged at the
1166 <tt/LOG_DEBUG/ level.
1167
1168 <item>
1169 If a module discovers that its personal configuration file or some
1170 system file it uses for information is corrupted or somehow unusable,
1171 it should indicate this by logging messages at level, <tt/LOG_ALERT/.
1172
1173 <item>
1174 Shortages of system resources, such as a failure to manipulate a file
1175 or <tt/malloc()/ failures should be logged at level <tt/LOG_CRIT/.
1176
1177 <item>
1178 Authentication failures, associated with an incorrectly typed password
1179 should be logged at level, <tt/LOG_NOTICE/.
1180
1181 </itemize>
1182
1183 <sect1> Modules that require system libraries
1184
1185 <p>
1186 Writing a module is much like writing an application. You have to
1187 provide the "conventional hooks" for it to work correctly, like
1188 <tt>pam_sm_authenticate()</tt> etc., which would correspond to the
1189 <tt/main()/ function in a normal function.
1190
1191 <p>
1192 Typically, the author may want to link against some standard system
1193 libraries. As when one compiles a normal program, this can be done for
1194 modules too: you simply append the <tt>-l</tt><em>XXX</em> arguments
1195 for the desired libraries when you create the shared module object. To
1196 make sure a module is linked to the <tt>lib<em>whatever</em>.so</tt>
1197 library when it is <tt>dlopen()</tt>ed, try:
1198 <tscreen>
1199 <verb>
1200 % gcc -shared -Xlinker -x -o pam_module.so pam_module.o -lwhatever
1201 </verb>
1202 </tscreen>
1203
1204 <sect1> Added requirements for <em/statically/ loaded modules.
1205
1206 <!--
1207         Copyright (C) Michael K. Johnson 1996.
1208         Last modified:  AGM 1996/5/31.
1209  -->
1210
1211 <p>
1212 Modules may be statically linked into libpam. This should be true of
1213 all the modules distributed with the basic <bf/Linux-PAM/
1214 distribution.  To be statically linked, a module needs to export
1215 information about the functions it contains in a manner that does not
1216 clash with other modules.
1217
1218 The extra code necessary to build a static module should be delimited
1219 with <tt/#ifdef PAM_STATIC/ and <tt/#endif/. The static code should do
1220 the following:
1221 <itemize>
1222 <item> Define a single structure, <tt/struct pam_module/, called
1223 <tt>_pam_<it>modname</it>_modstruct</tt>, where
1224 <tt><it>modname</it></tt> is the name of the module <bf/as used in the
1225 filesystem/ but without the leading directory name (generally
1226 <tt>/usr/lib/security/</tt> or the suffix (generally <tt/.so/).
1227
1228 </itemize>
1229
1230 <p>
1231 As a simple example, consider the following module code which defines
1232 a module that can be compiled to be <em/static/ or <em/dynamic/:
1233
1234 <p>
1235 <tscreen>
1236 <verb>
1237 #include <stdio.h>                                    /* for NULL define */
1238
1239 #define PAM_SM_PASSWORD         /* the only pam_sm_... function declared */
1240 #include <security/pam_modules.h>
1241
1242 PAM_EXTERN int pam_sm_chauthtok(pam_handle_t *pamh, int flags,
1243                                 int argc, const char **argv)
1244 {
1245      return PAM_SUCCESS;
1246 }
1247
1248 #ifdef PAM_STATIC             /* for the case that this module is static */
1249
1250 struct pam_module _pam_modname_modstruct = {       /* static module data */
1251      "pam_modname",
1252      NULL,
1253      NULL,
1254      NULL,
1255      NULL,
1256      NULL,
1257      pam_sm_chauthtok,
1258 };
1259
1260 #endif                                                 /* end PAM_STATIC */
1261 </verb>
1262 </tscreen>
1263
1264 <p>
1265 To be linked with <em/libpam/, staticly-linked modules must be built
1266 from within the <tt>Linux-PAM-X.YY/modules/</tt> subdirectory of the
1267 <bf/Linux-PAM/ source directory as part of a normal build of the
1268 <bf/Linux-PAM/ system.
1269
1270 The <em/Makefile/, for the module in question, must execute the
1271 <tt/register_static/ shell script that is located in the
1272 <tt>Linux-PAM-X.YY/modules/</tt> subdirectory. This is to ensure that
1273 the module is properly registered with <em/libpam/.
1274
1275 The <bf/two/ manditory arguments to <tt/register_static/ are the
1276 title, and the pathname of the object file containing the module's
1277 code. The pathname is specified relative to the
1278 <tt>Linux-PAM-X.YY/modules</tt> directory. The pathname may be an
1279 empty string---this is for the case that a single object file needs to
1280 register more than one <tt/struct pam_module/. In such a case, exactly
1281 one call to <tt/register_static/ must indicate the object file.
1282
1283 <p>
1284 Here is an example; a line in the <em/Makefile/ might look like this:
1285 <tscreen>
1286 <verb>
1287 register:
1288 ifdef STATIC
1289         (cd ..; ./register_static pam_modname pam_modname/pam_modname.o)
1290 endif
1291 </verb>
1292 </tscreen>
1293
1294 For some further examples, see the <tt>modules</tt> subdirectory of
1295 the current <bf/Linux-PAM/ distribution.
1296
1297 <sect>An example module file
1298
1299 <p>
1300 At some point, we may include a fully commented example of a module in
1301 this document. For now, we point the reader to these two locations in
1302 the public CVS repository:
1303 <itemize>
1304 <item> A module that always succeeds: <tt><htmlurl
1305 url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pam/Linux-PAM/modules/pam_permit/"
1306 name="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pam/Linux-PAM/modules/pam_permit/"
1307 ></tt>
1308 <item> A module that always fails: <tt><htmlurl
1309 url="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pam/Linux-PAM/modules/pam_deny/"
1310 name="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/pam/Linux-PAM/modules/pam_deny/"
1311 ></tt>
1312 </itemize>
1313
1314 <sect>Files
1315
1316 <p><descrip>
1317
1318 <tag><tt>/usr/lib/libpam.so.*</tt></tag>
1319
1320 the shared library providing applications with access to
1321 <bf/Linux-PAM/.
1322
1323 <tag><tt>/etc/pam.conf</tt></tag>
1324
1325 the <bf/Linux-PAM/ configuration file.
1326
1327 <tag><tt>/usr/lib/security/pam_*.so</tt></tag>
1328
1329 the primary location for <bf/Linux-PAM/ dynamically loadable object
1330 files; the modules.
1331
1332 </descrip>
1333
1334 <sect>See also
1335
1336 <p><itemize>
1337 <item>The <bf/Linux-PAM/ System Administrators' Guide.
1338 <item>The <bf/Linux-PAM/ Application Writers' Guide.
1339 <item>
1340 V. Samar and R. Schemers (SunSoft), ``UNIFIED LOGIN WITH PLUGGABLE
1341 AUTHENTICATION MODULES'', Open Software Foundation Request For
1342 Comments 86.0, October 1995.
1343 </itemize>
1344
1345 <sect>Notes
1346
1347 <p>
1348 I intend to put development comments here... like ``at the moment
1349 this isn't actually supported''. At release time what ever is in
1350 this section will be placed in the Bugs section below! :)
1351
1352 <p>
1353 <itemize>
1354 <item>
1355 Perhaps we should keep a registry of data-names as used by
1356 <tt/pam_[gs]et_data()/ so there are no unintentional problems due to
1357 conflicts?
1358
1359 <item>
1360 <tt/pam_strerror()/ should be internationalized....
1361
1362 <item>
1363 There has been some debate about whether <tt/initgroups()/ should be
1364 in an application or in a module. It was settled by Sun who stated
1365 that initgroups is an action of the <em/application/. The modules are
1366 permitted to add additional groups, however.
1367
1368 <item>
1369 Refinements/futher suggestions to <tt/syslog(3)/ usage by modules are
1370 needed.
1371
1372 </itemize>
1373
1374 <sect>Author/acknowledgments
1375
1376 <p>
1377 This document was written by Andrew G. Morgan
1378 (<tt/morgan@transmeta.com/) with many contributions from
1379 <!-- insert credits here -->
1380 <!--
1381  an sgml list of people to credit for their contributions to Linux-PAM
1382  $Id$
1383   -->
1384 Chris Adams,
1385 Peter Allgeyer,
1386 Tim Baverstock,
1387 Tim Berger,
1388 Craig S. Bell,
1389 Derrick J. Brashear,
1390 Ben Buxton,
1391 Seth Chaiklin,
1392 Oliver Crow,
1393 Chris Dent,
1394 Marc Ewing,
1395 Cristian Gafton,
1396 Emmanuel Galanos,
1397 Brad M. Garcia,
1398 Eric Hester,
1399 Roger Hu,
1400 Eric Jacksch,
1401 Michael K. Johnson,
1402 David Kinchlea,
1403 Olaf Kirch,
1404 Marcin Korzonek,
1405 Stephen Langasek,
1406 Nicolai Langfeldt,
1407 Elliot Lee,
1408 Luke Kenneth Casson Leighton,
1409 Al Longyear,
1410 Ingo Luetkebohle,
1411 Marek Michalkiewicz,
1412 Robert Milkowski,
1413 Aleph One,
1414 Martin Pool,
1415 Sean Reifschneider,
1416 Jan Rekorajski,
1417 Erik Troan,
1418 Theodore Ts'o,
1419 Jeff Uphoff,
1420 Myles Uyema,
1421 Savochkin Andrey Vladimirovich,
1422 Ronald Wahl,
1423 David Wood,
1424 John Wilmes,
1425 Joseph S. D. Yao
1426 and
1427 Alex O.  Yuriev.
1428
1429 <p>
1430 Thanks are also due to Sun Microsystems, especially to Vipin Samar and
1431 Charlie Lai for their advice. At an early stage in the development of
1432 <bf/Linux-PAM/, Sun graciously made the documentation for their
1433 implementation of PAM available. This act greatly accelerated the
1434 development of <bf/Linux-PAM/.
1435
1436 <sect>Bugs/omissions
1437
1438 <p>
1439 Few PAM modules currently exist. Few PAM-aware applications exist.
1440 This document is hopelessly unfinished. Only a partial list of people is
1441 credited for all the good work they have done.
1442
1443 <sect>Copyright information for this document
1444
1445 <p>
1446 Copyright (c) Andrew G. Morgan 1996, 1997.  All rights reserved.
1447 <newline>
1448 Email: <tt>&lt;morgan@transmeta.com&gt;</tt>
1449
1450 <p>
1451 Redistribution and use in source and binary forms, with or without
1452 modification, are permitted provided that the following conditions are
1453 met:
1454
1455 <p>
1456 <itemize>
1457
1458 <item>
1459 1. Redistributions of source code must retain the above copyright
1460    notice, and the entire permission notice in its entirety,
1461    including the disclaimer of warranties.
1462
1463 <item>
1464 2. Redistributions in binary form must reproduce the above copyright
1465    notice, this list of conditions and the following disclaimer in the
1466    documentation and/or other materials provided with the distribution.
1467
1468 <item>
1469 3. The name of the author may not be used to endorse or promote
1470    products derived from this software without specific prior
1471    written permission.
1472
1473 </itemize>
1474
1475 <p>
1476 <bf/Alternatively/, this product may be distributed under the terms of
1477 the GNU General Public License (GPL), in which case the provisions of
1478 the GNU GPL are required <bf/instead of/ the above restrictions.
1479 (This clause is necessary due to a potential bad interaction between
1480 the GNU GPL and the restrictions contained in a BSD-style copyright.)
1481
1482 <p>
1483 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
1484 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
1485 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
1486 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
1487 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
1488 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
1489 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1490 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
1491 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
1492 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
1493 DAMAGE.
1494
1495 <p>
1496 <tt>$Id$</tt>
1497
1498 </article>