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