1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
|
---|
3 | "http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd" [
|
---|
4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
5 | %general-entities;
|
---|
6 |
|
---|
7 | <!ENTITY shadow-download-http " ">
|
---|
8 | <!ENTITY shadow-download-ftp "ftp://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2">
|
---|
9 | <!ENTITY shadow-md5sum "89ebec0d1c0d861a5bd5c4c63e5cb0cc">
|
---|
10 | <!ENTITY shadow-size "1.0 MB">
|
---|
11 | <!ENTITY shadow-buildsize "13.2 MB">
|
---|
12 | <!ENTITY shadow-time "0.31 SBU">
|
---|
13 | ]>
|
---|
14 |
|
---|
15 | <sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
|
---|
16 | <?dbhtml filename="shadow.html"?>
|
---|
17 |
|
---|
18 | <sect1info>
|
---|
19 | <othername>$LastChangedBy$</othername>
|
---|
20 | <date>$Date$</date>
|
---|
21 | </sect1info>
|
---|
22 |
|
---|
23 | <title>Shadow-&shadow-version;</title>
|
---|
24 |
|
---|
25 | <indexterm zone="shadow">
|
---|
26 | <primary sortas="a-Shadow">Shadow</primary>
|
---|
27 | </indexterm>
|
---|
28 |
|
---|
29 | <sect2 role="package">
|
---|
30 | <title>Introduction to Shadow</title>
|
---|
31 |
|
---|
32 | <para><application>Shadow</application> was indeed installed in LFS and
|
---|
33 | there is no reason to reinstall it unless you installed
|
---|
34 | <application>Linux-PAM</application>. If you did, this will allow programs
|
---|
35 | like <command>login</command> and <command>su</command> to utilize PAM.</para>
|
---|
36 |
|
---|
37 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
38 | <itemizedlist spacing="compact">
|
---|
39 | <listitem>
|
---|
40 | <para>Download (HTTP): <ulink url="&shadow-download-http;"/></para>
|
---|
41 | </listitem>
|
---|
42 | <listitem>
|
---|
43 | <para>Download (FTP): <ulink url="&shadow-download-ftp;"/></para>
|
---|
44 | </listitem>
|
---|
45 | <listitem>
|
---|
46 | <para>Download MD5 sum: &shadow-md5sum;</para>
|
---|
47 | </listitem>
|
---|
48 | <listitem>
|
---|
49 | <para>Download size: &shadow-size;</para>
|
---|
50 | </listitem>
|
---|
51 | <listitem>
|
---|
52 | <para>Estimated disk space required: &shadow-buildsize;</para>
|
---|
53 | </listitem>
|
---|
54 | <listitem>
|
---|
55 | <para>Estimated build time: &shadow-time;</para>
|
---|
56 | </listitem>
|
---|
57 | </itemizedlist>
|
---|
58 |
|
---|
59 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
60 | <itemizedlist spacing='compact'>
|
---|
61 | <listitem>
|
---|
62 | <para>Patch to fix a bug in the <command>lastlog</command> program:
|
---|
63 | <ulink url="&patch-root;/shadow-&shadow-version;-fix_lastlog-1.patch"/></para>
|
---|
64 | </listitem>
|
---|
65 | </itemizedlist>
|
---|
66 |
|
---|
67 | <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
|
---|
68 |
|
---|
69 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
70 | <para><xref linkend="Linux_PAM"/></para>
|
---|
71 |
|
---|
72 | </sect2>
|
---|
73 |
|
---|
74 | <sect2 role="installation">
|
---|
75 | <title>Installation of Shadow</title>
|
---|
76 |
|
---|
77 | <para>Reinstall <application>Shadow</application> by running the following
|
---|
78 | commands:</para>
|
---|
79 |
|
---|
80 | <screen><userinput>patch -Np1 -i ../shadow-&shadow-version;-fix_lastlog-1.patch &&
|
---|
81 | ./configure --libdir=/lib --enable-shared \
|
---|
82 | --with-libpam --without-libcrack &&
|
---|
83 | sed -i 's/groups$(EXEEXT) //' src/Makefile &&
|
---|
84 | sed -i '/groups/d' man/Makefile &&
|
---|
85 | make</userinput></screen>
|
---|
86 |
|
---|
87 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
88 |
|
---|
89 | <screen role="root"><userinput>make install &&
|
---|
90 | mv -v /usr/bin/passwd /bin &&
|
---|
91 | mv -v /lib/libshadow.*a /usr/lib &&
|
---|
92 | rm -v /lib/libshadow.so &&
|
---|
93 | ln -v -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen>
|
---|
94 |
|
---|
95 | </sect2>
|
---|
96 |
|
---|
97 | <sect2 role="commands">
|
---|
98 | <title>Command Explanations</title>
|
---|
99 |
|
---|
100 | <para><parameter>--without-libcrack</parameter>: This switch tells
|
---|
101 | <application>Shadow</application> not to use
|
---|
102 | <filename class='libraryfile'>libcrack</filename>. This is desired as
|
---|
103 | <application>Linux-PAM</application> already contains
|
---|
104 | <filename class='libraryfile'>libcrack</filename>.</para>
|
---|
105 |
|
---|
106 | <para><command>sed -i ...</command>: These commands are used to suppress
|
---|
107 | the installation of the <command>groups</command> program as the version
|
---|
108 | from the <application>Coreutils</application> package installed during
|
---|
109 | LFS is preferred.</para>
|
---|
110 |
|
---|
111 | </sect2>
|
---|
112 |
|
---|
113 | <sect2 role="configuration">
|
---|
114 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
115 |
|
---|
116 | <sect3 id="pam.d">
|
---|
117 | <title>Config Files</title>
|
---|
118 |
|
---|
119 | <para><filename>/etc/pam.d/*</filename>, or alternatively,
|
---|
120 | <filename>/etc/pam.conf</filename></para>
|
---|
121 |
|
---|
122 | <indexterm zone="shadow pam.d">
|
---|
123 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
124 | </indexterm>
|
---|
125 |
|
---|
126 | <indexterm zone="shadow pam.d">
|
---|
127 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
128 | </indexterm>
|
---|
129 |
|
---|
130 | </sect3>
|
---|
131 |
|
---|
132 | <sect3>
|
---|
133 | <title>Configuration Information</title>
|
---|
134 |
|
---|
135 | <para>Add the following <application>Linux-PAM</application> configuration
|
---|
136 | files to <filename class="directory">/etc/pam.d/</filename> (or add them
|
---|
137 | to <filename>/etc/pam.conf</filename> with the additional field for
|
---|
138 | the program).</para>
|
---|
139 |
|
---|
140 | <sect4>
|
---|
141 | <title>'login' (with Cracklib)</title>
|
---|
142 |
|
---|
143 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
144 | <literal># Begin /etc/pam.d/login
|
---|
145 |
|
---|
146 | auth requisite pam_securetty.so
|
---|
147 | auth requisite pam_nologin.so
|
---|
148 | auth required pam_env.so
|
---|
149 | auth required pam_unix.so
|
---|
150 | account required pam_access.so
|
---|
151 | account required pam_unix.so
|
---|
152 | session required pam_motd.so
|
---|
153 | session required pam_limits.so
|
---|
154 | session optional pam_mail.so dir=/var/mail standard
|
---|
155 | session optional pam_lastlog.so
|
---|
156 | session required pam_unix.so
|
---|
157 | password required pam_cracklib.so retry=3 difok=8 minlen=5 \
|
---|
158 | dcredit=3 ocredit=3 \
|
---|
159 | ucredit=2 lcredit=2
|
---|
160 | password required pam_unix.so md5 shadow use_authtok
|
---|
161 |
|
---|
162 | # End /etc/pam.d/login</literal>
|
---|
163 | EOF</userinput></screen>
|
---|
164 |
|
---|
165 | </sect4>
|
---|
166 |
|
---|
167 | <sect4>
|
---|
168 | <title>'login' (without Cracklib)</title>
|
---|
169 |
|
---|
170 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
171 | <literal># Begin /etc/pam.d/login
|
---|
172 |
|
---|
173 | auth requisite pam_securetty.so
|
---|
174 | auth requisite pam_nologin.so
|
---|
175 | auth required pam_env.so
|
---|
176 | auth required pam_unix.so
|
---|
177 | account required pam_access.so
|
---|
178 | account required pam_unix.so
|
---|
179 | session required pam_motd.so
|
---|
180 | session required pam_limits.so
|
---|
181 | session optional pam_mail.so dir=/var/mail standard
|
---|
182 | session optional pam_lastlog.so
|
---|
183 | session required pam_unix.so
|
---|
184 | password required pam_unix.so md5 shadow
|
---|
185 |
|
---|
186 | # End /etc/pam.d/login</literal>
|
---|
187 | EOF</userinput></screen>
|
---|
188 |
|
---|
189 | </sect4>
|
---|
190 |
|
---|
191 | <sect4>
|
---|
192 | <title>'passwd' (with Cracklib)</title>
|
---|
193 |
|
---|
194 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
195 | <literal># Begin /etc/pam.d/passwd
|
---|
196 |
|
---|
197 | password required pam_cracklib.so retry=3 difok=8 minlen=5 \
|
---|
198 | dcredit=3 ocredit=3 \
|
---|
199 | ucredit=2 lcredit=2
|
---|
200 | password required pam_unix.so md5 shadow use_authtok
|
---|
201 |
|
---|
202 | # End /etc/pam.d/passwd</literal>
|
---|
203 | EOF</userinput></screen>
|
---|
204 |
|
---|
205 | </sect4>
|
---|
206 |
|
---|
207 | <sect4>
|
---|
208 | <title>'passwd' (without Cracklib)</title>
|
---|
209 |
|
---|
210 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
211 | <literal># Begin /etc/pam.d/passwd
|
---|
212 |
|
---|
213 | password required pam_unix.so md5 shadow
|
---|
214 |
|
---|
215 | # End /etc/pam.d/passwd</literal>
|
---|
216 | EOF</userinput></screen>
|
---|
217 |
|
---|
218 | </sect4>
|
---|
219 |
|
---|
220 | <sect4>
|
---|
221 | <title>'su'</title>
|
---|
222 |
|
---|
223 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
224 | <literal># Begin /etc/pam.d/su
|
---|
225 |
|
---|
226 | auth sufficient pam_rootok.so
|
---|
227 | auth required pam_unix.so
|
---|
228 | account required pam_unix.so
|
---|
229 | session optional pam_mail.so dir=/var/mail standard
|
---|
230 | session required pam_unix.so
|
---|
231 |
|
---|
232 | # End /etc/pam.d/su</literal>
|
---|
233 | EOF</userinput></screen>
|
---|
234 |
|
---|
235 | </sect4>
|
---|
236 |
|
---|
237 | <sect4>
|
---|
238 | <title>'chage'</title>
|
---|
239 |
|
---|
240 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
241 | <literal># Begin /etc/pam.d/chage
|
---|
242 |
|
---|
243 | auth sufficient pam_rootok.so
|
---|
244 | auth required pam_unix.so
|
---|
245 | account required pam_unix.so
|
---|
246 | session required pam_unix.so
|
---|
247 | password required pam_permit.so
|
---|
248 |
|
---|
249 | # End /etc/pam.d/chage</literal>
|
---|
250 | EOF</userinput></screen>
|
---|
251 |
|
---|
252 | </sect4>
|
---|
253 |
|
---|
254 | <sect4>
|
---|
255 | <title>'chpasswd', 'newusers', 'groupadd', 'groupdel',
|
---|
256 | 'groupmod', 'useradd', 'userdel', and 'usermod'</title>
|
---|
257 |
|
---|
258 | <screen role="root"><userinput>for PROGRAM in chpasswd newusers groupadd groupdel \
|
---|
259 | groupmod useradd userdel usermod
|
---|
260 | do
|
---|
261 | install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
|
---|
262 | sed -i -e "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
|
---|
263 | done</userinput></screen>
|
---|
264 |
|
---|
265 | </sect4>
|
---|
266 |
|
---|
267 | <sect4>
|
---|
268 | <title>Other</title>
|
---|
269 |
|
---|
270 | <warning>
|
---|
271 | <para>At this point, you should do a simple test to see if
|
---|
272 | <application>Shadow</application> is working as expected. Open
|
---|
273 | another term and login as a user, then su to <systemitem
|
---|
274 | class="username">root</systemitem>. If you do not see any errors,
|
---|
275 | then all is well and you should proceed with the rest of the
|
---|
276 | configuration. If you did receive errors, stop now and double check
|
---|
277 | the above configuration files manually. If you cannot find, and
|
---|
278 | fix the error, you should recompile <application>Shadow</application>
|
---|
279 | replacing <option>--with-libpam</option> with
|
---|
280 | <option>--without-libpam</option> in the above instructions. If you
|
---|
281 | fail to do this and the errors remain, you will be unable to log into
|
---|
282 | your system.</para>
|
---|
283 | </warning>
|
---|
284 |
|
---|
285 | <para>Currently, <filename>/etc/pam.d/other</filename> is configured
|
---|
286 | to allow anyone with an account on the machine to use PAM-aware
|
---|
287 | programs without a configuration file for that program. After testing
|
---|
288 | <application>Linux-PAM</application> for proper configuration, install
|
---|
289 | a more restrictive <filename>other</filename> file so that
|
---|
290 | program-specific configuration files are required:</para>
|
---|
291 |
|
---|
292 | <screen role="root"><userinput>cat > /etc/pam.d/other << "EOF"
|
---|
293 | <literal># Begin /etc/pam.d/other
|
---|
294 |
|
---|
295 | auth required pam_deny.so
|
---|
296 | auth required pam_warn.so
|
---|
297 | account required pam_deny.so
|
---|
298 | session required pam_deny.so
|
---|
299 | password required pam_deny.so
|
---|
300 | password required pam_warn.so
|
---|
301 |
|
---|
302 | # End /etc/pam.d/other</literal>
|
---|
303 | EOF</userinput></screen>
|
---|
304 |
|
---|
305 | </sect4>
|
---|
306 |
|
---|
307 | <sect4 id="pam-access">
|
---|
308 | <title>Configuring Login Access</title>
|
---|
309 |
|
---|
310 | <para>Instead of using the <filename>/etc/login.access</filename>
|
---|
311 | file for controlling access to the system,
|
---|
312 | <application>Linux-PAM</application> uses the
|
---|
313 | <filename class='libraryfile'>pam_access.so</filename> module along
|
---|
314 | with the <filename>/etc/security/access.conf</filename> file. Rename
|
---|
315 | the <filename>/etc/login.access</filename> file using the following
|
---|
316 | command:</para>
|
---|
317 |
|
---|
318 | <indexterm zone="shadow pam-access">
|
---|
319 | <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
|
---|
320 | </indexterm>
|
---|
321 |
|
---|
322 | <screen role="root"><userinput>if [ -f /etc/login.access ]; then
|
---|
323 | mv -v /etc/login.access /etc/login.access.NOUSE
|
---|
324 | fi</userinput></screen>
|
---|
325 |
|
---|
326 | </sect4>
|
---|
327 |
|
---|
328 | <sect4 id="pam-limits">
|
---|
329 | <title>Configuring Resource Limits</title>
|
---|
330 |
|
---|
331 | <para>Instead of using the <filename>/etc/limits</filename> file
|
---|
332 | for limiting usage of system resources,
|
---|
333 | <application>Linux-PAM</application> uses the
|
---|
334 | <filename class='libraryfile'>pam_limits.so</filename> module along
|
---|
335 | with the <filename>/etc/security/limits.conf</filename> file. Rename
|
---|
336 | the <filename>/etc/limits</filename> file using the following
|
---|
337 | command:</para>
|
---|
338 |
|
---|
339 | <indexterm zone="shadow pam-limits">
|
---|
340 | <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
|
---|
341 | </indexterm>
|
---|
342 |
|
---|
343 | <screen role="root"><userinput>if [ -f /etc/limits ]; then
|
---|
344 | mv -v /etc/limits /etc/limits.NOUSE
|
---|
345 | fi</userinput></screen>
|
---|
346 |
|
---|
347 | </sect4>
|
---|
348 |
|
---|
349 | <sect4 id="pam-login-defs">
|
---|
350 | <title>Configuring /etc/login.defs</title>
|
---|
351 |
|
---|
352 | <para>The <command>login</command> program currently performs many
|
---|
353 | functions which <application>Linux-PAM</application> modules should
|
---|
354 | now handle. The following command will comment out the appropriate
|
---|
355 | lines in <filename>/etc/login.defs</filename>, and stop
|
---|
356 | <command>login</command> from performing these functions:</para>
|
---|
357 |
|
---|
358 | <indexterm zone="shadow pam-login-defs">
|
---|
359 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
360 | </indexterm>
|
---|
361 |
|
---|
362 | <screen role="root"><userinput>for FUNCTION in LASTLOG_ENAB MAIL_CHECK_ENAB \
|
---|
363 | PORTTIME_CHECKS_ENAB CONSOLE \
|
---|
364 | MOTD_FILE NOLOGINS_FILE PASS_MIN_LEN \
|
---|
365 | SU_WHEEL_ONLY MD5_CRYPT_ENAB \
|
---|
366 | CONSOLE_GROUPS ENVIRON_FILE
|
---|
367 | do
|
---|
368 | sed -i -e "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
369 | done</userinput></screen>
|
---|
370 |
|
---|
371 | <para>If you have <application>cracklib</application> installed,
|
---|
372 | also comment out four more lines using the following command:</para>
|
---|
373 |
|
---|
374 | <screen role="root"><userinput>for FUNCTION in OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
|
---|
375 | PASS_CHANGE_TRIES PASS_ALWAYS_WARN
|
---|
376 | do
|
---|
377 | sed -i -e "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
378 | done</userinput></screen>
|
---|
379 |
|
---|
380 | </sect4>
|
---|
381 |
|
---|
382 | </sect3>
|
---|
383 |
|
---|
384 | </sect2>
|
---|
385 |
|
---|
386 | <sect2 role="content">
|
---|
387 | <title>Contents</title>
|
---|
388 |
|
---|
389 | <para>A list of the installed files, along with their short descriptions
|
---|
390 | can be found at
|
---|
391 | <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.</para>
|
---|
392 |
|
---|
393 | </sect2>
|
---|
394 |
|
---|
395 | </sect1>
|
---|