[b4b71892] | 1 | <?xml version="1.0" encoding="ISO-8859-1"?>
|
---|
[6732c094] | 2 | <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
|
---|
| 3 | "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
|
---|
[b4b71892] | 4 | <!ENTITY % general-entities SYSTEM "../../general.ent">
|
---|
| 5 | %general-entities;
|
---|
[17fb537e] | 6 |
|
---|
[e807ae1d] | 7 | <!-- <!ENTITY shadow-download-http "http://ftp.pld.org.pl/software/shadow/old/shadow-&shadow-version;.tar.bz2"> -->
|
---|
| 8 | <!ENTITY shadow-download-http "http://cross-lfs.org/files/packages/svn/shadow-&shadow-version;.tar.bz2">
|
---|
| 9 | <!ENTITY shadow-download-ftp "ftp://ftp.pld.org.pl/software/shadow/shadow-&shadow-version;.tar.bz2">
|
---|
| 10 | <!ENTITY shadow-md5sum "e7751d46ecf219c07ae0b028ab3335c6">
|
---|
| 11 | <!ENTITY shadow-size "1.5 MB">
|
---|
| 12 | <!ENTITY shadow-buildsize "18 MB">
|
---|
[349b53dd] | 13 | <!ENTITY shadow-time "0.3 SBU">
|
---|
[b4b71892] | 14 | ]>
|
---|
| 15 |
|
---|
[17fb537e] | 16 | <sect1 id="shadow" xreflabel="Shadow-&shadow-version;">
|
---|
[322f172] | 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><application>Shadow</application> was indeed installed in LFS and
|
---|
| 34 | there is no reason to reinstall it unless you installed
|
---|
[c6bdcb0] | 35 | <application>CrackLib</application> or
|
---|
| 36 | <application>Linux-PAM</application> after your LFS system was completed.
|
---|
| 37 | If you have installed <application>CrackLib</application> after LFS, then
|
---|
| 38 | reinstalling <application>Shadow</application> will enable strong password
|
---|
| 39 | support. If you have installed <application>Linux-PAM</application>,
|
---|
| 40 | reinstalling <application>Shadow</application> will allow programs such as
|
---|
[d8684cbc] | 41 | <command>login</command> and <command>su</command> to utilize PAM.</para>
|
---|
[322f172] | 42 |
|
---|
| 43 | <bridgehead renderas="sect3">Package Information</bridgehead>
|
---|
| 44 | <itemizedlist spacing="compact">
|
---|
| 45 | <listitem>
|
---|
| 46 | <para>Download (HTTP): <ulink url="&shadow-download-http;"/></para>
|
---|
| 47 | </listitem>
|
---|
| 48 | <listitem>
|
---|
| 49 | <para>Download (FTP): <ulink url="&shadow-download-ftp;"/></para>
|
---|
| 50 | </listitem>
|
---|
| 51 | <listitem>
|
---|
| 52 | <para>Download MD5 sum: &shadow-md5sum;</para>
|
---|
| 53 | </listitem>
|
---|
| 54 | <listitem>
|
---|
| 55 | <para>Download size: &shadow-size;</para>
|
---|
| 56 | </listitem>
|
---|
| 57 | <listitem>
|
---|
| 58 | <para>Estimated disk space required: &shadow-buildsize;</para>
|
---|
| 59 | </listitem>
|
---|
| 60 | <listitem>
|
---|
| 61 | <para>Estimated build time: &shadow-time;</para>
|
---|
| 62 | </listitem>
|
---|
| 63 | </itemizedlist>
|
---|
| 64 |
|
---|
| 65 | <bridgehead renderas="sect3">Additional Downloads</bridgehead>
|
---|
| 66 | <itemizedlist spacing='compact'>
|
---|
| 67 | <listitem>
|
---|
[d8684cbc] | 68 | <para>Required patch: <ulink
|
---|
[e807ae1d] | 69 | url="&patch-root;/shadow-&shadow-version;-useradd_fix-2.patch"/></para>
|
---|
[322f172] | 70 | </listitem>
|
---|
| 71 | </itemizedlist>
|
---|
| 72 |
|
---|
| 73 | <bridgehead renderas="sect3">Shadow Dependencies</bridgehead>
|
---|
| 74 |
|
---|
| 75 | <bridgehead renderas="sect4">Required</bridgehead>
|
---|
[c6bdcb0] | 76 | <para role="required"><xref linkend="linux-pam"/> and/or
|
---|
| 77 | <xref linkend="cracklib"/></para>
|
---|
[322f172] | 78 |
|
---|
[3597eb6] | 79 | <para condition="html" role="usernotes">User Notes:
|
---|
| 80 | <ulink url="&blfs-wiki;/shadow"/></para>
|
---|
| 81 |
|
---|
[322f172] | 82 | </sect2>
|
---|
| 83 |
|
---|
| 84 | <sect2 role="installation">
|
---|
| 85 | <title>Installation of Shadow</title>
|
---|
| 86 |
|
---|
[c6bdcb0] | 87 | <important>
|
---|
| 88 | <para>The installation shown below is for a situation where
|
---|
| 89 | <application>Linux-PAM</application> has been installed (with or
|
---|
| 90 | without a <application>CrackLib</application> installation) and
|
---|
| 91 | <application>Shadow</application> is being reinstalled to support the
|
---|
| 92 | <application>Linux-PAM</application> installation. If you are
|
---|
| 93 | reinstalling <application>Shadow</application> to provide strong
|
---|
| 94 | password support via the <application>CrackLib</application> library
|
---|
| 95 | and you have not installed <application>Linux-PAM</application>, ensure
|
---|
[8f68b03] | 96 | you add the <parameter>--with-libcrack</parameter> parameter to the
|
---|
| 97 | <command>configure</command> script below.</para>
|
---|
[c6bdcb0] | 98 | </important>
|
---|
| 99 |
|
---|
[322f172] | 100 | <para>Reinstall <application>Shadow</application> by running the following
|
---|
| 101 | commands:</para>
|
---|
| 102 |
|
---|
[e807ae1d] | 103 | <screen><userinput>patch -Np1 -i ../shadow-&shadow-version;-useradd_fix-2.patch &&
|
---|
| 104 |
|
---|
| 105 | ./configure --libdir=/lib \
|
---|
[71e9f62] | 106 | --sysconfdir=/etc \
|
---|
[8f68b03] | 107 | --enable-shared \
|
---|
| 108 | --without-selinux &&
|
---|
[e807ae1d] | 109 |
|
---|
[4fcf20a5] | 110 | sed -i 's/groups$(EXEEXT) //' src/Makefile &&
|
---|
[e807ae1d] | 111 | find man -name Makefile -exec sed -i 's/groups\.1 / /' {} \; &&
|
---|
[71e9f62] | 112 | sed -i -e 's/ ko//' -e 's/ zh_CN zh_TW//' man/Makefile &&
|
---|
[8f68b03] | 113 |
|
---|
| 114 | for i in de es fi fr id it pt_BR; do
|
---|
| 115 | convert-mans UTF-8 ISO-8859-1 man/${i}/*.?
|
---|
| 116 | done &&
|
---|
| 117 |
|
---|
| 118 | for i in cs hu pl; do
|
---|
| 119 | convert-mans UTF-8 ISO-8859-2 man/${i}/*.?
|
---|
| 120 | done &&
|
---|
| 121 |
|
---|
| 122 | convert-mans UTF-8 EUC-JP man/ja/*.? &&
|
---|
| 123 | convert-mans UTF-8 KOI8-R man/ru/*.? &&
|
---|
| 124 | convert-mans UTF-8 ISO-8859-9 man/tr/*.? &&
|
---|
| 125 |
|
---|
[322f172] | 126 | make</userinput></screen>
|
---|
[17fb537e] | 127 |
|
---|
[31f3a57] | 128 | <para>This package does not come with a test suite.</para>
|
---|
| 129 |
|
---|
[322f172] | 130 | <para>Now, as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[17fb537e] | 131 |
|
---|
[322f172] | 132 | <screen role="root"><userinput>make install &&
|
---|
[4fcf20a5] | 133 | mv -v /usr/bin/passwd /bin &&
|
---|
| 134 | mv -v /lib/libshadow.*a /usr/lib &&
|
---|
| 135 | rm -v /lib/libshadow.so &&
|
---|
[322f172] | 136 | ln -v -sf ../../lib/libshadow.so.0 /usr/lib/libshadow.so</userinput></screen>
|
---|
[b4b71892] | 137 |
|
---|
[322f172] | 138 | </sect2>
|
---|
[b4b71892] | 139 |
|
---|
[322f172] | 140 | <sect2 role="commands">
|
---|
| 141 | <title>Command Explanations</title>
|
---|
[b4b71892] | 142 |
|
---|
[8f68b03] | 143 | <!-- Removed the -with-libpam and -without-libcrack options from the
|
---|
| 144 | default as these are the defaults. Pam will automatically be picked
|
---|
| 145 | up if it is installed, and CrackLib won't be used unless specifically
|
---|
| 146 | requested via -with-libcrack
|
---|
| 147 | <para><parameter>-without-libcrack</parameter>: This switch tells
|
---|
[322f172] | 148 | <application>Shadow</application> not to use
|
---|
| 149 | <filename class='libraryfile'>libcrack</filename>. This is desired as
|
---|
[d8684cbc] | 150 | <application>Linux-PAM</application> will provide
|
---|
| 151 | <filename class='libraryfile'>libcrack</filename> functionality.</para>
|
---|
[8f68b03] | 152 | -->
|
---|
| 153 |
|
---|
| 154 | <para><parameter>--without-selinux</parameter>: Support for selinux is
|
---|
| 155 | enabled by default, but selinux is not built in a base LFS system. The
|
---|
| 156 | <command>configure</command> script will fail if this option is not
|
---|
| 157 | used.</para>
|
---|
| 158 |
|
---|
| 159 | <para><command>sed -i 's/groups$(EXEEXT) //' src/Makefile</command>: This
|
---|
| 160 | command is used to suppress the installation of the
|
---|
| 161 | <command>groups</command> program as the version from the
|
---|
| 162 | <application>Coreutils</application> package installed during LFS is
|
---|
| 163 | preferred.</para>
|
---|
| 164 |
|
---|
| 165 | <para><command>find man -name Makefile -exec ... {} \;</command>: This
|
---|
| 166 | command is used to suppress the installation of the
|
---|
| 167 | <command>groups</command> man pages so the existing ones installed from
|
---|
| 168 | the <application>Coreutils</application> package are not replaced.</para>
|
---|
| 169 |
|
---|
| 170 | <para><command>sed -i -e '...' -e '...' man/Makefile</command>: This
|
---|
| 171 | command disables the installation of Chinese and Korean manual pages, since
|
---|
| 172 | <application>Man-DB</application> cannot format them properly.</para>
|
---|
| 173 |
|
---|
| 174 | <para><command>convert-mans ...</command>: These commands are used to
|
---|
| 175 | convert some of the man pages so that <application>Man-DB</application>
|
---|
[98fa7cc0] | 176 | will display them in the expected encodings.</para>
|
---|
[8f68b03] | 177 |
|
---|
| 178 | <para><command>mv -v /usr/bin/passwd /bin</command>: The
|
---|
| 179 | <command>passwd</command> program may be needed during times when the
|
---|
| 180 | <filename class='directory'>/usr</filename> filesystem is not mounted so
|
---|
| 181 | it is moved into the root partition.</para>
|
---|
| 182 |
|
---|
| 183 | <para><command>mv -v ...; rm -v ...; ln -v ...</command>: These commands
|
---|
| 184 | are used to move the <filename class='libraryfile'>libshadow</filename>
|
---|
| 185 | library to the root partition to support the moving of the
|
---|
| 186 | <command>passwd</command> program earlier.</para>
|
---|
[39975e9] | 187 |
|
---|
[322f172] | 188 | </sect2>
|
---|
[b4b71892] | 189 |
|
---|
[e807ae1d] | 190 | <sect2 role="configuration">
|
---|
| 191 | <title>Configuring Shadow</title>
|
---|
| 192 |
|
---|
| 193 | <para><application>Shadow</application>'s stock configuration for the
|
---|
| 194 | <command>useradd</command> utility is not suitable for LFS systems. Use the
|
---|
| 195 | following commands as the <systemitem class="username">root</systemitem>
|
---|
| 196 | user to change the default home directory for new users and prevent the
|
---|
| 197 | creation of mail spool files:</para>
|
---|
| 198 |
|
---|
| 199 | <screen role="root"><userinput>useradd -D -b /home &&
|
---|
| 200 | sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
|
---|
| 201 |
|
---|
| 202 | </sect2>
|
---|
| 203 |
|
---|
[322f172] | 204 | <sect2 role="configuration">
|
---|
| 205 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
[b4b71892] | 206 |
|
---|
[8f68b03] | 207 | <note>
|
---|
[eb2eccc] | 208 | <para>The rest of this page is devoted to configuring
|
---|
[8f68b03] | 209 | <application>Shadow</application> to work properly with
|
---|
| 210 | <application>Linux-PAM</application>. If you do not have
|
---|
| 211 | <application>Linux-PAM</application> installed, and you reinstalled
|
---|
| 212 | <application>Shadow</application> to support strong passwords via
|
---|
| 213 | the <application>CrackLib</application> library, no further configuration
|
---|
| 214 | is required.</para>
|
---|
| 215 | </note>
|
---|
| 216 |
|
---|
[322f172] | 217 | <sect3 id="pam.d">
|
---|
| 218 | <title>Config Files</title>
|
---|
[b4b71892] | 219 |
|
---|
[1ba671c] | 220 | <para><filename>/etc/pam.d/*</filename> or alternatively
|
---|
| 221 | <filename>/etc/pam.conf, /etc/login.defs and
|
---|
| 222 | /etc/security/*</filename></para>
|
---|
[b4b71892] | 223 |
|
---|
[322f172] | 224 | <indexterm zone="shadow pam.d">
|
---|
| 225 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
| 226 | </indexterm>
|
---|
[2197589] | 227 |
|
---|
[322f172] | 228 | <indexterm zone="shadow pam.d">
|
---|
| 229 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
| 230 | </indexterm>
|
---|
[4fcf20a5] | 231 |
|
---|
[1ba671c] | 232 | <indexterm zone="shadow pam.d">
|
---|
| 233 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 234 | </indexterm>
|
---|
| 235 |
|
---|
| 236 | <indexterm zone="shadow pam.d">
|
---|
| 237 | <primary sortas="e-etc-security">/etc/security/*</primary>
|
---|
| 238 | </indexterm>
|
---|
| 239 |
|
---|
[322f172] | 240 | </sect3>
|
---|
| 241 |
|
---|
| 242 | <sect3>
|
---|
| 243 | <title>Configuration Information</title>
|
---|
| 244 |
|
---|
[8f68b03] | 245 | <para>Configuring your system to use <application>Linux-PAM</application>
|
---|
| 246 | can be a complex task. The information below will provide a basic setup
|
---|
| 247 | so that <application>Shadow</application>'s login and password
|
---|
| 248 | functionality will work effectively with
|
---|
| 249 | <application>Linux-PAM</application>. Review the information and links on
|
---|
| 250 | the <xref linkend="linux-pam"/> page for further configuration
|
---|
| 251 | information. For information specific to integrating
|
---|
| 252 | <application>Shadow</application>, <application>Linux-PAM</application>
|
---|
| 253 | and <application>CrackLib</application>, you can visit the following
|
---|
| 254 | links:</para>
|
---|
| 255 |
|
---|
| 256 | <itemizedlist spacing="compact">
|
---|
| 257 | <listitem>
|
---|
| 258 | <para><ulink
|
---|
| 259 | url="http://www.kernel.org/pub/linux/libs/pam/Linux-PAM-html/pam-6.html#ss6.3"/></para>
|
---|
| 260 | </listitem>
|
---|
| 261 | <listitem>
|
---|
| 262 | <para><ulink
|
---|
| 263 | url="http://www.deer-run.com/~hal/sysadmin/pam_cracklib.html"/></para>
|
---|
| 264 | </listitem>
|
---|
| 265 | </itemizedlist>
|
---|
| 266 |
|
---|
[1ba671c] | 267 | <sect4 id="pam-login-defs">
|
---|
| 268 | <title>Configuring /etc/login.defs</title>
|
---|
| 269 |
|
---|
| 270 | <para>The <command>login</command> program currently performs many
|
---|
| 271 | functions which <application>Linux-PAM</application> modules should
|
---|
| 272 | now handle. The following <command>sed</command> command will comment
|
---|
| 273 | out the appropriate lines in <filename>/etc/login.defs</filename>, and
|
---|
| 274 | stop <command>login</command> from performing these functions (a backup
|
---|
| 275 | file named <filename>/etc/login.defs.orig</filename> is also created
|
---|
[d8684cbc] | 276 | to preserve the original file's contents). Issue the following commands
|
---|
| 277 | as the <systemitem class="username">root</systemitem> user:</para>
|
---|
[1ba671c] | 278 |
|
---|
| 279 | <indexterm zone="shadow pam-login-defs">
|
---|
| 280 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 281 | </indexterm>
|
---|
| 282 |
|
---|
| 283 | <screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &&
|
---|
| 284 | for FUNCTION in LASTLOG_ENAB MAIL_CHECK_ENAB \
|
---|
| 285 | PORTTIME_CHECKS_ENAB CONSOLE \
|
---|
| 286 | MOTD_FILE NOLOGINS_FILE PASS_MIN_LEN \
|
---|
| 287 | SU_WHEEL_ONLY MD5_CRYPT_ENAB \
|
---|
| 288 | CONSOLE_GROUPS ENVIRON_FILE \
|
---|
| 289 | ULIMIT ENV_TZ ENV_HZ ENV_SUPATH \
|
---|
| 290 | ENV_PATH QMAIL_DIR MAIL_DIR MAIL_FILE \
|
---|
[8f68b03] | 291 | CHFN_AUTH FAILLOG_ENAB QUOTAS_ENAB FTMP_FILE \
|
---|
| 292 | OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
|
---|
[71e9f62] | 293 | PASS_CHANGE_TRIES PASS_ALWAYS_WARN ISSUE_FILE
|
---|
[1ba671c] | 294 | do
|
---|
[d8684cbc] | 295 | sed -i "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
[1ba671c] | 296 | done</userinput></screen>
|
---|
| 297 |
|
---|
[8f68b03] | 298 | <!-- Moved the commenting of these four parameters into the section
|
---|
| 299 | above. If PAM is installed, it complains if these are not commented
|
---|
| 300 | regardless if CrackLib is installed.
|
---|
| 301 |
|
---|
[1ba671c] | 302 | <para>If you have <application>CrackLib</application> installed,
|
---|
[d8684cbc] | 303 | also comment out four more lines using the following command as the
|
---|
| 304 | <systemitem class="username">root</systemitem> user:</para>
|
---|
[1ba671c] | 305 |
|
---|
| 306 | <screen role="root"><userinput>for FUNCTION in OBSCURE_CHECKS_ENAB CRACKLIB_DICTPATH \
|
---|
| 307 | PASS_CHANGE_TRIES PASS_ALWAYS_WARN
|
---|
| 308 | do
|
---|
[d8684cbc] | 309 | sed -i "s/^$FUNCTION/# &/" /etc/login.defs
|
---|
[1ba671c] | 310 | done</userinput></screen>
|
---|
| 311 |
|
---|
[8f68b03] | 312 | -->
|
---|
| 313 |
|
---|
[1ba671c] | 314 | </sect4>
|
---|
| 315 |
|
---|
| 316 | <sect4>
|
---|
| 317 | <title>Configuring the /etc/pam.d/ Files</title>
|
---|
| 318 |
|
---|
[29f80ebc] | 319 | <para>As mentioned previously in the
|
---|
| 320 | <application>Linux-PAM</application> instructions,
|
---|
| 321 | <application>Linux-PAM</application> has two supported methods for
|
---|
| 322 | configuration. The commands below assume that you've chosen to use
|
---|
| 323 | a directory based configuration, where each program has its own
|
---|
[eb2eccc] | 324 | configuration file. You can optionally use a single
|
---|
[29f80ebc] | 325 | <filename>/etc/pam.conf</filename> configuration file by using the
|
---|
| 326 | text from the files below, and supplying the program name as an
|
---|
[eb2eccc] | 327 | additional first field for each line.</para>
|
---|
| 328 |
|
---|
| 329 | <para>As the <systemitem class="username">root</systemitem> user,
|
---|
| 330 | create the <filename class="directory">/etc/pam.d</filename>
|
---|
| 331 | directory with the following command:</para>
|
---|
| 332 |
|
---|
[4c31e6de] | 333 | <screen role="root"><userinput>install -v -d -m755 /etc/pam.d</userinput></screen>
|
---|
[eb2eccc] | 334 |
|
---|
[29f80ebc] | 335 | <para>While still the <systemitem class="username">root</systemitem>
|
---|
| 336 | user, add the following <application>Linux-PAM</application>
|
---|
[eb2eccc] | 337 | configuration files to the
|
---|
[29f80ebc] | 338 | <filename class="directory">/etc/pam.d/</filename> directory (or
|
---|
| 339 | add the contents to the <filename>/etc/pam.conf</filename> file) with
|
---|
[eb2eccc] | 340 | the following commands:</para>
|
---|
[1ba671c] | 341 |
|
---|
| 342 | </sect4>
|
---|
[322f172] | 343 |
|
---|
| 344 | <sect4>
|
---|
[974951c] | 345 | <title>'login' (with CrackLib)</title>
|
---|
[322f172] | 346 |
|
---|
| 347 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 348 | <literal># Begin /etc/pam.d/login
|
---|
[4fcf20a5] | 349 |
|
---|
| 350 | auth requisite pam_nologin.so
|
---|
[e807ae1d] | 351 | auth required pam_securetty.so
|
---|
[4fcf20a5] | 352 | auth required pam_unix.so
|
---|
| 353 | account required pam_access.so
|
---|
| 354 | account required pam_unix.so
|
---|
[7fb0e285] | 355 | session required pam_env.so
|
---|
[4fcf20a5] | 356 | session required pam_motd.so
|
---|
| 357 | session required pam_limits.so
|
---|
| 358 | session optional pam_mail.so dir=/var/mail standard
|
---|
| 359 | session optional pam_lastlog.so
|
---|
| 360 | session required pam_unix.so
|
---|
[c0c33269] | 361 | password required pam_cracklib.so retry=3
|
---|
[4fcf20a5] | 362 | password required pam_unix.so md5 shadow use_authtok
|
---|
| 363 |
|
---|
[322f172] | 364 | # End /etc/pam.d/login</literal>
|
---|
| 365 | EOF</userinput></screen>
|
---|
| 366 |
|
---|
| 367 | </sect4>
|
---|
[4fcf20a5] | 368 |
|
---|
[322f172] | 369 | <sect4>
|
---|
[974951c] | 370 | <title>'login' (without CrackLib)</title>
|
---|
[4fcf20a5] | 371 |
|
---|
[322f172] | 372 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 373 | <literal># Begin /etc/pam.d/login
|
---|
[b4b71892] | 374 |
|
---|
| 375 | auth requisite pam_nologin.so
|
---|
[e807ae1d] | 376 | auth required pam_securetty.so
|
---|
[b4b71892] | 377 | auth required pam_env.so
|
---|
| 378 | auth required pam_unix.so
|
---|
| 379 | account required pam_access.so
|
---|
| 380 | account required pam_unix.so
|
---|
| 381 | session required pam_motd.so
|
---|
| 382 | session required pam_limits.so
|
---|
[4fcf20a5] | 383 | session optional pam_mail.so dir=/var/mail standard
|
---|
[b4b71892] | 384 | session optional pam_lastlog.so
|
---|
| 385 | session required pam_unix.so
|
---|
[4fcf20a5] | 386 | password required pam_unix.so md5 shadow
|
---|
[b4b71892] | 387 |
|
---|
[322f172] | 388 | # End /etc/pam.d/login</literal>
|
---|
| 389 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 390 |
|
---|
[322f172] | 391 | </sect4>
|
---|
[4fcf20a5] | 392 |
|
---|
[322f172] | 393 | <sect4>
|
---|
[974951c] | 394 | <title>'passwd' (with CrackLib)</title>
|
---|
[322f172] | 395 |
|
---|
| 396 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 397 | <literal># Begin /etc/pam.d/passwd
|
---|
[b4b71892] | 398 |
|
---|
[c0c33269] | 399 | password required pam_cracklib.so type=Linux retry=1 \
|
---|
| 400 | difok=5 diffignore=23 minlen=9 \
|
---|
| 401 | dcredit=1 ucredit=1 lcredit=1 \
|
---|
| 402 | ocredit=1 \
|
---|
| 403 | dictpath=/lib/cracklib/pw_dict
|
---|
[4fcf20a5] | 404 | password required pam_unix.so md5 shadow use_authtok
|
---|
[b4b71892] | 405 |
|
---|
[322f172] | 406 | # End /etc/pam.d/passwd</literal>
|
---|
| 407 | EOF</userinput></screen>
|
---|
| 408 |
|
---|
[c0c33269] | 409 | <note><para>In its default configuration, owing to credits,
|
---|
| 410 | pam_cracklib will allow multiple case passwords as short as 6
|
---|
| 411 | characters, even with the <parameter>minlen</parameter> value
|
---|
| 412 | set to 11. You should review the pam_cracklib(8) man page and
|
---|
| 413 | determine if these default values are acceptable for the security
|
---|
| 414 | of your system.</para></note>
|
---|
| 415 |
|
---|
[322f172] | 416 | </sect4>
|
---|
[b4b71892] | 417 |
|
---|
[322f172] | 418 | <sect4>
|
---|
[974951c] | 419 | <title>'passwd' (without CrackLib)</title>
|
---|
[4fcf20a5] | 420 |
|
---|
[322f172] | 421 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 422 | <literal># Begin /etc/pam.d/passwd
|
---|
[4fcf20a5] | 423 |
|
---|
| 424 | password required pam_unix.so md5 shadow
|
---|
[b4b71892] | 425 |
|
---|
[322f172] | 426 | # End /etc/pam.d/passwd</literal>
|
---|
| 427 | EOF</userinput></screen>
|
---|
| 428 |
|
---|
| 429 | </sect4>
|
---|
[4fcf20a5] | 430 |
|
---|
[322f172] | 431 | <sect4>
|
---|
| 432 | <title>'su'</title>
|
---|
[4fcf20a5] | 433 |
|
---|
[322f172] | 434 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
| 435 | <literal># Begin /etc/pam.d/su
|
---|
[b4b71892] | 436 |
|
---|
| 437 | auth sufficient pam_rootok.so
|
---|
| 438 | auth required pam_unix.so
|
---|
| 439 | account required pam_unix.so
|
---|
[4fcf20a5] | 440 | session optional pam_mail.so dir=/var/mail standard
|
---|
[7fb0e285] | 441 | session required pam_env.so
|
---|
[b4b71892] | 442 | session required pam_unix.so
|
---|
| 443 |
|
---|
[322f172] | 444 | # End /etc/pam.d/su</literal>
|
---|
| 445 | EOF</userinput></screen>
|
---|
[b4b71892] | 446 |
|
---|
[322f172] | 447 | </sect4>
|
---|
[b4b71892] | 448 |
|
---|
[322f172] | 449 | <sect4>
|
---|
| 450 | <title>'chage'</title>
|
---|
| 451 |
|
---|
| 452 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
| 453 | <literal># Begin /etc/pam.d/chage
|
---|
[b4b71892] | 454 |
|
---|
| 455 | auth sufficient pam_rootok.so
|
---|
| 456 | auth required pam_unix.so
|
---|
| 457 | account required pam_unix.so
|
---|
| 458 | session required pam_unix.so
|
---|
| 459 | password required pam_permit.so
|
---|
| 460 |
|
---|
[322f172] | 461 | # End /etc/pam.d/chage</literal>
|
---|
| 462 | EOF</userinput></screen>
|
---|
| 463 |
|
---|
| 464 | </sect4>
|
---|
[b4b71892] | 465 |
|
---|
[322f172] | 466 | <sect4>
|
---|
[e807ae1d] | 467 | <title>'chpasswd', 'chgpasswd', 'groupadd', 'groupdel', 'groupmems',
|
---|
| 468 | 'groupmod', 'newusers', 'useradd', 'userdel', and 'usermod'</title>
|
---|
[39975e9] | 469 |
|
---|
[e807ae1d] | 470 | <screen role="root"><userinput>for PROGRAM in chpasswd chgpasswd groupadd groupdel groupmems \
|
---|
| 471 | groupmod newusers useradd userdel usermod
|
---|
[4fcf20a5] | 472 | do
|
---|
[904f31e2] | 473 | install -v -m644 /etc/pam.d/chage /etc/pam.d/$PROGRAM
|
---|
[d8684cbc] | 474 | sed -i "s/chage/$PROGRAM/" /etc/pam.d/$PROGRAM
|
---|
[322f172] | 475 | done</userinput></screen>
|
---|
| 476 |
|
---|
| 477 | <warning>
|
---|
| 478 | <para>At this point, you should do a simple test to see if
|
---|
| 479 | <application>Shadow</application> is working as expected. Open
|
---|
[1ba671c] | 480 | another terminal and log in as a user, then <command>su</command> to
|
---|
[974951c] | 481 | <systemitem class="username">root</systemitem>. If you do not see any
|
---|
| 482 | errors, then all is well and you should proceed with the rest of the
|
---|
[322f172] | 483 | configuration. If you did receive errors, stop now and double check
|
---|
[b65246b] | 484 | the above configuration files manually. You can also run the test
|
---|
| 485 | suite from the <application>Linux-PAM</application> package to assist
|
---|
| 486 | you in determining the problem. If you cannot find and
|
---|
[322f172] | 487 | fix the error, you should recompile <application>Shadow</application>
|
---|
| 488 | replacing <option>--with-libpam</option> with
|
---|
[1ba671c] | 489 | <option>--without-libpam</option> in the above instructions (also move
|
---|
| 490 | the <filename>/etc/login.defs.orig</filename> backup file to
|
---|
| 491 | <filename>/etc/login.defs</filename>). If you
|
---|
[322f172] | 492 | fail to do this and the errors remain, you will be unable to log into
|
---|
| 493 | your system.</para>
|
---|
| 494 | </warning>
|
---|
| 495 |
|
---|
[349b53dd] | 496 | </sect4>
|
---|
| 497 |
|
---|
| 498 | <sect4>
|
---|
| 499 | <title>Other</title>
|
---|
| 500 |
|
---|
[322f172] | 501 | <para>Currently, <filename>/etc/pam.d/other</filename> is configured
|
---|
| 502 | to allow anyone with an account on the machine to use PAM-aware
|
---|
| 503 | programs without a configuration file for that program. After testing
|
---|
| 504 | <application>Linux-PAM</application> for proper configuration, install
|
---|
| 505 | a more restrictive <filename>other</filename> file so that
|
---|
| 506 | program-specific configuration files are required:</para>
|
---|
| 507 |
|
---|
| 508 | <screen role="root"><userinput>cat > /etc/pam.d/other << "EOF"
|
---|
| 509 | <literal># Begin /etc/pam.d/other
|
---|
[b4b71892] | 510 |
|
---|
| 511 | auth required pam_deny.so
|
---|
| 512 | auth required pam_warn.so
|
---|
| 513 | account required pam_deny.so
|
---|
| 514 | session required pam_deny.so
|
---|
| 515 | password required pam_deny.so
|
---|
| 516 | password required pam_warn.so
|
---|
| 517 |
|
---|
[322f172] | 518 | # End /etc/pam.d/other</literal>
|
---|
| 519 | EOF</userinput></screen>
|
---|
[4fcf20a5] | 520 |
|
---|
[b65246b] | 521 | <para>If you preserved the source tree from the
|
---|
| 522 | <application>Linux-PAM</application> package (or you feel like unpacking
|
---|
| 523 | that tarball, then running <command>configure</command> and
|
---|
| 524 | <command>make</command>), now would be a good time to run the test
|
---|
| 525 | suite from this package. This test suite will use the configuration you
|
---|
| 526 | just finished during the tests. All the tests should pass.</para>
|
---|
| 527 |
|
---|
[322f172] | 528 | </sect4>
|
---|
[4fcf20a5] | 529 |
|
---|
[322f172] | 530 | <sect4 id="pam-access">
|
---|
| 531 | <title>Configuring Login Access</title>
|
---|
[4fcf20a5] | 532 |
|
---|
[322f172] | 533 | <para>Instead of using the <filename>/etc/login.access</filename>
|
---|
| 534 | file for controlling access to the system,
|
---|
| 535 | <application>Linux-PAM</application> uses the
|
---|
| 536 | <filename class='libraryfile'>pam_access.so</filename> module along
|
---|
| 537 | with the <filename>/etc/security/access.conf</filename> file. Rename
|
---|
| 538 | the <filename>/etc/login.access</filename> file using the following
|
---|
| 539 | command:</para>
|
---|
| 540 |
|
---|
| 541 | <indexterm zone="shadow pam-access">
|
---|
| 542 | <primary sortas="e-etc-security-access.conf">/etc/security/access.conf</primary>
|
---|
| 543 | </indexterm>
|
---|
| 544 |
|
---|
| 545 | <screen role="root"><userinput>if [ -f /etc/login.access ]; then
|
---|
[4fcf20a5] | 546 | mv -v /etc/login.access /etc/login.access.NOUSE
|
---|
[322f172] | 547 | fi</userinput></screen>
|
---|
| 548 |
|
---|
| 549 | </sect4>
|
---|
| 550 |
|
---|
| 551 | <sect4 id="pam-limits">
|
---|
| 552 | <title>Configuring Resource Limits</title>
|
---|
| 553 |
|
---|
| 554 | <para>Instead of using the <filename>/etc/limits</filename> file
|
---|
| 555 | for limiting usage of system resources,
|
---|
| 556 | <application>Linux-PAM</application> uses the
|
---|
| 557 | <filename class='libraryfile'>pam_limits.so</filename> module along
|
---|
| 558 | with the <filename>/etc/security/limits.conf</filename> file. Rename
|
---|
| 559 | the <filename>/etc/limits</filename> file using the following
|
---|
| 560 | command:</para>
|
---|
| 561 |
|
---|
| 562 | <indexterm zone="shadow pam-limits">
|
---|
| 563 | <primary sortas="e-etc-security-limits.conf">/etc/security/limits.conf</primary>
|
---|
| 564 | </indexterm>
|
---|
| 565 |
|
---|
| 566 | <screen role="root"><userinput>if [ -f /etc/limits ]; then
|
---|
[4fcf20a5] | 567 | mv -v /etc/limits /etc/limits.NOUSE
|
---|
[322f172] | 568 | fi</userinput></screen>
|
---|
| 569 |
|
---|
| 570 | </sect4>
|
---|
[4fcf20a5] | 571 |
|
---|
[7fb0e285] | 572 | <sect4 id="pam-env">
|
---|
| 573 | <title>Configuring Default Environment</title>
|
---|
| 574 |
|
---|
[bccbdaea] | 575 | <para>During previous configuration, several items were removed from
|
---|
[7fb0e285] | 576 | <filename>/etc/login.defs</filename>. Some of these items are now
|
---|
[bccbdaea] | 577 | controlled by the <filename class='libraryfile'>pam_env.so</filename>
|
---|
| 578 | module and the <filename>/etc/security/pam_env.conf</filename>
|
---|
| 579 | configuration file. In particular, the default path has been
|
---|
| 580 | changed. To recover your default path, execute the following
|
---|
[7fb0e285] | 581 | commands:</para>
|
---|
| 582 |
|
---|
[d8684cbc] | 583 | <screen role="root"><userinput>ENV_PATH=`grep '^ENV_PATH' /etc/login.defs.orig | \
|
---|
[7fb0e285] | 584 | awk '{ print $2 }' | sed 's/PATH=//'` &&
|
---|
[d8684cbc] | 585 | echo 'PATH DEFAULT='`echo "${ENV_PATH}"`\
|
---|
| 586 | ' OVERRIDE=${PATH}' \
|
---|
[7fb0e285] | 587 | >> /etc/security/pam_env.conf &&
|
---|
[d8684cbc] | 588 | unset ENV_PATH</userinput></screen>
|
---|
[7fb0e285] | 589 |
|
---|
[d8684cbc] | 590 | <note>
|
---|
[bccbdaea] | 591 | <para>ENV_SUPATH is no longer supported. You must create
|
---|
| 592 | a valid <filename>/root/.bashrc</filename> file to provide a
|
---|
[d8684cbc] | 593 | modified path for the super-user.</para>
|
---|
| 594 | </note>
|
---|
[7fb0e285] | 595 |
|
---|
| 596 | </sect4>
|
---|
| 597 |
|
---|
[322f172] | 598 | </sect3>
|
---|
[b4b71892] | 599 |
|
---|
[322f172] | 600 | </sect2>
|
---|
[f45b1953] | 601 |
|
---|
[322f172] | 602 | <sect2 role="content">
|
---|
| 603 | <title>Contents</title>
|
---|
[17fb537e] | 604 |
|
---|
[322f172] | 605 | <para>A list of the installed files, along with their short descriptions
|
---|
| 606 | can be found at
|
---|
| 607 | <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.</para>
|
---|
[17fb537e] | 608 |
|
---|
[322f172] | 609 | </sect2>
|
---|
[17fb537e] | 610 |
|
---|
[f45b1953] | 611 | </sect1>
|
---|