1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
|
<?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_xauth">
<refmeta>
<refentrytitle>pam_xauth</refentrytitle>
<manvolnum>8</manvolnum>
<refmiscinfo class="sectdesc">Linux-PAM Manual</refmiscinfo>
</refmeta>
<refnamediv id="pam_xauth-name">
<refname>pam_xauth</refname>
<refpurpose>PAM module to forward xauth keys between users</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis id="pam_xauth-cmdsynopsis">
<command>pam_xauth.so</command>
<arg choice="opt">
debug
</arg>
<arg choice="opt">
xauthpath=<replaceable>/path/to/xauth</replaceable>
</arg>
<arg choice="opt">
systemuser=<replaceable>UID</replaceable>
</arg>
<arg choice="opt">
targetuser=<replaceable>UID</replaceable>
</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="pam_xauth-description">
<title>DESCRIPTION</title>
<para>
The pam_xauth PAM module is designed to forward xauth keys
(sometimes referred to as "cookies") between users.
</para>
<para>
Without pam_xauth, when xauth is enabled and a user uses the
<citerefentry>
<refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
</citerefentry> command to assume another user's privileges,
that user is no longer able to access the original user's X display
because the new user does not have the key needed to access the
display. pam_xauth solves the problem by forwarding the key from
the user running su (the source user) to the user whose identity the
source user is assuming (the target user) when the session is created,
and destroying the key when the session is torn down.
</para>
<para>
This means, for example, that when you run
<citerefentry>
<refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
</citerefentry> from an xterm session, you will be able to run
X programs without explicitly dealing with the
<citerefentry>
<refentrytitle>xauth</refentrytitle><manvolnum>1</manvolnum>
</citerefentry> xauth command or ~/.Xauthority files.
</para>
<para>
pam_xauth will only forward keys if xauth can list a key connected
to the $DISPLAY environment variable.
</para>
<para>
Primitive access control is provided by
<filename>~/.xauth/export</filename> in the invoking user's home
directory and <filename>~/.xauth/import</filename> in the target
user's home directory.
</para>
<para>
If a user has a <filename>~/.xauth/import</filename> file, the user
will only receive cookies from users listed in the file. If there is
no <filename>~/.xauth/import</filename> file, the user will accept
cookies from any other user.
</para>
<para>
If a user has a <filename>.xauth/export</filename> file, the user will
only forward cookies to users listed in the file. If there is no
<filename>~/.xauth/export</filename> file, and the invoking user is
not <emphasis remap='B'>root</emphasis>, the user will forward cookies
to any other user. If there is no <filename>~/.xauth/export</filename>
file, and the invoking user is <emphasis remap='B'>root</emphasis>,
the user will <emphasis remap='I'>not</emphasis> forward cookies to
other users.
</para>
<para>
Both the import and export files support wildcards (such as
<emphasis remap='I'>*</emphasis>). Both the import and export files
can be empty, signifying that no users are allowed.
</para>
</refsect1>
<refsect1 id="pam_xauth-options">
<title>OPTIONS</title>
<variablelist>
<varlistentry>
<term>
<option>debug</option>
</term>
<listitem>
<para>
Print debug information.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>xauthpath=<replaceable>/path/to/xauth</replaceable></option>
</term>
<listitem>
<para>
Specify the path the xauth program (it is expected in
<filename>/usr/X11R6/bin/xauth</filename>,
<filename>/usr/bin/xauth</filename>, or
<filename>/usr/bin/X11/xauth</filename> by default).
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>systemuser=<replaceable>UID</replaceable></option>
</term>
<listitem>
<para>
Specify the highest UID which will be assumed to belong to a
"system" user. pam_xauth will refuse to forward credentials to
users with UID less than or equal to this number, except for
root and the "targetuser", if specified.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>targetuser=<replaceable>UID</replaceable></option>
</term>
<listitem>
<para>
Specify a single target UID which is exempt from the
systemuser check.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="pam_xauth-types">
<title>MODULE TYPES PROVIDED</title>
<para>
Only the <emphasis remap='B'>session</emphasis> type is provided.
</para>
</refsect1>
<refsect1 id='pam_xauth-return_values'>
<title>RETURN VALUES</title>
<variablelist>
<varlistentry>
<term>PAM_BUF_ERR</term>
<listitem>
<para>
Memory buffer error.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PAM_PERM_DENIED</term>
<listitem>
<para>
Permission denied by import/export file.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PAM_SESSION_ERR</term>
<listitem>
<para>
Cannot determine user name, UID or access users home directory.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PAM_SUCCESS</term>
<listitem>
<para>
Success.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>PAM_USER_UNKNOWN</term>
<listitem>
<para>
User not known.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='pam_xauth-examples'>
<title>EXAMPLES</title>
<para>
Add the following line to <filename>/etc/pam.d/su</filename> to
forward xauth keys between users when calling su:
<programlisting>
session optional pam_xauth.so
</programlisting>
</para>
</refsect1>
<refsect1 id="pam_xauth-implementation">
<title>IMPLEMENTATION DETAILS</title>
<para>
pam_xauth will work <emphasis remap='I'>only</emphasis> if it is
used from a setuid application in which the
<function>getuid</function>() call returns the id of the user
running the application, and for which PAM can supply the name
of the account that the user is attempting to assume. The typical
application of this type is
<citerefentry>
<refentrytitle>su</refentrytitle><manvolnum>1</manvolnum>
</citerefentry>.
The application must call both <function>pam_open_session</function>()
and <function>pam_close_session</function>() with the ruid set to the
uid of the calling user and the euid set to root, and must have
provided as the PAM_USER item the name of the target user.
</para>
<para>
pam_xauth calls
<citerefentry>
<refentrytitle>xauth</refentrytitle><manvolnum>1</manvolnum>
</citerefentry> as the source user to extract the key for $DISPLAY,
then calls xauth as the target user to merge the key into the a
temporary database and later remove the database.
</para>
<para>
pam_xauth cannot be told to not remove the keys when the session
is closed.
</para>
</refsect1>
<refsect1 id="pam_lastlog-files">
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>~/.xauth/import</filename></term>
<listitem>
<para>XXX</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>~/.xauth/export</filename></term>
<listitem>
<para>XXX</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id='pam_xauth-see_also'>
<title>SEE ALSO</title>
<para>
<citerefentry>
<refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum>
</citerefentry>,
<citerefentry>
<refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum>
</citerefentry>
</para>
</refsect1>
<refsect1 id='pam_xauth-author'>
<title>AUTHOR</title>
<para>
pam_xauth was written by Nalin Dahyabhai <nalin@redhat.com>,
based on original version by
Michael K. Johnson <johnsonm@redhat.com>.
</para>
</refsect1>
</refentry>
|