2 TITLE: Linux PAM - Pluggable Authentication Modules
3 VERSION: 1.0 (08-APRIL-2002)
5 AUTHOR: Yannick Tousignant <yannick@iscream.ca>
8 How to compile, install and configure Linux-PAM.
16 3. CRACKLIB INSTALLATION
18 5. SHADOW INSTALLATION
28 This document describes how to compile, install and configure a Pluggable
29 Authentication Modules for a Linux system. PAM is a suite of shared libraries
30 that enable the local system administrator to choose how applications
31 authenticate users. In other words, without (rewriting and) recompiling a
32 PAM-aware application, it is possible to switch between the authentication
33 mechanism(s) it uses. Indeed, one may entirely upgrade the local authentication
34 system without touching the applications themselves. It is the purpose of the
35 Linux-PAM project to separate the development of privilege granting software
36 from the development of secure and appropriate authentication schemes. This is
37 accomplished by providing a library of functions that an application may use to
38 request that a user be authenticated.
46 You need the following sources to start the installation:
48 http://www.us.kernel.org/pub/linux/libs/pam/pre/library/Linux-PAM-0.75.tar.bz2
49 http://www.us.kernel.org/pub/linux/libs/pam/pre/library/cracklib-files.tgz
50 http://ftp.pld.org.pl/software/shadow/old/shadow-20001016.tar.gz
58 LAST MINUTE UPDATE : The cracklib package seems to be very unstable with this
59 version of pam or shadow. Fell free to experience it yourself...
61 When entering lots of numbers+letters, this end with passwd crashing.
67 If you find any fix or work around, email me right away at yannick@iscream.ca
69 WE DO NOT RECOMMEND INSTALLING CRACKLIB ON CRUCIAL SYSTEMS !!!
71 CrackLib is a library containing a C function which may be used in a
72 passwd-like program. The idea is simple: try to prevent users from choosing
73 passwords that could be guessed by "Crack" by filtering them out, at source.
75 This is a pre-compiled version a cracklib, if anyone can come up with a hint
76 on howto compile it... For now, lets just extact an move files.
78 If you extract this package, this will create a folder called "usr"
79 do not enter into it and execute :
81 cp usr/include/* /usr/include
83 cp usr/sbin/* /usr/sbin
91 Extract the source package and enter the source directory and enter the
94 ./configure --enable-read-both-confs \
95 --with-mailspool=/var/mail &&
99 ln -sf libpam.so.0.75 libpam.so &&
100 ln -sf libpamc.so.0.75 libpamc.so
103 This will install pam libraries in /lib, pam modules in /lib/security, and
104 pam config files in /etc/security.
112 Now, you must recompile the shadow password suite and link it with pam
113 librairies. Goes a little like that :
115 cp src/useradd.c src/useradd.c.backup &&
116 sed 's/\(.*\) (nflg || \(.*\))\(.*\)/\1\2\3/' \
117 src/useradd.c.backup > src/useradd.c &&
118 ./configure --prefix=/usr --with-libpam &&
122 mv libshadow.*a /usr/lib &&
123 ln -sf libshadow.so.0 libshadow.so &&
125 ln -sf ../../lib/libshadow.so &&
128 cd /usr/share/man/man8 &&
131 Now, if you do a "ldd /bin/login", the binary should be linked to pam.
133 LEAVE A SESSION OPEN TIL YOUR DONE, YOU CAN'T LOG IN RIGHT NOW !!!
141 Now, you have two way you can configure pam. The first one is the
142 /etc/pam.conf configuration file. This file can contain all your config
143 for every programs linked to the pam libraries.
145 The other way is to create the /etc/pam.d directory and then configure
146 each programs in a separate file. If there is a /etc/pam.d/ directory then
147 libpam only uses the files contained in this directory. However, in the
148 absence of the /etc/pam.d/ directory the /etc/pam.conf file is used.
150 To simplify things a little, we are going to use the pam.conf file to
151 configure everything into 1 step. If you think you are going to expand your
152 system a lot, you better use the pam.d directory...
154 For more information, please refer to this document :
156 http://www.us.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam.html
158 Here is a sample of a pam.conf file, use it well.
160 cat > /etc/pam.conf << "EOF"
161 # ---------------------------------------------------------------------------#
163 # ---------------------------------------------------------------------------#
164 # $Id: pam.txt,v 1.1 2003/09/13 16:18:12 tushar Exp $
165 # ---------------------------------------------------------------------------#
166 # serv. module ctrl module [path] ...[args..] #
168 # ---------------------------------------------------------------------------#
170 # 'pam_deny' deny everyting and 'pam_warn' logs it.
171 other auth required pam_deny.so
172 other auth required pam_warn.so
173 other account required pam_deny.so
174 other password required pam_deny.so
175 other password required pam_warn.so
176 other session required pam_deny.so
178 login auth requisite pam_securetty.so # /etc/securetty (CONSOLE)
179 login auth required pam_unix.so
180 login auth optional pam_group.so # group.conf (CONSOLE_GROUPS)
181 login auth requisite pam_nologin.so # /etc/nologin (NOLOGINS_FILE)
182 login auth required pam_env.so # pam_env.conf (ENVIRON_FILE)
183 login account required pam_unix.so
184 login account requisite pam_time.so # time.conf (PORTTIME_CHECKS_ENAB)
185 login account required pam_access.so # access.conf (/etc/access.defs)
186 login session required pam_unix.so
187 login session required pam_limits.so # limits.conf (/etc/limits)
188 login session optional pam_lastlog.so # (LASTLOG_ENAB)
189 login session optional pam_mail.so standard noenv # (MAIL_CHECK_ENAB)
190 login session optional pam_motd.so # (MOTD_FILE)
191 login password required pam_unix.so shadow md5
193 passwd password required pam_unix.so shadow md5
195 su auth sufficient pam_rootok.so
196 su auth required pam_unix.so
197 su account required pam_unix.so
198 su session required pam_unix.so
200 shadow auth sufficient pam_rootok.so
201 shadow auth required pam_unix.so
202 shadow account required pam_unix.so
203 shadow session required pam_unix.so
204 shadow password optional pam_permit.so
209 You must create the securetty file before you can log into you system :
211 cat > /etc/securetty << "EOF"
220 You must as well comment unused variables in /etc/login.defs...
240 You can also delete the old /etc/limits and login.access files.
241 All configuration are now in /etc/security/ and some files are still
242 in the /etc directory. (see in pam.conf)
244 I had a problems with useradd/groupadd commands linked with pam now.
245 If i comment out the "shadow password optional pam_permit.so",
246 The command is working well, but an error message appear :
248 root:/etc# useradd -g 100 -s /bin/bash -m test
249 useradd: PAM chauthtok failed
251 Also, the pam_issue.so don't seem to work, so i left out this job to
254 There is something i don't get, i'm not a pam expert, so please e-mail
255 at yannick@iscream.ca to complete this hint.
263 Now that pam is installed, you must recompile your favorite daemons with
264 pam support. i.e.: --with-pam ;-)
266 Here is an example for the widely used openssh :
268 sshd auth requisite pam_securetty.so
269 sshd auth required pam_unix.so
270 sshd account required pam_unix.so
271 sshd session required pam_unix.so
272 sshd password required pam_unix.so shadow md5