Linux-PAM SAG
Linux-PAM SAG
Linux-PAM SAG
Andrew G. Morgan
<morgan@kernel.org>
Thorsten Kukuk
<kukuk@thkukuk.de>
Abstract
--------------------------------------------------------------------------
1. Introduction
3. Overview
5. Security issues
7. See also
8. Author/acknowledgments
Chapter 1. Introduction
3
Chapter 2. Some comments on the text
Chapter 3. Overview
From the perspective of the application programmer (in this case the
person that wrote the login application), Linux-PAM takes care of this
authentication task -- verifying the identity of the user.
Linux-PAM deals with four separate types of (management) task. These are:
authentication management; account management; session management; and
password management. The association of the preferred management scheme
4
with the behavior of an application is made with entries in the relevant
Linux-PAM configuration file. The management functions are performed by
modules specified in the configuration file. The syntax for this file is
discussed in the section below.
+----------------+
| application: X |
+----------------+ / +----------+ +================+
| authentication-[---->--\--] Linux- |--<--| PAM config file|
| + [----<--/--] PAM | |================|
|[conversation()][--+ \ | | | X auth .. a.so |
+----------------+ | / +-n--n-----+ | X auth .. b.so |
| | | __| | | _____/
| service user | A | | |____,-----'
| | | V A
+----------------+ +------|-----|---------+ -----+------+
+---u-----u----+ | | |
| auth.... |--[ a ]--[ b ]--[ c ]
+--------------+
| acct.... |--[ b ]--[ d ]
+--------------+
| password |--[ b ]--[ c ]
+--------------+
| session |--[ e ]--[ c ]
+--------------+
The type is the management group that the rule corresponds to. It is used
to specify which of the management groups the subsequent module is to be
associated with. Valid entries are:
account
auth
password
6
session
If the type value from the list above is prepended with a - character the
PAM library will not log to the system log if it is not possible to load
the module because it is missing in the system. This can be useful
especially for modules which are not always installed on the system and
are not required for correct authentication and authorization of the login
session.
The third field, control, indicates the behavior of the PAM-API should the
module fail to succeed in its authentication task. There are two types of
syntax for this control field: the simple one has a single simple keyword;
the more complicated one involves a square-bracketed selection of
value=action pairs.
required
requisite
sufficient
optional
include
substack
For the more complicated syntax valid control values have the following
form:
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.
ignore
when used with a stack of modules, the module's return status will
not contribute to the return code the application obtains.
bad
die
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
8
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
reset
clear all memory of the state of the module stack and start again
with the next stacked module.
required
requisite
sufficient
optional
When using this convention, you can include `[' characters inside the
string, and if you wish to include a `]' character inside the string that
9
will survive the argument parsing, you should use `\]'. In other words:
Any line in (one of) the configuration file(s), that is not formatted
correctly, will generally tend (erring on the side of caution) to make the
authentication process fail. A corresponding error is written to the
system log files with a call to syslog(3).
The only difference being that the service-name is not present. The
service-name is of course the name of the given configuration file. For
example, /etc/pam.d/login contains the configuration for the login
service.
#
# default; deny access
#
other auth required pam_deny.so
other account required pam_deny.so
other password required pam_deny.so
other session required pam_deny.so
10
The addition of the following line before those in the above example would
provide a suitable warning to the administrator.
#
# default; wake up! This application is not configured
#
other auth required pam_warn.so
other password required pam_warn.so
#
# default configuration: /etc/pam.d/other
#
auth required pam_warn.so
auth required pam_deny.so
account required pam_deny.so
password required pam_warn.so
password required pam_deny.so
session required pam_deny.so
#
# default; standard UN*X access
#
auth required pam_unix.so
account required pam_unix.so
password required pam_unix.so
session required pam_unix.so
To recover, your best bet is to restore the system from a backup or boot
the system into a rescue system and correct things from there.
It is not a good thing to have a weak default (other) entry. This service
is the default configuration for all PAM aware applications and if it is
weak, your system is likely to be vulnerable to attack.
Here is a sample "other" configuration file. The pam_deny module will deny
access and the pam_warn module will send a syslog message to auth.notice:
#
# The PAM configuration file for the `other' service
#
auth required pam_deny.so
auth required pam_warn.so
account required pam_deny.so
account required pam_warn.so
password required pam_deny.so
password required pam_warn.so
session required pam_deny.so
session required pam_warn.so
6.1.1. DESCRIPTION
By default rules for access management are taken from config file
/etc/security/access.conf if you don't specify another file. Then
individual *.conf files from the /etc/security/access.d/ directory are
read. The files are parsed one after another in the order of the system
locale. The effect of the individual files is the same as if all the files
were concatenated together in the order of parsing. This means that once a
pattern is matched in some file no further files are parsed. If a config
file is explicitly specified with the accessfile option the files in the
above directory are not parsed.
If Linux PAM is compiled with audit support the module will report when it
denies access based on origin (host, tty, etc.).
12
6.1.2. DESCRIPTION
When someone logs in, the file access.conf is scanned for the first entry
that matches the (user/group, host) or (user/group, network/netmask)
combination, or, in case of non-networked logins, the first entry that
matches the (user/group, tty) combination, or in the case of non-networked
logins without a tty, the first entry that matches the (user/group,
X-$DISPLAY-value) or (user/group, pam-service-name/) combination. The
permissions field of that table entry determines whether the login will be
accepted or refused.
Each line of the login access control table has three fields separated by
a ":" character (colon):
permission:users/groups:origins
The first field, the permission field, can be either a "+" character
(plus) for access granted or a "-" character (minus) for access denied.
The second field, the users/group field, should be a list of one or more
login names, group names, or ALL (which always matches). To differentiate
user entries from group entries, group entries should be written with
brackets, e.g. (group).
The third field, the origins field, should be a list of one or more tty
names (for non-networked logins), X $DISPLAY values or PAM service names
(for non-networked logins without a tty), host names, domain names (begin
with "."), host addresses, internet network numbers (end with "."),
internet network addresses with network mask (where network mask can be a
decimal number or an internet address also), ALL (which always matches) or
LOCAL. The LOCAL keyword matches if and only if pam_get_item(3), when
called with an item_type of PAM_RHOST, returns NULL or an empty string
(and therefore the origins field is compared against the return value of
pam_get_item(3) called with an item_type of PAM_TTY or, absent that,
PAM_SERVICE).
If the nodefgroup is not set, the group file is searched when a name does
not match that of the logged-in user. Only groups are matched in which
users are explicitly listed. However the PAM module does not look at the
primary group id of a user.
The "#" character at start of line (no space at front) can be used to mark
this line as a comment line.
6.1.3. OPTIONS
13
accessfile=/path/to/access.conf
debug
noaudit
Do not report logins from disallowed hosts and ttys to the audit
subsystem.
fieldsep=separators
listsep=separators
nodefgroup
All module types (auth, account, password and session) are provided.
PAM_SUCCESS
PAM_PERM_DENIED
14
Access was not granted.
PAM_IGNORE
PAM_ABORT
PAM_USER_UNKNOWN
6.1.6. FILES
/etc/security/access.conf
6.1.7. EXAMPLES
User root should be allowed to get access via cron, X11 terminal :0, tty1,
..., tty5, tty6.
User root should be allowed to get access from hosts which own the IPv4
addresses. This does not mean that the connection have to be a IPv4 one, a
IPv6 connection from a host with one of this IPv4 addresses does work,
too.
+:root:127.0.0.1
User root should get access from network 192.168.201. where the term will
be evaluated by string matching. But it might be better to use
network/netmask instead. The same meaning of 192.168.201. is
192.168.201.0/24 or 192.168.201.0/255.255.255.0.
+:root:192.168.201.
User root should be able to have access from hosts foo1.bar.org and
foo2.bar.org (uses string matching also).
+:root:foo1.bar.org foo2.bar.org
User root should be able to have access from domain foo.bar.org (uses
string matching also).
+:root:.foo.bar.org
User root should be denied to get access from all other sources.
15
-:root:ALL
User foo and members of netgroup admins should be allowed to get access
from all sources. This will only work if netgroup service is available.
+:@admins foo:ALL
User john and foo should get access from IPv6 host address.
+:john foo:2001:db8:0:101::1
+:john:2001:db8:0:101::/64
Disallow console logins to all but the shutdown, sync and all other
accounts, which are a member of the wheel group.
All other users should be denied to get access from all sources.
-:ALL:ALL
6.1.8. AUTHORS
The logdaemon style login access control scheme was designed and
implemented by Wietse Venema. The pam_access PAM module was developed by
Alexei Nogin <alexei@nogin.dnttm.ru>. The IPv6 support and the
network(address) / netmask feature was developed and provided by Mike
Becher <mike.becher@lrz-muenchen.de>.
pam_cracklib.so [ ... ]
6.2.1. DESCRIPTION
This module can be plugged into the password stack of a given application
to provide some plug-in strength-checking for passwords.
The action of this module is to prompt the user for a password and check
its strength against a system dictionary and a set of rules for
identifying poor choices.
The first action is to prompt for a single password, check its strength
and then, if it is considered strong, prompt for the password a second
time (to verify that it was typed correctly on the first occasion). All
being well, the password is passed on to subsequent modules to be
installed as the new authentication token.
The strength checks works in the following manner: at first the Cracklib
routine is called to check if the password is part of a dictionary; if
this is not the case an additional set of strength checks is done. These
checks are:
Palindrome
16
Is the new password a palindrome?
Is the new password the the old one with only a change of case?
Similar
Is the new password too much like the old one? This is primarily
controlled by one argument, difok which is a number of character
changes (inserts, removals, or replacements) between the old and
new password that are enough to accept the new password. This
defaults to 5 changes.
Simple
Rotated
This module with no arguments will work well for standard unix password
encryption. With md5 encryption, passwords can be longer than 8 characters
and the default settings for this module can make it hard for the user to
choose a satisfactory new password. Notably, the requirement that the new
password contain no more than 1/2 of the characters in the old password
becomes a non-trivial constraint. For example, an old password of the form
"the quick brown fox jumped over the lazy dogs" would be difficult to
change... In addition, the default action is to allow passwords as small
as 5 characters in length. For a md5 systems it can be a good idea to
increase the required minimum size of a password. One can then allow more
credit for different kinds of characters but accept that the new password
may share most of these characters with the old password.
6.2.2. OPTIONS
debug
The default action is for the module to use the following prompts
when requesting passwords: "New UNIX password: " and "Retype UNIX
password: ". The example word UNIX can be replaced with this
option, by default it is empty.
retry=N
difok=N
minlen=N
The minimum acceptable size for the new password (plus one if
credits are not disabled which is the default). In addition to the
number of characters in the new password, credit (of +1 in length)
is given for each different kind of character (other, upper, lower
and digit). The default for this parameter is 9 which is good for
a old style UNIX password all of the same type of character but
may be too low to exploit the added security of a md5 system. Note
that there is a pair of length limits in Cracklib itself, a "way
too short" limit of 4 which is hard coded in and a defined limit
(6) that will be checked without reference to minlen. If you want
to allow passwords as short as 5 characters you should not use
this module.
dcredit=N
(N >= 0) This is the maximum credit for having digits in the new
password. If you have less than or N digits, each digit will count
+1 towards meeting the current minlen value. The default for
dcredit is 1 which is the recommended value for minlen less than
10.
(N < 0) This is the minimum number of digits that must be met for
a new password.
ucredit=N
(N >= 0) This is the maximum credit for having upper case letters
in the new password. If you have less than or N upper case letters
each letter will count +1 towards meeting the current minlen
value. The default for ucredit is 1 which is the recommended value
for minlen less than 10.
(N < 0) This is the minimum number of upper case letters that must
be met for a new password.
lcredit=N
18
(N >= 0) This is the maximum credit for having lower case letters
in the new password. If you have less than or N lower case
letters, each letter will count +1 towards meeting the current
minlen value. The default for lcredit is 1 which is the
recommended value for minlen less than 10.
(N < 0) This is the minimum number of lower case letters that must
be met for a new password.
ocredit=N
minclass=N
maxrepeat=N
maxsequence=N
maxclassrepeat=N
reject_username
gecoscheck
Check whether the words from the GECOS field (usualy full name of
the user) longer than 3 characters in straight or reversed form
19
are contained in the new password. If any such word is found the
new password is rejected.
enforce_for_root
The module will return error on failed check also if the user
changing the password is root. This option is off by default which
means that just the message about the failed check is printed but
root can change the password anyway. Note that root is not asked
for an old password so the checks that compare the old and new
password are not performed.
use_authtok
This argument is used to force the module to not prompt the user
for a new password but use the one provided by the previously
stacked password module.
dictpath=/path/to/dict
PAM_SUCCESS
PAM_AUTHTOK_ERR
PAM_AUTHTOK_RECOVERY_ERR
PAM_SERVICE_ERR
6.2.5. EXAMPLES
For an example of the use of this module, we show how it may be stacked
with the password component of pam_unix(8)
#
# These lines stack two password type modules. In this example the
# user is given 3 opportunities to enter a strong password. The
# "use_authtok" argument ensures that the pam_unix module does not
# prompt for a password, but instead uses the one provided by
# pam_cracklib.
20
#
passwd password required pam_cracklib.so retry=3
passwd password required pam_unix.so use_authtok
Another example (in the /etc/pam.d/passwd format) is for the case that you
want to use md5 password encryption:
#%PAM-1.0
#
# These lines allow a md5 systems to support passwords of at least 14
# bytes with extra credit of 2 for digits and 2 for others the new
# password must have at least three bytes that are not present in the
# old password
#
password required pam_cracklib.so \
difok=3 minlen=15 dcredit= 2 ocredit=2
password required pam_unix.so use_authtok nullok md5
And here is another example in case you don't want to use credits:
#%PAM-1.0
#
# These lines require the user to select a password with a minimum
# length of 8 and with at least 1 digit number, 1 upper case letter,
# and 1 other character
#
password required pam_cracklib.so \
dcredit=-1 ucredit=-1 ocredit=-1 lcredit=0 minlen=8
password required pam_unix.so use_authtok nullok md5
6.2.6. AUTHOR
6.3.1. DESCRIPTION
6.3.2. OPTIONS
auth=value
cred=value
prechauthtok=value
chauthtok=value
open_session=value
close_session=value
All module types (auth, account, password and session) are provided.
PAM_SUCCESS
6.3.5. EXAMPLES
6.3.6. AUTHOR
22
pam_deny.so
6.4.1. DESCRIPTION
6.4.2. OPTIONS
All module types (account, auth, password and session) are provided.
PAM_AUTH_ERR
PAM_CRED_ERR
PAM_AUTHTOK_ERR
PAM_SESSION_ERR
6.4.5. EXAMPLES
#%PAM-1.0
#
# If we don't have config entries for a service, the
# OTHER entries are used. To be secure, warn and deny
# access to everything.
other auth required pam_warn.so
other auth required pam_deny.so
other account required pam_warn.so
other account required pam_deny.so
other password required pam_warn.so
other password required pam_deny.so
other session required pam_warn.so
other session required pam_deny.so
6.4.6. AUTHOR
pam_echo.so [ file=/path/message ]
23
6.5.1. DESCRIPTION
The pam_echo PAM module is for printing text messages to inform user about
special things. Sequences starting with the % character are interpreted in
the following way:
%H
%h
%s
%t
%U
%u
6.5.2. OPTIONS
file=/path/message
The content of the file /path/message will be printed with the PAM
conversion function as PAM_TEXT_INFO.
All module types (auth, account, password and session) are provided.
PAM_BUF_ERR
PAM_SUCCESS
PAM_IGNORE
6.5.5. EXAMPLES
For an example of the use of this module, we show how it may be used to
print information about good passwords:
6.5.6. AUTHOR
6.6.1. DESCRIPTION
By default rules for (un)setting of variables are taken from the config
file /etc/security/pam_env.conf. An alternate file can be specified with
the conffile option.
Since setting of PAM environment variables can have side effects to other
modules, this module should be the last one on the stack.
6.6.2. DESCRIPTION
Each line starts with the variable name, there are then two possible
options for each variable DEFAULT and OVERRIDE. DEFAULT allows and
administrator to set the value of the variable to some default value, if
none is supplied then the empty string is assumed. The OVERRIDE option
tells pam_env that it should enter in its value (overriding the default
value) if there is one to use. OVERRIDE is not used, "" is assumed and no
override will be done.
The "#" character at start of line (no space at front) can be used to mark
this line as a comment line.
6.6.3. OPTIONS
conffile=/path/to/pam_env.conf
debug
envfile=/path/to/environment
readenv=0|1
user_envfile=filename
user_readenv=0|1
PAM_ABORT
PAM_BUF_ERR
PAM_IGNORE
PAM_SUCCESS
6.6.6. FILES
/etc/security/pam_env.conf
/etc/environment
$HOME/.pam_environment
6.6.7. EXAMPLES
Set the REMOTEHOST variable for any hosts that are remote, default to
"localhost" rather than not being set at all
PAGER DEFAULT=less
MANPAGER DEFAULT=less
LESS DEFAULT="M q e h15 z23 b80"
NNTPSERVER DEFAULT=localhost
PATH DEFAULT=${HOME}/bin:/usr/local/bin:/bin\
27
:/usr/bin:/usr/local/bin/X11:/usr/bin/X11
XDG_DATA_HOME @{HOME}/share/
DOLLAR DEFAULT=\$
DOLLARDOLLAR DEFAULT= OVERRIDE=\$${DOLLAR}
DOLLARPLUS DEFAULT=\${REMOTEHOST}${REMOTEHOST}
ATSIGN DEFAULT="" OVERRIDE=\@
6.6.8. AUTHOR
6.7.1. DESCRIPTION
Commands called by pam_exec need to be aware of that the user can have
controll over the environment.
6.7.2. OPTIONS
debug
expose_authtok
log=file
type=type
Only run the command if the module type matches the given type.
stdout
quiet
Per default pam_exec.so will echo the exit status of the external
command if it fails. Specifying this option will suppress the
message.
seteuid
Per default pam_exec.so will execute the external command with the
real user ID of the calling process. Specifying this option means
the command is run with the effective user ID.
All module types (auth, account, password and session) are provided.
PAM_SUCCESS
PAM_SERVICE_ERR
PAM_SYSTEM_ERR
PAM_IGNORE
pam_setcred was called, which does not execute the command. Or,
the value given for the type= parameter did not match the module
type.
6.7.5. EXAMPLES
make -C /var/yp
6.7.6. AUTHOR
6.8.1. DESCRIPTION
pam_faildelay is a PAM module that can be used to set the delay on failure
per-application.
6.8.2. OPTIONS
debug
delay=N
PAM_IGNORE
PAM_SYSTEM_ERR
6.8.5. EXAMPLES
6.8.6. AUTHOR
6.9.1. DESCRIPTION
30
To function this module requires filters to be installed on the system.
The single filter provided with the module simply transposes upper and
lower case letters in the input and output streams. (This can be very
annoying and is not kind to termcap based editors).
Each component of the module has the potential to invoke the desired
filter. The filter is always execv(2) with the privilege of the calling
application and not that of the user. For this reason it cannot usually be
killed by the user without closing their session.
6.9.2. OPTIONS
debug
new_term
non_term
runX
In order that the module can invoke a filter it should know when
to invoke it. This argument is required to tell the filter when to
do this.
For the case of the account component. Either run1 or run2 may be
used.
filter
The full pathname of the filter to be run and any command line
31
arguments that the filter might expect.
All module types (auth, account, password and session) are provided.
PAM_SUCCESS
PAM_ABORT
6.9.5. EXAMPLES
6.9.6. AUTHOR
6.10.1. DESCRIPTION
This module intercepts the user's name and password. If the name is ftp or
anonymous, the user's password is broken up at the @ delimiter into a
PAM_RUSER and a PAM_RHOST part; these pam-items being set accordingly. The
username (PAM_USER) is set to ftp. In this case the module succeeds.
Alternatively, the module sets the PAM_AUTHTOK item with the entered
password and fails.
6.10.2. OPTIONS
debug
ignore
ftp=XXX,YYY,...
32
Instead of ftp or anonymous, provide anonymous login to the comma
separated list of users: XXX,YYY,.... Should the applicant enter
one of these usernames the returned username is set to the first
in the list: XXX.
PAM_SUCCESS
PAM_USER_UNKNOWN
6.10.5. EXAMPLES
#
# ftpd; add ftp-specifics. These lines enable anonymous ftp over
# standard UN*X access (the listfile entry blocks access to
# users listed in /etc/ftpusers)
#
auth sufficient pam_ftp.so
auth required pam_unix.so use_first_pass
auth required pam_listfile.so \
onerr=succeed item=user sense=deny file=/etc/ftpusers
6.10.6. AUTHOR
pam_group.so
6.11.1. DESCRIPTION
The pam_group PAM module does not authenticate the user, but instead it
grants group memberships (in the credential setting phase of the
authentication module) to the user. Such memberships are based on the
service they are applying for.
By default rules for group memberships are taken from config file
/etc/security/group.conf.
6.11.2. DESCRIPTION
The pam_group PAM module does not authenticate the user, but instead it
grants group memberships (in the credential setting phase of the
authentication module) to the user. Such memberships are based on the
service they are applying for.
services;ttys;users;times;groups
The first field, the services field, is a logic list of PAM service names
that the rule applies to.
The second field, the tty field, is a logic list of terminal names that
this rule applies to.
The third field, the users field, is a logic list of users, or a UNIX
group, or a netgroup of users to whom this rule applies. Group names are
preceded by a '%' symbol, while netgroup names are preceded by a '@'
symbol.
For these items the simple wildcard '*' may be used only once. With UNIX
groups or netgroups no wildcards or logic operators are allowed.
The times field is used to indicate "when" these groups are to be given to
the user. The format here is a logic list of day/time-range entries. The
days are specified by a sequence of two character entries, MoTuSa for
example is Monday Tuesday and Saturday. Note that repeated days are unset
MoMo = no day, and MoWk = all weekdays bar Monday. The two character
combinations accepted are Mo Tu We Th Fr Sa Su Wk Wd Al, the last two
being week-end days and all 7 days of the week respectively. As a final
example, AlFr means all days except Friday.
The groups field is a comma or space separated list of groups that the
user inherits membership of. These groups are added if the previous fields
are satisfied by the user's request.
34
For a rule to be active, ALL of service+ttys+users must be satisfied by
the applying process.
6.11.3. OPTIONS
PAM_SUCCESS
PAM_ABORT
PAM_BUF_ERR
PAM_CRED_ERR
PAM_IGNORE
PAM_USER_UNKNOWN
6.11.6. FILES
/etc/security/group.conf
6.11.7. EXAMPLES
Running 'xsh' on tty* (any ttyXXX device), the user 'us' is given access
to the floppy (through membership of the floppy group)
xsh;tty*&!ttyp*;us;Al0000-2400;floppy
Running 'xsh' on tty* (any ttyXXX device), the users 'sword', 'pike' and
'shield' are given access to games (through membership of the floppy
group) after work hours.
Any member of the group 'admin' running 'xsh' on tty*, is granted access
(at any time) to the group 'plugdev'
6.11.8. AUTHORS
6.12.1. DESCRIPTION
Recognized escapes:
\d
current day
\l
\m
\n
\o
\r
\t
current time
\s
\u
36
number of users currently logged in
\U
\v
6.12.2. OPTIONS
noesc
issue=issue-file-name
PAM_BUF_ERR
PAM_IGNORE
PAM_SERVICE_ERR
PAM_SUCCESS
6.12.5. EXAMPLES
Add the following line to /etc/pam.d/login to set the user specific issue
at login:
6.12.6. AUTHOR
37
pam_keyinit.so [ debug ] [ force ] [ revoke ]
6.13.1. DESCRIPTION
The pam_keyinit PAM module ensures that the invoking process has a session
keyring other than the user default session keyring.
The session component of the module checks to see if the process's session
keyring is the user default, and, if it is, creates a new anonymous
session keyring with which to replace it.
This module should not, generally, be invoked by programs like su, since
it is usually desirable for the key set to percolate through to the
alternate context. The keys have their own permissions system to manage
this.
The keyutils package is used to manipulate keys more directly. This can be
obtained from:
Keyutils
6.13.2. OPTIONS
debug
force
revoke
38
PAM_SUCCESS
PAM_AUTH_ERR
Authentication failure.
PAM_BUF_ERR
PAM_IGNORE
PAM_SERVICE_ERR
PAM_SESSION_ERR
This module will return this value if its arguments are invalid or
if a system error such as ENOMEM occurs.
PAM_USER_UNKNOWN
6.13.5. EXAMPLES
Add this line to your login entries to start each login session with its
own session keyring:
This will prevent keys from one session leaking into another session for
the same user.
6.13.6. AUTHOR
6.14.1. DESCRIPTION
39
If the module is called in the auth or account phase, the accounts that
were not used recently enough will be disallowed to log in. The check is
not performed for the root account so the root is never locked out.
6.14.2. OPTIONS
debug
silent
Don't inform the user about any previous login, just update the
/var/log/lastlog file.
never
If the /var/log/lastlog file does not contain any old entries for
the user, indicate that the user has never previously logged in
with a welcome message.
nodate
noterm
Don't display the terminal name on which the last login was
attempted.
nohost
Don't indicate from which host the last login was attempted.
nowtmp
noupdate
showfailed
Display number of failed login attempts and the date of the last
failed attempt from btmp. The date is not displayed when nodate is
specified.
inactive=<days>
The auth and account module type allows to lock out users which did not
40
login recently enough. The session module type is provided for displaying
the information about the last login and/or updating the lastlog and wtmp
files.
PAM_SUCCESS
PAM_SERVICE_ERR
PAM_USER_UNKNOWN
PAM_AUTH_ERR
PAM_IGNORE
There was an error during reading the lastlog file in the auth or
account phase and thus inactivity of the user cannot be
determined.
6.14.5. EXAMPLES
Add the following line to /etc/pam.d/login to display the last login time
of an user:
To reject the user if he did not login during the previous 50 days the
following line can be used:
6.14.6. AUTHOR
6.15.1. DESCRIPTION
The pam_limits PAM module sets limits on the system resources that can be
obtained in a user-session. Users of uid=0 are affected by this limits,
too.
41
By default limits are taken from the /etc/security/limits.conf config
file. Then individual *.conf files from the /etc/security/limits.d/
directory are read. The files are parsed one after another in the order of
"C" locale. The effect of the individual files is the same as if all the
files were concatenated together in the order of parsing. If a config file
is explicitly specified with a module option then the files in the above
directory are not parsed.
If Linux PAM is compiled with audit support the module will report when it
denies access based on limit of maximum number of concurrent login
sessions.
6.15.2. DESCRIPTION
The pam_limits.so module applies ulimit limits, nice priority and number
of simultaneous login sessions limit to user login sessions. This
description of the configuration file syntax applies to the
/etc/security/limits.conf file and *.conf files in the
/etc/security/limits.d directory.
<domain>
* a username
hard
soft
<item>
core
data
fsize
memlock
nofile
rss
stack
nproc
as
maxlogins
maxsyslogins
priority
locks
sigpending
msgqueue
nice
rtprio
Also, please note that all limit settings are set per login. They are not
global, nor are they permanent; existing only for the duration of the
session. One exception is the maxlogin option, this one is system wide.
But there is a race, concurrent logins at the same time will not always be
detect as such but only counted as one.
6.15.3. OPTIONS
conf=/path/to/limits.conf
debug
set_all
utmp_early
noaudit
45
PAM_ABORT
PAM_IGNORE
PAM_PERM_DENIED
PAM_SERVICE_ERR
PAM_SESSION_ERR
PAM_SUCCESS
PAM_USER_UNKNOWN
6.15.6. FILES
/etc/security/limits.conf
6.15.7. EXAMPLES
* soft core 0
* hard nofile 512
@student hard nproc 20
@faculty soft nproc 20
@faculty hard nproc 50
ftp hard nproc 0
@student - maxlogins 4
:123 hard cpu 5000
@500: soft cpu 10000
600:700 hard locks 10
6.15.8. AUTHORS
6.16.1. DESCRIPTION
The module gets the item of the type specified -- user specifies the
username, PAM_USER; tty specifies the name of the terminal over which the
request has been made, PAM_TTY; rhost specifies the name of the remote
host (if any) from which the request was made, PAM_RHOST; and ruser
specifies the name of the remote user (if available) who made the request,
PAM_RUSER -- and looks for an instance of that item in the file=filename.
filename contains one line per item listed. If the item is found, then if
sense=allow, PAM_SUCCESS is returned, causing the authorization request to
succeed; else if sense=deny, PAM_AUTH_ERR is returned, causing the
authorization request to fail.
Besides this last one, all arguments should be specified; do not count on
any default behavior.
6.16.2. OPTIONS
item=[tty|user|rhost|ruser|group|shell]
sense=[allow|deny]
file=/path/filename
File containing one item per line. The file needs to be a plain
file and not world writable.
onerr=[succeed|fail]
apply=[user|@group]
Restrict the user class for which the restriction apply. Note that
with item=[user|ruser|group] this does not make sense, but for
47
item=[tty|rhost|shell] it have a meaning.
quiet
All module types (auth, account, password and session) are provided.
PAM_AUTH_ERR
Authentication failure.
PAM_BUF_ERR
PAM_IGNORE
PAM_SERVICE_ERR
PAM_SUCCESS
Success.
6.16.5. EXAMPLES
#
# deny ftp-access to users listed in the /etc/ftpusers file
#
auth required pam_listfile.so \
onerr=succeed item=user sense=deny file=/etc/ftpusers
To allow login access only for certain users, you can use a
/etc/pam.d/login entry like this:
#
# permit login to users listed in /etc/loginusers
#
auth required pam_listfile.so \
onerr=fail item=user sense=allow file=/etc/loginusers
48
For this example to work, all users who are allowed to use the login
service should be listed in the file /etc/loginusers. Unless you are
explicitly trying to lock out root, make sure that when you do this, you
leave a way for root to log in, either by listing root in /etc/loginusers,
or by listing a user who is able to su to the root account.
6.16.6. AUTHOR
6.17.1. DESCRIPTION
This could also be implemented using pam_listfile.so and a very short awk
script invoked by cron, but it's common enough to have been separated out.
6.17.2. OPTIONS
debug
file=/path/passwd
All module types (account, auth, password and session) are provided.
PAM_SUCCESS
PAM_SERVICE_ERR
PAM_PERM_DENIED
6.17.5. EXAMPLES
6.17.6. AUTHOR
pam_loginuid.so [ require_auditd ]
6.18.1. DESCRIPTION
The pam_loginuid module sets the loginuid process attribute for the
process that was authenticated. This is necessary for applications to be
correctly audited. This PAM module should only be used for entry point
applications like: login, sshd, gdm, vsftpd, crond and atd. There are
probably other entry point applications besides these. You should not use
it for applications like sudo or su as that defeats the purpose by
changing the loginuid to the account they just switched to.
6.18.2. OPTIONS
require_auditd
This option, when given, will cause this module to query the audit
daemon status and deny logins if it is not running.
PAM_SUCCESS
PAM_IGNORE
PAM_SESSION_ERR
6.18.5. EXAMPLES
#%PAM-1.0
auth required pam_unix.so
auth required pam_nologin.so
50
account required pam_unix.so
password required pam_unix.so
session required pam_unix.so
session required pam_loginuid.so
6.18.6. AUTHOR
6.19.1. DESCRIPTION
The pam_mail PAM module provides the "you have new mail" service to the
user. It can be plugged into any application that has credential or
session hooks. It gives a single message indicating the newness of any
mail it finds in the user's mail folder. This module also sets the PAM
environment variable, MAIL, to the user's mail directory.
If the mail spool file (be it /var/mail/$USER or a pathname given with the
dir= parameter) is a directory then pam_mail assumes it is in the Maildir
format.
6.19.2. OPTIONS
close
debug
dir=maildir
empty
hash=count
noenv
51
nopen
quiet
standard
Old style "You have..." format which doesn't show the mail spool
being used. This also implies "empty".
The session and auth (on establishment and deletion of credentials) module
types are provided.
PAM_BUF_ERR
PAM_SERVICE_ERR
PAM_SUCCESS
Success.
PAM_USER_UNKNOWN
6.19.5. EXAMPLES
Add the following line to /etc/pam.d/login to indicate that the user has
new mail when they login to the system.
6.19.6. AUTHOR
6.20.1. DESCRIPTION
The pam_mkhomedir PAM module will create a users home directory if it does
not exist when the session begins. This allows users to be present in
52
central database (such as NIS, kerberos or LDAP) without using a
distributed file system or pre-creating a large number of directories. The
skeleton directory (usually /etc/skel/) is used to copy default files and
also sets a umask for the creation.
The new users home directory will not be removed after logout of the user.
6.20.2. OPTIONS
silent
umask=mask
skel=/path/to/skel/directory
PAM_BUF_ERR
PAM_CRED_INSUFFICIENT
PAM_PERM_DENIED
PAM_USER_UNKNOWN
PAM_SUCCESS
6.20.5. EXAMPLES
6.20.6. AUTHOR
pam_motd.so [ motd=/path/filename ]
6.21.1. DESCRIPTION
6.21.2. OPTIONS
motd=/path/filename
motd_dir=/path/dirname.d
When no options are given, the default is to display both /etc/motd and
the contents of /etc/motd.d. Specifying either option (or both) will
disable this default behavior.
PAM_IGNORE
6.21.5. EXAMPLES
6.21.6. AUTHOR
6.22.1. DESCRIPTION
6.22.2. DESCRIPTION
When someone logs in, the file namespace.conf is scanned. Comments are
marked by # characters. Each non comment line represents one
polyinstantiated directory. The fields are separated by spaces but can be
quoted by " characters also escape sequences \b, \n, and \t are
recognized. The fields are as follows:
The second field, instance_prefix is the string prefix used to build the
pathname for the instantiation of <polydir>. Depending on the
polyinstantiation method it is then appended with "instance
differentiation string" to generate the final instance directory path.
This directory is created if it did not exist already, and is then bind
mounted on the <polydir> to provide an instance of <polydir> based on the
<method> column. The special string $HOME is replaced with the user's home
directory, and $USER with the username. This field cannot be blank.
The third field, method, is the method used for polyinstantiation. It can
take these values; "user" for polyinstantiation based on user name,
"level" for polyinstantiation based on process MLS level and user name,
"context" for polyinstantiation based on process security context and user
name, "tmpfs" for mounting tmpfs filesystem as an instance dir, and
"tmpdir" for creating temporary directory as an instance dir which is
removed when the user's session is closed. Methods "context" and "level"
are only available with SELinux. This field cannot be blank.
The method field can contain also following optional flags separated by :
characters.
shared - the instance directories for "context" and "level" methods will
not contain the user name and will be shared among all users.
mntopts=value - value of this flag is passed to the mount call when the
tmpfs mount is done. It allows for example the specification of the
maximum size of the tmpfs instance that is created by the mount call. See
mount(8) for details.
56
The directory where polyinstantiated instances are to be created, must
exist and must have, by default, the mode of 0000. The requirement that
the instance parent be of mode 0000 can be overridden with the command
line option ignore_instance_parent_mode
The "instance differentiation string" is <user name> for "user" method and
<user name>_<raw directory context> for "context" and "level" methods. If
the whole string is too long the end of it is replaced with md5sum of
itself. Also when command line option gen_hash is used the whole string is
replaced with md5sum of itself.
6.22.3. OPTIONS
debug
unmnt_remnt
For programs such as su and newrole, the login session has already
setup a polyinstantiated namespace. For these programs,
polyinstantiation is performed based on new user id or security
context, however the command first needs to undo the
polyinstantiation performed by login. This argument instructs the
command to first undo previous polyinstantiation before proceeding
with new polyinstantiation based on new id/context
unmnt_only
For trusted programs that want to undo any existing bind mounts
and process instance directories on their own, this argument
allows them to unmount currently mounted instance directories
require_selinux
gen_hash
ignore_config_error
ignore_instance_parent_mode
57
Instance parent directories by default are expected to have the
restrictive mode of 000. Using this option, an administrator can
choose to ignore the mode of the instance parent. This option
should be used with caution as it will reduce security and
isolation goals of the polyinstantiation mechanism.
unmount_on_close
use_current_context
Useful for services which do not change the SELinux context with
setexeccon call. The module will use the current SELinux context
of the calling process for the level and context
polyinstantiation.
use_default_context
Useful for services which do not use pam_selinux for changing the
SELinux context with setexeccon call. The module will use the
default SELinux context of the user for the level and context
polyinstantiation.
mount_private
This option can be used on systems where the / mount point or its
submounts are made shared (for example with a mount --make-rshared
/ command). The module will mark the whole directory tree so any
mount and unmount operations in the polyinstantiation namespace
are private. Normally the pam_namespace will try to detect the
shared / mount point and make the polyinstantiated directories
private automatically. This option has to be used just when only a
subtree is shared and / is not.
Note that mounts and unmounts done in the private namespace will
not affect the parent namespace if this option is used or when the
shared / mount point is autodetected.
Only the session module type is provided. The module must not be called
from multithreaded processes.
PAM_SUCCESS
PAM_SERVICE_ERR
58
Unexpected system error occurred while setting up namespace.
PAM_SESSION_ERR
6.22.6. FILES
/etc/security/namespace.conf
/etc/security/namespace.d
/etc/security/namespace.init
6.22.7. EXAMPLES
For the <service>s you need polyinstantiation (login for example) put the
following line in /etc/pam.d/<service> as the last line for session group:
6.22.8. AUTHORS
The namespace setup scheme was designed by Stephen Smalley, Janak Desai
and Chad Sellers. The pam_namespace PAM module was developed by Janak
59
Desai <janak@us.ibm.com>, Chad Sellers <csellers@tresys.com> and Steve
Grubb <sgrubb@redhat.com>. Additional improvements by Xavier Toth
<txtoth@gmail.com> and Tomas Mraz <tmraz@redhat.com>.
6.23.1. DESCRIPTION
pam_nologin is a PAM module that prevents users from logging into the
system when /var/run/nologin or /etc/nologin exists. The contents of the
file are displayed to the user. The pam_nologin module has no effect on
the root user's ability to log in.
6.23.2. OPTIONS
file=/path/nologin
successok
PAM_AUTH_ERR
The user is not root and /etc/nologin exists, so the user is not
permitted to log in.
PAM_BUF_ERR
PAM_IGNORE
PAM_SUCCESS
Success: either the user is root or the nologin file does not
exist.
PAM_USER_UNKNOWN
6.23.5. EXAMPLES
60
auth required pam_nologin.so
6.23.6. AUTHOR
pam_permit.so
6.24.1. DESCRIPTION
6.24.2. OPTIONS
The auth, account, password and session module types are provided.
PAM_SUCCESS
6.24.5. EXAMPLES
Add this line to your other login entries to disable account management,
but continue to permit users to log in.
6.24.6. AUTHOR
6.25.1. DESCRIPTION
This module saves the last passwords for each user in order to force
password change history and keep the user from alternating between the
same password too frequently.
61
This module does not work together with kerberos. In general, it does not
make much sense to use this module in conjunction with NIS or LDAP, since
the old passwords are stored on the local machine and are not available on
another machine for password history checking.
6.25.2. OPTIONS
debug
use_authtok
When password changing enforce the module to use the new password
provided by a previously stacked password module (this is used in
the example of the stacking of the pam_cracklib module documented
below).
enforce_for_root
remember=N
retry=N
authtok_type=STRING
PAM_AUTHTOK_ERR
PAM_IGNORE
PAM_MAXTRIES
62
PAM_USER_UNKNOWN
6.25.5. FILES
/etc/security/opasswd
6.25.6. EXAMPLES
#%PAM-1.0
password required pam_pwhistory.so
password required pam_unix.so use_authtok
#%PAM-1.0
password required pam_cracklib.so retry=3
password required pam_pwhistory.so use_authtok
password required pam_unix.so use_authtok
6.25.7. AUTHOR
pam_rhosts.so
6.26.1. DESCRIPTION
6.26.2. OPTIONS
63
debug
silent
superuser=account
PAM_AUTH_ERR
The remote host, remote user name or the local user name couldn't
be determined or access was denied by .rhosts file.
PAM_USER_UNKNOWN
6.26.5. EXAMPLES
#%PAM-1.0
#
auth required pam_rhosts.so
auth required pam_nologin.so
auth required pam_env.so
auth required pam_unix.so
6.26.6. AUTHOR
pam_rootok.so [ debug ]
6.27.1. DESCRIPTION
6.27.2. OPTIONS
64
debug
PAM_SUCCESS
The UID is 0.
PAM_AUTH_ERR
6.27.5. EXAMPLES
In the case of the su(1) application the historical usage is to permit the
superuser to adopt the identity of a lesser user without the use of a
password. To obtain this behavior with PAM the following pair of lines are
needed for the corresponding entry in the /etc/pam.d/su configuration
file:
6.27.6. AUTHOR
pam_securetty.so [ debug ]
6.28.1. DESCRIPTION
pam_securetty is a PAM module that allows root logins only if the user is
logging in on a "secure" tty, as defined by the listing in /etc/securetty.
pam_securetty also checks to make sure that /etc/securetty is a plain file
and not world writable. It will also allow root logins on the tty
specified with console= switch on the kernel command line and on ttys from
the /sys/class/tty/console/active.
This module has no effect on non-root users and requires that the
application fills in the PAM_TTY item correctly.
6.28.2. OPTIONS
debug
65
Print debug information.
noconsole
PAM_SUCCESS
PAM_AUTH_ERR
PAM_INCOMPLETE
PAM_SERVICE_ERR
An error occurred while the module was determining the user's name
or tty, or the module could not open /etc/securetty.
PAM_USER_UNKNOWN
The module could not find the user name in the /etc/passwd file to
verify whether the user had a UID of 0. Therefore, the results of
running this module are ignored.
6.28.5. EXAMPLES
6.28.6. AUTHOR
6.29.1. DESCRIPTION
66
pam_selinux is a PAM module that sets up the default SELinux security
context for the next executed process.
When the session is ended, the close_session part of the module restores
old security contexts that were in effect before the change made by the
open_session part of the module.
Adding pam_selinux into the PAM stack might disrupt behavior of other PAM
modules which execute applications. To avoid that, pam_selinux.so open
should be placed after such modules in the PAM stack, and pam_selinux.so
close should be placed before them. When such a placement is not feasible,
pam_selinux.so restore could be used to temporary restore original
security contexts.
6.29.2. OPTIONS
open
close
restore
nottys
debug
verbose
select_context
Attempt to ask the user for a custom security context role. If MLS
is on, ask also for sensitivity level.
env_params
use_current_range
Use the sensitivity level of the current process for the user
context instead of the default level. Also suppresses asking of
the sensitivity level from the user or obtaining it from PAM
environment.
PAM_SUCCESS
PAM_SESSION_ERR
PAM_USER_UNKNOWN
PAM_BUF_ERR
6.29.5. EXAMPLES
6.29.6. AUTHOR
pam_shells.so
6.30.1. DESCRIPTION
pam_shells is a PAM module that only allows access to the system if the
user's shell is listed in /etc/shells.
68
6.30.2. OPTIONS
PAM_AUTH_ERR
PAM_SUCCESS
PAM_SERVICE_ERR
The module was not able to get the name of the user.
6.30.5. EXAMPLES
6.30.6. AUTHOR
6.31.1. DESCRIPTION
The module should be given one or more conditions as module arguments, and
authentication will succeed only if all of the conditions are met.
6.31.2. OPTIONS
debug
use_uid
Evaluate conditions using the account of the user whose UID the
application is running under instead of the user being
authenticated.
69
quiet
quiet_fail
quiet_success
audit
Conditions are three words: a field, a test, and a value to test for.
Available fields are user, uid, gid, shell, home, ruser, rhost, tty and
service:
field eq number
field ne number
field = string
field != string
field =~ glob
70
field !~ glob
field in item:item:...
All module types (account, auth, password and session) are provided.
PAM_SUCCESS
PAM_AUTH_ERR
PAM_SERVICE_ERR
6.31.5. EXAMPLES
Given that the type matches, only loads the othermodule rule if the UID is
over 500. Adjust the number after default to skip several rules.
71
type [default=1 success=ignore] pam_succeed_if.so quiet uid > 500
type required othermodule.so arguments...
6.31.6. AUTHOR
6.32.1. DESCRIPTION
pam_tally has several limitations, which are solved with pam_tally2. For
this reason pam_tally is deprecated and will be removed in a future
release.
Normally, failed attempts to access root will not cause the root account
to become blocked, to prevent denial-of-service: if your users aren't
given shell accounts and root may only login via su or at the machine
console (not telnet/rsh, etc), this is safe.
6.32.2. OPTIONS
GLOBAL OPTIONS
onerr=[fail|succeed]
file=/path/to/counter
72
audit
Will log the user name into the system log if the
user is not found.
silent
no_log_info
AUTH OPTIONS
deny=n
lock_time=n
unlock_time=n
magic_root
no_lock_time
no_reset
even_deny_root_account
per_user
73
If /var/log/faillog contains a non-zero
.fail_max/.fail_locktime field for this user then use
it instead of deny=n/ lock_time=n parameter.
no_lock_time
ACCOUNT OPTIONS
magic_root
no_reset
PAM_AUTH_ERR
A invalid option was given, the module was not able to retrieve
the user name, no valid counter file was found, or too many failed
logins.
PAM_SUCCESS
PAM_USER_UNKNOWN
6.32.5. EXAMPLES
Add the following line to /etc/pam.d/login to lock the account after too
many failed logins. The number of allowed fails is specified by
/var/log/faillog and needs to be set with pam_tally or faillog(8) before.
6.32.6. AUTHOR
6.33.1. DESCRIPTION
Normally, failed attempts to access root will not cause the root account
to become blocked, to prevent denial-of-service: if your users aren't
given shell accounts and root may only login via su or at the machine
console (not telnet/rsh, etc), this is safe.
6.33.2. OPTIONS
GLOBAL OPTIONS
onerr=[fail|succeed]
file=/path/to/counter
Will log the user name into the system log if the
user is not found.
silent
no_log_info
debug
AUTH OPTIONS
deny=n
lock_time=n
unlock_time=n
magic_root
even_deny_root
root_unlock_time=n
serialize
ACCOUNT OPTIONS
magic_root
PAM_AUTH_ERR
A invalid option was given, the module was not able to retrieve
the user name, no valid counter file was found, or too many failed
logins.
PAM_SUCCESS
PAM_USER_UNKNOWN
6.33.5. NOTES
pam_tally2 is not compatible with the old pam_tally faillog file format.
This is caused by requirement of compatibility of the tallylog file format
between 32bit and 64bit architectures on multiarch systems.
77
There is no setuid wrapper for access to the data file such as when the
pam_tally2.so module is called from xscreensaver. As this would make it
impossible to share PAM configuration with such services the following
workaround is used: If the data file cannot be opened because of
insufficient permissions (EACCES) the module returns PAM_IGNORE.
6.33.6. EXAMPLES
6.33.7. FILES
/var/log/tallylog
6.33.8. AUTHOR
6.34.1. DESCRIPTION
The pam_time PAM module does not authenticate the user, but instead it
restricts access to a system and or specific applications at various times
of the day and on specific days or over various terminal lines. This
module can be configured to deny access to (individual) users based on
their name, the time of day, the day of week, the service they are
applying for and their terminal from which they are making their request.
By default rules for time/port access are taken from config file
/etc/security/time.conf.
If Linux PAM is compiled with audit support the module will report when it
denies access.
6.34.2. DESCRIPTION
78
The pam_time PAM module does not authenticate the user, but instead it
restricts access to a system and or specific applications at various times
of the day and on specific days or over various terminal lines. This
module can be configured to deny access to (individual) users based on
their name, the time of day, the day of week, the service they are
applying for and their terminal from which they are making their request.
services;ttys;users;times
The first field, the services field, is a logic list of PAM service names
that the rule applies to.
The second field, the tty field, is a logic list of terminal names that
this rule applies to.
The third field, the users field, is a logic list of users or a netgroup
of users to whom this rule applies.
For these items the simple wildcard '*' may be used only once. With
netgroups no wildcards or logic operators are allowed.
The times field is used to indicate the times at which this rule applies.
The format here is a logic list of day/time-range entries. The days are
specified by a sequence of two character entries, MoTuSa for example is
Monday Tuesday and Saturday. Note that repeated days are unset MoMo = no
day, and MoWk = all weekdays bar Monday. The two character combinations
accepted are Mo Tu We Th Fr Sa Su Wk Wd Al, the last two being week-end
days and all 7 days of the week respectively. As a final example, AlFr
means all days except Friday.
6.34.3. OPTIONS
debug
79
Some debug information is printed with syslog(3).
noaudit
PAM_SUCCESS
PAM_ABORT
PAM_BUF_ERR
PAM_PERM_DENIED
PAM_USER_UNKNOWN
6.34.6. FILES
/etc/security/time.conf
6.34.7. EXAMPLES
All users except for root are denied access to console-login at all times:
6.34.8. AUTHOR
80
6.35. pam_timestamp - authenticate using cached successful authentication
attempts
6.35.1. DESCRIPTION
6.35.2. OPTIONS
timestampdir=directory
timestamp_timeout=number
verbose
debug
PAM_AUTH_ERR
The module was not able to retrieve the user name or no valid
timestamp file was found.
PAM_SUCCESS
PAM_SESSION_ERR
6.35.5. NOTES
81
Users can get confused when they are not always asked for passwords when
running a given program. Some users reflexively begin typing information
before noticing that it is not being asked for.
6.35.6. EXAMPLES
6.35.7. FILES
/var/run/pam_timestamp/...
6.35.8. AUTHOR
6.36.1. DESCRIPTION
pam_umask is a PAM module to set the file mode creation mask of the
current environment. The umask affects the default permissions assigned to
newly created files.
The PAM module tries to get the umask value from the following places in
the following order:
* umask= argument
The GECOS field is split on comma ',' characters. The module also in
addition to the umask= entry recognizes pri= entry, which sets the nice
priority value for the session, and ulimit= entry, which sets the maximum
size of files the processes in the session can create.
6.36.2. OPTIONS
debug
silent
If the user is not root and the username is the same as primary
group name, the umask group bits are set to be the same as owner
bits (examples: 022 -> 002, 077 -> 007).
umask=mask
Sets the calling process's file mode creation mask (umask) to mask
& 0777. The value is interpreted as Octal.
PAM_SUCCESS
PAM_SERVICE_ERR
PAM_USER_UNKNOWN
6.36.5. EXAMPLES
Add the following line to /etc/pam.d/login to set the user specific umask
at login:
6.36.6. AUTHOR
pam_unix.so [ ... ]
6.37.1. DESCRIPTION
The account component performs the task of establishing the status of the
user's account and password based on the following shadow elements:
expire, last_change, max_change, min_change, warn_change. In the case of
the latter, it may offer advice to the user on changing their password or,
through the PAM_AUTHTOKEN_REQD return, delay giving service to the user
83
until they have established a new password. The entries listed above are
documented in the shadow(5) manual page. Should the user's record not
contain one or more of these entries, the corresponding shadow check is
not performed.
The maximum length of a password supported by the pam_unix module via the
helper binary is PAM_MAX_RESP_SIZE - currently 512 bytes. The rest of the
password provided by the conversation function to the module will be
ignored.
The password component of this module performs the task of updating the
user's password. The default encryption hash is taken from the
ENCRYPT_METHOD variable from /etc/login.defs
The session component of this module logs when a user logins or leave the
system.
6.37.2. OPTIONS
debug
audit
quiet
nullok
The default action of this module is to not permit the user access
to a service if their official password is blank. The nullok
argument overrides this default.
try_first_pass
84
Before prompting the user for their password, the module first
tries the previous stacked module's password in case that
satisfies this module as well.
use_first_pass
nodelay
use_authtok
When password changing enforce the module to set the new password
to the one provided by a previously stacked password module (this
is used in the example of the stacking of the pam_cracklib module
documented below).
authtok_type=type
nis
remember=n
shadow
md5
When a user changes their password next, encrypt it with the MD5
algorithm.
bigcrypt
When a user changes their password next, encrypt it with the DEC
C2 algorithm.
85
sha256
sha512
blowfish
rounds=n
broken_shadow
minlen=n
no_pass_expiry
All module types (account, auth, password and session) are provided.
PAM_IGNORE
6.37.5. EXAMPLES
86
An example usage for /etc/pam.d/login would be:
6.37.6. AUTHOR
6.38.1. DESCRIPTION
6.38.2. OPTIONS
crypt=[crypt|none]
db=/path/database
debug
dump
Dump all the entries in the database to the log. Don't do this by
default!
icase
try_first_pass
use_first_pass
unknown_ok
Do not return error when checking for a user that is not in the
database. This can be used to stack more than one pam_userdb
module that will check a username/password pair in more than a
database.
key_only
PAM_AUTH_ERR
Authentication failure.
PAM_AUTHTOK_RECOVERY_ERR
PAM_BUF_ERR
PAM_CONV_ERR
Conversation failure.
PAM_SERVICE_ERR
88
Error in service module.
PAM_SUCCESS
Success.
PAM_USER_UNKNOWN
6.38.5. EXAMPLES
6.38.6. AUTHOR
pam_warn.so
6.39.1. DESCRIPTION
pam_warn is a PAM module that logs the service, terminal, user, remote
user and remote host to syslog(3). The items are not probed for, but
instead obtained from the standard PAM items. The module always returns
PAM_IGNORE, indicating that it does not want to affect the authentication
process.
6.39.2. OPTIONS
The auth, account, password and session module types are provided.
PAM_IGNORE
6.39.5. EXAMPLES
#%PAM-1.0
#
# If we don't have config entries for a service, the
# OTHER entries are used. To be secure, warn and deny
# access to everything.
other auth required pam_warn.so
other auth required pam_deny.so
other account required pam_warn.so
other account required pam_deny.so
other password required pam_warn.so
other password required pam_deny.so
89
other session required pam_warn.so
other session required pam_deny.so
6.39.6. AUTHOR
6.40.1. DESCRIPTION
The pam_wheel PAM module is used to enforce the so-called wheel group. By
default it permits root access to the system if the applicant user is a
member of the wheel group. If no group with this name exist, the module is
using the group with the group-ID 0.
6.40.2. OPTIONS
debug
deny
group=name
Instead of checking the wheel or GID 0 groups, use the name group
to perform the authentication.
root_only
The check for wheel membership is done only when the target user
UID is 0.
trust
use_uid
The check for wheel membership will be done against the current
uid instead of the original one (useful when jumping with su from
one account to another for example).
PAM_AUTH_ERR
Authentication failure.
PAM_BUF_ERR
PAM_IGNORE
PAM_PERM_DENY
Permission denied.
PAM_SERVICE_ERR
PAM_SUCCESS
Success.
PAM_USER_UNKNOWN
6.40.5. EXAMPLES
The root account gains access by default (rootok), only wheel members can
become root (wheel) but Unix authenticate non-root applicants.
6.40.6. AUTHOR
6.41.1. DESCRIPTION
Without pam_xauth, when xauth is enabled and a user uses the su(1) command
91
to assume another user's privileges, that user is no longer able to access
the original user's X display because the new user does not have the key
needed to access the display. pam_xauth solves the problem by forwarding
the key from the user running su (the source user) to the user whose
identity the source user is assuming (the target user) when the session is
created, and destroying the key when the session is torn down.
This means, for example, that when you run su(1) from an xterm session,
you will be able to run X programs without explicitly dealing with the
xauth(1) xauth command or ~/.Xauthority files.
pam_xauth will only forward keys if xauth can list a key connected to the
$DISPLAY environment variable.
If a user has a ~/.xauth/import file, the user will only receive cookies
from users listed in the file. If there is no ~/.xauth/import file, the
user will accept cookies from any other user.
If a user has a .xauth/export file, the user will only forward cookies to
users listed in the file. If there is no ~/.xauth/export file, and the
invoking user is not root, the user will forward cookies to any other
user. If there is no ~/.xauth/export file, and the invoking user is root,
the user will not forward cookies to other users.
Both the import and export files support wildcards (such as *). Both the
import and export files can be empty, signifying that no users are
allowed.
6.41.2. OPTIONS
debug
xauthpath=/path/to/xauth
systemuser=UID
targetuser=UID
92
Only the session type is provided.
PAM_BUF_ERR
PAM_PERM_DENIED
PAM_SESSION_ERR
PAM_SUCCESS
Success.
PAM_USER_UNKNOWN
6.41.5. EXAMPLES
6.41.6. AUTHOR
Chapter 8. Author/acknowledgments
Thanks are also due to Sun Microsystems, especially to Vipin Samar and
Charlie Lai for their advice. At an early stage in the development of
Linux-PAM, Sun graciously made the documentation for their implementation
of PAM available. This act greatly accelerated the development of
Linux-PAM.
Alternatively, this product may be distributed under the terms of the GNU
General Public License (GPL), in which case the provisions of the GNU GPL
are required instead of the above restrictions. (This clause is necessary
due to a potential bad interaction between the GNU GPL and the
restrictions contained in a BSD-style copyright.)
94