summaryrefslogtreecommitdiff
path: root/docs/man/pkcheck.xml
blob: ae40476628751a397b6b28eeca2e06f65fc8293b (plain)
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
<?xml version="1.0"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
               "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY version SYSTEM "../version.xml">
]>
<refentry id="pkcheck.1" xmlns:xi="http://www.w3.org/2003/XInclude">
  <refentryinfo>
    <title>pkcheck</title>
    <date>May 2009</date>
    <productname>polkit</productname>
  </refentryinfo>

  <refmeta>
    <refentrytitle>pkcheck</refentrytitle>
    <manvolnum>1</manvolnum>
    <refmiscinfo class="version"></refmiscinfo>
  </refmeta>

  <refnamediv>
    <refname>pkcheck</refname>
    <refpurpose>Check whether a process is authorized</refpurpose>
  </refnamediv>

  <refsynopsisdiv>
    <cmdsynopsis>
      <command>pkcheck</command>
      <arg><option>--version</option></arg>
      <arg><option>--help|-h</option></arg>
    </cmdsynopsis>

    <cmdsynopsis>
      <command>pkcheck</command>
      <arg><option>--list-temp</option></arg>
    </cmdsynopsis>

    <cmdsynopsis>
      <command>pkcheck</command>
      <arg><option>--revoke-temp</option></arg>
    </cmdsynopsis>

    <cmdsynopsis>
      <command>pkcheck</command>
      <arg choice="plain">
        <option>--action-id|-a</option>
        <replaceable>action</replaceable>
      </arg>

      <group choice="req">
        <arg choice="plain">
          <option>--process|-p</option>
          <group choice="req">
            <arg choice="plain">
              <replaceable>pid</replaceable>
            </arg>
            <arg choice="plain">
              <replaceable>pid,pid-start-time</replaceable>
            </arg>
            <arg choice="plain">
              <replaceable>pid,pid-start-time,uid</replaceable>
            </arg>
          </group>
        </arg>
        <arg choice="plain">
          <option>--system-bus-name|-s</option>
          <replaceable>busname</replaceable>
        </arg>
      </group>

      <group>
        <arg choice="plain">
          <option>--allow-user-interaction|-u</option>
        </arg>
      </group>

      <group>
        <arg choice="plain">
          <option>--enable-internal-agent</option>
        </arg>
      </group>

      <group rep="repeat">
        <arg choice="plain">
          <option>--detail|-d</option>
          <replaceable>key</replaceable>
          <replaceable>value</replaceable>
        </arg>
      </group>
    </cmdsynopsis>

  </refsynopsisdiv>

  <refsect1 id="pkcheck-descsription">
    <title>DESCRIPTION</title>
    <para>
      <command>pkcheck</command> is used to check whether a process, specified by
      either <option>--process</option> (see below) or <option>--system-bus-name</option>,
      is authorized for <replaceable>action</replaceable>. The <option>--detail</option>
      option can be used zero or more times to pass details about <replaceable>action</replaceable>.
      If <option>--allow-user-interaction</option> is passed, <command>pkcheck</command> blocks
      while waiting for authentication.
    </para>
    <para>
      The invocation <command>pkcheck --list-temp</command> will list
      all temporary authorizations for the current session and
      <command>pkcheck --revoke-temp</command> will revoke all
      temporary authorizations for the current session.
    </para>
    <para>
      This command is a simple wrapper around the polkit D-Bus interface; see the
      D-Bus interface documentation for details.
    </para>
  </refsect1>

  <refsect1 id="pkcheck-return-value">
    <title>RETURN VALUE</title>
    <para>
      If the specified process is
      authorized, <command>pkcheck</command> exits with a return value
      of 0. If the authorization result contains any details, these
      are printed on standard output as key/value pairs using
      environment style reporting, e.g. first the key followed by a an equal sign, then the
      value followed by a newline.
