From: Thorsten Kukuk Date: Sun, 18 Jun 2006 16:08:02 +0000 (+0000) Subject: Relevant BUGIDs: X-Git-Tag: Linux-PAM-0_99_5_0~21 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fa6ee52f9eed1bb6e6cc6d43491996096d3533c3;p=linux-pam Relevant BUGIDs: Purpose of commit: new feature Commit summary: --------------- 2006-06-18 Thorsten Kukuk * modules/pam_tally/Makefile.am: Include Make.xml.rules. * modules/pam_tally/pam_tally.8.xml: New. * modules/pam_tally/pam_tally.8: New, generated from xml file. * modules/pam_tally/README.xml: New. * modules/pam_tally/README: Regenerated from xml file. --- diff --git a/ChangeLog b/ChangeLog index d3b76be6..8e5d3819 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2006-06-18 Thorsten Kukuk + * modules/pam_tally/Makefile.am: Include Make.xml.rules. + * modules/pam_tally/pam_tally.8.xml: New. + * modules/pam_tally/pam_tally.8: New, generated from xml file. + * modules/pam_tally/README.xml: New. + * modules/pam_tally/README: Regenerated from xml file. + * modules/pam_selinux/Makefile.am: Include Make.xml.rules. * modules/pam_selinux/pam_selinux.8.xml: New. * modules/pam_selinux/pam_selinux.8: Regenerated from xml file. diff --git a/NEWS b/NEWS index 6b0506eb..d36e7c6b 100644 --- a/NEWS +++ b/NEWS @@ -8,7 +8,7 @@ Linux-PAM NEWS -- history of user-visible changes. pam_issue, pam_ftp, pam_group, pam_lastlog, pam_listfile, pam_localuser, pam_mail, pam_motd, pam_nologin, pam_permit, pam_rootok, pam_securetty, pam_shells, pam_userdb, pam_warn, - pam_time, pam_limits, pam_debug + pam_time, pam_limits, pam_debug, pam_tally * The libpam memory debug code was removed Release 0.99.4.0 diff --git a/modules/pam_tally/Makefile.am b/modules/pam_tally/Makefile.am index 8b8c63bf..72a70401 100644 --- a/modules/pam_tally/Makefile.am +++ b/modules/pam_tally/Makefile.am @@ -4,7 +4,10 @@ CLEANFILES = *~ -EXTRA_DIST = README tst-pam_tally +EXTRA_DIST = README $(MANS) $(XMLS) tst-pam_tally + +man_MANS = pam_tally.8 +XMLS = README.xml pam_tally.8.xml TESTS = tst-pam_tally @@ -25,3 +28,10 @@ securelib_LTLIBRARIES = pam_tally.la sbin_PROGRAMS = pam_tally pam_tally_SOURCES = pam_tally_app.c + +if ENABLE_REGENERATE_MAN +noinst_DATA = README +README: pam_tally.8.xml +-include $(top_srcdir)/Make.xml.rules +endif + diff --git a/modules/pam_tally/README b/modules/pam_tally/README index c8b715bd..cfd8a468 100644 --- a/modules/pam_tally/README +++ b/modules/pam_tally/README @@ -1,116 +1,136 @@ -SUMMARY: - pam_tally.so: - - Maintains a count of attempted accesses, can reset count on success, - can deny access if too many attempts fail. - - Options: - - * onerr=[succeed|fail] (if something weird happens - such as unable to open the file, what to do?) - * file=/where/to/keep/counts (default /var/log/faillog) - * audit (will display the username typed if the user is not found) - - (auth) - Authentication phase first checks if user should be denied access - and if not it increments attempted login counter. Then on call to - pam_setcred it resets the attempts counter if the user is NOT - magic root. - * deny=n (deny access if tally for this user exceeds n) - - * lock_time=n (always deny for n seconds after failed attempt) - - * unlock_time=n (allow access after n seconds after the last - failed attempt with exceeded tally) - - * magic_root (access attempts by root as requesting user ignore - deny and don't change counter. - Use this for su and similar services.) - - * even_deny_root_account (Root can become unavailable. BEWARE. - Note that magic root trying to gain root bypasses this, - but normal users can be locked out.) - - * per_user (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 (Don't use .fail_locktime filed in - /var/log/faillog for this user) - - * no_reset (don't reset count on successful entry, - only decrement) - - - (account) - Account phase resets attempts counter if the user is NOT magic root. - This phase can be used optionaly for services which don't call - pam_setcred correctly or if the reset should be done regardless - of the failure of the account phase of other modules. - - * magic_root (access attempts by root as requesting user - don't change counter. - Use this for su and similar services.) - - * no_reset (don't reset count on successful entry, - only decrement) - - Also checks to make sure that the counts file is a plain - file and not world writable. - - - Tim Baverstock , v0.1 5 March 1997 - - Tomas Mraz , v0.2 5 January 2005 - -LONGER: - -pam_tally comes in two parts: pam_tally.so and pam_tally. - -pam_tally.so sits in a pam config file, in the auth and account sections. - -In the auth section, it denies access if attempted logins exceed some -threshold and it increments a per-uid counter for each attempted login, -in the account section, it resets that counter to zero on successful -login. If the module isn't used in the account section it resets the counter -to zero on call to pam_setcred. - -Root is treated specially: - -1. When a process already running as root tries to access some service and the -'magic_root' flag is set, the access is `magic', and bypasses pam_tally's -checks: handy for `su'ing from root into an account otherwise blocked. -NOTE: This was changed from the previous version of pam_tally where the default -was to treat root as magic and there were the 'no_magic_root' flag. However -for most of services the current default make sense. - -2. 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. If you really want root to be -blocked for some given service, use even_deny_root_account. - -pam_tally is an (optional) application which can be used to interrogate and -manipulate the counter file. It can display users' counts, set individual -counts, or clear all counts. Setting artificially high counts may be useful -for blocking users without changing their passwords. I found it useful to -clear all counts every midnight from a cron.. - -The counts file is organised as a binary-word array, indexed by uid. You -can probably make sense of it with `od', if you don't want to use the -supplied application. - -BUGS: - -pam_tally is very dependant on getpw*(): a database of usernames -would be much more flexible. - -The (4.0 Redhat) utilities seem to do funny things with uid, and I'm -not wholly sure I understood what I should have been doing anyway so -the `keep a count of current logins' bit has been #ifdef'd out and you -can only reset the counter on successful authentication, for now. - -IMPORTANT NOTICE: -In the original version of pam_tally there was a bug where the information -if the password was correct or not was leaked by returning error from -different pam management phases. This was solved by moving the denying -functionality to the auth phase. However it's necessary to update the pam -configuration by moving the required options (as deny=N) to the auth phase. +pam_tally — The login counter (tallying) module + +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ + +DESCRIPTION + +This module maintains a count of attempted accesses, can reset count on +success, can deny access if too many attempts fail. + +pam_tally comes in two parts: pam_tally.so and pam_tally. The former is the PAM +module and the latter, a stand-alone program. pam_tally is an (optional) +application which can be used to interrogate and manipulate the counter file. +It can display users' counts, set individual counts, or clear all counts. +Setting artificially high counts may be useful for blocking users without +changing their passwords. For example, one might find it useful to clear all +counts every midnight from a cron job. The faillog(8) command can be used +instead of pam_tally to to maintain the counter file. + +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. + +OPTIONS + +GLOBAL OPTIONS + + This can be used for auth and account services. + + onerr=[fail|succeed] + + If something weird happens (like unable to open the file), return with + PAM_SUCESS if onerr=succeed is given, else with the corresponding PAM + error code. + + file=/path/to/counter + + File where to keep counts. Default is /var/log/faillog. + + audit + + Will display the username typed if the user is not found. + +AUTH OPTIONS + + Authentication phase first checks if user should be denied access and if + not it increments attempted login counter. Then on call to pam_setcred(3) + it resets the attempts counter. + + deny=n + + Deny access if tally for this user exceeds n. + + lock_time=n + + Always deny for n seconds after failed attempt. + + unlock_time=n + + Allow access after n seconds after failed attempt. If this option is + used the user will be locked out for the specified amount of time after + he exceeded his maximum allowed attempts. Otherwise the account is + locked until the lock is removed by a manual intervention of the system + administrator. + + magic_root + + If the module is invoked by a user with uid=0 the counter is not + incremented. The sys-admin should use this for user launched services, + like su, otherwise this argument should be omitted. + + no_lock_time + + Do not use the .fail_locktime field in /var/log/faillog for this user. + + no_reset + + Don't reset count on successful entry, only decrement. + + even_deny_root_account + + Root account can become unavailable. + + even_deny_root_account + + Root account can become unavailable. + + per_user + + 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 + + Don't use .fail_locktime filed in /var/log/faillog for this user. + +ACCOUNT OPTIONS + + Account phase resets attempts counter if the user is not magic root. This + phase can be used optionaly for services which don't call pam_setcred(3) + correctly or if the reset should be done regardless of the failure of the + account phase of other modules. + + magic_root + + If the module is invoked by a user with uid=0 the counter is not + incremented. The sys-admin should use this for user launched services, + like su, otherwise this argument should be omitted. + + no_reset + + Don't reset count on successful entry, only decrement. + +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. + +auth required pam_securetty.so +auth required pam_tally.so per_user +auth required pam_env.so +auth required pam_unix.so +auth required pam_nologin.so +account required pam_unix.so +password required pam_unix.so +session required pam_limits.so +session required pam_unix.so +session required pam_lastlog.so nowtmp +session optional pam_mail.so standard + + +AUTHOR + +pam_tally was written by Tim Baverstock and Tomas Mraz. + diff --git a/modules/pam_tally/README.xml b/modules/pam_tally/README.xml new file mode 100644 index 00000000..3c6de50e --- /dev/null +++ b/modules/pam_tally/README.xml @@ -0,0 +1,41 @@ + + +--> +]> + +
+ + + + + <xi:include xmlns:xi="http://www.w3.org/2001/XInclude" + href="pam_tally.8.xml" xpointer='xpointer(//refnamediv[@id = "pam_tally-name"]/*)'/> + + + + +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
+ +
diff --git a/modules/pam_tally/pam_tally.8 b/modules/pam_tally/pam_tally.8 new file mode 100644 index 00000000..a4476b6b --- /dev/null +++ b/modules/pam_tally/pam_tally.8 @@ -0,0 +1,188 @@ +.\" Title: pam_tally +.\" Author: +.\" Generator: DocBook XSL Stylesheets v1.70.1 +.\" Date: 06/18/2006 +.\" Manual: Linux\-PAM Manual +.\" Source: Linux\-PAM Manual +.\" +.TH "PAM_TALLY" "8" "06/18/2006" "Linux\-PAM Manual" "Linux\-PAM Manual" +.\" disable hyphenation +.nh +.\" disable justification (adjust text to left margin only) +.ad l +.SH "NAME" +pam_tally \- The login counter (tallying) module +.SH "SYNOPSIS" +.HP 13 +\fBpam_tally.so\fR [file=\fI/path/to/counter\fR] [onerr=[\fIfail\fR|\fIsucceed\fR]] [magic_root] [even_deny_root_account] [deny=\fIn\fR] [lock_time=\fIn\fR] [unlock_time=\fIn\fR] [per_user] [no_lock_time] [no_reset] [audit] +.HP 10 +\fBpam_tally\fR [\-\-file\ \fI/path/to/counter\fR] [\-\-user\ \fIusername\fR] [\-\-reset[=\fIn\fR]] [\-\-quiet] +.SH "DESCRIPTION" +.PP +This module maintains a count of attempted accesses, can reset count on success, can deny access if too many attempts fail. +.PP +pam_tally comes in two parts: +\fBpam_tally.so\fR +and +\fBpam_tally\fR. The former is the PAM module and the latter, a stand\-alone program. +\fBpam_tally\fR +is an (optional) application which can be used to interrogate and manipulate the counter file. It can display users' counts, set individual counts, or clear all counts. Setting artificially high counts may be useful for blocking users without changing their passwords. For example, one might find it useful to clear all counts every midnight from a cron job. The +\fBfaillog\fR(8) +command can be used instead of pam_tally to to maintain the counter file. +.PP +Normally, failed attempts to access +\fIroot\fR +will +\fBnot\fR +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 +\fBsu\fR +or at the machine console (not telnet/rsh, etc), this is safe. +.SH "OPTIONS" +.TP 3n +GLOBAL OPTIONS +This can be used for +\fIauth\fR +and +\fIaccount\fR +services. +.RS 3n +.TP 3n +\fBonerr=[\fR\fB\fIfail\fR\fR\fB|\fR\fB\fIsucceed\fR\fR\fB]\fR +If something weird happens (like unable to open the file), return with +\fBPAM_SUCESS\fR +if +\fBonerr=\fR\fB\fIsucceed\fR\fR +is given, else with the corresponding PAM error code. +.TP 3n +\fBfile=\fR\fB\fI/path/to/counter\fR\fR +File where to keep counts. Default is +\fI/var/log/faillog\fR. +.TP 3n +\fBaudit\fR +Will display the username typed if the user is not found. +.RE +.TP 3n +AUTH OPTIONS +Authentication phase first checks if user should be denied access and if not it increments attempted login counter. Then on call to +\fBpam_setcred\fR(3) +it resets the attempts counter. +.RS 3n +.TP 3n +\fBdeny=\fR\fB\fIn\fR\fR +Deny access if tally for this user exceeds +\fIn\fR. +.TP 3n +\fBlock_time=\fR\fB\fIn\fR\fR +Always deny for +\fIn\fR +seconds after failed attempt. +.TP 3n +\fBunlock_time=\fR\fB\fIn\fR\fR +Allow access after +\fIn\fR +seconds after failed attempt. If this option is used the user will be locked out for the specified amount of time after he exceeded his maximum allowed attempts. Otherwise the account is locked until the lock is removed by a manual intervention of the system administrator. +.TP 3n +\fBmagic_root\fR +If the module is invoked by a user with uid=0 the counter is not incremented. The sys\-admin should use this for user launched services, like +\fBsu\fR, otherwise this argument should be omitted. +.TP 3n +\fBno_lock_time\fR +Do not use the .fail_locktime field in +\fI/var/log/faillog\fR +for this user. +.TP 3n +\fBno_reset\fR +Don't reset count on successful entry, only decrement. +.TP 3n +\fBeven_deny_root_account\fR +Root account can become unavailable. +.TP 3n +\fBeven_deny_root_account\fR +Root account can become unavailable. +.TP 3n +\fBper_user\fR +If +\fI/var/log/faillog\fR +contains a non\-zero .fail_max/.fail_locktime field for this user then use it instead of +\fBdeny=\fR\fB\fIn\fR\fR/ +\fBlock_time=\fR\fB\fIn\fR\fR +parameter. +.TP 3n +\fBno_lock_time\fR +Don't use .fail_locktime filed in +\fI/var/log/faillog\fR +for this user. +.RE +.TP 3n +ACCOUNT OPTIONS +Account phase resets attempts counter if the user is +\fBnot\fR +magic root. This phase can be used optionaly for services which don't call +\fBpam_setcred\fR(3) +correctly or if the reset should be done regardless of the failure of the account phase of other modules. +.RS 3n +.TP 3n +\fBmagic_root\fR +If the module is invoked by a user with uid=0 the counter is not incremented. The sys\-admin should use this for user launched services, like +\fBsu\fR, otherwise this argument should be omitted. +.TP 3n +\fBno_reset\fR +Don't reset count on successful entry, only decrement. +.RE +.SH "MODULE SERVICES PROVIDED" +.PP +The +\fBauth\fR +and +\fBaccount\fR +services are supported. +.SH "RETURN VALUES" +.TP 3n +PAM_AUTH_ERR +A invalid option was given, the module was not able to retrive the user name, no valid counter file was found, or too many failed logins. +.TP 3n +PAM_SUCCESS +Everything was successfull. +.TP 3n +PAM_USER_UNKNOWN +User not known. +.SH "EXAMPLES" +.PP +Add the following line to +\fI/etc/pam.d/login\fR +to lock the account after too many failed logins. The number of allowed fails is specified by +\fI/var/log/faillog\fR +and needs to be set with pam_tally or +\fBfaillog\fR(8) +before. +.sp +.RS 3n +.nf +auth required pam_securetty.so +auth required pam_tally.so per_user +auth required pam_env.so +auth required pam_unix.so +auth required pam_nologin.so +account required pam_unix.so +password required pam_unix.so +session required pam_limits.so +session required pam_unix.so +session required pam_lastlog.so nowtmp +session optional pam_mail.so standard + +.fi +.RE +.SH "FILES" +.TP 3n +\fI/var/log/faillog\fR +failure logging file +.SH "SEE ALSO" +.PP + +\fBfaillog\fR(8), +\fBpam.conf\fR(5), +\fBpam.d\fR(8), +\fBpam\fR(8) +.SH "AUTHOR" +.PP +pam_tally was written by Tim Baverstock and Tomas Mraz. diff --git a/modules/pam_tally/pam_tally.8.xml b/modules/pam_tally/pam_tally.8.xml new file mode 100644 index 00000000..1261130a --- /dev/null +++ b/modules/pam_tally/pam_tally.8.xml @@ -0,0 +1,437 @@ + + + + + + + pam_tally + 8 + Linux-PAM Manual + + + + pam_tally + The login counter (tallying) module + + + + + pam_tally.so + + file=/path/to/counter + + + onerr=[fail|succeed] + + + magic_root + + + even_deny_root_account + + + deny=n + + + lock_time=n + + + unlock_time=n + + + per_user + + + no_lock_time + + + no_reset + + + audit + + + + pam_tally + + --file /path/to/counter + + + --user username + + + --reset[=n] + + + --quiet + + + + + + + DESCRIPTION + + + This module maintains a count of attempted accesses, can + reset count on success, can deny access if too many attempts fail. + + + pam_tally comes in two parts: + pam_tally.so and + pam_tally. The former is the PAM module and + the latter, a stand-alone program. pam_tally + is an (optional) application which can be used to interrogate and + manipulate the counter file. It can display users' counts, set + individual counts, or clear all counts. Setting artificially high + counts may be useful for blocking users without changing their + passwords. For example, one might find it useful to clear all counts + every midnight from a cron job. The + + faillog8 + command can be used instead of pam_tally to to + maintain the counter file. + + + 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. + + + + + + OPTIONS + + + + GLOBAL OPTIONS + + + + This can be used for auth and + account services. + + + + + + + + + If something weird happens (like unable to open the file), + return with PAM_SUCESS if + + is given, else with the corresponding PAM error code. + + + + + + + + + + File where to keep counts. Default is + /var/log/faillog. + + + + + + + + + + Will display the username typed if the user is not found. + + + + + + + + + + AUTH OPTIONS + + + + Authentication phase first checks if user should be denied + access and if not it increments attempted login counter. Then + on call to + pam_setcred3 + it resets the attempts counter. + + + + + + + + + Deny access if tally for this user exceeds + n. + + + + + + + + + + Always deny for n seconds + after failed attempt. + + + + + + + + + + Allow access after n seconds + after failed attempt. If this option is used the user will + be locked out for the specified amount of time after he + exceeded his maximum allowed attempts. Otherwise the + account is locked until the lock is removed by a manual + intervention of the system administrator. + + + + + + + + + + If the module is invoked by a user with uid=0 the + counter is not incremented. The sys-admin should use this + for user launched services, like su, + otherwise this argument should be omitted. + + + + + + + + + + Do not use the .fail_locktime field in + /var/log/faillog for this user. + + + + + + + + + + Don't reset count on successful entry, only decrement. + + + + + + + + + + Root account can become unavailable. + + + + + + + + + + Root account can become unavailable. + + + + + + + + + + If /var/log/faillog contains a non-zero + .fail_max/.fail_locktime field for this user then use it + instead of / + parameter. + + + + + + + + + + Don't use .fail_locktime filed in + /var/log/faillog for this user. + + + + + + + + + + + + ACCOUNT OPTIONS + + + + Account phase resets attempts counter if the user is + not magic root. + This phase can be used optionaly for services which don't call + + pam_setcred3 + correctly or if the reset should be done regardless + of the failure of the account phase of other modules. + + + + + + + + + If the module is invoked by a user with uid=0 the + counter is not incremented. The sys-admin should use this + for user launched services, like su, + otherwise this argument should be omitted. + + + + + + + + + + Don't reset count on successful entry, only decrement. + + + + + + + + + + + MODULE SERVICES PROVIDED + + The and + services are supported. + + + + + RETURN VALUES + + + PAM_AUTH_ERR + + + A invalid option was given, the module was not able + to retrive the user name, no valid counter file + was found, or too many failed logins. + + + + + PAM_SUCCESS + + + Everything was successfull. + + + + + PAM_USER_UNKNOWN + + + User not known. + + + + + + + + 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 + faillog8 + before. + + +auth required pam_securetty.so +auth required pam_tally.so per_user +auth required pam_env.so +auth required pam_unix.so +auth required pam_nologin.so +account required pam_unix.so +password required pam_unix.so +session required pam_limits.so +session required pam_unix.so +session required pam_lastlog.so nowtmp +session optional pam_mail.so standard + + + + + FILES + + + /var/log/faillog + + failure logging file + + + + + + + SEE ALSO + + + faillog8 + , + + pam.conf5 + , + + pam.d8 + , + + pam8 + + + + + + AUTHOR + + pam_tally was written by Tim Baverstock and Tomas Mraz. + + + +