xref: /dflybsd-src/lib/libpam/modules/pam_exec/pam_exec.8 (revision c98db40744766ab0803912f29557df02814bcd9d)
1242be47eSzrj.\" Copyright (c) 2001,2003 Networks Associates Technology, Inc.
2242be47eSzrj.\" All rights reserved.
3242be47eSzrj.\"
4242be47eSzrj.\" Portions of this software were developed for the FreeBSD Project by
5242be47eSzrj.\" ThinkSec AS and NAI Labs, the Security Research Division of Network
6242be47eSzrj.\" Associates, Inc.  under DARPA/SPAWAR contract N66001-01-C-8035
7242be47eSzrj.\" ("CBOSS"), as part of the DARPA CHATS research program.
8242be47eSzrj.\"
9242be47eSzrj.\" Redistribution and use in source and binary forms, with or without
10242be47eSzrj.\" modification, are permitted provided that the following conditions
11242be47eSzrj.\" are met:
12242be47eSzrj.\" 1. Redistributions of source code must retain the above copyright
13242be47eSzrj.\"    notice, this list of conditions and the following disclaimer.
14242be47eSzrj.\" 2. Redistributions in binary form must reproduce the above copyright
15242be47eSzrj.\"    notice, this list of conditions and the following disclaimer in the
16242be47eSzrj.\"    documentation and/or other materials provided with the distribution.
17242be47eSzrj.\" 3. The name of the author may not be used to endorse or promote
18242be47eSzrj.\"    products derived from this software without specific prior written
19242be47eSzrj.\"    permission.
20242be47eSzrj.\"
21242be47eSzrj.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
22242be47eSzrj.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23242be47eSzrj.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24242be47eSzrj.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
25242be47eSzrj.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26242be47eSzrj.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27242be47eSzrj.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28242be47eSzrj.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29242be47eSzrj.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30242be47eSzrj.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31242be47eSzrj.\" SUCH DAMAGE.
32242be47eSzrj.\"
33*c98db407SSascha Wildner.\" $FreeBSD: head/lib/libpam/modules/pam_exec/pam_exec.8 235873 2012-05-24 02:24:03Z wblock $
34242be47eSzrj.\"
35242be47eSzrj.Dd July 11, 2012
36242be47eSzrj.Dt PAM_EXEC 8
37242be47eSzrj.Os
38242be47eSzrj.Sh NAME
39242be47eSzrj.Nm pam_exec
40242be47eSzrj.Nd Exec PAM module
41242be47eSzrj.Sh SYNOPSIS
42242be47eSzrj.Op Ar service-name
43242be47eSzrj.Ar module-type
44242be47eSzrj.Ar control-flag
45242be47eSzrj.Pa pam_exec
46242be47eSzrj.Op Ar arguments
47242be47eSzrj.Sh DESCRIPTION
48242be47eSzrjThe exec service module for PAM executes the program designated by
49242be47eSzrjits first argument if no options are specified, with its remaining
50242be47eSzrjarguments as command-line arguments.
51242be47eSzrjIf options are specified, the program and its arguments follow the last
52242be47eSzrjoption or
53242be47eSzrj.Cm --
54242be47eSzrjif the program name conflicts with an option name.
55242be47eSzrj.Pp
56242be47eSzrjThe following options may be passed before the program and its
57242be47eSzrjarguments:
58242be47eSzrj.Bl -tag -width ".Cm return_prog_exit_status"
59242be47eSzrj.It Cm return_prog_exit_status
60242be47eSzrjUse the program exit status as the return code of the pam_sm_* function.
61242be47eSzrjIt must be a valid return value for this function.
62242be47eSzrj.It Cm --
63242be47eSzrjStop options parsing;
64242be47eSzrjprogram and its arguments follow.
65242be47eSzrj.El
66242be47eSzrj.Pp
67242be47eSzrjThe child's environment is set to the current PAM environment list,
68242be47eSzrjas returned by
69242be47eSzrj.Xr pam_getenvlist 3 .
70242be47eSzrjIn addition, the following PAM items are exported as environment
71242be47eSzrjvariables:
72242be47eSzrj.Ev PAM_RHOST ,
73242be47eSzrj.Ev PAM_RUSER ,
74242be47eSzrj.Ev PAM_SERVICE ,
75242be47eSzrj.Ev PAM_SM_FUNC ,
76242be47eSzrj.Ev PAM_TTY
77242be47eSzrjand
78242be47eSzrj.Ev PAM_USER .
79242be47eSzrj.Pp
80242be47eSzrjThe
81242be47eSzrj.Ev PAM_SM_FUNC
82242be47eSzrjvariable contains the name of the PAM service module function being
83242be47eSzrjcalled.
84242be47eSzrjIt may be:
85242be47eSzrj.Bl -dash -offset indent -compact
86242be47eSzrj.It
87242be47eSzrjpam_sm_acct_mgmt
88242be47eSzrj.It
89242be47eSzrjpam_sm_authenticate
90242be47eSzrj.It
91242be47eSzrjpam_sm_chauthtok
92242be47eSzrj.It
93242be47eSzrjpam_sm_close_session
94242be47eSzrj.It
95242be47eSzrjpam_sm_open_session
96242be47eSzrj.It
97242be47eSzrjpam_sm_setcred
98242be47eSzrj.El
99242be47eSzrj.Pp
100242be47eSzrjIf
101242be47eSzrj.Cm return_prog_exit_status
102242be47eSzrjis not set (default), the
103242be47eSzrj.Ev PAM_SM_FUNC
104242be47eSzrjfunction returns
105242be47eSzrj.Er PAM_SUCCESS
106242be47eSzrjif the program exit status is 0,
107242be47eSzrj.Er PAM_PERM_DENIED
108242be47eSzrjotherwise.
109242be47eSzrj.Pp
110242be47eSzrjIf
111242be47eSzrj.Cm return_prog_exit_status
112242be47eSzrjis set, the program exit status is used.
113242be47eSzrjIt should be
114242be47eSzrj.Er PAM_SUCCESS
115242be47eSzrjor one of the error codes allowed by the calling
116242be47eSzrj.Ev PAM_SM_FUNC
117242be47eSzrjfunction.
118242be47eSzrjThe valid codes are documented in each function man page.
119242be47eSzrjIf the exit status is not a valid return code,
120242be47eSzrj.Er PAM_SERVICE_ERR
121242be47eSzrjis returned.
122242be47eSzrjEach valid codes numerical value is available as an environment variable
123242be47eSzrj(eg.\&
124242be47eSzrj.Ev PAM_SUCESS ,
125242be47eSzrj.Ev PAM_USER_UNKNOWN ,
126242be47eSzrjetc).
127242be47eSzrjThis is useful in shell scripts for instance.
128242be47eSzrj.Sh SEE ALSO
129dfc0c85aSSascha Wildner.Xr pam 3 ,
130242be47eSzrj.Xr pam_get_item 3 ,
131242be47eSzrj.Xr pam_sm_acct_mgmt 3 ,
132242be47eSzrj.Xr pam_sm_authenticate 3 ,
133242be47eSzrj.Xr pam_sm_chauthtok 3 ,
134242be47eSzrj.Xr pam_sm_close_session 3 ,
135242be47eSzrj.Xr pam_sm_open_session 3 ,
136242be47eSzrj.Xr pam_sm_setcred 3 ,
137dfc0c85aSSascha Wildner.Xr pam.conf 5
138242be47eSzrj.Sh AUTHORS
139242be47eSzrjThe
140242be47eSzrj.Nm
141242be47eSzrjmodule and this manual page were developed for the
142242be47eSzrj.Fx
143242be47eSzrjProject by
144242be47eSzrjThinkSec AS and NAI Labs, the Security Research Division of Network
145242be47eSzrjAssociates, Inc.\& under DARPA/SPAWAR contract N66001-01-C-8035
146242be47eSzrj.Pq Dq CBOSS ,
147242be47eSzrjas part of the DARPA CHATS research program.
148