1 <!doctype linuxdoc system>
5 $Id: pam_source.sgml,v 1.5 1997/04/05 06:49:14 morgan Exp morgan $
6 $FreeBSD: src/contrib/libpam/doc/pam_source.sgml,v 1.1.1.1.6.2 2001/06/11 15:28:10 markm Exp $
8 Copyright (c) Andrew G. Morgan 1996,1997. All rights reserved.
10 Redistribution and use in source (sgml) and binary (derived) forms,
11 with or without modification, are permitted provided that the
12 following conditions are met:
14 1. Redistributions of source code must retain the above copyright
15 notice, and the entire permission notice in its entirety,
16 including the disclaimer of warranties.
18 2. Redistributions in binary form must reproduce the above copyright
19 notice, this list of conditions and the following disclaimer in the
20 documentation and/or other materials provided with the distribution.
22 3. The name of the author may not be used to endorse or promote
23 products derived from this software without specific prior
26 ALTERNATIVELY, this product may be distributed under the terms of the
27 GNU General Public License, in which case the provisions of the GNU
28 GPL are required INSTEAD OF the above restrictions. (This clause is
29 necessary due to a potential bad interaction between the GNU GPL and
30 the restrictions contained in a BSD-style copyright.)
32 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
33 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
34 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
35 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
36 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
37 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
38 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
39 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
40 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
41 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
48 <title>The Linux-PAM System Administrators' Guide
49 <author>Andrew G. Morgan, <tt>morgan@linux.kernel.org</tt>
50 <date>DRAFT v0.59 1998/1/7
52 This manual documents what a system-administrator needs to know about
53 the <bf>Linux-PAM</bf> library. It covers the correct syntax of the
54 PAM configuration file and discusses strategies for maintaining a
58 <!-- Table of contents -->
61 <!-- Begin the document -->
65 <p><bf/Linux-PAM/ (Pluggable Authentication Modules for Linux) is a
66 suite of shared libraries that enable the local system administrator
67 to choose how applications authenticate users.
69 <p>In other words, without (rewriting and) recompiling a PAM-aware
70 application, it is possible to switch between the authentication
71 mechanism(s) it uses. Indeed, one may entirely upgrade the local
72 authentication system without touching the applications themselves.
74 <p>Historically an application that has required a given user to be
75 authenticated, has had to be compiled to use a specific authentication
76 mechanism. For example, in the case of traditional UN*X systems, the
77 identity of the user is verified by the user entering a correct
78 password. This password, after being prefixed by a two character
79 ``salt'', is encrypted (with crypt(3)). The user is then authenticated
80 if this encrypted password is identical to the second field of the
81 user's entry in the system password database (the <tt>/etc/passwd</tt>
82 file). On such systems, most if not all forms of privileges are
83 granted based on this single authentication scheme. Privilege comes in
84 the form of a personal user-identifier (<tt/uid/) and membership of
85 various groups. Services and applications are available based on the
86 personal and group identity of the user. Traditionally, group
87 membership has been assigned based on entries in the
88 <tt>/etc/group</tt> file.
91 Unfortunately, increases in the speed of computers and the
92 widespread introduction of network based computing, have made once
93 secure authentication mechanisms, such as this, vulnerable to
94 attack. In the light of such realities, new methods of authentication
95 are continuously being developed.
98 It is the purpose of the <bf/Linux-PAM/ project to separate the
99 development of privilege granting software from the development of
100 secure and appropriate authentication schemes. This is accomplished
101 by providing a library of functions that an application may use to
102 request that a user be authenticated. This PAM library is configured
103 locally with a system file, <tt>/etc/pam.conf</tt> (or a series of
104 configuration files located in <tt>/etc/pam.d/</tt>) to authenticate a
105 user request via the locally available authentication modules. The
106 modules themselves will usually be located in the directory
107 <tt>/usr/lib/security</tt> and take the form of dynamically loadable
108 object files (see <tt/dlopen(3)/).
110 <sect>Some comments on the text<label id="text-conventions">
113 Before proceeding to read the rest of this document, it should be
114 noted that the text assumes that certain files are placed in certain
115 directories. Where they have been specified, the conventions we adopt
116 here for locating these files are those of the relevant RFC (RFC-86.0,
117 see <ref id="see-also-sec" name="bibliography">). If you are using a
118 distribution of Linux (or some other operating system) that supports
119 PAM but chooses to distribute these files in a diferent way (Red Hat
120 is one such distribution), you should be careful when copying examples
121 directly from the text.
124 As an example of the above, where it is explicit, the text assumes
125 that PAM loadable object files (the <em/modules/) are to be located in
126 the following directory: <tt>/usr/lib/security/</tt>. However, Red Hat
127 Linux, in agreement with the Linux File System Standard (the FSSTND),
128 places these files in <tt>/lib/security</tt>. Please be careful to
129 perform the necessary transcription when using the examples from the
132 <sect>Overview<label id="overview-section">
135 For the uninitiated, we begin by considering an example. We take an
136 application that grants some service to users; <em/login/ is one such
137 program. <em/Login/ does two things, it first establishes that the
138 requesting user is whom they claim to be and second provides them with
139 the requested service: in the case of <em/login/ the service is a
140 command shell (<em>bash, tcsh, zsh, etc.</em>) running with the
141 identity of the user.
144 Traditinally, the former step is achieved by the <em/login/
145 application prompting the user for a password and then verifying that
146 it agrees with that located on the system; hence verifying that the
147 so far as the system is concerned the user is who they claim to be.
148 This is the task that is delegated to <bf/Linux-PAM/.
151 From the perspective of the application programmer (in this case the
152 person that wrote the <em/login/ application), <bf/Linux-PAM/ takes
153 care of this authentication task -- verifying the identity of the user.
156 The flexibility of <bf/Linux-PAM/ is that <em/you/, the system
157 administrator, have the freedom to stipulate which authentication
158 scheme is to be used. You have the freedom to set the scheme for
159 any/all PAM-aware applications on your Linux system. That is, you can
160 authenticate from anything as naive as <em/simple trust/
161 (<tt/pam_permit/) to something as paranoid as a combination of a
162 retinal scan, a voice print and a one-time password!
165 To illustrate the flexibility you face, consider the following
166 situation: a system administrator (parent) wishes to improve the
167 mathematical ability of her users (children). She can configure their
168 favorite ``Shoot 'em up game'' (PAM-aware of course) to authenticate
169 them with a request for the product of a couple of random numbers less
170 than 12. It is clear that if the game is any good they will soon learn
171 their <em/multiplication tables/. As they mature, the authentication
172 can be upgraded to include (long) division!
175 <bf/Linux-PAM/ deals with four separate types of (management)
176 task. These are: <em/authentication management/; <em/account
177 management/; <em/session management/; and <em/password management/.
178 The association of the preferred management scheme with the behavior
179 of an application is made with entries in the relevant <bf/Linux-PAM/
180 configuration file. The management functions are performed by
181 <em/modules/ specified in the configuration file. The syntax for this
182 file is discussed in the section <ref id="configuration"
186 Here is a figure that describes the overall organization of
192 +----------------+ / +----------+ +================+
193 | authentication-[---->--\--] Linux- |--<--| PAM config file|
194 | + [----<--/--] PAM | |================|
195 |[conversation()][--+ \ | | | X auth .. a.so |
196 +----------------+ | / +-n--n-----+ | X auth .. b.so |
198 | service user | A | | |____,-----'
200 +----------------+ +------|-----|---------+ -----+------+
201 +---u-----u----+ | | |
202 | auth.... |--[ a ]--[ b ]--[ c ]
204 | acct.... |--[ b ]--[ d ]
206 | password |--[ b ]--[ c ]
208 | session |--[ e ]--[ c ]
212 By way of explanation, the left of the figure represents the
213 application; application X. Such an application interfaces with the
214 <bf/Linux-PAM/ library and knows none of the specifics of its
215 configured authentication method. The <bf/Linux-PAM/ library (in the
216 center) consults the contents of the PAM configuration file and loads
217 the modules that are appropriate for application-X. These modules fall
218 into one of four management groups (lower-center) and are stacked in
219 the order they appear in the configuaration file. These modules, when
220 called by <bf/Linux-PAM/, perform the various authentication tasks for
221 the application. Textual information, required from/or offered to the
222 user, can be exchanged through the use of the application-supplied
223 <em/conversation/ function.
225 <sect>The Linux-PAM configuration file
226 <label id="configuration">
229 <bf/Linux-PAM/ is designed to provide the system administrator with a
230 great deal of flexibility in configuring the privilege granting
231 applications of their system. The local configuration of those aspects
232 of system security controlled by <tt/Linux-PAM/ is contained in one of
233 two places: either the single system file, <tt>/etc/pam.conf</tt>; or
234 the <tt>/etc/pam.d/</tt> directory. In this section we discuss the
235 correct syntax of and generic options respected by entries to these
238 <sect1>Configuration file syntax
241 The reader should note that the <bf/Linux-PAM/ specific tokens in this
242 file are case <em/insensitive/. The module paths, however, are case
243 sensitive since they indicate a file's <em/name/ and reflect the case
244 dependence of typical Linux file-systems. The case-sensitivity of the
245 arguments to any given module is defined for each module in turn.
248 In addition to the lines described below, there are two <em/special/
249 characters provided for the convenience of the system administrator:
250 comments are preceded by a `<tt/#/' and extend to the
251 next end-of-line; also, module specification lines may be extended
252 with a `<tt/\/' escaped newline.
255 A general configuration line of the <tt>/etc/pam.conf</tt> file has
259 service-name module-type control-flag module-path arguments
262 Below, we explain the meaning of each of these tokens. The second (and
263 more recently adopted) way of configuring <bf/Linux-PAM/ is via the
264 contents of the <tt>/etc/pam.d/</tt> directory. Once we have explained
265 the meaning of the above tokens, we will describe this method.
269 <tag><tt/service-name/</tag>
270 The name of the service associated with this entry. Frequently the
271 service name is the conventional name of the given application. For
272 example, `<tt/ftpd/', `<tt/rlogind/' and `<tt/su/', <em/etc./ .
275 There is a special <tt/service-name/, reserved for defining a default
276 authentication mechanism. It has the name `<tt/OTHER/' and may be
277 specified in either lower or upper case characters. Note, when there
278 is a module specified for a named service, the `<tt/OTHER/' entries
281 <tag><tt/module-type/</tag>
282 One of (currently) four types of module. The four types are as
285 <item> <tt/auth/; this module type provides two aspects of
286 authenticating the user. Firstly, it establishes that the user is who
287 they claim to be, by instructing the application to prompt the user
288 for a password or other means of identification. Secondly, the module
289 can grant <tt/group/ membership (independently of the
290 <tt>/etc/groups</tt> file discussed above) or other privileges through
291 its <em/credential/ granting properties.
293 <item> <tt/account/; this module performs non-authentication based
294 account management. It is typically used to restrict/permit access to
295 a service based on the time of day, currently available system
296 resources (maximum number of users) or perhaps the location of the
297 applicant user---`<tt/root/' login only on the console.
299 <item> <tt/session/; primarily, this module is associated with doing
300 things that need to be done for the user before/after they can be
301 given service. Such things include the logging of information
302 concerning the opening/closing of some data exchange with a user,
303 mounting directories, etc. .
305 <item> <tt/password/; this last module type is required for updating the
306 authentication token associated with the user. Typically, there is one
307 module for each `challenge/response' based authentication (<tt/auth/)
312 <tag><tt/control-flag/</tag>
314 The control-flag is used to indicate how the PAM library will react to
315 the success or failure of the module it is associated with. Since
316 modules can be <em/stacked/ (modules of the same type execute in
317 series, one after another), the control-flags determine the relative
318 importance of each module. The application is not made aware of the
319 individual success or failure of modules listed in the
320 `<tt>/etc/pam.conf</tt>' file. Instead, it receives a summary
321 <em/success/ or <em/fail/ response from the <bf/Linux-PAM/ library.
322 The order of execution of these modules is that of the entries in the
323 <tt>/etc/pam.conf</tt> file; earlier entries are executed before later
324 ones. As of Linux-PAM v0.60, this <em/control-flag/ can be defined
325 with one of two syntaxes.
328 The simpler (and historical) syntax for the control-flag is a single
329 keyword defined to indicate the severity of concern associated with
330 the success or failure of a specific module. There are four such
331 keywords: <tt/required/, <tt/requisite/, <tt/sufficient/ and
335 The Linux-PAM library interprets these keywords in the following
340 <item> <tt/required/; this indicates that the success of the module is
341 required for the <tt/module-type/ facility to succeed. Failure of this
342 module will not be apparent to the user until all of the remaining
343 modules (of the same <tt/module-type/) have been executed.
345 <item> <tt/requisite/; like <tt/required/, however, in the case that
346 such a module returns a failure, control is directly returned to the
347 application. The return value is that associated with the <em/first/
348 <tt/required/ or <tt/requisite/ module to fail. Note, this flag can be
349 used to protect against the possibility of a user getting the
350 opportunity to enter a password over an unsafe medium. It is
351 conceivable that such behavior might inform an attacker of valid
352 accounts on a system. This possibility should be weighed against the
353 not insignificant concerns of exposing a sensitive password in a
356 <item> <tt/sufficient/; the success of this module is deemed
357 `<em/sufficient/' to satisfy the <bf/Linux-PAM/ library that this
358 module-type has succeeded in its purpose. In the event that no
359 previous <tt/required/ module has failed, no more `<em/stacked/'
360 modules of this type are invoked. (Note, in this case subsequent
361 <tt/required/ modules are <bf/not/ invoked.). A failure of this module
362 is not deemed as fatal to satisfying the application that this
363 <tt/module-type/ has succeeded.
365 <item> <tt/optional/; as its name suggests, this <tt/control-flag/
366 marks the module as not being critical to the success or failure of
367 the user's application for service. However, in the absence of any
368 successes of previous or subsequent stacked modules this module will
369 determine the nature of the response to the application.
374 The more elaborate (newer) syntax is much more specific and gives the
375 administrator a great deal of control over how the user is
376 authenticated. This form of the control flag is delimeted with square
377 brackets and consists of a series of <tt/value=action/ tokens:
380 [value1=action1 value2=action2 ...]
385 Here, <tt/valueI/ is one of the following <em/return values/:
386 <tt/success/; <tt/open_err/; <tt/symbol_err/; <tt/service_err/;
387 <tt/system_err/; <tt/buf_err/; <tt/perm_denied/; <tt/auth_err/;
388 <tt/cred_insufficient/; <tt/authinfo_unavail/; <tt/user_unknown/;
389 <tt/maxtries/; <tt/new_authtok_reqd/; <tt/acct_expired/;
390 <tt/session_err/; <tt/cred_unavail/; <tt/cred_expired/; <tt/cred_err/;
391 <tt/no_module_data/; <tt/conv_err/; <tt/authtok_err/;
392 <tt/authtok_recover_err/; <tt/authtok_lock_busy/;
393 <tt/authtok_disable_aging/; <tt/try_again/; <tt/ignore/; <tt/abort/;
394 <tt/authtok_expired/; <tt/module_unknown/; <tt/bad_item/; and
395 <tt/default/. The last of these (<tt/default/) can be used to set the
396 action for those return values that are not set explicitly.
399 The <tt/actionI/ can be a positive integer or one of the following
400 tokens: <tt/ignore/; <tt/ok/; <tt/done/; <tt/bad/; <tt/die/; and
401 <tt/reset/. A positive integer, <tt/J/, when specified as the action
402 can be used to indicate that the next <em/J/ modules of the current
403 type will be skipped. In this way, the administrator can develop a
404 moderately sophisticated stack of modules with a number of different
405 paths of execution. Which path is taken can be determined by the
406 reactions of individual modules.
409 <bf>Note, at time of writing, this newer syntax is so new that I don't
410 want to write too much about it. Please play with this. Report all
411 the bugs and make suggestions for new actions (etc.).</bf>
413 <tag> <tt/module-path/</tag>
415 The path-name of the dynamically loadable object file; <em/the
416 pluggable module/ itself. If the first character of the module path is
417 `<tt>/</tt>', it is assumed to be a complete path. If this is not the
418 case, the given module path is appended to the default module path:
419 <tt>/usr/lib/security</tt> (but see the notes <ref
420 id="text-conventions" name="above">).
422 <tag> <tt/args/</tag>
424 The <tt/args/ are a list of tokens that are passed to the module when
425 it is invoked. Much like arguments to a typical Linux shell command.
426 Generally, valid arguments are optional and are specific to any given
427 module. Invalid arguments are ignored by a module, however, when
428 encountering an invalid argument, the module is required to write an
429 error to <tt/syslog(3)/. For a list of <em/generic/ options see the
435 Any line in (one of) the confiuration file(s), that is not formatted
436 correctly, will generally tend (erring on the side of caution) to make
437 the authentication process fail. A corresponding error is written to
438 the system log files with a call to <tt/syslog(3)/.
440 <sect1>Directory based configuration
443 More flexible than the single configuration file, as of version 0.56,
444 it is possible to configure <tt>libpam</tt> via the contents of the
445 <tt>/etc/pam.d/</tt> directory. In this case the directory is filled
446 with files each of which has a filename equal to a service-name (in
447 lower-case): it is the personal configuration file for the named
451 <bf/Linux-PAM/ can be compiled in one of two modes. The preferred
452 mode uses either <tt>/etc/pam.d/</tt> or <tt>/etc/pam.conf</tt>
453 configuration but not both. That is to say, if there is a
454 <tt>/etc/pam.d/</tt> directory then libpam only uses the files
455 contained in this directory. However, in the absence of the
456 <tt>/etc/pam.d/</tt> directory the <tt>/etc/pam.conf</tt> file is
457 used. The other mode (and the one currently supported by Red Hat 4.2)
458 is to use both <tt>/etc/pam.d/</tt> and <tt>/etc/pam.conf</tt> in
459 sequence. In this mode, entries in <tt>/etc/pam.d/</tt> override
460 those of <tt>/etc/pam.conf</tt>.
462 The syntax of each file in <tt>/etc/pam.d/</tt> is similar to that of
463 the <tt>/etc/pam.conf</tt> file and is made up of lines of the
467 module-type control-flag module-path arguments
470 The only difference being that the <tt>service-name</tt> is not
471 present. The service-name is of course the name of the given
472 configuration file. For example, <tt>/etc/pam.d/login</tt> contains
473 the configuration for the <em>login</em> service.
476 This method of configuration has a number of advantages over the
477 single file approach. We list them here to assist the reader in
478 deciding which scheme to adopt:
483 <item>A lower chance of misconfiguring an application. There is one
484 less field to mis-type when editing the configuration files by hand.
486 <item>Easier to maintain. One application may be reconfigured without
487 risk of interfering with other applications on the system.
489 <item>It is possible to symbolically link different services
490 configuration files to a single file. This makes it easier to keep the
491 system policy for access consistent across different applications.
492 (It should be noted, to conserve space, it is equally possible to
493 <em>hard</em> link a number of configuration files. However, care
494 should be taken when administering this arrangement as editing a hard
495 linked file is likely to break the link.)
497 <item>A potential for quicker configuration file parsing. Only the
498 relevant entries are parsed when a service gets bound to its modules.
500 <item>It is possible to limit read access to individual <bf/Linux-PAM/
501 configuration files using the file protections of the filesystem.
503 <item>Package management becomes simpler. Every time a new
504 application is installed, it can be accompanied by an
505 <tt>/etc/pam.d/</tt><em>xxxxxx</em> file.
509 <sect1>Generic optional arguments
512 The following are optional arguments which are likely to be understood
513 by any module. Arguments (including these) are in general
518 <tag><tt/debug/</tag>
520 Use the <tt/syslog(3)/ call to log debugging information to the system
523 <tag> <tt/no_warn/</tag>
525 Instruct module to not give warning messages to the application.
527 <tag> <tt/use_first_pass/</tag>
529 The module should not prompt the user for a password. Instead, it
530 should obtain the previously typed password (from the preceding
531 <tt/auth/ module), and use that. If that doesn't work, then the user
532 will not be authenticated. (This option is intended for <tt/auth/
533 and <tt/password/ modules only).
535 <tag> <tt/try_first_pass/</tag>
537 The module should attempt authentication with the previously typed
538 password (from the preceding <tt/auth/ module). If that doesn't work,
539 then the user is prompted for a password. (This option is intended for
540 <tt/auth/ modules only).
542 <tag> <tt/use_mapped_pass/</tag>
544 This argument is not currently supported by any of the modules in the
545 <bf/Linux-PAM/ distribution because of possible consequences
546 associated with U.S. encryption exporting restrictions. Within the
547 U.S., module developers are, of course, free to implement it (as are
548 developers in other countries). For compatibility reasons we describe
549 its use as suggested in the <bf/DCE-RFC 86.0/, see section <ref
550 id="see-also-sec" name="bibliography"> for a pointer to this document.
553 The <tt/use_mapped_pass/ argument instructs the module to take the
554 clear text authentication token entered by a previous module (that
555 requests such a token) and use it to generate an encryption/decryption
556 key with which to safely store/retrieve the authentication token
557 required for this module. In this way the user can enter a single
558 authentication token and be quietly authenticated by a number of
559 stacked modules. Obviously a convenient feature that necessarily
560 requires some reliably strong encryption to make it secure.
561 This argument is intended for the <tt/auth/ and <tt/password/ module
566 <sect1>Example configuration file entries
569 In this section, we give some examples of entries that can be present
570 in the <bf/Linux-PAM/ configuration file. As a first attempt at
571 configuring your system you could do worse than to implement these.
573 <sect2>Default policy
576 If a system is to be considered secure, it had better have a
577 reasonably secure `<tt/OTHER/' entry. The following is a paranoid
578 setting (which is not a bad place to start!):
582 # default; deny access
584 OTHER auth required /usr/lib/security/pam_deny.so
585 OTHER account required /usr/lib/security/pam_deny.so
586 OTHER password required /usr/lib/security/pam_deny.so
587 OTHER session required /usr/lib/security/pam_deny.so
590 Whilst fundamentally a secure default, this is not very sympathetic to
591 a misconfigured system. For example, such a system is vulnerable to
592 locking everyone out should the rest of the file become badly written.
595 The module <tt/pam_deny/ (documented in a later section) is not very
596 sophisticated. For example, it logs no information when it is invoked
597 so unless the users of a system contact the administrator when failing
598 to execute a service application, the administrator may go for a long
599 while in ignorance of the fact that his system is misconfigured.
602 The addition of the following line before those in the above example
603 would provide a suitable warning to the administrator.
607 # default; wake up! This application is not configured
609 OTHER auth required /usr/lib/security/pam_warn.so
610 OTHER password required /usr/lib/security/pam_warn.so
613 Having two ``<tt/OTHER auth/'' lines is an example of stacking.
616 On a system that uses the <tt>/etc/pam.d/</tt> configuration, the
617 corresponding default setup would be achieved with the following file:
621 # default configuration: /etc/pam.d/other
623 auth required /usr/lib/security/pam_warn.so
624 auth required /usr/lib/security/pam_deny.so
625 account required /usr/lib/security/pam_deny.so
626 password required /usr/lib/security/pam_warn.so
627 password required /usr/lib/security/pam_deny.so
628 session required /usr/lib/security/pam_deny.so
631 This is the only explicit example we give for an <tt>/etc/pam.d/</tt>
632 file. In general, it should be clear how to transpose the remaining
633 examples to this configuration scheme.
636 On a less sensitive computer, one on which the system administrator
637 wishes to remain ignorant of much of the power of <tt/Linux-PAM/, the
638 following selection of lines (in <tt>/etc/pam.conf</tt>) is likely to
639 mimic the historically familiar Linux setup.
643 # default; standard UNIX access
645 OTHER auth required /usr/lib/security/pam_unix_auth.so
646 OTHER account required /usr/lib/security/pam_unix_acct.so
647 OTHER password required /usr/lib/security/pam_unix_passwd.so
648 OTHER session required /usr/lib/security/pam_unix_session.so
651 In general this will provide a starting place for most applications.
652 Unfortunately, most is not all. One application that might require
653 additional lines is <em/ftpd/ if you wish to enable
657 To enable anonymous-ftp, the following lines might be used to replace
658 the default (<tt/OTHER/) ones. (<bf/*WARNING*/ as of 1996/12/28 this
659 does not work correctly with any ftpd. Consequently, this description
660 may be subject to change or the application will be fixed.)
664 # ftpd; add ftp-specifics. These lines enable anonymous ftp over
665 # standard UNIX access (the listfile entry blocks access to
666 # users listed in /etc/ftpusers)
668 ftpd auth sufficient /usr/lib/security/pam_ftp.so
669 ftpd auth required /usr/lib/security/pam_unix_auth.so use_first_pass
670 ftpd auth required /usr/lib/security/pam_listfile.so \
671 onerr=succeed item=user sense=deny file=/etc/ftpusers
674 Note, the second line is necessary since the default entries are
675 ignored by a service application (here <em/ftpd/) if there are
676 <em/any/ entries in <tt>/etc/pam.conf</tt> for that specified service.
677 Again, this is an example of authentication module stacking. Note the
678 use of the <tt/sufficient/ control-flag. It says that ``if this module
679 authenticates the user, ignore the subsequent <tt/auth/
680 modules''. Also note the use of the ``<tt/use_first_pass/''
681 module-argument, this instructs the UNIX authentication module that it
682 is not to prompt for a password but rely one already having been
683 obtained by the ftp module.
686 The standard UNIX modules, used above, are strongly tied to using the
687 default `<tt/libc/' user database functions (see for example, <tt/man
688 getpwent/). It is the opinion of the author that these functions are
689 not sufficently flexible to make full use of the power of
690 <bf/Linux-PAM/. For this reason, and as a small plug, I mention in
691 passing that there is a pluggable replacement for the <tt/pam_unix_../
692 modules; <tt/pam_pwdb/. See the section below for a more complete
696 <sect>Security issues of Linux-PAM
699 This section will discuss good practices for using Linux-PAM in a
700 secure manner. <em>It is currently sadly lacking...suggestions are
703 <sect1>If something goes wrong
706 <bf/Linux-PAM/ has the potential to seriously change the security of
707 your system. You can choose to have no security or absolute security
708 (no access permitted). In general, <bf/Linux-PAM/ errs towards the
709 latter. Any number of configuration errors can dissable access to
710 your system partially, or completely.
713 The most dramatic problem that is likely to be encountered when
714 configuring <bf/Linux-PAM/ is that of <em>deleting</em> the
715 configuration file(s): <tt>/etc/pam.d/*</tt> and/or
716 <tt>/etc/pam.conf</tt>. This will lock you out of your own system!
719 To recover, your best bet is to reboot the system in single user mode
720 and set about correcting things from there. The following has been
721 <em>adapted</em> from a life-saving email on the subject from David
724 > What the hell do I do now?
726 OK, don't panic. The first thing you have to realize is that
727 this happens to 50% of users who ever do anything with PAM.
728 It happened here, not once, not twice, but three times, all
729 different, and in the end, the solution was the same every
732 First, I hope you installed LILO with a delay. If you can,
733 reboot, hit shift or tab or something and type:
735 LILO boot: linux single
737 (Replace 'linux' with 'name-of-your-normal-linux-image').
738 This will let you in without logging in. Ever wondered how
739 easy it is to break into a linux machine from the console?
742 If you can't do that, then get yourself a bootkernel floppy
743 and a root disk a-la slackware's rescue.gz. (Red Hat's
744 installation disks can be used in this mode too.)
746 In either case, the point is to get back your root prompt.
748 Second, I'm going to assume that you haven't completely
749 nuked your pam installation - just your configuration files.
750 Here's how you make your configs nice again:
753 mv pam.conf pam.conf.orig
758 and then use vi to create a file called "other" in this
759 directory. It should contain the following four lines:
761 auth required pam_unix_auth.so
762 account required pam_unix_acct.so
763 password required pam_unix_passwd.so
764 session required pam_unix_session.so
766 Now you have the simplest possible PAM configuration that
767 will work the way you're used to. Everything should
768 magically start to work again. Try it out by hitting ALT-F2
769 and logging in on another virtual console. If it doesn't
770 work, you have bigger problems, or you've mistyped
771 something. One of the wonders of this system (seriously,
772 perhaps) is that if you mistype anything in the conf files,
773 you usually get no error reporting of any kind on the
774 console - just some entries in the log file. So look there!
775 (Try 'tail /var/log/messages'.)
777 From here you can go back and get a real configuration
778 going, hopefully after you've tested it first on a machine
779 you don't care about screwing up. :/
781 Some pointers (to make everything "right" with Red Hat...):
783 Install the newest pam, pamconfig, and pwdb from the
784 redhat current directory, and do it all on the same
785 command line with rpm...
787 rpm -Uvh [maybe --force too] pam-* pamconfig-* pwdb-*
789 Then make sure you install (or reinstall) the newest
790 version of libc, util-linux, wuftp, and NetKit. For
791 kicks you might try installing the newest versions of
792 the affected x apps, like xlock, but I haven't gotten
793 those to work at all yet.
797 <sect1>Avoid having a weak `other' configuration
800 It is not a good thing to have a weak default (<tt/OTHER/) entry.
801 This service is the default configuration for all PAM aware
802 applications and if it is weak, your system is likely to be vulnerable
805 <sect>A reference guide for available modules
808 Here, we collect together some descriptions of the various modules
809 available for <bf/Linux-PAM/. In general these modules should be
810 freely available. Where this is not the case, it will be indicated.
813 Also please note the comments contained in the section <ref
814 id="text-conventions" name="on text conventions above"> when copying
815 the examples listed below.
817 <!-- insert-file MODULES-SGML -->
823 <tag><tt>/usr/lib/libpam.so.*</tt></tag>
825 the shared library providing applications with access to
828 <tag><tt>/etc/pam.conf</tt></tag>
830 the <bf/Linux-PAM/ configuration file.
832 <tag><tt>/usr/lib/security/pam_*.so</tt></tag>
834 the primary location for <bf/Linux-PAM/ dynamically loadable object
839 <sect>See also<label id="see-also-sec">
843 <item>The <bf/Linux-PAM/ Application Writers' Guide.
845 <item>The <bf/Linux-PAM/ Module Writers' Guide.
847 <item>The V. Samar and R. Schemers (SunSoft), ``UNIFIED LOGIN WITH
848 PLUGGABLE AUTHENTICATION MODULES'', Open Software Foundation Request
849 For Comments 86.0, October 1995. See this url:
851 url="http://www.pilgrim.umass.edu/pub/osf_dce/RFC/rfc86.0.txt"
852 name="http://www.pilgrim.umass.edu/pub/osf_dce/RFC/rfc86.0.txt"></tt>
859 I intend to put development comments here... like ``at the moment
860 this isn't actually supported''. At release time what ever is in
861 this section will be placed in the Bugs section below! :)
864 Are we going to be able to support the <tt/use_mapped_pass/ module
865 argument? Anyone know a cheap (free) good lawyer?!
870 This issue may go away, as Sun have investigated adding a new
871 management group for mappings. In this way, libpam would have mapping
872 modules that could securely store passwords using strong cryptography
873 and in such a way that they need not be distributed with Linux-PAM.
876 <sect>Author/acknowledgments
879 This document was written by Andrew G. Morgan (morgan@parc.power.net)
880 with many contributions from
881 <!-- insert credits here -->
883 an sgml list of people to credit for their contributions to Linux-PAM
884 $Id: pam_source.sgml,v 1.5 1997/04/05 06:49:14 morgan Exp morgan $
912 Thanks are also due to Sun Microsystems, especially to Vipin Samar and
913 Charlie Lai for their advice. At an early stage in the development of
914 <bf/Linux-PAM/, Sun graciously made the documentation for their
915 implementation of PAM available. This act greatly accelerated the
916 development of <bf/Linux-PAM/.
921 More PAM modules are being developed all the time. It is unlikely that
922 this document will ever be truely up to date!
925 Currently there is no documentation for PAM-aware applications.
928 This manual is unfinished. Only a partial list of people is credited
929 for all the good work they have done.
931 <sect>Copyright information for this document
934 Copyright (c) Andrew G. Morgan 1996. All rights reserved.
936 Email: <tt><morgan@parc.power.net></tt>
939 Redistribution and use in source and binary forms, with or without
940 modification, are permitted provided that the following conditions are
947 1. Redistributions of source code must retain the above copyright
948 notice, and the entire permission notice in its entirety,
949 including the disclaimer of warranties.
952 2. Redistributions in binary form must reproduce the above copyright
953 notice, this list of conditions and the following disclaimer in the
954 documentation and/or other materials provided with the distribution.
957 3. The name of the author may not be used to endorse or promote
958 products derived from this software without specific prior
964 <bf/Alternatively/, this product may be distributed under the terms of
965 the GNU General Public License (GPL), in which case the provisions of
966 the GNU GPL are required <bf/instead of/ the above restrictions.
967 (This clause is necessary due to a potential bad interaction between
968 the GNU GPL and the restrictions contained in a BSD-style copyright.)
971 THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
972 WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
973 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
974 IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
975 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
976 BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
977 OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
978 ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
979 TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
980 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
984 <tt>$Id: pam_source.sgml,v 1.5 1997/04/05 06:49:14 morgan Exp morgan $</tt>