1REQUEST-KEY.CONF(5) Linux Key Management Utilities REQUEST-KEY.CONF(5)
2
3
4
6 request-key.conf - Instantiation handler configuration file
7
9 This file and its associated key-type specific variants are used by the
10 /sbin/request-key program to determine which program it should run to
11 instantiate a key.
12
13 request-key looks first in /etc/request-key.d/ for a file of the key
14 type name plus ".conf" that it can use. If that is not found, it will
15 fall back to /etc/request-key.conf.
16
17 request-key scans through the chosen file one line at a time until it
18 finds a match, which it will then use. If it doesn't find a match,
19 it'll return an error and the kernel will automatically negate the key.
20
21 Any blank line or line beginning with a hash mark '#' is considered to
22 be a comment and ignored.
23
24 All other lines are assumed to be command lines with a number of white
25 space separated fields:
26
27 <op> <type> <description> <callout-info> <prog> <arg1> <arg2> ...
28
29 The first four fields are used to match the parameters passed to
30 request-key by the kernel. op is the operation type; currently the only
31 supported operation is "create".
32
33 type, description and callout-info match the three parameters passed to
34 keyctl request2 or the request_key() system call. Each of these may
35 contain one or more asterisk '*' characters as wildcards anywhere
36 within the string.
37
38 Should a match be made, the program specified by <prog> will be exec'd.
39 This must have a fully qualified path name. argv[0] will be set from
40 the part of the program name that follows the last slash '/' character.
41
42 If the program name is prefixed with a pipe bar character '|', then the
43 program will be forked and exec'd attached to three pipes. The callout
44 information will be piped to it on it's stdin and the intended payload
45 data will be retrieved from its stdout. Anything sent to stderr will be
46 posted in syslog. If the program exits 0, then /sbin/request-key will
47 attempt to instantiate the key with the data read from stdout. If it
48 fails in any other way, then request-key will attempt to execute the
49 appropriate 'negate' operation command.
50
51 The program arguments can be substituted with various macros. Only com‐
52 plete argument substitution is supported - macro substitutions can't be
53 embedded. All macros begin with a percent character '%'. An argument
54 beginning with two percent characters will have one of them discarded.
55
56 The following macros are supported:
57
58 %o Operation type
59 %k Key ID
60 %t Key type
61 %d Key description
62 %c Callout information
63 %u Key UID
64 %g Key GID
65 %T Requestor's thread keyring
66 %P Requestor's process keyring
67 %S Requestor's session keyring
68
69 There's another macro substitution too that permits the interpolation
70 of the contents of a key:
71
72 %{<type>:<description>}
73
74 This performs a lookup for a key of the given type and description on
75 the requestor's keyrings, and if found, substitutes the contents for
76 the macro. If not found an error will be logged and the key under con‐
77 struction will be negated.
78
80 A basic file will be installed in the /etc. This will contain two
81 debugging lines that can be used to test the installation:
82
83 create user debug:* negate /bin/keyctl negate %k 30 %S
84 create user debug:loop:* * |/bin/cat
85 create user debug:* * /usr/share/keyutils/request-key-debug.sh
86 %k %d %c %S
87 negate * * * /bin/keyctl negate %k 30 %S
88
89 This is set up so that something like:
90
91 keyctl request2 user debug:xxxx negate
92
93 will create a negative user-defined key, something like:
94
95 keyctl request2 user debug:yyyy spoon
96
97 will create an instantiated user-defined key with "Debug spoon" as the
98 payload, and something like:
99
100 keyctl request2 user debug:loop:zzzz abcdefghijkl
101
102 will create an instantiated user-defined key with the callout informa‐
103 tion as the payload.
104
106 /etc/request-key.conf
107 /etc/request-key.d/<keytype>.conf
108
110 keyctl(1), request-key.conf(5)
111
112
113
114Linux 15 November 2011 REQUEST-KEY.CONF(5)