1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY shadow-download-http
|
---|
8 | "http://pkg-shadow.alioth.debian.org/releases/shadow-&shadow-version;.tar.bz2 ">
|
---|
9 | <!ENTITY shadow-download-ftp " ">
|
---|
10 | <!ENTITY shadow-md5sum "d5f7a588fadb79faeb4b08b1eee82e9a">
|
---|
11 | <!ENTITY shadow-size "2.1 MB">
|
---|
12 | <!ENTITY shadow-buildsize "35 MB">
|
---|
13 | <!ENTITY shadow-time "0.3 SBU">
|
---|
14 | ]>
|
---|
15 |
|
---|
16 | <sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
|
---|
17 | <?dbhtml filename="shadow.html"?>
|
---|
18 |
|
---|
19 | <sect1info>
|
---|
20 | <othername>$LastChangedBy$</othername>
|
---|
21 | <date>$Date$</date>
|
---|
22 | </sect1info>
|
---|
23 |
|
---|
24 | <title>Shadow-&shadow-version;</title>
|
---|
25 |
|
---|
26 | <indexterm zone="shadow">
|
---|
27 | <primary sortas="a-Shadow">Shadow</primary>
|
---|
28 | </indexterm>
|
---|
29 |
|
---|
30 | <sect2 role="package">
|
---|
31 | <title>Introduction to Shadow</title>
|
---|
32 |
|
---|
33 | <para>
|
---|
34 | <application>Shadow</application> was indeed installed in LFS and there is
|
---|
35 | no reason to reinstall it unless you installed
|
---|
36 | <application>CrackLib</application> or
|
---|
37 | <application>Linux-PAM</application> after your LFS system was completed.
|
---|
38 | If you have installed <application>CrackLib</application> after LFS, then
|
---|
39 | reinstalling <application>Shadow</application> will enable strong password
|
---|
40 | support. If you have installed <application>Linux-PAM</application>,
|
---|
41 | reinstalling <application>Shadow</application> will allow programs such as
|
---|
42 | <command>login</command> and <command>su</command> to utilize PAM.
|
---|
43 | </para>
|
---|
44 |
|
---|
45 | &lfs71_checked;
|
---|
46 |
|
---|
47 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
48 | <itemizedlist spacing="compact">
|
---|
49 | <listitem>
|
---|
50 | <para>
|
---|
51 | Download (HTTP): <ulink url="&shadow-download-http;"/>
|
---|
52 | </para>
|
---|
53 | </listitem>
|
---|
54 | <listitem>
|
---|
55 | <para>
|
---|
56 | Download (FTP): <ulink url="&shadow-download-ftp;"/>
|
---|
57 | </para>
|
---|
58 | </listitem>
|
---|
59 | <listitem>
|
---|
60 | <para>
|
---|
61 | Download MD5 sum: &shadow-md5sum;
|
---|
62 | </para>
|
---|
63 | </listitem>
|
---|
64 | <listitem>
|
---|
65 | <para>
|
---|
66 | Download size: &shadow-size;
|
---|
67 | </para>
|
---|
68 | </listitem>
|
---|
69 | <listitem>
|
---|
70 | <para>
|
---|
71 | Estimated disk space required: &shadow-buildsize;
|
---|
72 | </para>
|
---|
73 | </listitem>
|
---|
74 | <listitem>
|
---|
75 | <para>
|
---|
76 | Estimated build time: &shadow-time;
|
---|
77 | </para>
|
---|
78 | </listitem>
|
---|
79 | </itemizedlist>
|
---|
80 |
|
---|
81 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
82 | <itemizedlist spacing='compact'>
|
---|
83 | <listitem>
|
---|
84 | <para>
|
---|
85 | Required patch: <ulink
|
---|
86 | url="http://www.&lfs-domainname;/patches/lfs/development/shadow-&shadow-version;-nscd-1.patch"/>
|
---|
87 | </para>
|
---|
88 | </listitem>
|
---|
89 | </itemizedlist>
|
---|
90 |
|
---|
91 | <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
|
---|
92 |
|
---|
93 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
94 | <para role="required">
|
---|
95 | <xref linkend="linux-pam"/> or
|
---|
96 | <xref linkend="cracklib"/>
|
---|
97 | </para>
|
---|
98 |
|
---|
99 | <para condition="html" role="usernotes">
|
---|
100 | User Notes: <ulink url="&blfs-wiki;/shadow"/>
|
---|
101 | </para>
|
---|
102 | </sect2>
|
---|
103 |
|
---|
104 | <sect2 role="installation">
|
---|
105 | <title>Installation of Shadow</title>
|
---|
106 |
|
---|
107 | <important>
|
---|
108 | <para>
|
---|
109 | The installation commands shown below are for installations where
|
---|
110 | <application>Linux-PAM</application> has been installed (with or
|
---|
111 | without a <application>CrackLib</application> installation) and
|
---|
112 | <application>Shadow</application> is being reinstalled to support the
|
---|
113 | <application>Linux-PAM</application> installation.
|
---|
114 | </para>
|
---|
115 |
|
---|
116 | <para>
|
---|
117 | If you are reinstalling <application>Shadow</application> to provide
|
---|
118 | strong password support using the <application>CrackLib</application>
|
---|
119 | library without using <application>Linux-PAM</application>, ensure you
|
---|
120 | add the <parameter>--with-libcrack</parameter> parameter to the
|
---|
121 | <command>configure</command> script below and also issue the following
|
---|
122 | command:
|
---|
123 | </para>
|
---|
124 |
|
---|
125 | <screen><userinput>sed -i 's@DICTPATH.*@DICTPATH\t/lib/cracklib/pw_dict@' etc/login.defs</userinput></screen>
|
---|
126 | </important>
|
---|
127 |
|
---|
128 | <para>
|
---|
129 | Reinstall <application>Shadow</application> by running the following
|
---|
130 | commands:
|
---|
131 | </para>
|
---|
132 |
|
---|
133 | <screen><userinput>sed -i 's/groups$(EXEEXT) //' src/Makefile.in &&
|
---|
134 | find man -name Makefile.in -exec sed -i 's/groups\.1 / /' {} \; &&
|
---|
135 | sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile.in &&
|
---|
136 | sed -i '/<stdio.h>/a#include <stdarg.h>' libmisc/copydir.c &&
|
---|
137 |
|
---|
138 | sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' \
|
---|
139 | -e 's@/var/spool/mail@/var/mail@' etc/login.defs &&
|
---|
140 |
|
---|
141 | sed -i -e 's@PATH=/sbin:/bin:/usr/sbin:/usr/bin@&:/usr/local/sbin:/usr/local/bin@' \
|
---|
142 | -e 's@PATH=/bin:/usr/bin@&:/usr/local/bin@' etc/login.defs &&
|
---|
143 |
|
---|
144 | patch -Np1 -i ../shadow-&shadow-version;-nscd-1.patch &&
|
---|
145 |
|
---|
146 | ./configure --prefix=/usr --sysconfdir=/etc &&
|
---|
147 | make</userinput></screen>
|
---|
148 |
|
---|
149 | <para>
|
---|
150 | This package does not come with a test suite.
|
---|
151 | </para>
|
---|
152 |
|
---|
153 | <para>
|
---|
154 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
155 | </para>
|
---|
156 |
|
---|
157 | <screen role="root"><userinput>make install &&
|
---|
158 | mv -v /usr/bin/passwd /bin</userinput></screen>
|
---|
159 | </sect2>
|
---|
160 |
|
---|
161 | <sect2 role="commands">
|
---|
162 | <title>Command Explanations</title>
|
---|
163 |
|
---|
164 | <para>
|
---|
165 | <command>sed -i 's/groups$(EXEEXT) //' src/Makefile.in</command>: This sed
|
---|
166 | is used to suppress the installation of the <command>groups</command>
|
---|
167 | program as the version from the <application>Coreutils</application>
|
---|
168 | package installed during LFS is preferred.
|
---|
169 | </para>
|
---|
170 |
|
---|
171 | <para>
|
---|
172 | <command>find man -name Makefile.in -exec ... {} \;</command>: This
|
---|
173 | command is used to suppress the installation of the
|
---|
174 | <command>groups</command> man pages so the existing ones installed from
|
---|
175 | the <application>Coreutils</application> package are not replaced.
|
---|
176 | </para>
|
---|
177 |
|
---|
178 | <para>
|
---|
179 | <command>sed -i -e '...' -e '...' man/Makefile.in</command>: This command
|
---|
180 | disables the installation of Chinese and Korean manual pages, since
|
---|
181 | <application>Man-DB</application> cannot format them properly.
|
---|
182 | </para>
|
---|
183 |
|
---|
184 | <para>
|
---|
185 | <command>sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' -e
|
---|
186 | 's@/var/spool/mail@/var/mail@' etc/login.defs</command>: Instead of using
|
---|
187 | the default 'DES' method, this command modifies the installation to use
|
---|
188 | the more secure 'SHA512' method of hashing passwords, which also allows
|
---|
189 | passwords longer than eight characters. It also changes the obsolete
|
---|
190 | <filename class="directory">/var/spool/mail</filename> location for user
|
---|
191 | mailboxes that <application>Shadow</application> uses by default to the
|
---|
192 | <filename class="directory">/var/mail</filename> location.
|
---|
193 | </para>
|
---|
194 |
|
---|
195 | <para>
|
---|
196 | <command>sed -i -e
|
---|
197 | 's@PATH=/sbin:/bin:/usr/sbin:/usr/bin@&:/usr/local/sbin:/usr/local/bin@'
|
---|
198 | -e 's@PATH=/bin:/usr/bin@&:/usr/local/bin@' etc/login.defs</command>:
|
---|
199 | This sed expands PATH to
|
---|
200 | <filename class="directory">/usr/local/bin</filename> for normal and
|
---|
201 | <systemitem class="username">root</systemitem> user and to
|
---|
202 | <filename class="directory">/usr/local/sbin</filename> for
|
---|
203 | <systemitem class="username">root</systemitem> user only.
|
---|
204 | </para>
|
---|
205 |
|
---|
206 | <para>
|
---|
207 | <command>sed -i '/<stdio.h>/a#include <stdarg.h>'
|
---|
208 | libmisc/copydir.c</command>: This sed fixes a bug which would make the
|
---|
209 | build fail if <xref linkend="acl"/> is installed.
|
---|
210 | </para>
|
---|
211 |
|
---|
212 | <para>
|
---|
213 | <command>mv -v /usr/bin/passwd /bin</command>: The
|
---|
214 | <command>passwd</command> program may be needed during times when the
|
---|
215 | <filename class='directory'>/usr</filename> filesystem is not mounted so
|
---|
216 | it is moved into the root partition.
|
---|
217 | </para>
|
---|
218 | </sect2>
|
---|
219 |
|
---|
220 | <sect2 role="configuration">
|
---|
221 | <title>Configuring Shadow</title>
|
---|
222 |
|
---|
223 | <para>
|
---|
224 | <application>Shadow</application>'s stock configuration for the
|
---|
225 | <command>useradd</command> utility may not be desirable for your
|
---|
226 | installation. One default parameter causes <command>useradd</command> to
|
---|
227 | create a mailbox file for any newly created user.
|
---|
228 | <command>useradd</command> will make the group ownership of this file to
|
---|
229 | the <systemitem class="groupname">mail</systemitem> group with 0660
|
---|
230 | permissions. If you would prefer that these mailbox files are not created
|
---|
231 | by <command>useradd</command>, issue the following command as the
|
---|
232 | <systemitem class="username">root</systemitem> user:
|
---|
233 | </para>
|
---|
234 |
|
---|
235 | <screen role="root"><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
|
---|
236 | </sect2>
|
---|
237 |
|
---|
238 | <sect2 role="configuration">
|
---|
239 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
240 |
|
---|
241 | <note>
|
---|
242 | <para>
|
---|
243 | The rest of this page is devoted to configuring
|
---|
244 | <application>Shadow</application> to work properly with
|
---|
245 | <application>Linux-PAM</application>. If you do not have
|
---|
246 | <application>Linux-PAM</application> installed, and you reinstalled
|
---|
247 | <application>Shadow</application> to support strong passwords via the
|
---|
248 | <application>CrackLib</application> library, no further configuration is
|
---|
249 | required.
|
---|
250 | </para>
|
---|
251 | </note>
|
---|
252 |
|
---|
253 | <sect3 id="pam.d">
|
---|
254 | <title>Config Files</title>
|
---|
255 |
|
---|
256 | <para>
|
---|
257 | <filename>/etc/pam.d/*</filename> or alternatively
|
---|
258 | <filename>/etc/pam.conf</filename>,
|
---|
259 | <filename>/etc/login.defs</filename> and
|
---|
260 | <filename>/etc/security/*</filename>
|
---|
261 | </para>
|
---|
262 |
|
---|
263 | <indexterm zone="shadow pam.d">
|
---|
264 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
265 | </indexterm>
|
---|
266 |
|
---|
267 | <indexterm zone="shadow pam.d">
|
---|
268 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
269 | </indexterm>
|
---|
270 |
|
---|
271 | <indexterm zone="shadow pam.d">
|
---|
272 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
273 | </indexterm>
|
---|
274 |
|
---|
275 | <indexterm zone="shadow pam.d">
|
---|
276 | <primary sortas="e-etc-security">/etc/security/*</primary>
|
---|
277 | </indexterm>
|
---|
278 | </sect3>
|
---|
279 |
|
---|
280 | <sect3>
|
---|
281 | <title>Configuration Information</title>
|
---|
282 |
|
---|
283 | <para>
|
---|
284 | Configuring your system to use <application>Linux-PAM</application> can
|
---|
285 | be a complex task. The information below will provide a basic setup so
|
---|
286 | that <application>Shadow</application>'s login and password
|
---|
287 | functionality will work effectively with
|
---|
288 | <application>Linux-PAM</application>. Review the information and links
|
---|
289 | on the <xref linkend="linux-pam"/> page for further configuration
|
---|
290 | information. For information specific to integrating
|
---|
291 | <application>Shadow</application>, <application>Linux-PAM</application>
|
---|
292 | and <application>CrackLib</application>, you can visit the following
|
---|
293 | link:
|
---|
294 | </para>
|
---|
295 |
|
---|
296 | <itemizedlist spacing="compact">
|
---|
297 | <listitem>
|
---|
298 | <para>
|
---|
299 | <ulink url="http://www.deer-run.com/~hal/sysadmin/pam_cracklib.html"/>
|
---|
300 | </para>
|
---|
301 | </listitem>
|
---|
302 | </itemizedlist>
|
---|
303 |
|
---|
304 | <sect4 id="pam-login-defs">
|
---|
305 | <title>Configuring /etc/login.defs</title>
|
---|
306 |
|
---|
307 | <para>
|
---|
308 | The <command>login</command> program currently performs many functions
|
---|
309 | which <application>Linux-PAM</application> modules should now handle.
|
---|
310 | The following <command>sed</command> command will comment out the
|
---|
311 | appropriate lines in <filename>/etc/login.defs</filename>, and stop
|
---|
312 | <command>login</command> from performing these functions (a backup
|
---|
313 | file named <filename>/etc/login.defs.orig</filename> is also created
|
---|
314 | to preserve the original file's contents). Issue the following
|
---|
315 | commands as the <systemitem class="username">root</systemitem> user:
|
---|
316 | </para>
|
---|
317 |
|
---|
318 | <indexterm zone="shadow pam-login-defs">
|
---|
319 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
320 | </indexterm>
|
---|
321 |
|
---|
322 | <screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &&
|
---|
323 | for FUNCTION in FAIL_DELAY LASTLOG_ENAB \
|
---|
324 | FAILLOG_ENAB QUOTAS_ENAB \
|
---|
325 | FTMP_FILE PASS_MIN_LEN \
|
---|
326 | MAIL_CHECK_ENAB \
|
---|
327 | OBSCURE_CHECKS_ENAB \
|
---|
328 | PORTTIME_CHECKS_ENAB \
|
---|
329 | CONSOLE MOTD_FILE \
|
---|
330 | NOLOGINS_FILE ENV_HZ \
|
---|
331 | SU_WHEEL_ONLY \
|
---|
332 | CRACKLIB_DICTPATH \
|
---|
333 | SYS_UID_MIN SYS_UID_MAX \
|
---|
334 | SYS_GID_MIN SYS_GID_MAX \
|
---|
335 | PASS_CHANGE_TRIES \
|
---|
336 | PASS_ALWAYS_WARN \
|
---|
337 | CHFN_AUTH ENVIRON_FILE
|
---|
338 | do
|
---|
339 | sed -i "s/^${FUNCTION}/# &/" /etc/login.defs
|
---|
340 | done</userinput></screen>
|
---|
341 | </sect4>
|
---|
342 |
|
---|
343 | <sect4>
|
---|
344 | <title>Configuring the /etc/pam.d/ Files</title>
|
---|
345 |
|
---|
346 | <para>
|
---|
347 | As mentioned previously in the <application>Linux-PAM</application>
|
---|
348 | instructions, <application>Linux-PAM</application> has two supported
|
---|
349 | methods for configuration. The commands below assume that you've
|
---|
350 | chosen to use a directory based configuration, where each program has
|
---|
351 | its own configuration file. You can optionally use a single
|
---|
352 | <filename>/etc/pam.conf</filename> configuration file by using the
|
---|
353 | text from the files below, and supplying the program name as an
|
---|
354 | additional first field for each line.
|
---|
355 | </para>
|
---|
356 |
|
---|
357 | <para>
|
---|
358 | As the <systemitem class="username">root</systemitem> user, replace
|
---|
359 | the following <application>Linux-PAM</application> configuration files
|
---|
360 | in the <filename class="directory">/etc/pam.d/</filename> directory
|
---|
361 | (or add the contents to the <filename>/etc/pam.conf</filename> file)
|
---|
362 | using the following commands:
|
---|
363 | </para>
|
---|
364 | </sect4>
|
---|
365 |
|
---|
366 | <sect4>
|
---|
367 | <title>'system-account'</title>
|
---|
368 |
|
---|
369 | <screen role="root"><userinput>cat > /etc/pam.d/system-account << "EOF"
|
---|
370 | <literal># Begin /etc/pam.d/system-account
|
---|
371 |
|
---|
372 | account required pam_unix.so
|
---|
373 |
|
---|
374 | # End /etc/pam.d/system-account</literal>
|
---|
375 | EOF</userinput></screen>
|
---|
376 | </sect4>
|
---|
377 |
|
---|
378 | <sect4>
|
---|
379 | <title>'system-auth'</title>
|
---|
380 |
|
---|
381 | <screen role="root"><userinput>cat > /etc/pam.d/system-auth << "EOF"
|
---|
382 | <literal># Begin /etc/pam.d/system-auth
|
---|
383 |
|
---|
384 | auth required pam_unix.so
|
---|
385 |
|
---|
386 | # End /etc/pam.d/system-auth</literal>
|
---|
387 | EOF</userinput></screen>
|
---|
388 | </sect4>
|
---|
389 |
|
---|
390 | <sect4>
|
---|
391 | <title>'system-passwd' (with cracklib)</title>
|
---|
392 |
|
---|
393 | <screen role="root"><userinput>cat > /etc/pam.d/system-password << "EOF"
|
---|
394 | <literal># Begin /etc/pam.d/system-password
|
---|
395 |
|
---|
396 | # check new passwords for strength (man pam_cracklib)
|
---|
397 | password required pam_cracklib.so type=Linux retry=3 difok=5 \
|
---|
398 | difignore=23 minlen=9 dcredit=1 \
|
---|
399 | ucredit=1 lcredit=1 ocredit=1 \
|
---|
400 | dictpath=/lib/cracklib/pw_dict
|
---|
401 | # use sha512 hash for encryption, use shadow, and use the
|
---|
402 | # authentication token (chosen password) set by pam_cracklib
|
---|
403 | # above (or any previous modules)
|
---|
404 | password required pam_unix.so sha512 shadow use_authtok
|
---|
405 |
|
---|
406 | # End /etc/pam.d/system-password</literal>
|
---|
407 | EOF</userinput></screen>
|
---|
408 |
|
---|
409 | <note>
|
---|
410 | <para>
|
---|
411 | In its default configuration, owing to credits, pam_cracklib will
|
---|
412 | allow multiple case passwords as short as 6 characters, even with
|
---|
413 | the <parameter>minlen</parameter> value set to 11. You should review
|
---|
414 | the pam_cracklib(8) man page and determine if these default values
|
---|
415 | are acceptable for the security of your system.
|
---|
416 | </para>
|
---|
417 | </note>
|
---|
418 | </sect4>
|
---|
419 |
|
---|
420 | <sect4>
|
---|
421 | <title>'system-passwd' (without cracklib)</title>
|
---|
422 |
|
---|
423 | <screen role="root"><userinput>cat > /etc/pam.d/system-password << "EOF"
|
---|
424 | <literal># Begin /etc/pam.d/system-password
|
---|
425 |
|
---|
426 | # use sha512 hash for encryption, use shadow, and try to use any previously
|
---|
427 | # defined authentication token (chosen password) set by any prior module
|
---|
428 | password required pam_unix.so sha512 shadow try_first_pass
|
---|
429 |
|
---|
430 | # End /etc/pam.d/system-password</literal>
|
---|
431 | EOF</userinput></screen>
|
---|
432 | </sect4>
|
---|
433 |
|
---|
434 | <sect4>
|
---|
435 | <title>'system-session'</title>
|
---|
436 |
|
---|
437 | <screen role="root"><userinput>cat > /etc/pam.d/system-session << "EOF"
|
---|
438 | <literal># Begin /etc/pam.d/system-session
|
---|
439 |
|
---|
440 | session required pam_unix.so
|
---|
441 |
|
---|
442 | # End /etc/pam.d/system-session</literal>
|
---|
443 | EOF</userinput></screen>
|
---|
444 | </sect4>
|
---|
445 |
|
---|
446 | <sect4>
|
---|
447 | <title>'login'</title>
|
---|
448 |
|
---|
449 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
450 | <literal># Begin /etc/pam.d/login
|
---|
451 |
|
---|
452 | # Set failure delay before next prompt to 3 seconds
|
---|
453 | auth optional pam_faildelay.so delay=3000000
|
---|
454 |
|
---|
455 | # Check to make sure that the user is allowed to login
|
---|
456 | auth requisite pam_nologin.so
|
---|
457 |
|
---|
458 | # Check to make sure that root is allowed to login
|
---|
459 | # Disabled by default. You will need to create /etc/securetty
|
---|
460 | # file for this module to function. See man 5 securetty.
|
---|
461 | #auth required pam_securetty.so
|
---|
462 |
|
---|
463 | # Additional group memberships - disabled by default
|
---|
464 | #auth optional pam_group.so
|
---|
465 |
|
---|
466 | # include the default auth settings
|
---|
467 | auth include system-auth
|
---|
468 |
|
---|
469 | # check access for the user
|
---|
470 | account required pam_access.so
|
---|
471 |
|
---|
472 | # include the default account settings
|
---|
473 | account include system-account
|
---|
474 |
|
---|
475 | # Set default environment variables for the user
|
---|
476 | session required pam_env.so
|
---|
477 |
|
---|
478 | # Set resource limits for the user
|
---|
479 | session required pam_limits.so
|
---|
480 |
|
---|
481 | # Display date of last login - Disabled by default
|
---|
482 | #session optional pam_lastlog.so
|
---|
483 |
|
---|
484 | # Display the message of the day - Disabled by default
|
---|
485 | #session optional pam_motd.so
|
---|
486 |
|
---|
487 | # Check user's mail - Disabled by default
|
---|
488 | #session optional pam_mail.so standard quiet
|
---|
489 |
|
---|
490 | # include the default session and password settings
|
---|
491 | session include system-session
|
---|
492 | password include system-password
|
---|
493 |
|
---|
494 | # End /etc/pam.d/login</literal>
|
---|
495 | EOF</userinput></screen>
|
---|
496 | </sect4>
|
---|
497 |
|
---|
498 | <sect4>
|
---|
499 | <title>'passwd'</title>
|
---|
500 |
|
---|
501 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
502 | <literal># Begin /etc/pam.d/passwd
|
---|
503 |
|
---|
504 | password include system-password
|
---|
505 |
|
---|
506 | # End /etc/pam.d/passwd</literal>
|
---|
507 | EOF</userinput></screen>
|
---|
508 | </sect4>
|
---|
509 |
|
---|
510 | <sect4>
|
---|
511 | <title>'su'</title>
|
---|
512 |
|
---|
513 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
514 | <literal># Begin /etc/pam.d/su
|
---|
515 |
|
---|
516 | # always allow root
|
---|
517 | auth sufficient pam_rootok.so
|
---|
518 | auth include system-auth
|
---|
519 |
|
---|
520 | # include the default account settings
|
---|
521 | account include system-account
|
---|
522 |
|
---|
523 | # Set default environment variables for the service user
|
---|
524 | session required pam_env.so
|
---|
525 |
|
---|
526 | # include system session defaults
|
---|
527 | session include system-session
|
---|
528 |
|
---|
529 | # End /etc/pam.d/su</literal>
|
---|
530 | EOF</userinput></screen>
|
---|
531 | </sect4>
|
---|
532 |
|
---|
533 | <sect4>
|
---|
534 | <title>'chage'</title>
|
---|
535 |
|
---|
536 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
537 | <literal>#Begin /etc/pam.d/chage
|
---|
538 |
|
---|
539 | # always allow root
|
---|
540 | auth sufficient pam_rootok.so
|
---|
541 |
|
---|
542 | # include system defaults for auth account and session
|
---|
543 | auth include system-auth
|
---|
544 | account include system-account
|
---|
545 | session include system-session
|
---|
546 |
|
---|
547 | # Always permit for authentication updates
|
---|
548 | password required pam_permit.so
|
---|
549 |
|
---|
550 | # End /etc/pam.d/chage</literal>
|
---|
551 | EOF</userinput></screen>
|
---|
552 | </sect4>
|
---|
553 |
|
---|
554 | <sect4>
|
---|
555 | <title>'chfn', 'chgpasswd', 'chgpasswd', 'chsh', 'groupadd', 'groupdel',
|
---|
556 | 'groupmems', 'groupmod', 'newusers', 'useradd', 'userdel' and
|
---|
557 | 'usermod'</title>
|
---|
558 |
|
---|
559 | <screen role="root"><userinput>for PROGRAM in chfn chgpasswd chpasswd chsh groupadd groupdel \
|
---|
560 | groupmems groupmod newusers useradd userdel usermod
|
---|
561 | do
|
---|
562 | install -v -m644 /etc/pam.d/chage /etc/pam.d/${PROGRAM}
|
---|
563 | sed -i "s/chage/$PROGRAM/" /etc/pam.d/${PROGRAM}
|
---|
564 | done</userinput></screen>
|
---|
565 |
|
---|
566 | <warning>
|
---|
567 | <para>
|
---|
568 | At this point, you should do a simple test to see if
|
---|
569 | <application>Shadow</application> is working as expected. Open
|
---|
570 | another terminal and log in as a user, then <command>su</command> to
|
---|
571 | <systemitem class="username">root</systemitem>. If you do not see
|
---|
572 | any errors, then all is well and you should proceed with the rest of
|
---|
573 | the configuration. If you did receive errors, stop now and double
|
---|
574 | check the above configuration files manually. You can also run the
|
---|
575 | test suite from the <application>Linux-PAM</application> package to
|
---|
576 | assist you in determining the problem. If you cannot find and fix
|
---|
577 | the error, you should recompile <application>Shadow</application>
|
---|
578 | adding the <option>--without-libpam</option> switch to the
|
---|
579 | <command>configure</command> command in the above instructions (also
|
---|
580 | move the <filename>/etc/login.defs.orig</filename> backup file to
|
---|
581 | <filename>/etc/login.defs</filename>). If you fail to do this and
|
---|
582 | the errors remain, you will be unable to log into your system.
|
---|
583 | </para>
|
---|
584 | </warning>
|
---|
585 | </sect4>
|
---|
586 |
|
---|
587 | <sect4>
|
---|
588 | <title>Other</title>
|
---|
589 |
|
---|
590 | <para>
|
---|
591 | Currently, <filename>/etc/pam.d/other</filename> is configured to
|
---|
592 | allow anyone with an account on the machine to use PAM-aware programs
|
---|
593 | without a configuration file for that program. After testing
|
---|
594 | <application>Linux-PAM</application> for proper configuration, install
|
---|
595 | a more restrictive <filename>other</filename> file so that
|
---|
596 | program-specific configuration files are required:
|
---|
597 | </para>
|
---|
598 |
|
---|
599 | <screen role="root"><userinput>cat > /etc/pam.d/other << "EOF"
|
---|
600 | <literal># Begin /etc/pam.d/other
|
---|
601 |
|
---|
602 | auth required pam_warn.so
|
---|
603 | auth required pam_deny.so
|
---|
604 | account required pam_warn.so
|
---|
605 | account required pam_deny.so
|
---|
606 | password required pam_warn.so
|
---|
607 | password required pam_deny.so
|
---|
608 | session required pam_warn.so
|
---|
609 | session required pam_deny.so
|
---|
610 |
|
---|
611 | # End /etc/pam.d/other</literal>
|
---|
612 | EOF</userinput></screen>
|
---|
613 | </sect4>
|
---|
614 |
|
---|
615 | <sect4 id="pam-access">
|
---|
616 | <title>Configuring Login Access</title>
|
---|
617 |
|
---|
618 | <para>
|
---|
619 | Instead of using the <filename>/etc/login.access</filename> file for
|
---|
620 | controlling access to the system, <application>Linux-PAM</application>
|
---|
621 | uses the <filename class='libraryfile'>pam_access.so</filename> module
|
---|
622 | along with the <filename>/etc/security/access.conf</filename> file.
|
---|
623 | Rename the <filename>/etc/login.access</filename> file using the
|
---|
624 | following command:
|
---|
625 | </para>
|
---|
626 |
|
---|
627 | <indexterm zone="shadow pam-access">
|
---|
628 | <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
|
---|
629 | </indexterm>
|
---|
630 |
|
---|
631 | <screen role="root"><userinput>[ -f /etc/login.access ] && mv -v /etc/login.access{,.NOUSE}</userinput></screen>
|
---|
632 | </sect4>
|
---|
633 |
|
---|
634 | <sect4 id="pam-limits">
|
---|
635 | <title>Configuring Resource Limits</title>
|
---|
636 |
|
---|
637 | <para>
|
---|
638 | Instead of using the <filename>/etc/limits</filename> file for
|
---|
639 | limiting usage of system resources,
|
---|
640 | <application>Linux-PAM</application> uses the
|
---|
641 | <filename class='libraryfile'>pam_limits.so</filename> module along
|
---|
642 | with the <filename>/etc/security/limits.conf</filename> file. Rename
|
---|
643 | the <filename>/etc/limits</filename> file using the following command:
|
---|
644 | </para>
|
---|
645 |
|
---|
646 | <indexterm zone="shadow pam-limits">
|
---|
647 | <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
|
---|
648 | </indexterm>
|
---|
649 |
|
---|
650 | <screen role="root"><userinput>[ -f /etc/limits ] && mv -v /etc/limits{,.NOUSE}</userinput></screen>
|
---|
651 | </sect4>
|
---|
652 | </sect3>
|
---|
653 | </sect2>
|
---|
654 |
|
---|
655 | <sect2 role="content">
|
---|
656 | <title>Contents</title>
|
---|
657 |
|
---|
658 | <para>
|
---|
659 | A list of the installed files, along with their short descriptions can be
|
---|
660 | found at <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.
|
---|
661 | </para>
|
---|
662 | </sect2>
|
---|
663 | </sect1>
|
---|