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