{"id":4421,"date":"2022-12-20T17:49:15","date_gmt":"2022-12-20T20:49:15","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/request-key-conf-man5\/"},"modified":"2022-12-20T17:49:15","modified_gmt":"2022-12-20T20:49:15","slug":"request-key-conf-man5","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/request-key-conf-man5\/","title":{"rendered":"REQUEST-KEY.CONF (man5)"},"content":{"rendered":"<h1 align=\"center\">REQUEST-KEY.CONF<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#EXAMPLE\">EXAMPLE<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#SEE ALSO\">SEE ALSO<\/a> <\/p>\n<hr>\n<h2>NAME <a name=\"NAME\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">request\u2212key.conf \u2212 Instantiation handler configuration file<\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">These files are used by the \/sbin\/request\u2212key program to determine which program it should run to instantiate a key.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">request\u2212key looks for the best match, reading all the following files:<\/p>\n<table width=\"100%\" border=\"0\" rules=\"none\" frame=\"void\" cellspacing=\"0\" cellpadding=\"0\">\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"85%\">\n<p>\/etc\/request\u2212key.d\/*.conf<\/p>\n<\/td>\n<\/tr>\n<tr valign=\"top\" align=\"left\">\n<td width=\"8%\"><\/td>\n<td width=\"7%\"><\/td>\n<td width=\"85%\">\n<p>\/etc\/request\u2212key.conf<\/p>\n<\/td>\n<\/tr>\n<\/table>\n<p style=\"margin-left:11%; margin-top: 1em\">If it doesn\u2019t find a match, it will return an error and the kernel will automatically negate the key.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The best match is defined as the line with the shortest wildcard skips, ranking the columns in order left to right. If two lines have the same length skips, then the first read is the one taken.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">In the files, any blank line or line beginning with a hash mark \u2019#\u2019 is considered to be a comment and ignored.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">All other lines are assumed to be command lines with a number of white space separated fields:<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><op> <type> <description> <callout\u2212info> <prog> <arg1> <arg2> &#8230;<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The first four fields are used to match the parameters passed to request\u2212key by the kernel. <i>op<\/i> is the operation type; currently the only supported operation is &#8220;create&#8221;.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>type<\/i>, <i>description<\/i> and <i>callout\u2212info<\/i> match the three parameters passed to <b>keyctl request2<\/b> or the <b>request_key()<\/b> system call. Each of these may contain one asterisk \u2019*\u2019 character as a wildcard anywhere within the string.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Should a match be made, the program specified by <prog> will be exec\u2019d. This must have a fully qualified path name. argv[0] will be set from the part of the program name that follows the last slash \u2019\/\u2019 character.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">If the program name is prefixed with a pipe bar character \u2019|\u2019, then the program will be forked and exec\u2019d attached to three pipes. The callout information will be piped to it on it\u2019s stdin and the intended payload data will be retrieved from its stdout. Anything sent to stderr will be posted in syslog. If the program exits 0, then \/sbin\/request\u2212key will attempt to instantiate the key with the data read from stdout. If it fails in any other way, then request\u2212key will attempt to execute the appropriate \u2019negate\u2019 operation command.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The program arguments can be substituted with various macros. Only complete argument substitution is supported &#8211; macro substitutions can\u2019t be embedded. All macros begin with a percent character \u2019%\u2019. An argument beginning with two percent characters will have one of them discarded.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The following macros are supported:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">%o Operation type <br \/> %k Key ID <br \/> %t Key type <br \/> %d Key description <br \/> %c Callout information <br \/> %u Key UID <br \/> %g Key GID <br \/> %T Requestor\u2019s thread keyring <br \/> %P Requestor\u2019s process keyring <br \/> %S Requestor\u2019s session keyring<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">There\u2019s another macro substitution too that permits the interpolation of the contents of a key:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">%{<type>:<description>}<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This performs a lookup for a key of the given type and description on the requestor\u2019s keyrings, and if found, substitutes the contents for the macro. If not found an error will be logged and the key under construction will be negated.<\/p>\n<h2>EXAMPLE <a name=\"EXAMPLE\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">A basic file will be installed in the \/etc. This will contain two debugging lines that can be used to test the installation:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">create user debug:* negate \/bin\/keyctl negate %k 30 %S <br \/> create user debug:loop:* bodies manpages.csv script_extrae_body.sh script.sh usr |\/bin\/cat <br \/> create user debug:* bodies manpages.csv script_extrae_body.sh script.sh usr \/usr\/share\/keyutils\/request\u2212key\u2212debug.sh %k %d %c %S <br \/> negate bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr bodies manpages.csv script_extrae_body.sh script.sh usr \/bin\/keyctl negate %k 30 %S<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">This is set up so that something like:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">keyctl request2 user debug:xxxx negate<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">will create a negative user-defined key, something like:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">keyctl request2 user debug:yyyy spoon<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">will create an instantiated user-defined key with &#8220;Debug spoon&#8221; as the payload, and something like:<\/p>\n<p style=\"margin-left:22%; margin-top: 1em\">keyctl request2 user debug:loop:zzzz abcdefghijkl<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">will create an instantiated user-defined key with the callout information as the payload.<\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i>\/etc\/request\u2212key.conf <br \/> \/etc\/request\u2212key.d\/*.conf<\/i><\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><i><b>keyctl<\/b><\/i>(1), <b>request\u2212key.conf<\/b>(5)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  request\u2212key.conf \u2212 Instantiation handler configuration file <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[959],"tags":[961,1291,908],"class_list":["post-4421","post","type-post","status-publish","format-standard","hentry","category-5-formatos-de-ficheros","tag-961","tag-man5","tag-request-key"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4421","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/comments?post=4421"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4421\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4421"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4421"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4421"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}