xref: /dflybsd-src/lib/libpam/modules/pam_exec/pam_exec.8 (revision 242be47e2206d44451f1e1b27f7966e08c0620c8)
1*242be47eSzrj.\" Copyright (c) 2001,2003 Networks Associates Technology, Inc.
2*242be47eSzrj.\" All rights reserved.
3*242be47eSzrj.\"
4*242be47eSzrj.\" Portions of this software were developed for the FreeBSD Project by
5*242be47eSzrj.\" ThinkSec AS and NAI Labs, the Security Research Division of Network
6*242be47eSzrj.\" Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035
7*242be47eSzrj.\" ("CBOSS"), as part of the DARPA CHATS research program.
8*242be47eSzrj.\"
9*242be47eSzrj.\" Redistribution and use in source and binary forms, with or without
10*242be47eSzrj.\" modification, are permitted provided that the following conditions
11*242be47eSzrj.\" are met:
12*242be47eSzrj.\" 1. Redistributions of source code must retain the above copyright
13*242be47eSzrj.\"    notice, this list of conditions and the following disclaimer.
14*242be47eSzrj.\" 2. Redistributions in binary form must reproduce the above copyright
15*242be47eSzrj.\"    notice, this list of conditions and the following disclaimer in the
16*242be47eSzrj.\"    documentation and/or other materials provided with the distribution.
17*242be47eSzrj.\" 3. The name of the author may not be used to endorse or promote
18*242be47eSzrj.\"    products derived from this software without specific prior written
19*242be47eSzrj.\"    permission.
20*242be47eSzrj.\"
21*242be47eSzrj.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22*242be47eSzrj.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23*242be47eSzrj.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24*242be47eSzrj.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25*242be47eSzrj.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26*242be47eSzrj.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27*242be47eSzrj.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28*242be47eSzrj.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29*242be47eSzrj.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30*242be47eSzrj.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31*242be47eSzrj.\" SUCH DAMAGE.
32*242be47eSzrj.\"
33*242be47eSzrj.\" $FreeBSD: src/lib/libpam/modules/pam_exec/pam_exec.8,v 1.8 2012/05/24 02:24:03 wblock Exp $
34*242be47eSzrj.\"
35*242be47eSzrj.Dd July 11, 2012
36*242be47eSzrj.Dt PAM_EXEC 8
37*242be47eSzrj.Os
38*242be47eSzrj.Sh NAME
39*242be47eSzrj.Nm pam_exec
40*242be47eSzrj.Nd Exec PAM module
41*242be47eSzrj.Sh SYNOPSIS
42*242be47eSzrj.Op Ar service-name
43*242be47eSzrj.Ar module-type
44*242be47eSzrj.Ar control-flag
45*242be47eSzrj.Pa pam_exec
46*242be47eSzrj.Op Ar arguments
47*242be47eSzrj.Sh DESCRIPTION
48*242be47eSzrjThe exec service module for PAM executes the program designated by
49*242be47eSzrjits first argument if no options are specified, with its remaining
50*242be47eSzrjarguments as command-line arguments.
51*242be47eSzrjIf options are specified, the program and its arguments follow the last
52*242be47eSzrjoption or
53*242be47eSzrj.Cm --
54*242be47eSzrjif the program name conflicts with an option name.
55*242be47eSzrj.Pp
56*242be47eSzrjThe following options may be passed before the program and its
57*242be47eSzrjarguments:
58*242be47eSzrj.Bl -tag -width ".Cm return_prog_exit_status"
59*242be47eSzrj.It Cm return_prog_exit_status
60*242be47eSzrjUse the program exit status as the return code of the pam_sm_* function.
61*242be47eSzrjIt must be a valid return value for this function.
62*242be47eSzrj.It Cm --
63*242be47eSzrjStop options parsing;
64*242be47eSzrjprogram and its arguments follow.
65*242be47eSzrj.El
66*242be47eSzrj.Pp
67*242be47eSzrjThe child's environment is set to the current PAM environment list,
68*242be47eSzrjas returned by
69*242be47eSzrj.Xr pam_getenvlist 3 .
70*242be47eSzrjIn addition, the following PAM items are exported as environment
71*242be47eSzrjvariables:
72*242be47eSzrj.Ev PAM_RHOST ,
73*242be47eSzrj.Ev PAM_RUSER ,
74*242be47eSzrj.Ev PAM_SERVICE ,
75*242be47eSzrj.Ev PAM_SM_FUNC ,
76*242be47eSzrj.Ev PAM_TTY
77*242be47eSzrjand
78*242be47eSzrj.Ev PAM_USER .
79*242be47eSzrj.Pp
80*242be47eSzrjThe
81*242be47eSzrj.Ev PAM_SM_FUNC
82*242be47eSzrjvariable contains the name of the PAM service module function being
83*242be47eSzrjcalled.
84*242be47eSzrjIt may be:
85*242be47eSzrj.Bl -dash -offset indent -compact
86*242be47eSzrj.It
87*242be47eSzrjpam_sm_acct_mgmt
88*242be47eSzrj.It
89*242be47eSzrjpam_sm_authenticate
90*242be47eSzrj.It
91*242be47eSzrjpam_sm_chauthtok
92*242be47eSzrj.It
93*242be47eSzrjpam_sm_close_session
94*242be47eSzrj.It
95*242be47eSzrjpam_sm_open_session
96*242be47eSzrj.It
97*242be47eSzrjpam_sm_setcred
98*242be47eSzrj.El
99*242be47eSzrj.Pp
100*242be47eSzrjIf
101*242be47eSzrj.Cm return_prog_exit_status
102*242be47eSzrjis not set (default), the
103*242be47eSzrj.Ev PAM_SM_FUNC
104*242be47eSzrjfunction returns
105*242be47eSzrj.Er PAM_SUCCESS
106*242be47eSzrjif the program exit status is 0,
107*242be47eSzrj.Er PAM_PERM_DENIED
108*242be47eSzrjotherwise.
109*242be47eSzrj.Pp
110*242be47eSzrjIf
111*242be47eSzrj.Cm return_prog_exit_status
112*242be47eSzrjis set, the program exit status is used.
113*242be47eSzrjIt should be
114*242be47eSzrj.Er PAM_SUCCESS
115*242be47eSzrjor one of the error codes allowed by the calling
116*242be47eSzrj.Ev PAM_SM_FUNC
117*242be47eSzrjfunction.
118*242be47eSzrjThe valid codes are documented in each function man page.
119*242be47eSzrjIf the exit status is not a valid return code,
120*242be47eSzrj.Er PAM_SERVICE_ERR
121*242be47eSzrjis returned.
122*242be47eSzrjEach valid codes numerical value is available as an environment variable
123*242be47eSzrj(eg.\&
124*242be47eSzrj.Ev PAM_SUCESS ,
125*242be47eSzrj.Ev PAM_USER_UNKNOWN ,
126*242be47eSzrjetc).
127*242be47eSzrjThis is useful in shell scripts for instance.
128*242be47eSzrj.Sh SEE ALSO
129*242be47eSzrj.Xr pam_get_item 3 ,
130*242be47eSzrj.Xr pam_sm_acct_mgmt 3 ,
131*242be47eSzrj.Xr pam_sm_authenticate 3 ,
132*242be47eSzrj.Xr pam_sm_chauthtok 3 ,
133*242be47eSzrj.Xr pam_sm_close_session 3 ,
134*242be47eSzrj.Xr pam_sm_open_session 3 ,
135*242be47eSzrj.Xr pam_sm_setcred 3 ,
136*242be47eSzrj.Xr pam.conf 5 ,
137*242be47eSzrj.Xr pam 8
138*242be47eSzrj.Sh AUTHORS
139*242be47eSzrjThe
140*242be47eSzrj.Nm
141*242be47eSzrjmodule and this manual page were developed for the
142*242be47eSzrj.Fx
143*242be47eSzrjProject by
144*242be47eSzrjThinkSec AS and NAI Labs, the Security Research Division of Network
145*242be47eSzrjAssociates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
146*242be47eSzrj.Pq Dq CBOSS ,
147*242be47eSzrjas part of the DARPA CHATS research program.
148