[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 |
|
---|
[e8ea43e] | 7 | <!ENTITY shadow-download-http "http://cdn.debian.net/debian/pool/main/s/shadow//shadow_&shadow-version;.orig.tar.gz">
|
---|
[fb89293] | 8 | <!ENTITY shadow-download-ftp " ">
|
---|
[e8ea43e] | 9 | <!ENTITY shadow-md5sum "ae66de9953f840fb3a97f6148bc39a30">
|
---|
| 10 | <!ENTITY shadow-size "3.4 MB">
|
---|
[c627795] | 11 | <!ENTITY shadow-buildsize "38 MB">
|
---|
[f4797d2] | 12 | <!ENTITY shadow-time "0.3 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 |
|
---|
[f6068507] | 44 | &lfs74_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 |
|
---|
| 128 | sed -i -e 's@PATH=/sbin:/bin:/usr/sbin:/usr/bin@&:/usr/local/sbin:/usr/local/bin@' \
|
---|
| 129 | -e 's@PATH=/bin:/usr/bin@&:/usr/local/bin@' etc/login.defs &&
|
---|
[8f68b03] | 130 |
|
---|
[9a3142c] | 131 | ./configure --prefix=/usr --sysconfdir=/etc &&
|
---|
[322f172] | 132 | make</userinput></screen>
|
---|
[17fb537e] | 133 |
|
---|
[9a3142c] | 134 | <para>
|
---|
| 135 | This package does not come with a test suite.
|
---|
| 136 | </para>
|
---|
[31f3a57] | 137 |
|
---|
[9a3142c] | 138 | <para>
|
---|
| 139 | Now, as the <systemitem class="username">root</systemitem> user:
|
---|
| 140 | </para>
|
---|
[17fb537e] | 141 |
|
---|
[322f172] | 142 | <screen role="root"><userinput>make install &&
|
---|
[bca744f] | 143 | mv -v /usr/bin/passwd /bin</userinput></screen>
|
---|
[322f172] | 144 | </sect2>
|
---|
[b4b71892] | 145 |
|
---|
[322f172] | 146 | <sect2 role="commands">
|
---|
| 147 | <title>Command Explanations</title>
|
---|
[b4b71892] | 148 |
|
---|
[9a3142c] | 149 | <para>
|
---|
| 150 | <command>sed -i 's/groups$(EXEEXT) //' src/Makefile.in</command>: This sed
|
---|
| 151 | is used to suppress the installation of the <command>groups</command>
|
---|
| 152 | program as the version from the <application>Coreutils</application>
|
---|
| 153 | package installed during LFS is preferred.
|
---|
| 154 | </para>
|
---|
| 155 |
|
---|
| 156 | <para>
|
---|
| 157 | <command>find man -name Makefile.in -exec ... {} \;</command>: This
|
---|
| 158 | command is used to suppress the installation of the
|
---|
| 159 | <command>groups</command> man pages so the existing ones installed from
|
---|
| 160 | the <application>Coreutils</application> package are not replaced.
|
---|
| 161 | </para>
|
---|
| 162 |
|
---|
| 163 | <para>
|
---|
| 164 | <command>sed -i -e 's@#ENCRYPT_METHOD DES@ENCRYPT_METHOD SHA512@' -e
|
---|
| 165 | 's@/var/spool/mail@/var/mail@' etc/login.defs</command>: Instead of using
|
---|
| 166 | the default 'DES' method, this command modifies the installation to use
|
---|
| 167 | the more secure 'SHA512' method of hashing passwords, which also allows
|
---|
| 168 | passwords longer than eight characters. It also changes the obsolete
|
---|
| 169 | <filename class="directory">/var/spool/mail</filename> location for user
|
---|
| 170 | mailboxes that <application>Shadow</application> uses by default to the
|
---|
| 171 | <filename class="directory">/var/mail</filename> location.
|
---|
| 172 | </para>
|
---|
| 173 |
|
---|
| 174 | <para>
|
---|
[0d7900a] | 175 | <command>sed -i -e
|
---|
| 176 | 's@PATH=/sbin:/bin:/usr/sbin:/usr/bin@&:/usr/local/sbin:/usr/local/bin@'
|
---|
[9a3142c] | 177 | -e 's@PATH=/bin:/usr/bin@&:/usr/local/bin@' etc/login.defs</command>:
|
---|
| 178 | This sed expands PATH to
|
---|
| 179 | <filename class="directory">/usr/local/bin</filename> for normal and
|
---|
[0d7900a] | 180 | <systemitem class="username">root</systemitem> user and to
|
---|
| 181 | <filename class="directory">/usr/local/sbin</filename> for
|
---|
[9a3142c] | 182 | <systemitem class="username">root</systemitem> user only.
|
---|
| 183 | </para>
|
---|
| 184 |
|
---|
| 185 | <para>
|
---|
| 186 | <command>mv -v /usr/bin/passwd /bin</command>: The
|
---|
| 187 | <command>passwd</command> program may be needed during times when the
|
---|
| 188 | <filename class='directory'>/usr</filename> filesystem is not mounted so
|
---|
| 189 | it is moved into the root partition.
|
---|
| 190 | </para>
|
---|
[322f172] | 191 | </sect2>
|
---|
[b4b71892] | 192 |
|
---|
[e807ae1d] | 193 | <sect2 role="configuration">
|
---|
| 194 | <title>Configuring Shadow</title>
|
---|
| 195 |
|
---|
[9a3142c] | 196 | <para>
|
---|
| 197 | <application>Shadow</application>'s stock configuration for the
|
---|
| 198 | <command>useradd</command> utility may not be desirable for your
|
---|
| 199 | installation. One default parameter causes <command>useradd</command> to
|
---|
| 200 | create a mailbox file for any newly created user.
|
---|
| 201 | <command>useradd</command> will make the group ownership of this file to
|
---|
| 202 | the <systemitem class="groupname">mail</systemitem> group with 0660
|
---|
| 203 | permissions. If you would prefer that these mailbox files are not created
|
---|
| 204 | by <command>useradd</command>, issue the following command as the
|
---|
| 205 | <systemitem class="username">root</systemitem> user:
|
---|
| 206 | </para>
|
---|
[e807ae1d] | 207 |
|
---|
[bca744f] | 208 | <screen role="root"><userinput>sed -i 's/yes/no/' /etc/default/useradd</userinput></screen>
|
---|
[e807ae1d] | 209 | </sect2>
|
---|
| 210 |
|
---|
[322f172] | 211 | <sect2 role="configuration">
|
---|
| 212 | <title>Configuring Linux-PAM to Work with Shadow</title>
|
---|
[b4b71892] | 213 |
|
---|
[8f68b03] | 214 | <note>
|
---|
[9a3142c] | 215 | <para>
|
---|
| 216 | The rest of this page is devoted to configuring
|
---|
| 217 | <application>Shadow</application> to work properly with
|
---|
| 218 | <application>Linux-PAM</application>. If you do not have
|
---|
| 219 | <application>Linux-PAM</application> installed, and you reinstalled
|
---|
| 220 | <application>Shadow</application> to support strong passwords via the
|
---|
| 221 | <application>CrackLib</application> library, no further configuration is
|
---|
| 222 | required.
|
---|
| 223 | </para>
|
---|
[8f68b03] | 224 | </note>
|
---|
| 225 |
|
---|
[322f172] | 226 | <sect3 id="pam.d">
|
---|
| 227 | <title>Config Files</title>
|
---|
[b4b71892] | 228 |
|
---|
[9a3142c] | 229 | <para>
|
---|
| 230 | <filename>/etc/pam.d/*</filename> or alternatively
|
---|
| 231 | <filename>/etc/pam.conf</filename>,
|
---|
| 232 | <filename>/etc/login.defs</filename> and
|
---|
| 233 | <filename>/etc/security/*</filename>
|
---|
| 234 | </para>
|
---|
[b4b71892] | 235 |
|
---|
[322f172] | 236 | <indexterm zone="shadow pam.d">
|
---|
| 237 | <primary sortas="e-etc-pam.d">/etc/pam.d/*</primary>
|
---|
| 238 | </indexterm>
|
---|
[2197589] | 239 |
|
---|
[322f172] | 240 | <indexterm zone="shadow pam.d">
|
---|
| 241 | <primary sortas="e-etc-pam.conf">/etc/pam.conf</primary>
|
---|
| 242 | </indexterm>
|
---|
[4fcf20a5] | 243 |
|
---|
[1ba671c] | 244 | <indexterm zone="shadow pam.d">
|
---|
| 245 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 246 | </indexterm>
|
---|
| 247 |
|
---|
| 248 | <indexterm zone="shadow pam.d">
|
---|
| 249 | <primary sortas="e-etc-security">/etc/security/*</primary>
|
---|
| 250 | </indexterm>
|
---|
[322f172] | 251 | </sect3>
|
---|
| 252 |
|
---|
| 253 | <sect3>
|
---|
| 254 | <title>Configuration Information</title>
|
---|
| 255 |
|
---|
[9a3142c] | 256 | <para>
|
---|
| 257 | Configuring your system to use <application>Linux-PAM</application> can
|
---|
| 258 | be a complex task. The information below will provide a basic setup so
|
---|
| 259 | that <application>Shadow</application>'s login and password
|
---|
| 260 | functionality will work effectively with
|
---|
| 261 | <application>Linux-PAM</application>. Review the information and links
|
---|
| 262 | on the <xref linkend="linux-pam"/> page for further configuration
|
---|
| 263 | information. For information specific to integrating
|
---|
| 264 | <application>Shadow</application>, <application>Linux-PAM</application>
|
---|
| 265 | and <application>CrackLib</application>, you can visit the following
|
---|
| 266 | link:
|
---|
| 267 | </para>
|
---|
[8f68b03] | 268 |
|
---|
| 269 | <itemizedlist spacing="compact">
|
---|
[9a3142c] | 270 | <listitem>
|
---|
| 271 | <para>
|
---|
| 272 | <ulink url="http://www.deer-run.com/~hal/sysadmin/pam_cracklib.html"/>
|
---|
| 273 | </para>
|
---|
| 274 | </listitem>
|
---|
[8f68b03] | 275 | </itemizedlist>
|
---|
| 276 |
|
---|
[1ba671c] | 277 | <sect4 id="pam-login-defs">
|
---|
| 278 | <title>Configuring /etc/login.defs</title>
|
---|
| 279 |
|
---|
[9a3142c] | 280 | <para>
|
---|
| 281 | The <command>login</command> program currently performs many functions
|
---|
| 282 | which <application>Linux-PAM</application> modules should now handle.
|
---|
| 283 | The following <command>sed</command> command will comment out the
|
---|
| 284 | appropriate lines in <filename>/etc/login.defs</filename>, and stop
|
---|
| 285 | <command>login</command> from performing these functions (a backup
|
---|
| 286 | file named <filename>/etc/login.defs.orig</filename> is also created
|
---|
| 287 | to preserve the original file's contents). Issue the following
|
---|
| 288 | commands as the <systemitem class="username">root</systemitem> user:
|
---|
| 289 | </para>
|
---|
[1ba671c] | 290 |
|
---|
| 291 | <indexterm zone="shadow pam-login-defs">
|
---|
| 292 | <primary sortas="e-etc-login.defs">/etc/login.defs</primary>
|
---|
| 293 | </indexterm>
|
---|
| 294 |
|
---|
| 295 | <screen role="root"><userinput>install -v -m644 /etc/login.defs /etc/login.defs.orig &&
|
---|
[574d896d] | 296 | for FUNCTION in FAIL_DELAY FAILLOG_ENAB \
|
---|
| 297 | LASTLOG_ENAB \
|
---|
[5443006d] | 298 | MAIL_CHECK_ENAB \
|
---|
| 299 | OBSCURE_CHECKS_ENAB \
|
---|
| 300 | PORTTIME_CHECKS_ENAB \
|
---|
[574d896d] | 301 | QUOTAS_ENAB \
|
---|
[5443006d] | 302 | CONSOLE MOTD_FILE \
|
---|
[574d896d] | 303 | FTMP_FILE NOLOGINS_FILE \
|
---|
| 304 | ENV_HZ PASS_MIN_LEN \
|
---|
[5443006d] | 305 | SU_WHEEL_ONLY \
|
---|
| 306 | CRACKLIB_DICTPATH \
|
---|
| 307 | PASS_CHANGE_TRIES \
|
---|
| 308 | PASS_ALWAYS_WARN \
|
---|
[574d896d] | 309 | CHFN_AUTH ENCRYPT_METHOD \
|
---|
| 310 | ENVIRON_FILE
|
---|
[1ba671c] | 311 | do
|
---|
[9a3142c] | 312 | sed -i "s/^${FUNCTION}/# &/" /etc/login.defs
|
---|
[1ba671c] | 313 | done</userinput></screen>
|
---|
| 314 | </sect4>
|
---|
| 315 |
|
---|
| 316 | <sect4>
|
---|
| 317 | <title>Configuring the /etc/pam.d/ Files</title>
|
---|
| 318 |
|
---|
[9a3142c] | 319 | <para>
|
---|
| 320 | As mentioned previously in the <application>Linux-PAM</application>
|
---|
| 321 | instructions, <application>Linux-PAM</application> has two supported
|
---|
| 322 | methods for configuration. The commands below assume that you've
|
---|
| 323 | chosen to use a directory based configuration, where each program has
|
---|
| 324 | its own configuration file. You can optionally use a single
|
---|
| 325 | <filename>/etc/pam.conf</filename> configuration file by using the
|
---|
| 326 | text from the files below, and supplying the program name as an
|
---|
| 327 | additional first field for each line.
|
---|
| 328 | </para>
|
---|
[1ba671c] | 329 |
|
---|
[9a3142c] | 330 | <para>
|
---|
| 331 | As the <systemitem class="username">root</systemitem> user, replace
|
---|
| 332 | the following <application>Linux-PAM</application> configuration files
|
---|
| 333 | in the <filename class="directory">/etc/pam.d/</filename> directory
|
---|
| 334 | (or add the contents to the <filename>/etc/pam.conf</filename> file)
|
---|
| 335 | using the following commands:
|
---|
| 336 | </para>
|
---|
[1ba671c] | 337 | </sect4>
|
---|
[322f172] | 338 |
|
---|
| 339 | <sect4>
|
---|
[3e8fb4c] | 340 | <title>'system-account'</title>
|
---|
[322f172] | 341 |
|
---|
[3e8fb4c] | 342 | <screen role="root"><userinput>cat > /etc/pam.d/system-account << "EOF"
|
---|
| 343 | <literal># Begin /etc/pam.d/system-account
|
---|
[4fcf20a5] | 344 |
|
---|
[3e8fb4c] | 345 | account required pam_unix.so
|
---|
[4fcf20a5] | 346 |
|
---|
[3e8fb4c] | 347 | # End /etc/pam.d/system-account</literal>
|
---|
[322f172] | 348 | EOF</userinput></screen>
|
---|
| 349 | </sect4>
|
---|
[4fcf20a5] | 350 |
|
---|
[322f172] | 351 | <sect4>
|
---|
[3e8fb4c] | 352 | <title>'system-auth'</title>
|
---|
[4fcf20a5] | 353 |
|
---|
[3e8fb4c] | 354 | <screen role="root"><userinput>cat > /etc/pam.d/system-auth << "EOF"
|
---|
| 355 | <literal># Begin /etc/pam.d/system-auth
|
---|
[b4b71892] | 356 |
|
---|
[3e8fb4c] | 357 | auth required pam_unix.so
|
---|
[b4b71892] | 358 |
|
---|
[3e8fb4c] | 359 | # End /etc/pam.d/system-auth</literal>
|
---|
[322f172] | 360 | EOF</userinput></screen>
|
---|
| 361 | </sect4>
|
---|
[4fcf20a5] | 362 |
|
---|
[322f172] | 363 | <sect4>
|
---|
[3e8fb4c] | 364 | <title>'system-passwd' (with cracklib)</title>
|
---|
| 365 |
|
---|
| 366 | <screen role="root"><userinput>cat > /etc/pam.d/system-password << "EOF"
|
---|
| 367 | <literal># Begin /etc/pam.d/system-password
|
---|
| 368 |
|
---|
| 369 | # check new passwords for strength (man pam_cracklib)
|
---|
| 370 | password required pam_cracklib.so type=Linux retry=3 difok=5 \
|
---|
| 371 | difignore=23 minlen=9 dcredit=1 \
|
---|
| 372 | ucredit=1 lcredit=1 ocredit=1 \
|
---|
| 373 | dictpath=/lib/cracklib/pw_dict
|
---|
| 374 | # use sha512 hash for encryption, use shadow, and use the
|
---|
| 375 | # authentication token (chosen password) set by pam_cracklib
|
---|
| 376 | # above (or any previous modules)
|
---|
| 377 | password required pam_unix.so sha512 shadow use_authtok
|
---|
| 378 |
|
---|
| 379 | # End /etc/pam.d/system-password</literal>
|
---|
[322f172] | 380 | EOF</userinput></screen>
|
---|
| 381 |
|
---|
[9a3142c] | 382 | <note>
|
---|
| 383 | <para>
|
---|
| 384 | In its default configuration, owing to credits, pam_cracklib will
|
---|
| 385 | allow multiple case passwords as short as 6 characters, even with
|
---|
| 386 | the <parameter>minlen</parameter> value set to 11. You should review
|
---|
| 387 | the pam_cracklib(8) man page and determine if these default values
|
---|
| 388 | are acceptable for the security of your system.
|
---|
| 389 | </para>
|
---|
| 390 | </note>
|
---|
[322f172] | 391 | </sect4>
|
---|
[0d7900a] | 392 |
|
---|
[3e8fb4c] | 393 | <sect4>
|
---|
| 394 | <title>'system-passwd' (without cracklib)</title>
|
---|
| 395 |
|
---|
| 396 | <screen role="root"><userinput>cat > /etc/pam.d/system-password << "EOF"
|
---|
| 397 | <literal># Begin /etc/pam.d/system-password
|
---|
| 398 |
|
---|
[a6bd736] | 399 | # use sha512 hash for encryption, use shadow, and try to use any previously
|
---|
[3e8fb4c] | 400 | # defined authentication token (chosen password) set by any prior module
|
---|
| 401 | password required pam_unix.so sha512 shadow try_first_pass
|
---|
| 402 |
|
---|
| 403 | # End /etc/pam.d/system-password</literal>
|
---|
| 404 | EOF</userinput></screen>
|
---|
| 405 | </sect4>
|
---|
| 406 |
|
---|
| 407 | <sect4>
|
---|
| 408 | <title>'system-session'</title>
|
---|
| 409 |
|
---|
| 410 | <screen role="root"><userinput>cat > /etc/pam.d/system-session << "EOF"
|
---|
| 411 | <literal># Begin /etc/pam.d/system-session
|
---|
| 412 |
|
---|
| 413 | session required pam_unix.so
|
---|
| 414 |
|
---|
| 415 | # End /etc/pam.d/system-session</literal>
|
---|
| 416 | EOF</userinput></screen>
|
---|
| 417 | </sect4>
|
---|
[b4b71892] | 418 |
|
---|
[322f172] | 419 | <sect4>
|
---|
[3e8fb4c] | 420 | <title>'login'</title>
|
---|
| 421 |
|
---|
| 422 | <screen role="root"><userinput>cat > /etc/pam.d/login << "EOF"
|
---|
| 423 | <literal># Begin /etc/pam.d/login
|
---|
| 424 |
|
---|
| 425 | # Set failure delay before next prompt to 3 seconds
|
---|
| 426 | auth optional pam_faildelay.so delay=3000000
|
---|
| 427 |
|
---|
| 428 | # Check to make sure that the user is allowed to login
|
---|
| 429 | auth requisite pam_nologin.so
|
---|
| 430 |
|
---|
[0d7900a] | 431 | # Check to make sure that root is allowed to login
|
---|
[d265d4c] | 432 | # Disabled by default. You will need to create /etc/securetty
|
---|
| 433 | # file for this module to function. See man 5 securetty.
|
---|
| 434 | #auth required pam_securetty.so
|
---|
[3e8fb4c] | 435 |
|
---|
| 436 | # Additional group memberships - disabled by default
|
---|
| 437 | #auth optional pam_group.so
|
---|
| 438 |
|
---|
| 439 | # include the default auth settings
|
---|
| 440 | auth include system-auth
|
---|
| 441 |
|
---|
| 442 | # check access for the user
|
---|
| 443 | account required pam_access.so
|
---|
| 444 |
|
---|
| 445 | # include the default account settings
|
---|
| 446 | account include system-account
|
---|
| 447 |
|
---|
| 448 | # Set default environment variables for the user
|
---|
| 449 | session required pam_env.so
|
---|
| 450 |
|
---|
| 451 | # Set resource limits for the user
|
---|
| 452 | session required pam_limits.so
|
---|
| 453 |
|
---|
| 454 | # Display date of last login - Disabled by default
|
---|
| 455 | #session optional pam_lastlog.so
|
---|
| 456 |
|
---|
| 457 | # Display the message of the day - Disabled by default
|
---|
| 458 | #session optional pam_motd.so
|
---|
| 459 |
|
---|
| 460 | # Check user's mail - Disabled by default
|
---|
| 461 | #session optional pam_mail.so standard quiet
|
---|
| 462 |
|
---|
| 463 | # include the default session and password settings
|
---|
| 464 | session include system-session
|
---|
| 465 | password include system-password
|
---|
| 466 |
|
---|
| 467 | # End /etc/pam.d/login</literal>
|
---|
| 468 | EOF</userinput></screen>
|
---|
| 469 | </sect4>
|
---|
| 470 |
|
---|
| 471 | <sect4>
|
---|
| 472 | <title>'passwd'</title>
|
---|
[4fcf20a5] | 473 |
|
---|
[322f172] | 474 | <screen role="root"><userinput>cat > /etc/pam.d/passwd << "EOF"
|
---|
| 475 | <literal># Begin /etc/pam.d/passwd
|
---|
[4fcf20a5] | 476 |
|
---|
[3e8fb4c] | 477 | password include system-password
|
---|
[b4b71892] | 478 |
|
---|
[322f172] | 479 | # End /etc/pam.d/passwd</literal>
|
---|
| 480 | EOF</userinput></screen>
|
---|
| 481 | </sect4>
|
---|
[4fcf20a5] | 482 |
|
---|
[322f172] | 483 | <sect4>
|
---|
| 484 | <title>'su'</title>
|
---|
[4fcf20a5] | 485 |
|
---|
[322f172] | 486 | <screen role="root"><userinput>cat > /etc/pam.d/su << "EOF"
|
---|
| 487 | <literal># Begin /etc/pam.d/su
|
---|
[b4b71892] | 488 |
|
---|
[3e8fb4c] | 489 | # always allow root
|
---|
| 490 | auth sufficient pam_rootok.so
|
---|
[55e18620] | 491 | auth include system-auth
|
---|
[3e8fb4c] | 492 |
|
---|
| 493 | # include the default account settings
|
---|
| 494 | account include system-account
|
---|
| 495 |
|
---|
| 496 | # Set default environment variables for the service user
|
---|
| 497 | session required pam_env.so
|
---|
| 498 |
|
---|
| 499 | # include system session defaults
|
---|
| 500 | session include system-session
|
---|
[b4b71892] | 501 |
|
---|
[322f172] | 502 | # End /etc/pam.d/su</literal>
|
---|
| 503 | EOF</userinput></screen>
|
---|
| 504 | </sect4>
|
---|
[b4b71892] | 505 |
|
---|
[322f172] | 506 | <sect4>
|
---|
| 507 | <title>'chage'</title>
|
---|
| 508 |
|
---|
| 509 | <screen role="root"><userinput>cat > /etc/pam.d/chage << "EOF"
|
---|
[3e8fb4c] | 510 | <literal>#Begin /etc/pam.d/chage
|
---|
| 511 |
|
---|
| 512 | # always allow root
|
---|
| 513 | auth sufficient pam_rootok.so
|
---|
| 514 |
|
---|
| 515 | # include system defaults for auth account and session
|
---|
| 516 | auth include system-auth
|
---|
| 517 | account include system-account
|
---|
| 518 | session include system-session
|
---|
[b4b71892] | 519 |
|
---|
[3e8fb4c] | 520 | # Always permit for authentication updates
|
---|
| 521 | password required pam_permit.so
|
---|
[b4b71892] | 522 |
|
---|
[322f172] | 523 | # End /etc/pam.d/chage</literal>
|
---|
| 524 | EOF</userinput></screen>
|
---|
| 525 | </sect4>
|
---|
[b4b71892] | 526 |
|
---|
[322f172] | 527 | <sect4>
|
---|
[9a3142c] | 528 | <title>'chfn', 'chgpasswd', 'chgpasswd', 'chsh', 'groupadd', 'groupdel',
|
---|
| 529 | 'groupmems', 'groupmod', 'newusers', 'useradd', 'userdel' and
|
---|
| 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
|
---|
| 633 | found at <ulink url="&lfs-root;/chapter06/shadow.html#contents-shadow"/>.
|
---|
| 634 | </para>
|
---|
[c627795] | 635 |
|
---|
[322f172] | 636 | </sect2>
|
---|
[c627795] | 637 |
|
---|
[f45b1953] | 638 | </sect1>
|
---|