summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--modules/pam_selinux/Makefile.am11
-rw-r--r--modules/pam_selinux/README71
-rw-r--r--modules/pam_selinux/README.xml41
-rw-r--r--modules/pam_selinux/pam_selinux.8134
-rw-r--r--modules/pam_selinux/pam_selinux.8.xml207
-rw-r--r--modules/pam_selinux/pam_selinux.c2
-rw-r--r--modules/pam_selinux/pam_selinux_check.82
8 files changed, 402 insertions, 74 deletions
diff --git a/ChangeLog b/ChangeLog
index bf75c2f4..d3b76be6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2006-06-18 Thorsten Kukuk <kukuk@thkukuk.de>
+
+ * 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.
+ * modules/pam_selinux/README.xml: New.
+ * modules/pam_selinux/README: Regenerated from xml file.
+
2006-06-17 Thorsten Kukuk <kukuk@thkukuk.de>
* modules/pam_debug/Makefile.am: Include Make.xml.rules.
diff --git a/modules/pam_selinux/Makefile.am b/modules/pam_selinux/Makefile.am
index d830bf7e..4b8e5251 100644
--- a/modules/pam_selinux/Makefile.am
+++ b/modules/pam_selinux/Makefile.am
@@ -1,14 +1,15 @@
#
-# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@suse.de>
+# Copyright (c) 2005, 2006 Thorsten Kukuk <kukuk@thkukuk.de>
#
CLEANFILES = *~
-EXTRA_DIST = README ${MANS} pam_selinux_check.8 tst-pam_selinux
+EXTRA_DIST = README ${MANS} $(XMLS) pam_selinux_check.8 tst-pam_selinux
if HAVE_LIBSELINUX
TESTS = tst-pam_selinux
man_MANS = pam_selinux.8
+ XMLS = README.xml pam_selinux.8.xml
endif
securelibdir = $(SECUREDIR)
@@ -30,3 +31,9 @@ if HAVE_LIBSELINUX
securelib_LTLIBRARIES = pam_selinux.la
noinst_PROGRAMS = pam_selinux_check
endif
+if ENABLE_REGENERATE_MAN
+noinst_DATA = README pam_selinux.8
+README: pam_selinux.8.xml
+-include $(top_srcdir)/Make.xml.rules
+endif
+
diff --git a/modules/pam_selinux/README b/modules/pam_selinux/README
index 174c4bda..13eba8af 100644
--- a/modules/pam_selinux/README
+++ b/modules/pam_selinux/README
@@ -1,17 +1,64 @@
-This is pam_selinux, a module for setting the default security context after
-login via PAM.
+pam_selinux — PAM module to set the default security context
-Background: SELinux provides a mechanism for allowing people to login with
-different security contexts.
+━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
-The module takes these arguments:
-The module takes these arguments:
- close Only execute the close_session portion of the module.
- debug Log debug messages (with priority DEBUG) to syslog.
- nottys Do not set security context on controlling tty
- verbose Attempt to tell the user when security context is set.
- open Only execute the open_session portion of the module.
+DESCRIPTION
-Dan Walsh <dwalsh@redhat.com>
+In a nutshell, pam_selinux sets up the default security context for the next
+execed shell.
+When an application opens a session using pam_selinux, the shell that gets
+executed will be run in the default security context, or if the user chooses
+and the pam file allows the selected security context. Also the controlling tty
+will have it's security context modified to match the users.
+
+Adding pam_selinux into a pam file could cause other pam modules to change
+their behavior if the exec another application. The close and open option help
+mitigate this problem. close option will only cause the close portion of the
+pam_selinux to execute, and open will only cause the open portion to run. You
+can add pam_selinux to the config file twice. Add the pam_selinux close as the
+executes the open pass through the modules, pam_selinux open_session will
+happen last. When PAM executes the close pass through the modules pam_selinux
+close_session will happen first.
+
+OPTIONS
+
+close
+
+ Only execute the close_session portion of the module.
+
+debug
+
+ Turns on debugging via syslog(3).
+
+multiple
+
+ Tells pam_selinux.so to allow the user to select the security context they
+ will login with, if the user has more than one role.
+
+open
+
+ Only execute the open_session portion of the module.
+
+nottys
+
+ Do not try to setup the ttys security context.
+
+verbose
+
+ attempt to inform the user when security context is set.
+
+EXAMPLES
+
+auth requisite pam_permit.so
+auth [success=2 default=ok] pam_selinux.so auth=perm_denied cred=success
+auth [default=reset] pam_selinux.so auth=success cred=perm_denied
+auth [success=done default=die] pam_selinux.so
+auth optional pam_selinux.so auth=perm_denied cred=perm_denied
+auth sufficient pam_selinux.so auth=success cred=success
+
+
+AUTHOR
+
+pam_selinux was written by Dan Walsh <dwalsh@redhat.com>.
diff --git a/modules/pam_selinux/README.xml b/modules/pam_selinux/README.xml
new file mode 100644
index 00000000..7e1baf55
--- /dev/null
+++ b/modules/pam_selinux/README.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+"http://www.docbook.org/xml/4.3/docbookx.dtd"
+[
+<!--
+<!ENTITY pamaccess SYSTEM "pam_selinux.8.xml">
+-->
+]>
+
+<article>
+
+ <articleinfo>
+
+ <title>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="pam_selinux.8.xml" xpointer='xpointer(//refnamediv[@id = "pam_selinux-name"]/*)'/>
+ </title>
+
+ </articleinfo>
+
+ <section>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="pam_selinux.8.xml" xpointer='xpointer(//refsect1[@id = "pam_selinux-description"]/*)'/>
+ </section>
+
+ <section>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="pam_selinux.8.xml" xpointer='xpointer(//refsect1[@id = "pam_selinux-options"]/*)'/>
+ </section>
+
+ <section>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="pam_selinux.8.xml" xpointer='xpointer(//refsect1[@id = "pam_selinux-examples"]/*)'/>
+ </section>
+
+ <section>
+ <xi:include xmlns:xi="http://www.w3.org/2001/XInclude"
+ href="pam_selinux.8.xml" xpointer='xpointer(//refsect1[@id = "pam_selinux-author"]/*)'/>
+ </section>
+
+</article>
diff --git a/modules/pam_selinux/pam_selinux.8 b/modules/pam_selinux/pam_selinux.8
index 4ccec58c..70ffbecf 100644
--- a/modules/pam_selinux/pam_selinux.8
+++ b/modules/pam_selinux/pam_selinux.8
@@ -1,63 +1,81 @@
-.TH pam_selinux 8 2003/08/26 "Red Hat Linux" "System Administrator's Manual"
-.SH NAME
-pam_selinux \- set the default security context after login via PAM.
-.SH SYNOPSIS
-.B session optional /lib/security/pam_selinux.so
-.br
-
-.SH DESCRIPTION
-In a nutshell, pam_selinux sets up the default security context for the next execed
-shell.
-
-When an application opens a session using pam_selinux, the shell that gets
-executed will be run in the default security context, or if the user chooses
-and the pam file allows the selected security context. Also the controlling
-tty will have it's security context modified to match the users.
-
-Adding pam_selinux into a pam file could cause other pam modules to change
-their behavior if the exec another application. The close and open option help
-mitigate this problem. close option will only cause the close portion of the
-pam_selinux to execute, and open will only cause the open portion to run. You
-can add pam_selinux to the config file twice. Add the pam_selinux close as the
-'first' session entry and open as the 'last' session entry. This way when pam
-executes the open pass through the modules, pam_selinux open_session will
-happen last. When pam executes the close pass through the modules pam_selinux
-close_session will happen first.
-
-.SH ARGUMENTS
-.IP close
+.\" Title: pam_selinux
+.\" Author:
+.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
+.\" Date: 06/18/2006
+.\" Manual: Linux\-PAM Manual
+.\" Source: Linux\-PAM Manual
+.\"
+.TH "PAM_SELINUX" "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_selinux \- PAM module to set the default security context
+.SH "SYNOPSIS"
+.HP 15
+\fBpam_selinux.so\fR [close] [debug] [multiple] [open] [nottys] [verbose]
+.SH "DESCRIPTION"
+.PP
+In a nutshell, pam_selinux sets up the default security context for the next execed shell.
+.PP
+When an application opens a session using pam_selinux, the shell that gets executed will be run in the default security context, or if the user chooses and the pam file allows the selected security context. Also the controlling tty will have it's security context modified to match the users.
+.PP
+Adding pam_selinux into a pam file could cause other pam modules to change their behavior if the exec another application. The close and open option help mitigate this problem. close option will only cause the close portion of the pam_selinux to execute, and open will only cause the open portion to run. You can add pam_selinux to the config file twice. Add the pam_selinux close as the executes the open pass through the modules, pam_selinux open_session will happen last. When PAM executes the close pass through the modules pam_selinux close_session will happen first.
+.SH "OPTIONS"
+.TP 3n
+\fBclose\fR
Only execute the close_session portion of the module.
-.IP debug
-turns on debugging via \fBsyslog(3)\fR.
-.IP multiple
-tells pam_selinux.so to allow the user to select the security context they will
-login with, if the user has more than one role.
-.IP open
+.TP 3n
+\fBdebug\fR
+Turns on debugging via
+\fBsyslog\fR(3).
+.TP 3n
+\fBmultiple\fR
+Tells pam_selinux.so to allow the user to select the security context they will login with, if the user has more than one role.
+.TP 3n
+\fBopen\fR
Only execute the open_session portion of the module.
-.IP nottys
+.TP 3n
+\fBnottys\fR
Do not try to setup the ttys security context.
-.IP verbose
+.TP 3n
+\fBverbose\fR
attempt to inform the user when security context is set.
+.SH "MODULE SERVICES PROVIDED"
+.PP
+Only the
+\fBsession\fR
+service is supported.
+.SH "RETURN VALUES"
+.TP 3n
+PAM_AUTH_ERR
+Unable to get or set a valid context.
+.TP 3n
+PAM_SUCCESS
+The security context was set successfull.
+.TP 3n
+PAM_USER_UNKNOWN
+The user is not known to the system.
+.SH "EXAMPLES"
+.sp
+.RS 3n
+.nf
+auth requisite pam_permit.so
+auth [success=2 default=ok] pam_selinux.so auth=perm_denied cred=success
+auth [default=reset] pam_selinux.so auth=success cred=perm_denied
+auth [success=done default=die] pam_selinux.so
+auth optional pam_selinux.so auth=perm_denied cred=perm_denied
+auth sufficient pam_selinux.so auth=success cred=success
+
+.fi
+.RE
+.SH "SEE ALSO"
+.PP
-.SH EXAMPLE
-\fB/etc/pam.d/some-login-program\fP:
-.br
-auth required /lib/security/pam_unix.so
-.br
-session required /lib/security/pam_permit.so
-session optional /lib/security/pam_selinux.so
-.br
-
-.SH CAVEATS
-Setting the following line will cause the login to fail
-auth sufficient /lib/security/pam_selinux.so verbose
-
-
-.SH SEE ALSO
-pam_selinux_check(8)
-
-.SH BUGS
-Let's hope not, but if you find any, please email the author.
-
-.SH AUTHOR
-Dan Walsh <dwalsh@redhat.com>
+\fBpam.conf\fR(5),
+\fBpam.d\fR(8),
+\fBpam\fR(8)
+.SH "AUTHOR"
+.PP
+pam_selinux was written by Dan Walsh <dwalsh@redhat.com>.
diff --git a/modules/pam_selinux/pam_selinux.8.xml b/modules/pam_selinux/pam_selinux.8.xml
new file mode 100644
index 00000000..1f00f082
--- /dev/null
+++ b/modules/pam_selinux/pam_selinux.8.xml
@@ -0,0 +1,207 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.3//EN"
+ "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd">
+
+<refentry id="pam_selinux">
+
+ <refmeta>
+ <refentrytitle>pam_selinux</refentrytitle>
+ <manvolnum>8</manvolnum>
+ <refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
+ </refmeta>
+
+ <refnamediv id="pam_selinux-name">
+ <refname>pam_selinux</refname>
+ <refpurpose>PAM module to set the default security context</refpurpose>
+ </refnamediv>
+
+ <refsynopsisdiv>
+ <cmdsynopsis id="pam_selinux-cmdsynopsis">
+ <command>pam_selinux.so</command>
+ <arg choice="opt">
+ close
+ </arg>
+ <arg choice="opt">
+ debug
+ </arg>
+ <arg choice="opt">
+ multiple
+ </arg>
+ <arg choice="opt">
+ open
+ </arg>
+ <arg choice="opt">
+ nottys
+ </arg>
+ <arg choice="opt">
+ verbose
+ </arg>
+ </cmdsynopsis>
+ </refsynopsisdiv>
+
+ <refsect1 id="pam_selinux-description">
+ <title>DESCRIPTION</title>
+ <para>
+ In a nutshell, pam_selinux sets up the default security context for the
+ next execed shell.
+ </para>
+ <para>
+ When an application opens a session using pam_selinux, the shell that
+ gets executed will be run in the default security context, or if the
+ user chooses and the pam file allows the selected security context.
+ Also the controlling tty will have it's security context modified to
+ match the users.
+ </para>
+ <para>
+ Adding pam_selinux into a pam file could cause other pam modules to
+ change their behavior if the exec another application. The close and
+ open option help mitigate this problem. close option will only cause
+ the close portion of the pam_selinux to execute, and open will only
+ cause the open portion to run. You can add pam_selinux to the config
+ file twice. Add the pam_selinux close as the executes the open pass
+ through the modules, pam_selinux open_session will happen last.
+ When PAM executes the close pass through the modules pam_selinux
+ close_session will happen first.
+ </para>
+ </refsect1>
+
+ <refsect1 id="pam_selinux-options">
+ <title>OPTIONS</title>
+ <variablelist>
+ <varlistentry>
+ <term>
+ <option>close</option>
+ </term>
+ <listitem>
+ <para>
+ Only execute the close_session portion of the module.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>debug</option>
+ </term>
+ <listitem>
+ <para>
+ Turns on debugging via
+ <citerefentry>
+ <refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum>
+ </citerefentry>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>multiple</option>
+ </term>
+ <listitem>
+ <para>
+ Tells pam_selinux.so to allow the user to select the
+ security context they will login with, if the user has
+ more than one role.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>open</option>
+ </term>
+ <listitem>
+ <para>
+ Only execute the open_session portion of the module.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>nottys</option>
+ </term>
+ <listitem>
+ <para>
+ Do not try to setup the ttys security context.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>
+ <option>verbose</option>
+ </term>
+ <listitem>
+ <para>
+ attempt to inform the user when security context is set.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 id="pam_selinux-services">
+ <title>MODULE SERVICES PROVIDED</title>
+ <para>
+ Only the <option>session</option> service is supported.
+ </para>
+ </refsect1>
+
+ <refsect1 id='pam_selinux-return_values'>
+ <title>RETURN VALUES</title>
+ <variablelist>
+ <varlistentry>
+ <term>PAM_AUTH_ERR</term>
+ <listitem>
+ <para>
+ Unable to get or set a valid context.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>PAM_SUCCESS</term>
+ <listitem>
+ <para>
+ The security context was set successfull.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>PAM_USER_UNKNOWN</term>
+ <listitem>
+ <para>
+ The user is not known to the system.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </refsect1>
+
+ <refsect1 id='pam_selinux-examples'>
+ <title>EXAMPLES</title>
+ <programlisting>
+auth required pam_unix.so
+session required pam_permit.so
+session optional pam_selinux.so
+ </programlisting>
+ </refsect1>
+
+ <refsect1 id='pam_selinux-see_also'>
+ <title>SEE ALSO</title>
+ <para>
+ <citerefentry>
+ <refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>pam.d</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>,
+ <citerefentry>
+ <refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
+ </citerefentry>
+ </para>
+ </refsect1>
+
+ <refsect1 id='pam_selinux-author'>
+ <title>AUTHOR</title>
+ <para>
+ pam_selinux was written by Dan Walsh &lt;dwalsh@redhat.com&gt;.
+ </para>
+ </refsect1>
+
+</refentry>
diff --git a/modules/pam_selinux/pam_selinux.c b/modules/pam_selinux/pam_selinux.c
index a6ea3e1d..d3b809c9 100644
--- a/modules/pam_selinux/pam_selinux.c
+++ b/modules/pam_selinux/pam_selinux.c
@@ -359,7 +359,7 @@ pam_sm_open_session(pam_handle_t *pamh, int flags UNUSED,
if (pam_get_item(pamh, PAM_USER, &username) != PAM_SUCCESS ||
username == NULL) {
- return PAM_AUTH_ERR;
+ return PAM_USER_UNKNOWN;
}
num_contexts = get_ordered_context_list(username, 0, &contextlist);
if (num_contexts > 0) {
diff --git a/modules/pam_selinux/pam_selinux_check.8 b/modules/pam_selinux/pam_selinux_check.8
index 5151be7d..d6fcdff1 100644
--- a/modules/pam_selinux/pam_selinux_check.8
+++ b/modules/pam_selinux/pam_selinux_check.8
@@ -1,6 +1,6 @@
.TH pam_selinux_check 8 2002/05/23 "Red Hat Linux" "System Administrator's Manual"
.SH NAME
-pam_selinux_check \- login program to test pam_selinux_check
+pam_selinux_check \- login program to test pam_selinux.so
.SH SYNOPSIS
.B pam_selinux_check [user]
.br