{"id":4556,"date":"2022-12-20T18:09:03","date_gmt":"2022-12-20T21:09:03","guid":{"rendered":"http:\/\/lode.uno\/linux-man\/index.php\/2022\/12\/20\/selabel_media-man5\/"},"modified":"2022-12-20T18:09:03","modified_gmt":"2022-12-20T21:09:03","slug":"selabel_media-man5","status":"publish","type":"post","link":"https:\/\/lode.uno\/linux-man\/2022\/12\/20\/selabel_media-man5\/","title":{"rendered":"selabel_media (man5)"},"content":{"rendered":"<h1 align=\"center\">selabel_media<\/h1>\n<p> <a href=\"#NAME\">NAME<\/a><br \/> <a href=\"#SYNOPSIS\">SYNOPSIS<\/a><br \/> <a href=\"#DESCRIPTION\">DESCRIPTION<\/a><br \/> <a href=\"#OPTIONS\">OPTIONS<\/a><br \/> <a href=\"#FILES\">FILES<\/a><br \/> <a href=\"#FILE FORMAT\">FILE FORMAT<\/a><br \/> <a href=\"#NOTES\">NOTES<\/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\">selabel_media \u2212 userspace SELinux labeling interface and configuration file format for the media contexts backend<\/p>\n<h2>SYNOPSIS <a name=\"SYNOPSIS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>#include <selinux\/label.h><\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int selabel_lookup(struct selabel_handle *<\/b><i>hnd<\/i><b>,<\/b><\/p>\n<p style=\"margin-left:40%;\"><b>char **<\/b><i>context<\/i><b>, <br \/> const char *<\/b><i>device_name<\/i><b>, int<\/b> <i>unused<\/i><b>);<\/b><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>int selabel_lookup_raw(struct selabel_handle *<\/b><i>hnd<\/i><b>,<\/b><\/p>\n<p style=\"margin-left:40%;\"><b>char **<\/b><i>context<\/i><b>, <br \/> const char *<\/b><i>device_name<\/i><b>, int<\/b> <i>unused<\/i><b>);<\/b><\/p>\n<h2>DESCRIPTION <a name=\"DESCRIPTION\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The media contexts backend maps from media device names such as &#8220;cdrom&#8221; or &#8220;floppy&#8221; into security contexts. It is used to find the appropriate context for establishing context mounts on these devices. The returned <i>context<\/i> must be freed using <b>freecon<\/b>(3). <b><br \/> selabel_lookup<\/b>(3) describes the function with its return and error codes.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The integer lookup argument is currently unused and should be set to zero.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Any messages generated by <b>selabel_lookup<\/b>(3) are sent to <i>stderr<\/i> by default, although this can be changed by <b>selinux_set_callback<\/b>(3).<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>selabel_lookup_raw<\/b>(3) behaves identically to <b>selabel_lookup<\/b>(3) but does not perform context translation.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The <b>FILES<\/b> section details the configuration files used to determine the media context.<\/p>\n<h2>OPTIONS <a name=\"OPTIONS\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">In addition to the global options described in <b>selabel_open<\/b>(3), this backend recognizes the following options: <b><br \/> SELABEL_OPT_PATH<\/b><\/p>\n<p style=\"margin-left:22%;\">A non-null value for this option specifies a path to a file that will be opened in lieu of the standard <i>media<\/i> contexts file.<\/p>\n<h2>FILES <a name=\"FILES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">The media context file used to retrieve a default context depends on the <b>SELABEL_OPT_PATH<\/b> parameter passed to <b>selabel_open(3). If<\/b> <i>NULL<\/i>, then the <b>SELABEL_OPT_PATH<\/b> value will default to the active policy media contexts location (as returned by <b>selinux_media_context_path<\/b>(3)), otherwise the actual <b>SELABEL_OPT_PATH<\/b> value specified is used.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">The default media contexts file is:<\/p>\n<p style=\"margin-left:22%;\"><i>\/etc\/selinux\/{SELINUXTYPE}\/contexts\/files\/media<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Where <i>{SELINUXTYPE}<\/i> is the entry from the selinux configuration file <i>config<\/i> (see <b>selinux_config<\/b>(5)).<\/p>\n<h2>FILE FORMAT <a name=\"FILE FORMAT\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">Each line within the <i>media<\/i> file is as follows:<\/p>\n<p style=\"margin-left:22%;\"><i>device_name context<\/i><\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Where:<\/p>\n<p style=\"margin-left:22%;\"><i>device_name<\/i><\/p>\n<p style=\"margin-left:32%;\">The media identifier (e.g. cdrom, floppy, disk and usb).<\/p>\n<p style=\"margin-left:22%;\"><i>context<\/i><\/p>\n<p style=\"margin-left:32%;\">The context to be used for labeling the device.<\/p>\n<p style=\"margin-left:11%; margin-top: 1em\">Example:<\/p>\n<p style=\"margin-left:22%;\"># contexts\/files\/media <br \/> cdrom system_u:object_r:removable_device_t <br \/> floppy system_u:object_r:removable_device_t <br \/> disk system_u:object_r:fixed_disk_device_t<\/p>\n<h2>NOTES <a name=\"NOTES\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\">If contexts are to be validated, then the global option <b>SELABEL_OPT_VALIDATE<\/b> must be set before calling <b>selabel_open<\/b>(3). If this is not set, then it is possible for an invalid context to be returned.<\/p>\n<h2>SEE ALSO <a name=\"SEE ALSO\"><\/a> <\/h2>\n<p style=\"margin-left:11%; margin-top: 1em\"><b>selinux<\/b>(8), <b>selabel_open<\/b>(3), <b>selabel_lookup<\/b>(3), <b>selabel_stats<\/b>(3), <b>selabel_close<\/b>(3), <b>selinux_set_callback<\/b>(3), <b>selinux_media_context_path<\/b>(3), <b>freecon<\/b>(3), <b>selinux_config<\/b>(5)<\/p>\n<hr>\n","protected":false},"excerpt":{"rendered":"<p>  selabel_media \u2212 userspace SELinux labeling interface and configuration file format for the media contexts backend <\/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,1515],"class_list":["post-4556","post","type-post","status-publish","format-standard","hentry","category-5-formatos-de-ficheros","tag-961","tag-man5","tag-selabel_media"],"gutentor_comment":0,"_links":{"self":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4556","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=4556"}],"version-history":[{"count":0,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/posts\/4556\/revisions"}],"wp:attachment":[{"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/media?parent=4556"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/categories?post=4556"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lode.uno\/linux-man\/wp-json\/wp\/v2\/tags?post=4556"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}