Overview#

All Pluggable Authentication Modules generate a success or failure result when checked. PAM Control flags tell PAM what do with the result.

Since modules can be stacked in a particular order, control flags give you the ability to set the importance of a module in respect to the modules that follow it.

Simple Syntax#

For the simple (historical) syntax valid control values are:

required #

failure of such a PAM will ultimately lead to the PAM-API returning failure but only after the remaining stacked modules (for this service and type) have been invoked.

requisite#

Like required, however, in the case that such a module returns a failure, control is directly returned to the application. The return value is that associated with the first required or requisite module to fail.

Note, this flag can be used to protect against the possibility of a user getting the opportunity to enter a password over an unsafe medium. It is conceivable that such behavior might inform an attacker of valid accounts on a system. This possibility should be weighed against the not insignificant concerns of exposing a sensitive password in a hostile environment.

sufficient#

success of such a module is enough to satisfy the authentication requirements of the stack of modules (if a prior required module has failed the success of this one is ignored). A failure of this module is not deemed as fatal to satisfying the application that this type has succeeded. If the module succeeds the PAM framework returns success to the application immediately without trying any other modules.

optional#

The success or failure of this module is only important if it is the only module in the stack associated with this service+type.

include#

include all lines of given type from the configuration file specified as an argument to this control.

substack#

include all lines of given type from the configuration file specified as an argument to this control. This differs from include in that evaluation of the done and die actions in a substack does not cause skipping the rest of the complete module stack, but only of the substack. Jumps in a substack also can not make evaluation jump out of it, and the whole substack is counted as one module when the jump is done in a parent stack. The reset action will reset the state of a module stack to the state it was in as of beginning of the substack evaluation.
The order in which required modules are called is not critical. The sufficient and requisite control flags cause order to become important.

Complex Syntax#

For the more complicated syntax valid control values have the following form:
      [value1=action1 value2=action2 ...]

Where valueN corresponds to the return code from the function invoked in the module for which the line is defined. It is selected from one of these: success, open_err, symbol_err, service_err, system_err, buf_err, perm_denied, auth_err, cred_insufficient, authinfo_unavail, user_unknown, maxtries, new_authtok_reqd, acct_expired, session_err, cred_unavail, cred_expired, cred_err, no_module_data, conv_err, authtok_err, authtok_recover_err, authtok_lock_busy, authtok_disable_aging, try_again, ignore, abort, authtok_expired, module_unknown, bad_item, conv_again, incomplete, and default.

The last of these, default, implies 'all valueN's not mentioned explicitly. Note, the full list of PAM errors is available in /usr/include/security/_pam_types.h. The actionN can be: an unsigned integer, n, signifying an action of 'jump over the next n modules in the stack'; or take one of the following forms:

ignore#

when used with a stack of modules, the module's return status will not contribute to the return code the application obtains.

bad#

this action indicates that the return code should be thought of as indicative of the module failing. If this module is the first in the stack to fail, its status value will be used for that of the whole stack.

die#

equivalent to bad with the side effect of terminating the module stack and PAM immediately returning to the application.

ok#

this tells PAM that the administrator thinks this return code should contribute directly to the return code of the full stack of modules. In other words, if the former state of the stack would lead to a return of PAM_SUCCESS, the module's return code will override this value. Note, if the former state of the stack holds some value that is indicative of a modules failure, this 'ok' value will not be used to override that value.

done#

equivalent to ok with the side effect of terminating the module stack and PAM immediately returning to the application.

reset#

clear all memory of the state of the module stack and start again with the next stacked module.

[...] Syntax#

Each of the four keywords: required; requisite; sufficient; and optional, have an equivalent expression in terms of the [...] syntax. They are as follows:

required#

    [success=ok new_authtok_reqd=ok ignore=ignore default=bad] 

requisite#

    [success=ok new_authtok_reqd=ok ignore=ignore default=die] 

sufficient#

    [success=done new_authtok_reqd=done default=ignore] 

optional#

    [success=ok new_authtok_reqd=ok default=ignore] 

More Information#

There might be more information for this subject on one of the following:

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-7) was last changed on 28-Apr-2016 05:03 by jim