REQUEST-KEY.CONF(5)
β¨ request-key.conf β the instantiation handler config file, bestie β¨
okay so you found the request-key.conf manpage and honestly? you're about to have a great time. this is the config file for the Linux Key Management Utilities and it's lowkey the backstage pass of key instantiation. let's get into it π
π NAME π
request-key.conf β the instantiation handler configuration file. yes queen, it's the file that tells request-key who to call when a key needs to be brought into existence. main character energy fr fr.
π DESCRIPTION π
so. these files are the little instruction manuals that /sbin/request-key reads to figure out which program it should run to instantiate a key. that's the whole job. that's the assignment.
request-key is a best match girlie β she reads all of the following files looking for the best match:
/etc/request-key.d/*.conf
/etc/request-key.conf
and if she doesn't find a match? she returns an error and the kernel automatically negates the key. brutal. no key for you. π
so what even is the "best match"? okay bestie, listen up:
- the best match is the line with the shortest wildcard skips, ranking the columns in order from left to right.
- and if two lines have the same length skips? then the first read is the one taken. first come, first served, no cap.
now, inside these files, the vibe check is simple: any blank line, or any line beginning with a hash mark #, is considered a comment and gets ignored. bye. not invited. π
every other line is assumed to be a command line with a bunch of white-space-separated fields, like:
<op> <type> <description> <callout-info> <prog> <arg1> <arg2> ...
the first four fields are what's used to match the parameters that the kernel passed to request-key. let's break them down π§
opis the operation type. and currently? the only supported operation is"create". that's it. that's the whole menu.type,descriptionandcallout-infomatch the three parameters passed tokeyctl request2or therequest_key()system call. and here's the fun part β each of these may contain one asterisk'*'character as a wildcard anywhere within the string. anywhere!! wild.
so should a match be made? the program specified by <prog> will be exec'd. iconic. but heads up:
<prog>must have a fully qualified path name. no shortcuts, no vibes-based guessing. andargv[0]will be set from the part of the program name that follows the last slash'/'character. π
π¦ the pipe bar thing (this part is so cool) π¦
if the program name is prefixed with a pipe bar character '|', then the program will be forked and exec'd attached to three pipes. yes, three. a whole trio.
here's how that goes:
- the callout information will be piped to it on its
stdin - the intended payload data will be retrieved from its
stdout - anything sent to
stderrwill be posted insyslog
and then the moment of truth: if the program exits 0, then /sbin/request-key will attempt to instantiate the key with the data read from stdout. slay. β¨
but if it fails in any other way? then request-key will attempt to execute the appropriate 'negate' operation command. it's giving consequences.
πΈ the macros (aka the glow-up section) πΈ
the program arguments can be substituted with various macros. but bestie, listen carefully β only complete argument substitution is supported. macro substitutions can't be embedded. no mixing, no remixing.
all macros begin with a percent character '%'. and an argument beginning with two percent characters will have one of them discarded. cute little escape hatch.
the following macros are supported:
%oβ Operation type%kβ Key ID%tβ Key type%dβ Key description%cβ Callout information%uβ Key UID%gβ Key GID%Tβ Requestor's thread keyring%Pβ Requestor's process keyring%Sβ Requestor's session keyring
π and there's another macro substitution too π
it permits the interpolation of the contents of a key:
%{<type>:<description>}
this performs a lookup for a key of the given type and description on the requestor's keyrings, and if found, substitutes the contents for the macro. found it, got it, gorgeous. π«Ά
but if it's not found? an error will be logged and the key under construction will be negated. tragic. the key never makes it to the group chat.
π₯ EXAMPLE π₯
a basic file will be installed in the /etc. this will contain two debugging lines that can be used to test the installation:
create user debug:* negate /bin/keyctl negate %k 30 %S
create user debug:loop:* * |/bin/cat
create user debug:* * /usr/share/keyutils/request-key-debug.sh %k %d %c %S
negate * * * /bin/keyctl negate %k 30 %S
this is set up so that something like:
keyctl request2 user debug:xxxx negate
will create a negative user-defined key, something like:
keyctl request2 user debug:yyyy spoon
will create an instantiated user-defined key with "Debug spoon" as the payload, and something like:
keyctl request2 user debug:loop:zzzz abcdefghijkl
will create an instantiated user-defined key with the callout information as the payload. obsessed. π
π FILES π
/etc/request-key.conf/etc/request-key.d/*.conf
π SEE ALSO π
and that's the whole page, bestie π this one came from the Linux keyutils fam, dated 15 November 2011 β old but still absolutely eating, periodt. β¨π
π¦ where this page comes from
- alpine 3.22: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.23: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- alpine 3.24: keyutils-doc 1.6.3-r4 Β· GPL-2.0-or-later AND LGPL-2.0-or-later
- arch rolling: keyutils 1.6.3-4 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 10: keyutils 1.6.3-5.el10 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 9: keyutils 1.6.3-1.el9 Β· GPLv2+ and LGPLv2+
- debian bookworm: keyutils 1.6.3-2 Β· GPL-2.0-or-later
- debian trixie: keyutils 1.6.3-6 Β· GPL-2.0-or-later
- fedora 43: keyutils 1.6.3-6.fc43 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 44: keyutils 1.6.3-7.fc44 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- nixpkgs unstable: keyutils 1.6.3
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- opensuse-leap 16.0: keyutils 1.6.3-160000.3.2 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- ubuntu jammy: keyutils 1.6.1-2ubuntu3 Β· GPL-2.0-or-later
- ubuntu noble: keyutils 1.6.3-3build1 Β· GPL-2.0-or-later
- ubuntu questing: keyutils 1.6.3-6ubuntu2
- ubuntu resolute: keyutils 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- ubuntu stonking: keyutils 1.6.3-6ubuntu3 Β· GPL-2.0-or-later
- Copyright (C) 2005 Red Hat, Inc. All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms