summaryrefslogtreecommitdiff
path: root/modules/pam_limits
diff options
context:
space:
mode:
authorTomas Mraz <tm@t8m.info>2007-12-07 15:40:01 +0000
committerTomas Mraz <tm@t8m.info>2007-12-07 15:40:01 +0000
commit8ae5f5769c4c611ca6918450bbe6e55dfa4e5926 (patch)
treea217a8080c67dbd2189a3fcdb3f627223e8f6101 /modules/pam_limits
parent67b5cdd945120d8b0fe4c40fe9df576fa5c2a9a2 (diff)
Relevant BUGIDs:
Purpose of commit: new feature and cleanup Commit summary: --------------- 2007-12-07 Tomas Mraz <t8m@centrum.cz> * libpam/libpam.map: Add LIBPAM_MODUTIL_1.1 version. * libpam/pam_audit.c: Add _pam_audit_open() and pam_modutil_audit_write(). (_pam_auditlog): Call _pam_audit_open(). * libpam/include/security/pam_modutil.h: Add pam_modutil_audit_write(). * modules/pam_access/pam_access.8.xml: Add noaudit option. Document auditing. * modules/pam_access/pam_access.c: Move fs, sep, pam_access_debug, and only_new_group_syntax variables to struct login_info. Add noaudit member. (_parse_args): Adjust for the move of variables and add support for noaudit option. (group_match): Add debug parameter. (string_match): Likewise. (network_netmask_match): Likewise. (login_access): Adjust for the move of variables. Add nonall_match. Add call to pam_modutil_audit_write(). (list_match): Adjust for the move of variables. (user_match): Likewise. (from_match): Likewise. (pam_sm_authenticate): Call _parse_args() earlier. * modules/pam_limits/pam_limits.8.xml: Add noaudit option. Document auditing. * modules/pam_limits/pam_limits.c (_pam_parse): Add noaudit option. (setup_limits): Call pam_modutil_audit_write(). * modules/pam_time/pam_time.8.xml: Add debug and noaudit options. Document auditing. * modules/pam_time/pam_time.c: Add option parsing (_pam_parse()). (check_account): Call _pam_parse(). Call pam_modutil_audit_write() and pam_syslog() on login denials.
Diffstat (limited to 'modules/pam_limits')
-rw-r--r--modules/pam_limits/README7
-rw-r--r--modules/pam_limits/pam_limits.875
-rw-r--r--modules/pam_limits/pam_limits.8.xml18
-rw-r--r--modules/pam_limits/pam_limits.c14
4 files changed, 80 insertions, 34 deletions
diff --git a/modules/pam_limits/README b/modules/pam_limits/README
index 26336711..3c59052a 100644
--- a/modules/pam_limits/README
+++ b/modules/pam_limits/README
@@ -16,6 +16,9 @@ module option then the files in the above directory are not parsed.
The module must not be called by a multithreaded application.
+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.
+
OPTIONS
change_uid
@@ -41,6 +44,10 @@ utmp_early
to compensate for this behavior and at the same time maintain system-wide
consistency with a single limits.conf file.
+noaudit
+
+ Do not report exceeded maximum logins count to the audit subsystem.
+
EXAMPLES
These are some example lines which might be specified in /etc/security/
diff --git a/modules/pam_limits/pam_limits.8 b/modules/pam_limits/pam_limits.8
index 4f01e4cf..fa183d3a 100644
--- a/modules/pam_limits/pam_limits.8
+++ b/modules/pam_limits/pam_limits.8
@@ -1,125 +1,132 @@
.\" Title: pam_limits
.\" Author:
-.\" Generator: DocBook XSL Stylesheets v1.71.1 <http://docbook.sf.net/>
-.\" Date: 04/30/2007
-.\" Manual: Linux\-PAM Manual
-.\" Source: Linux\-PAM Manual
+.\" Generator: DocBook XSL Stylesheets v1.73.2 <http://docbook.sf.net/>
+.\" Date: 12/06/2007
+.\" Manual: Linux-PAM Manual
+.\" Source: Linux-PAM Manual
.\"
-.TH "PAM_LIMITS" "8" "04/30/2007" "Linux\-PAM Manual" "Linux\-PAM Manual"
+.TH "PAM_LIMITS" "8" "12/06/2007" "Linux-PAM Manual" "Linux-PAM Manual"
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.SH "NAME"
-pam_limits \- PAM module to limit resources
+pam_limits - PAM module to limit resources
.SH "SYNOPSIS"
.HP 14
-\fBpam_limits.so\fR [change_uid] [conf=\fI/path/to/limits.conf\fR] [debug] [utmp_early]
+\fBpam_limits\.so\fR [change_uid] [conf=\fI/path/to/limits\.conf\fR] [debug] [utmp_early] [noaudit]
.SH "DESCRIPTION"
.PP
-The pam_limits PAM module sets limits on the system resources that can be obtained in a user\-session. Users of
+The pam_limits PAM module sets limits on the system resources that can be obtained in a user\-session\. Users of
\fIuid=0\fR
-are affected by this limits, too.
+are affected by this limits, too\.
.PP
By default limits are taken from the
-\fI/etc/security/limits.conf\fR
-config file. Then individual files from the
-\fI/etc/security/limits.d/\fR
-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 explicitely specified with a module option then the files in the above directory are not parsed.
+\fI/etc/security/limits\.conf\fR
+config file\. Then individual files from the
+\fI/etc/security/limits\.d/\fR
+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 explicitely specified with a module option then the files in the above directory are not parsed\.
.PP
-The module must not be called by a multithreaded application.
+The module must not be called by a multithreaded application\.
+.PP
+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\.
.SH "OPTIONS"
.PP
\fBchange_uid\fR
.RS 4
-Change real uid to the user for who the limits are set up. Use this option if you have problems like login not forking a shell for user who has no processes. Be warned that something else may break when you do this.
+Change real uid to the user for who the limits are set up\. Use this option if you have problems like login not forking a shell for user who has no processes\. Be warned that something else may break when you do this\.
.RE
.PP
-\fBconf=\fR\fB\fI/path/to/limits.conf\fR\fR
+\fBconf=\fR\fB\fI/path/to/limits\.conf\fR\fR
.RS 4
-Indicate an alternative limits.conf style configuration file to override the default.
+Indicate an alternative limits\.conf style configuration file to override the default\.
.RE
.PP
\fBdebug\fR
.RS 4
-Print debug information.
+Print debug information\.
.RE
.PP
\fButmp_early\fR
.RS 4
-Some broken applications actually allocate a utmp entry for the user before the user is admitted to the system. If some of the services you are configuring PAM for do this, you can selectively use this module argument to compensate for this behavior and at the same time maintain system\-wide consistency with a single limits.conf file.
+Some broken applications actually allocate a utmp entry for the user before the user is admitted to the system\. If some of the services you are configuring PAM for do this, you can selectively use this module argument to compensate for this behavior and at the same time maintain system\-wide consistency with a single limits\.conf file\.
+.RE
+.PP
+\fBnoaudit\fR
+.RS 4
+Do not report exceeded maximum logins count to the audit subsystem\.
.RE
.SH "MODULE SERVICES PROVIDED"
.PP
Only the
\fBsession\fR
-service is supported.
+service is supported\.
.SH "RETURN VALUES"
.PP
PAM_ABORT
.RS 4
-Cannot get current limits.
+Cannot get current limits\.
.RE
.PP
PAM_IGNORE
.RS 4
-No limits found for this user.
+No limits found for this user\.
.RE
.PP
PAM_PERM_DENIED
.RS 4
-New limits could not be set.
+New limits could not be set\.
.RE
.PP
PAM_SERVICE_ERR
.RS 4
-Cannot read config file.
+Cannot read config file\.
.RE
.PP
PAM_SESSEION_ERR
.RS 4
-Error recovering account name.
+Error recovering account name\.
.RE
.PP
PAM_SUCCESS
.RS 4
-Limits were changed.
+Limits were changed\.
.RE
.PP
PAM_USER_UNKNOWN
.RS 4
-The user is not known to the system.
+The user is not known to the system\.
.RE
.SH "FILES"
.PP
-\fI/etc/security/limits.conf\fR
+\fI/etc/security/limits\.conf\fR
.RS 4
Default configuration file
.RE
.SH "EXAMPLES"
.PP
For the services you need resources limits (login for example) put a the following line in
-\fI/etc/pam.d/login\fR
+\fI/etc/pam\.d/login\fR
as the last line for that service (usually after the pam_unix session line):
.sp
.RS 4
.nf
-#%PAM\-1.0
+#%PAM\-1\.0
#
# Resource limits imposed on login sessions via pam_limits
#
-session required pam_limits.so
+session required pam_limits\.so
.fi
.RE
.PP
-Replace "login" for each service you are using this module.
+Replace "login" for each service you are using this module\.
.SH "SEE ALSO"
.PP
\fBlimits.conf\fR(5),
\fBpam.d\fR(8),
-\fBpam\fR(8).
+\fBpam\fR(8)\.
.SH "AUTHORS"
.PP
-pam_limits was initially written by Cristian Gafton <gafton@redhat.com>
+pam_limits was initially written by Cristian Gafton <gafton@redhat\.com>
diff --git a/modules/pam_limits/pam_limits.8.xml b/modules/pam_limits/pam_limits.8.xml
index 9f13bb68..98afdcd4 100644
--- a/modules/pam_limits/pam_limits.8.xml
+++ b/modules/pam_limits/pam_limits.8.xml
@@ -34,6 +34,9 @@
<arg choice="opt">
utmp_early
</arg>
+ <arg choice="opt">
+ noaudit
+ </arg>
</cmdsynopsis>
</refsynopsisdiv>
@@ -57,6 +60,11 @@
<para>
The module must not be called by a multithreaded application.
</para>
+ <para>
+ 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.
+ </para>
</refsect1>
<refsect1 id="pam_limits-options">
@@ -111,6 +119,16 @@
</para>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>noaudit</option>
+ </term>
+ <listitem>
+ <para>
+ Do not report exceeded maximum logins count to the audit subsystem.
+ </para>
+ </listitem>
+ </varlistentry>
</variablelist>
</refsect1>
diff --git a/modules/pam_limits/pam_limits.c b/modules/pam_limits/pam_limits.c
index d65e64bf..f1e29b85 100644
--- a/modules/pam_limits/pam_limits.c
+++ b/modules/pam_limits/pam_limits.c
@@ -41,6 +41,10 @@
#include <pwd.h>
#include <locale.h>
+#ifdef HAVE_LIBAUDIT
+#include <libaudit.h>
+#endif
+
/* Module defines */
#define LINE_LENGTH 1024
@@ -101,6 +105,7 @@ struct pam_limit_s {
#define PAM_DEBUG_ARG 0x0001
#define PAM_DO_SETREUID 0x0002
#define PAM_UTMP_EARLY 0x0004
+#define PAM_NO_AUDIT 0x0008
/* Limits from globbed files. */
#define LIMITS_CONF_GLOB LIMITS_FILE_DIR
@@ -126,6 +131,8 @@ _pam_parse (const pam_handle_t *pamh, int argc, const char **argv,
ctrl |= PAM_DO_SETREUID;
} else if (!strcmp(*argv,"utmp_early")) {
ctrl |= PAM_UTMP_EARLY;
+ } else if (!strcmp(*argv,"noaudit")) {
+ ctrl |= PAM_NO_AUDIT;
} else {
pam_syslog(pamh, LOG_ERR, "unknown option: %s", *argv);
}
@@ -595,6 +602,13 @@ static int setup_limits(pam_handle_t *pamh,
D(("skip login limit check for uid=0"));
} else if (pl->login_limit > 0) {
if (check_logins(pamh, uname, pl->login_limit, ctrl, pl) == LOGIN_ERR) {
+#ifdef HAVE_LIBAUDIT
+ if (!(ctrl & PAM_NO_AUDIT)) {
+ pam_modutil_audit_write(pamh, AUDIT_ANOM_LOGIN_SESSIONS,
+ "pam_limits", PAM_PERM_DENIED);
+ /* ignore return value as we fail anyway */
+ }
+#endif
retval |= LOGIN_ERR;
}
} else if (pl->login_limit == 0) {