diff options
Diffstat (limited to 'Linux-PAM/modules/pam_time')
-rw-r--r-- | Linux-PAM/modules/pam_time/README | 3 | ||||
-rw-r--r-- | Linux-PAM/modules/pam_time/pam_time.8 | 79 | ||||
-rw-r--r-- | Linux-PAM/modules/pam_time/pam_time.8.xml | 37 | ||||
-rw-r--r-- | Linux-PAM/modules/pam_time/pam_time.c | 50 | ||||
-rw-r--r-- | Linux-PAM/modules/pam_time/time.conf.5 | 49 |
5 files changed, 162 insertions, 56 deletions
diff --git a/Linux-PAM/modules/pam_time/README b/Linux-PAM/modules/pam_time/README index abafd936..05eaec2c 100644 --- a/Linux-PAM/modules/pam_time/README +++ b/Linux-PAM/modules/pam_time/README @@ -14,6 +14,9 @@ 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. + EXAMPLES These are some example lines which might be specified in /etc/security/ diff --git a/Linux-PAM/modules/pam_time/pam_time.8 b/Linux-PAM/modules/pam_time/pam_time.8 index 89506830..2edfac91 100644 --- a/Linux-PAM/modules/pam_time/pam_time.8 +++ b/Linux-PAM/modules/pam_time/pam_time.8 @@ -1,63 +1,86 @@ .\" Title: pam_time .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/> -.\" Date: 06/21/2006 -.\" Manual: Linux\-PAM Manual -.\" Source: Linux\-PAM Manual +.\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/> +.\" Date: 01/08/2008 +.\" Manual: Linux-PAM Manual +.\" Source: Linux-PAM Manual .\" -.TH "PAM_TIME" "8" "06/21/2006" "Linux\-PAM Manual" "Linux\-PAM Manual" +.TH "PAM_TIME" "8" "01/08/2008" "Linux-PAM Manual" "Linux-PAM Manual" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -pam_time \- PAM module for time control access +pam_time - PAM module for time control access .SH "SYNOPSIS" .HP 12 -\fBpam_time.so\fR +\fBpam_time\.so\fR [debug] [noaudit] .SH "DESCRIPTION" .PP -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. +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\. .PP By default rules for time/port access are taken from config file -\fI/etc/security/time.conf\fR. +\fI/etc/security/time\.conf\fR\. +.PP +If Linux PAM is compiled with audit support the module will report when it denies access\. .SH "OPTIONS" .PP -This module does not recognice any options. +\fBdebug\fR +.RS 4 +Some debug informations are printed with +\fBsyslog\fR(3)\. +.RE +.PP +\fBnoaudit\fR +.RS 4 +Do not report logins at disallowed time to the audit subsystem\. +.RE .SH "MODULE SERVICES PROVIDED" .PP Only the \fBaccount\fR -service is supported. +service is supported\. .SH "RETURN VALUES" -.TP 3n +.PP PAM_SUCCESS -Access was granted. -.TP 3n +.RS 4 +Access was granted\. +.RE +.PP PAM_ABORT -Not all relevant data could be gotten. -.TP 3n +.RS 4 +Not all relevant data could be gotten\. +.RE +.PP PAM_BUF_ERR -Memory buffer error. -.TP 3n +.RS 4 +Memory buffer error\. +.RE +.PP PAM_PERM_DENIED -Access was not granted. -.TP 3n +.RS 4 +Access was not granted\. +.RE +.PP PAM_USER_UNKNOWN -The user is not known to the system. +.RS 4 +The user is not known to the system\. +.RE .SH "FILES" -.TP 3n -\fI/etc/security/time.conf\fR +.PP +\fI/etc/security/time\.conf\fR +.RS 4 Default configuration file +.RE .SH "EXAMPLES" .sp -.RS 3n +.RS 4 .nf -#%PAM\-1.0 +#%PAM\-1\.0 # # apply pam_time accounting to login requests # -login account required pam_time.so +login account required pam_time\.so .fi .RE @@ -66,7 +89,7 @@ login account required pam_time.so \fBtime.conf\fR(5), \fBpam.d\fR(8), -\fBpam\fR(8). +\fBpam\fR(8)\. .SH "AUTHOR" .PP -pam_time was written by Andrew G. Morgan <morgan@kernel.org>. +pam_time was written by Andrew G\. Morgan <morgan@kernel\.org>\. diff --git a/Linux-PAM/modules/pam_time/pam_time.8.xml b/Linux-PAM/modules/pam_time/pam_time.8.xml index 1ec7eb0e..e0b149a7 100644 --- a/Linux-PAM/modules/pam_time/pam_time.8.xml +++ b/Linux-PAM/modules/pam_time/pam_time.8.xml @@ -22,6 +22,12 @@ <refsynopsisdiv> <cmdsynopsis id="pam_time-cmdsynopsis"> <command>pam_time.so</command> + <arg choice="opt"> + debug + </arg> + <arg choice="opt"> + noaudit + </arg> </cmdsynopsis> </refsynopsisdiv> @@ -41,11 +47,40 @@ By default rules for time/port access are taken from config file <filename>/etc/security/time.conf</filename>. </para> + <para> + If Linux PAM is compiled with audit support the module will report + when it denies access. + </para> </refsect1> <refsect1 id="pam_time-options"> <title>OPTIONS</title> - <para>This module does not recognice any options.</para> + <variablelist> + + <varlistentry> + <term> + <option>debug</option> + </term> + <listitem> + <para> + Some debug informations are printed with + <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>. + </para> + </listitem> + </varlistentry> + + <varlistentry> + <term> + <option>noaudit</option> + </term> + <listitem> + <para> + Do not report logins at disallowed time to the audit subsystem. + </para> + </listitem> + </varlistentry> + + </variablelist> </refsect1> <refsect1 id="pam_time-services"> diff --git a/Linux-PAM/modules/pam_time/pam_time.c b/Linux-PAM/modules/pam_time/pam_time.c index 56b418f4..8e3b2486 100644 --- a/Linux-PAM/modules/pam_time/pam_time.c +++ b/Linux-PAM/modules/pam_time/pam_time.c @@ -22,9 +22,16 @@ #include <fcntl.h> #include <netdb.h> +#ifdef HAVE_LIBAUDIT +#include <libaudit.h> +#endif + #define PAM_TIME_BUFLEN 1000 #define FIELD_SEPARATOR ';' /* this is new as of .02 */ +#define PAM_DEBUG_ARG 0x0001 +#define PAM_NO_AUDIT 0x0002 + #ifndef TRUE # define TRUE 1 #endif @@ -46,6 +53,29 @@ typedef enum { AND, OR } operator; #include <security/_pam_macros.h> #include <security/pam_modules.h> #include <security/pam_ext.h> +#include <security/pam_modutil.h> + +static int +_pam_parse (const pam_handle_t *pamh, int argc, const char **argv) +{ + int ctrl = 0; + + /* step through arguments */ + for (; argc-- > 0; ++argv) { + + /* generic options */ + + if (!strcmp(*argv, "debug")) { + ctrl |= PAM_DEBUG_ARG; + } else if (!strcmp(*argv, "noaudit")) { + ctrl |= PAM_NO_AUDIT; + } else { + pam_syslog(pamh, LOG_ERR, "unknown option: %s", *argv); + } + } + + return ctrl; +} /* --- static functions for checking whether the user should be let in --- */ @@ -567,11 +597,15 @@ check_account(pam_handle_t *pamh, const char *service, PAM_EXTERN int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags UNUSED, - int argc UNUSED, const char **argv UNUSED) + int argc, const char **argv) { const void *service=NULL, *void_tty=NULL; const char *tty; const char *user=NULL; + int ctrl; + int rv; + + ctrl = _pam_parse(pamh, argc, argv); /* set service name */ @@ -620,7 +654,19 @@ pam_sm_acct_mgmt(pam_handle_t *pamh, int flags UNUSED, D(("user=%s", user)); D(("tty=%s", tty)); - return check_account(pamh, service, tty, user); + rv = check_account(pamh, service, tty, user); + if (rv != PAM_SUCCESS) { +#ifdef HAVE_LIBAUDIT + if (!(ctrl & PAM_NO_AUDIT)) { + pam_modutil_audit_write(pamh, AUDIT_ANOM_LOGIN_TIME, + "pam_time", rv); /* ignore return value as we fail anyway */ + } +#endif + if (ctrl & PAM_DEBUG_ARG) { + pam_syslog(pamh, LOG_DEBUG, "user %s rejected", user); + } + } + return rv; } /* end of module definition */ diff --git a/Linux-PAM/modules/pam_time/time.conf.5 b/Linux-PAM/modules/pam_time/time.conf.5 index 400344a6..34b6e60c 100644 --- a/Linux-PAM/modules/pam_time/time.conf.5 +++ b/Linux-PAM/modules/pam_time/time.conf.5 @@ -1,79 +1,78 @@ .\" Title: time.conf .\" Author: -.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/> -.\" Date: 06/21/2006 -.\" Manual: Linux\-PAM Manual -.\" Source: Linux\-PAM Manual +.\" Generator: DocBook XSL Stylesheets v1.73.1 <http://docbook.sf.net/> +.\" Date: 01/08/2008 +.\" Manual: Linux-PAM Manual +.\" Source: Linux-PAM Manual .\" -.TH "TIME.CONF" "5" "06/21/2006" "Linux\-PAM Manual" "Linux\-PAM Manual" +.TH "TIME\.CONF" "5" "01/08/2008" "Linux-PAM Manual" "Linux\-PAM Manual" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" -time.conf \- configuration file for the pam_time module +time.conf - configuration file for the pam_time module .SH "DESCRIPTION" .PP -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. +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\. .PP For this module to function correctly there must be a correctly formatted -\fI/etc/security/time.conf\fR -file present. White spaces are ignored and lines maybe extended with '\\' (escaped newlines). Text following a '#' is ignored to the end of the line. +\fI/etc/security/time\.conf\fR +file present\. White spaces are ignored and lines maybe extended with \'\e\' (escaped newlines)\. Text following a \'#\' is ignored to the end of the line\. .PP The syntax of the lines is as follows: .PP \fIservices\fR;\fIttys\fR;\fIusers\fR;\fItimes\fR .PP -In words, each rule occupies a line, terminated with a newline or the beginning of a comment; a '\fB#\fR'. It contains four fields separated with semicolons, '\fB;\fR'. +In words, each rule occupies a line, terminated with a newline or the beginning of a comment; a \'\fB#\fR\'\. It contains four fields separated with semicolons, \'\fB;\fR\'\. .PP The first field, the \fIservices\fR -field, is a logic list of PAM service names that the rule applies to. +field, is a logic list of PAM service names that the rule applies to\. .PP The second field, the \fItty\fR -field, is a logic list of terminal names that this rule applies to. +field, is a logic list of terminal names that this rule applies to\. .PP The third field, the \fIusers\fR -field, is a logic list of users or a netgroup of users to whom this rule applies. +field, is a logic list of users or a netgroup of users to whom this rule applies\. .PP -For these items the simple wildcard '*' may be used only once. With netgroups no wildcards or logic operators are allowed. +For these items the simple wildcard \'*\' may be used only once\. With netgroups no wildcards or logic operators are allowed\. .PP The \fItimes\fR -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. +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\. .PP -Each day/time\-range can be prefixed with a '!' to indicate "anything but". The time\-range part is two 24\-hour times HHMM, separated by a hyphen, indicating the start and finish time (if the finish time is smaller than the start time it is deemed to apply on the following day). +Each day/time\-range can be prefixed with a \'!\' to indicate "anything but"\. The time\-range part is two 24\-hour times HHMM, separated by a hyphen, indicating the start and finish time (if the finish time is smaller than the start time it is deemed to apply on the following day)\. .PP -For a rule to be active, ALL of service+ttys+users must be satisfied by the applying process. +For a rule to be active, ALL of service+ttys+users must be satisfied by the applying process\. .PP -Note, currently there is no daemon enforcing the end of a session. This needs to be remedied. +Note, currently there is no daemon enforcing the end of a session\. This needs to be remedied\. .PP Poorly formatted rules are logged as errors using -\fBsyslog\fR(3). +\fBsyslog\fR(3)\. .SH "EXAMPLES" .PP These are some example lines which might be specified in -\fI/etc/security/time.conf\fR. +\fI/etc/security/time\.conf\fR\. .PP All users except for \fIroot\fR are denied access to console\-login at all times: .sp -.RS 3n +.RS 4 .nf login ; tty* & !ttyp* ; !root ; !Al0000\-2400 .fi .RE -.sp .PP -Games (configured to use PAM) are only to be accessed out of working hours. This rule does not apply to the user +Games (configured to use PAM) are only to be accessed out of working hours\. This rule does not apply to the user \fIwaster\fR: .sp -.RS 3n +.RS 4 .nf games ; * ; !waster ; Wd0000\-2400 | Wk1800\-0800 @@ -89,4 +88,4 @@ games ; * ; !waster ; Wd0000\-2400 | Wk1800\-0800 \fBpam\fR(8) .SH "AUTHOR" .PP -pam_time was written by Andrew G. Morgan <morgan@kernel.org>. +pam_time was written by Andrew G\. Morgan <morgan@kernel\.org>\. |