<programlisting>
KEY1=VALUE1
KEY2=VALUE2
KEY3=VALUE3
...</programlisting>
      Octets that are not in [a-zA-Z0-9_] are escaped using octal codes prefixed
      with <emphasis>\</emphasis>.
      For example, the UTF-8 string <emphasis>føl,你好</emphasis> will be printed
      as <emphasis>f\303\270l\54\344\275\240\345\245\275</emphasis>.
    </para>
    <para>
      If the specified process is not
      authorized, <command>pkcheck</command> exits with a return value
      of 1 and a diagnostic message is printed on standard error. Details
      are printed on standard output.
    </para>
    <para>
      If the specified process is not
      authorized because no suitable authentication agent is available or if the
      <option>--allow-user-interaction</option> wasn't passed, <command>pkcheck</command>
      exits with a return value of 2 and a diagnostic message is printed on standard error.
      Details are printed on standard output.
    </para>
    <para>
      If the specified process is not authorized because the
      authentication dialog / request was dismissed by the user,
      <command>pkcheck</command> exits with a return value of 3 and a
      diagnostic message is printed on standard error.  Details are
      printed on standard output.
    </para>
    <para>
      If an error occurred while checking for authorization, <command>pkcheck</command> exits
      with a return value of 127 with a diagnostic message printed on standard error.
    </para>
    <para>
      If one or more of the options passed are malformed, <command>pkcheck</command> exits
      with a return value of 126. If stdin is a tty, then this manual page is also shown.
    </para>
  </refsect1>

  <refsect1 id="pkcheck-notes">
    <title>NOTES</title>
    <para>
      Do not use either the bare <replaceable>pid</replaceable> or
      <replaceable>pid,start-time</replaceable> syntax forms for
      <option>--process</option>.  There are race conditions in both.
      New code should always use
      <replaceable>pid,pid-start-time,uid</replaceable>.  The value of
      <replaceable>start-time</replaceable> can be determined by
      consulting e.g. the
      <citerefentry><refentrytitle>proc</refentrytitle><manvolnum>5</manvolnum></citerefentry>
      file system depending on the operating system.  If fewer than 3
      arguments are passed, <command>pkcheck</command> will attempt to
      look up them up internally, but note that this may be racy.
    </para>
    <para>
      If your program is a daemon with e.g. a custom Unix domain
      socket, you should determine the <replaceable>uid</replaceable>
      parameter via operating system mechanisms such as
      <literal>PEERCRED</literal>.
    </para>
  </refsect1>

  <refsect1 id="pkcheck-auth-agent"><title>AUTHENTICATION AGENT</title>
    <para>
      <command>pkcheck</command>, like any other polkit
      application, will use the authentication agent registered for
      the process in question. However, if no authentication agent is
      available, then <command>pkcheck</command> can register its own
      textual authentication agent if the option
      <option>--enable-internal-agent</option> is passed.
    </para>
  </refsect1>

  <refsect1 id="pkcheck-author"><title>AUTHOR</title>
    <para>
      Written by David Zeuthen <email>davidz@redhat.com</email> with
      a lot of help from many others.
    </para>
  </refsect1>

  <refsect1 id="pkcheck-bugs">
    <title>BUGS</title>
    <para>
      Please send bug reports to either the distribution or the
      polkit-devel mailing list,
      see the link <ulink url="https://gitlab.freedesktop.org/polkit/polkit/-/issues/"/>
      on how to subscribe.
    </para>
  </refsect1>

  <refsect1 id="pkcheck-see-also">
    <title>SEE ALSO</title>
    <para>
      <link linkend="polkit.8"><citerefentry><refentrytitle>polkit</refentrytitle><manvolnum>8</manvolnum></citerefentry></link>,
      <link linkend="polkitd.8"><citerefentry><refentrytitle>polkitd</refentrytitle><manvolnum>8</manvolnum></citerefentry></link>,
      <link linkend="pkaction.1"><citerefentry><refentrytitle>pkaction</refentrytitle><manvolnum>1</manvolnum></citerefentry></link>,
      <link linkend="pkexec.1"><citerefentry><refentrytitle>pkexec</refentrytitle><manvolnum>1</manvolnum></citerefentry></link>,
      <link linkend="pkttyagent.1"><citerefentry><refentrytitle>pkttyagent</refentrytitle><manvolnum>1</manvolnum></citerefentry></link>
    </para>
  </refsect1>
</refentry>