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