<?Pub UDT _bookmark _target?><?Pub CX solbook(?><chapter id="pam-1"><?Pub Tag atict:info tracking="off" ref="0"?><?Pub Tag atict:user
user="sharonr" fullname="Sharon Veach"?><?Pub Tag atict:user user="kathys"
fullname="Kathy Slattery"?><title>Using PAM</title><highlights><para>This chapter covers the Pluggable Authentication Module (PAM) framework.
PAM provides a method to &ldquo;plug in&rdquo; authentication services into
the Solaris Operating System (Solaris OS). PAM provides support for multiple
authentication services when accessing a system.</para><itemizedlist><listitem><para><olink targetptr="pam-2" remap="internal">PAM (Overview)</olink></para>
</listitem><listitem><para><olink targetptr="pam-11" remap="internal">PAM (Tasks)</olink></para>
</listitem><listitem><para><olink targetptr="pam-32" remap="internal">PAM Configuration (Reference)</olink></para>
</listitem>
</itemizedlist>
</highlights><sect1 id="pam-2"><title>PAM (Overview)</title><para><indexterm><primary>pluggable authentication module</primary><see>PAM</see></indexterm><indexterm><primary>PAM</primary><secondary>overview</secondary></indexterm>The Pluggable Authentication Module (PAM) framework lets you &ldquo;plug
in&rdquo; new authentication services without changing system entry services,
such as <command>login</command>, <command>ftp</command>, and <command>telnet</command>.
You can also use PAM to integrate UNIX login with other security mechanisms
such as Kerberos.  Mechanisms for account, credential, session, and password
management can also be &ldquo;plugged in&rdquo; by using this framework.</para><sect2 id="pam-3"><title>Benefits of Using PAM</title><itemizedlist><para>The PAM framework enables you to configure the use of system entry services
(such as, <command>ftp</command>, <command>login</command>, <command>telnet</command>,
or <command>rsh</command>)  for user authentication. Some benefits that PAM
provides are as follows:</para><listitem><para>Flexible configuration policy</para><itemizedlist><listitem><para>Per-application authentication policy</para>
</listitem><listitem><para>The ability to choose a default authentication mechanism</para>
</listitem><listitem><para>The ability to require multiple authorizations on high-security
systems</para>
</listitem>
</itemizedlist>
</listitem><listitem><para>Ease of use for the end user</para><itemizedlist><listitem><para>No retyping of passwords if the passwords are the same for
different authentication services</para>
</listitem><listitem><para>The ability to prompt the user for passwords for multiple
authentication services without requiring the user to type multiple commands</para>
</listitem>
</itemizedlist>
</listitem><listitem><para>The ability to pass optional options to the user authentication
services</para>
</listitem><listitem><para>The ability to implement a site-specific security policy without
having to change the system entry services</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="gedro"><title>Introduction to the PAM Framework</title><itemizedlist><para><indexterm><primary>PAM</primary><secondary>framework</secondary></indexterm>The PAM framework consists of four parts:</para><listitem><para>PAM consumers</para>
</listitem><listitem><para>PAM library</para>
</listitem><listitem><para>The <olink targetdoc="group-refman" targetptr="pam.conf-4" remap="external"><citerefentry><refentrytitle>pam.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> configuration
file</para>
</listitem><listitem><para>PAM service modules, also referred to as providers</para>
</listitem>
</itemizedlist><para><indexterm><primary><filename>pam.conf</filename> file</primary><see>PAM configuration file</see></indexterm>The framework provides a uniform way for
authentication-related activities to take place. This approach enables application
developers to use PAM services without having to know the semantics of the
policy. Algorithms are centrally supplied. The algorithms can be modified
independently of the individual applications. With PAM, administrators can
tailor the authentication process to the needs of a particular system without
having to change any applications. Adjustments are made through <filename>pam.conf</filename>, the PAM configuration file.</para><para>The following figure illustrates the PAM architecture. Applications
communicate with the PAM library through the PAM application programming interface
(API). PAM modules communicate with the PAM library through the PAM service
provider interface (SPI). Thus, the PAM library enables applications and modules
to communicate with each other.</para><figure id="geofl"><title>PAM Architecture</title><mediaobject><imageobject><imagedata entityref="pam.overview.1.eps"/>
</imageobject><textobject><simpara>Figure shows how the PAM library is accessed by applications
and PAM service modules.</simpara>
</textobject>
</mediaobject>
</figure>
</sect2><sect2 id="pam-38"><title>Changes to PAM for the Solaris 10 Release</title><indexterm><primary>new features</primary><secondary>PAM enhancements</secondary>
</indexterm><itemizedlist><para>The Solaris 10 release includes the following changes to the Pluggable
Authentication Module (PAM) framework:</para><listitem><para>The <literal>pam_authtok_check</literal> module now allows
for strict password checking using new tunable parameters in the <filename>/etc/default/passwd</filename> file. The new parameters define:</para><itemizedlist><listitem><para>A list of comma separated dictionary files used for checking
common dictionary words in a password</para>
</listitem><listitem><para>The minimum differences required between a new password and
an old password</para>
</listitem><listitem><para>The minimum number of alphabetic or nonalphabetic characters
that must be used in a new password</para>
</listitem><listitem><para>The minimum number of uppercase or lowercase letters that
must be used in a new password</para>
</listitem><listitem><para>The number of allowable consecutive repeating characters</para>
</listitem>
</itemizedlist>
</listitem><listitem><para>The <literal>pam_unix_auth</literal> module implements account
locking for local users. Account locking is enabled by the <literal>LOCK_AFTER_RETRIES</literal> parameter in <filename>/etc/security/policy.conf</filename> and
the <literal>lock_after-retries</literal> key in <filename>/etc/user_attr</filename>.
See the <olink targetdoc="group-refman" targetptr="policy.conf-4" remap="external"><citerefentry><refentrytitle>policy.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> and the <olink targetdoc="group-refman" targetptr="user-attr-4" remap="external"><citerefentry><refentrytitle>user_attr</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man pages for more information.</para>
</listitem><listitem><para>A new <literal>binding</literal> control flag has been defined.
This control flag is documented in the <olink targetdoc="group-refman" targetptr="pam.conf-4" remap="external"><citerefentry><refentrytitle>pam.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> man page and in <olink targetptr="pam-15" remap="internal">How PAM Stacking Works</olink>.</para>
</listitem><listitem><para>The <literal>pam_unix</literal> module has been removed and
replaced by a set of service modules of equivalent or greater functionality.
Many of these modules were introduced in the Solaris 9 release. Here is a
list of the replacement modules:</para><itemizedlist><listitem><para><literal>pam_authtok_check</literal></para>
</listitem><listitem><para><literal>pam_authtok_get</literal></para>
</listitem><listitem><para><literal>pam_authtok_store</literal></para>
</listitem><listitem><para><literal>pam_dhkeys</literal></para>
</listitem><listitem><para><literal>pam_passwd_auth</literal></para>
</listitem><listitem><para><literal>pam_unix_account</literal></para>
</listitem><listitem><para><literal>pam_unix_auth</literal></para>
</listitem><listitem><para><literal>pam_unix_cred</literal></para>
</listitem><listitem><para><literal>pam_unix_session</literal></para>
</listitem>
</itemizedlist>
</listitem><listitem><para>The functionality of the <literal>pam_unix_auth</literal> module
has been split into two modules. The <literal>pam_unix_auth</literal> module
now verifies that the password is correct for the user. The new <literal>pam_unix_cred</literal> module provides functions that establish user credential information.</para>
</listitem><listitem><para>Additions to the <literal>pam_krb5</literal> module have been
made to manage the Kerberos credentials cache using the PAM framework.</para>
</listitem><listitem><para>A new <literal>pam_deny</literal> module has been added. The
module can be used to deny access to services. By default, the <literal>pam_deny</literal> module
is not used. For more information, see the <olink targetdoc="group-refman" targetptr="pam-deny-5" remap="external"><citerefentry><refentrytitle>pam_deny</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> man page.</para>
</listitem>
</itemizedlist>
</sect2><sect2 id="gegzf"><title>Changes to PAM for the Solaris
Express 1/06 Release</title><para>The PAM framework for the Solaris Express 1/06 release includes a new <literal>pam_allow</literal> module. The module can be used to grant access to all
users, without enforcing any security. The module should be used with caution.
For more information, see the <olink targetdoc="group-refman" targetptr="pam-allow-5" remap="external"><citerefentry><refentrytitle>pam_allow</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> man
page.</para>
</sect2>
</sect1><sect1 id="pam-11"><title>PAM (Tasks)</title><para><indexterm><primary>task maps</primary><secondary>PAM</secondary></indexterm><indexterm><primary>PAM</primary><secondary>task map</secondary></indexterm>This section discusses some tasks that might be required to make
the PAM framework use a particular security policy. You should be aware of
some security issues that are associated with the PAM configuration file.
For information about the security issues, see <olink targetptr="pam-13" remap="internal">Planning
for Your PAM Implementation</olink>.</para><sect2 id="esqbh"><title>PAM (Task Map)</title><informaltable frame="all" pgwide="1"><tgroup cols="3" colsep="1" rowsep="1"><colspec colwidth="110*"/><colspec colname="col2" colwidth="167*"/><colspec colwidth="119*"/><thead><row><entry><para>Task</para>
</entry><entry><para>Description</para>
</entry><entry><para>For Instructions</para>
</entry>
</row>
</thead><tbody><row><entry><para>Plan for your PAM installation.</para>
</entry><entry><para>Consider configuration issues and make decisions about them before you
start the software configuration process.</para>
</entry><entry><para><olink targetptr="pam-13" remap="internal">Planning for Your PAM Implementation</olink></para>
</entry>
</row><row><entry><para>Add new PAM modules.</para>
</entry><entry><para>Sometimes, site-specific modules must be written and installed to cover
requirements that are not part of the generic software. This procedure explains
how to install these new PAM modules.</para>
</entry><entry><para><olink targetptr="pam-14" remap="internal">How to Add a PAM Module</olink></para>
</entry>
</row><row><entry><para>Block access through <filename>~/.rhosts</filename>.</para>
</entry><entry><para>Further increase security by preventing access through <filename>~/.rhosts</filename>.</para>
</entry><entry><para><olink targetptr="ewaws" remap="internal">How to Prevent Rhost-Style Access From Remote
Systems With PAM</olink></para>
</entry>
</row><row><entry><para>Initiate error logging.</para>
</entry><entry><para>Start the logging of PAM error messages through <command>syslog</command>.</para>
</entry><entry><para><olink targetptr="pam-23" remap="internal">How to Log PAM Error Reports</olink></para>
</entry>
</row>
</tbody>
</tgroup>
</informaltable>
</sect2><sect2 id="pam-13"><title>Planning for Your PAM Implementation</title><itemizedlist><para><indexterm><primary>PAM</primary><secondary>planning</secondary></indexterm><indexterm><primary>planning</primary><secondary>PAM</secondary></indexterm>As delivered, the <filename>pam.conf</filename> configuration
file implements the standard Solaris security policy. This policy should work
in many situations. If you need to implement a different security policy,
here are the issues that you should focus on:</para><listitem><para>Determine what your needs are, especially which PAM service
modules you should select.</para>
</listitem><listitem><para>Identify the services that need special configuration options.
Use <literal>other</literal> if appropriate.</para>
</listitem><listitem><para>Decide the order in which the modules should be run.</para>
</listitem><listitem><para>Select the control flag for each module. See <olink targetptr="pam-15" remap="internal">How PAM Stacking Works</olink> for more information about
all of the control flags.</para>
</listitem><listitem><para>Choose any options that are necessary for each module. The
man page for each module should list any special options.</para>
</listitem>
</itemizedlist><itemizedlist><para>Here are some suggestions to consider before you change the PAM configuration
file:</para><listitem><para>Use <literal>other</literal> entries for each module type
so that every application does not have to be included in <filename>/etc/pam.conf</filename>.</para>
</listitem><listitem><para>Make sure to consider the security implications of the <literal>binding</literal>, <literal>sufficient</literal>, and <literal>optional</literal> control
flags.</para>
</listitem><listitem><para>Review the man pages that are associated with the modules.
These man pages can help you understand how each module functions, what options
are available, and the interactions between stacked modules.</para><caution><para>If the PAM configuration file is misconfigured or the file
becomes corrupted, no user might be able to log in. Because the <command>sulogin</command> command
does not use PAM, the root password would then be required to boot the machine
into single-user mode and fix the problem.</para>
</caution><para>After you change the <filename>/etc/pam.conf</filename> file, review
the file as much as possible while you still have system access to correct
problems. Test all the commands that might have been affected by your changes.
An example is adding a new module to the <command>telnet</command> service.
In this example, you would use the <command>telnet</command> command and verify
that your changes make the service behave as expected.</para>
</listitem>
</itemizedlist>
</sect2><task id="pam-14"><title>How to Add a PAM Module</title><indexterm><primary>PAM</primary><secondary>adding a module</secondary>
</indexterm><indexterm><primary>adding</primary><secondary>PAM modules</secondary>
</indexterm><tasksummary><para>This procedure shows how to add a new PAM module. New modules can be
created to cover site-specific security policies or to support third party
applications.</para>
</tasksummary><procedure>&rolestepA;<step id="pam-step-17"><para>Determine which control flags and which other
options should be used.</para><para>Refer to <olink targetptr="pam-15" remap="internal">How
PAM Stacking Works</olink> for information on the control flags.</para>
</step><step id="pam-step-19"><para>Ensure that the ownership and permissions are
set so that the module file is owned by <literal>root</literal> and the permissions
are <literal>555</literal>.</para>
</step><step id="pam-step-20"><para>Edit the PAM configuration file, <filename>/etc/pam.conf</filename>, and add this module to the appropriate services.</para>
</step><step><para>Verify that the module has been added properly.</para><para>You
must test <emphasis>before</emphasis> the system is rebooted in case the configuration
file is misconfigured. Login using a direct service, such as <command>ssh</command>,
and run the <command>su</command> command, before you reboot the system. The
service might be a daemon that is spawned only once when the system is booted.
Then, you must reboot the system before you can verify that the module has
been added.</para>
</step>
</procedure>
</task><task id="ewaws"><title>How to Prevent Rhost-Style Access From Remote Systems
With PAM</title><procedure>&rolestepA;<step><para>Remove all of the lines that include <literal>rhosts_auth.so.1</literal> from
the PAM configuration file.</para><para>This step prevents the reading of
the <filename>~/.rhosts</filename> files during an <command>rlogin</command> session.
Therefore, this step prevents unauthenticated access to the local system from
remote systems. All <command>rlogin</command> access requires a password,
regardless of the presence or contents of any <filename>~/.rhosts</filename> or <filename>/etc/hosts.equiv</filename> files.</para>
</step><step><para>Disable the <command>rsh</command> service.</para><para>To prevent
other unauthenticated access to the <filename>~/.rhosts</filename> files,
remember to disable the <command>rsh</command> service. </para><screen># <userinput>svcadm disable network/shell</userinput></screen>
</step>
</procedure>
</task><task id="pam-23"><title>How to Log PAM Error Reports</title><procedure>&rolestepA;<step id="pam-step-25"><para><indexterm><primary>PAM</primary><secondary><filename>/etc/syslog.conf</filename> file</secondary></indexterm><indexterm><primary><filename>/etc/syslog.conf</filename> file</primary><secondary>PAM and</secondary></indexterm>Configure the <filename>/etc/syslog.conf</filename> file for the
level of logging that you need.</para><para>See the <olink targetdoc="group-refman" targetptr="syslog.conf-4" remap="external"><citerefentry><refentrytitle>syslog.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink> for more information about
the logging levels.</para>
</step><step id="pam-step-26"><para>Refresh the configuration information for the <command>syslog</command> daemon.</para><screen># <userinput>svcadm refresh system/system-log</userinput></screen>
</step>
</procedure>
</task>
</sect1><sect1 id="pam-32"><title>PAM Configuration (Reference)</title><para><indexterm><primary>PAM</primary><secondary>configuration file</secondary><tertiary>introduction</tertiary></indexterm>The PAM configuration file, <olink targetdoc="group-refman" targetptr="pam.conf-4" remap="external"><citerefentry><refentrytitle>pam.conf</refentrytitle><manvolnum>4</manvolnum></citerefentry></olink>, is used to configure PAM
service modules for system services, such as <command>login</command>, <command>rlogin</command>, <command>su</command>, and <command>cron</command>. The system
administrator manages this file. An incorrect order of entries in <filename>pam.conf</filename> can cause unforeseen side effects. For example, a badly configured <filename>pam.conf</filename> can lock out users so that  single-user mode becomes necessary
for repair. For a description of setting the order, see <olink targetptr="pam-15" remap="internal">How PAM Stacking Works</olink>.</para><sect2 id="pam-33"><title>PAM Configuration File Syntax</title><para><indexterm><primary>PAM</primary><secondary>configuration file</secondary><tertiary>syntax</tertiary></indexterm>The entries in the configuration file
are in the format:</para><programlisting><replaceable>service-name</replaceable> <replaceable>module-type</replaceable> <replaceable>control-flag</replaceable> <replaceable>module-path</replaceable> <replaceable>module-options</replaceable></programlisting><variablelist><varlistentry><term><replaceable>service-name</replaceable></term><listitem><para>Name of the service, for example, <command>ftp</command>, <command>login</command>, or <command>passwd</command>. An application can use different
service names for the services that the application provides. For example,
the Solaris secure shell daemon uses these service names: <literal>sshd-none</literal>, <literal>sshd-password</literal>, <literal>sshd-kbdint</literal>, <literal>sshd-pubkey</literal>,
and <literal>sshd-hostbased</literal>. The service-name <emphasis>other</emphasis> is
a predefined name that is used as a wildcard service-name. If a particular
service-name is not found in the configuration file, the configuration for <emphasis>other</emphasis> is used.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>module-type</replaceable></term><listitem><para>The type of service, that is, <literal>auth</literal>, <literal>account</literal>, <literal>session</literal>, or <literal>password</literal>.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>control-flag</replaceable></term><listitem><para>Indicates the role of the module in determining the integrated
success or failure value for the service. Valid control flags are <literal>binding</literal>, <literal>include</literal>, <literal>optional</literal>, <literal>required</literal>, <literal>requisite</literal>, and <literal>sufficient</literal>.
See <olink targetptr="pam-15" remap="internal">How PAM Stacking Works</olink> for information
on the use of these flags.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>module-path</replaceable></term><listitem><para>The path to the library object that implements the service.
If the pathname is not absolute, the pathname is assumed to be relative to <filename>/usr/lib/security/$ISA/</filename>.  Use the architecture-dependent macro
$ISA to cause <filename>libpam</filename> to look in the directory for the
particular architecture of the application.</para>
</listitem>
</varlistentry><varlistentry><term><replaceable>module-options</replaceable></term><listitem><para>Options that are passed to the service modules. A module's
man page describes the options that are accepted by that module. Typical module
options include <literal>nowarn</literal> and <literal>debug</literal>.</para>
</listitem>
</varlistentry>
</variablelist>
</sect2><sect2 id="pam-15"><title>How PAM Stacking Works</title><itemizedlist><para><indexterm><primary>PAM</primary><secondary>configuration file</secondary><tertiary>stacking explained</tertiary></indexterm>When an application calls
on the following functions, <filename>libpam</filename> reads the configuration
file <filename>/etc/pam.conf</filename> to determine which modules participate
in the operation for this service:</para><listitem><para><olink targetdoc="refman" targetptr="pam-authenticate-3pam" remap="external"><citerefentry><refentrytitle>pam_authenticate</refentrytitle><manvolnum>3PAM</manvolnum></citerefentry></olink></para>
</listitem><listitem><para><olink targetdoc="refman" targetptr="pam-acct-mgmt-3pam" remap="external"><citerefentry><refentrytitle>pam_acct_mgmt</refentrytitle><manvolnum>3PAM</manvolnum></citerefentry></olink></para>
</listitem><listitem><para><olink targetdoc="refman" targetptr="pam-setcred-3pam" remap="external"><citerefentry><refentrytitle>pam_setcred</refentrytitle><manvolnum>3PAM</manvolnum></citerefentry></olink></para>
</listitem><listitem><para><olink targetdoc="refman" targetptr="pam-open-session-3pam" remap="external"><citerefentry><refentrytitle>pam_open_session</refentrytitle><manvolnum>3PAM</manvolnum></citerefentry></olink></para>
</listitem><listitem><para><olink targetdoc="refman" targetptr="pam-close-session-3pam" remap="external"><citerefentry><refentrytitle>pam_close_session</refentrytitle><manvolnum>3PAM</manvolnum></citerefentry></olink></para>
</listitem><listitem><para><olink targetdoc="refman" targetptr="pam-chauthtok-3pam" remap="external"><citerefentry><refentrytitle>pam_chauthtok</refentrytitle><manvolnum>3PAM</manvolnum></citerefentry></olink></para>
</listitem>
</itemizedlist><para>If <filename>/etc/pam.conf</filename> contains only one module for an
operation for this service such as authentication or account management, the
result of that module determines the outcome of the operation. For example,
the default authentication operation for the <command>passwd</command> application
contains one module, <literal>pam_passwd_auth.so.1</literal>:</para><screen>passwd  auth required           pam_passwd_auth.so.1</screen><para>If, on the other hand, there are multiple modules defined for the service's
operation, those modules are said to be <emphasis>stacked</emphasis> and that
a <emphasis>PAM stack</emphasis> exists for that service. For example, consider
the case where <filename>pam.conf</filename> contains the following entries:</para><screen>login   auth requisite          pam_authtok_get.so.1
login   auth required           pam_dhkeys.so.1
login   auth required           pam_unix_cred.so.1
login   auth required           pam_unix_auth.so.1
login   auth required           pam_dial_auth.so.1</screen><para>These entries represent a sample <literal>auth</literal> stack for the <command>login</command> service. To determine the outcome of this stack, the result
codes of the individual modules require an <emphasis>integration process</emphasis>.
In the integration process, the modules are executed in order as specified
in <filename>/etc/pam.conf</filename>. Each success or failure code is integrated
in the overall result depending on the module's control flag. The control
flag can cause early termination of the stack. For example, a <literal>requisite</literal> module
might fail, or a <literal>sufficient</literal> or <literal>binding</literal> module
might succeed. After the stack has been processed, the individual results
are combined into a single, overall result that is delivered to the application.</para><itemizedlist><para><indexterm><primary>PAM</primary><secondary>configuration file</secondary><tertiary>control flags</tertiary></indexterm>The control flag indicates the
role that a PAM module plays in determining access to the service. The control
flags and their effects are:</para><listitem><para><indexterm><primary>binding control flag</primary><secondary>PAM</secondary></indexterm><emphasis role="strong">Binding</emphasis> &ndash; Success in
meeting a binding module's requirements returns success immediately to the
application if no previous required modules have failed. If these conditions
are met, then no further execution of modules occurs. Failure causes a required
failure to be recorded and the processing of modules to be continued.</para>
</listitem><listitem><para><indexterm><primary>include control flag</primary><secondary>PAM</secondary></indexterm><emphasis role="strong">Include</emphasis> &ndash; Adds lines
from a separate PAM configuration file to be used at this point in the PAM
stack. This flag does not control success or failure behaviors. When a new
file is read, the PAM include stack is incremented. When the stack check in
the new file finishes, the include stack value is decremented. When the end
of a file is reached and the PAM include stack is 0, then the stack processing
ends. The maximum number for the PAM include stack is 32.</para>
</listitem><listitem><para><indexterm><primary>optional control flag</primary><secondary>PAM</secondary></indexterm><emphasis role="strong">Optional</emphasis> &ndash;
Success in meeting an optional module's requirements is not necessary for
using the service. Failure causes an optional failure to be recorded.</para>
</listitem><listitem><para><indexterm><primary>required control flag</primary><secondary>PAM</secondary></indexterm><emphasis role="strong">Required</emphasis> &ndash;
Success in meeting a required module's requirements is necessary for using
the service. Failure results in an error return after the remaining modules
for this service have been executed. Final success for the service is returned
only if no binding or required modules have reported failures.</para>
</listitem><listitem><para><indexterm><primary>requisite control flag</primary><secondary>PAM</secondary></indexterm><emphasis role="strong">Requisite</emphasis> &ndash;
Success in meeting a requisite module's requirements is necessary for using
the service. Failure results in an immediate error return with no further
execution of modules. All requisite modules for a service must return success
for the function to be able to return success to the application. </para>
</listitem><listitem><para><indexterm><primary>sufficient control flag</primary><secondary>PAM</secondary></indexterm><emphasis role="strong">Sufficient</emphasis> &ndash;
 If no previous required failures have occurred, success in a sufficient module
returns success to the application immediately with no further execution of
modules. Failure causes an optional failure to be recorded.</para>
</listitem>
</itemizedlist><para><indexterm><primary>PAM</primary><secondary>configuration file</secondary><tertiary>stacking diagrams</tertiary></indexterm>The following two diagrams
shows how access is determined in the integration process. The first diagram
indicates how success or failure is recorded for each type of control flag.
The second diagram shows how the integrated value is determined.</para><figure id="pam-fig-24"><title>PAM Stacking: Effect of Control Flags</title><mediaobject><imageobject><imagedata entityref="pam.run_stack1.eps"/>
</imageobject><textobject><simpara>Flow diagram shows how control flags affect PAM stacking.</simpara>
</textobject>
</mediaobject>
</figure><figure id="pam-fig-25"><title>PAM Stacking: How Integrated Value Is Determined</title><mediaobject><imageobject><imagedata entityref="pam.run_stack2.eps"/>
</imageobject><textobject><simpara>Flow diagram shows how integrated values are determined
in PAM stacking.</simpara>
</textobject>
</mediaobject>
</figure>
</sect2><sect2 id="emqut"><title>PAM Stacking Example</title><para><indexterm><primary>PAM</primary><secondary>configuration file</secondary><tertiary>stacking example</tertiary></indexterm>Consider the following example
of an <command>rlogin</command> service that requests authentication. </para><example id="pam-ex-18"><title>Partial Contents of a Typical PAM Configuration
File</title><para>The <filename>pam.conf</filename> file in this example has the following
contents for <command>rlogin</command> services:</para><screen>     # Authentication management
     ...     
     # rlogin service 
     rlogin  auth sufficient         pam_rhosts_auth.so.1
     rlogin  auth requisite          pam_authtok_get.so.1
     rlogin  auth required           pam_dhkeys.so.1
     rlogin  auth required           pam_unix_auth.so.1
     ...</screen><para>When the <command>rlogin</command> service requests authentication, <filename>libpam</filename> first executes the <olink targetdoc="group-refman" targetptr="pam-rhosts-auth-5" remap="external"><citerefentry><refentrytitle>pam_rhosts_auth</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> module. The control flag is
set to <literal>sufficient</literal> for the <literal>pam_rhosts_auth</literal> module.
If the <literal>pam_rhosts_auth</literal> module is able to authenticate the
user, then processing stops and success is returned to the application.</para><para>If the <literal>pam_rhosts_auth</literal> module fails to authenticate
the user, then the next PAM module, <olink targetdoc="group-refman" targetptr="pam-authtok-get-5" remap="external"><citerefentry><refentrytitle>pam_authtok_get</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> is executed. The control flag
for this module is set to <literal>requisite</literal>. If <literal>pam_authtok_get</literal> fails, then the authentication process ends and the failure is
returned to <command>rlogin</command>. </para><para>If <literal>pam_authtok_get</literal> succeeds, then the next two modules, <olink targetdoc="group-refman" targetptr="pam-dhkeys-5" remap="external"><citerefentry><refentrytitle>pam_dhkeys</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink> and <olink targetdoc="group-refman" targetptr="pam-unix-auth-5" remap="external"><citerefentry><refentrytitle>pam_unix_auth</refentrytitle><manvolnum>5</manvolnum></citerefentry></olink>, are executed.
Both modules have the associated control flags that are set to <literal>required</literal> so
that the process continues regardless of whether an individual failure is
returned. After <literal>pam_unix_auth</literal> is executed, no modules for <command>rlogin</command> authentication remain. At this point, if either <literal>pam_dhkeys</literal> or <literal>pam_unix_auth</literal> has returned a failure, the
user is denied access through <command>rlogin</command>.</para>
</example>
</sect2>
</sect1>
</chapter><?Pub *0000032794 0?>