selabel_x(5) | SELinux API documentation | selabel_x(5) |
selabel_x - userspace SELinux labeling interface and configuration file format for the X Window System contexts backend. This backend is also used to determine the default context for labeling remotely connected X clients
#include <selinux/label.h>
int selabel_lookup(struct selabel_handle
*hnd,
char **context,
const char *object_name, int object_type);
int selabel_lookup_raw(struct selabel_handle
*hnd,
char **context,
const char *object_name, int
object_type);
The X contexts backend maps from X Window System object names into
security contexts. It is used to find the appropriate context for X Window
System objects whose significance and/or usage semantics are determined
primarily by name. The returned context must be freed using
freecon(3).
selabel_lookup(3) describes the function with its return and error
codes.
This backend is also used to determine the default context for labeling remotely connected X clients.
The object_type argument should be set to one of the following values:
Any messages generated by selabel_lookup(3) are sent to stderr by default, although this can be changed by selinux_set_callback(3).
selabel_lookup_raw behaves identically to selabel_lookup but does not perform context translation.
The FILES section details the configuration files used to determine the X object context.
In addition to the global options described in selabel_open(3), this backend recognizes the following options:
The X context file used to retrieve a default context depends on the SELABEL_OPT_PATH parameter passed to selabel_open(3). If NULL, then the SELABEL_OPT_PATH value will default to the active policy X contexts location (as returned by selinux_x_context_path(3)), otherwise the actual SELABEL_OPT_PATH value specified is used.
The default X object contexts file is:
Where {SELINUXTYPE} is the entry from the selinux configuration file config (see selinux_config(5)).
The entries within the X contexts file are shown in the Object Name String Values and FILE FORMAT sections.
The string name assigned to each object_type argument that can be present in the X contexts file are:
object_type | Text Name |
SELABEL_X_PROP | property |
SELABEL_X_SELN | selection |
SELABEL_X_EXT | extension |
SELABEL_X_EVENT | event |
SELABEL_X_CLIENT | client |
SELABEL_X_POLYPROP | poly_property |
SELABEL_X_POLYSELN | poly_selection |
Each line within the X contexts file is as follows:
Where:
Example 1:
# object_type object_name context selection PRIMARY system_u:object_r:clipboard_xselection_t:s0 selection * system_u:object_r:xselection_t:s0
Example 2 - This example shows how a client entry can be configured to ensure an entry is always found:
# object_type object_name context client * system_u:object_r:remote_t:s0
selinux(8), selabel_open(3), selabel_lookup(3), selabel_stats(3), selabel_close(3), selinux_set_callback(3), selinux_x_context_path(3), freecon(3), selinux_config(5)
29 Nov 2011 | Security Enhanced Linux |