2012-11-13 20:15:34 +00:00
|
|
|
.TH "getkeycreatecon" "3" "9 September 2008" "dwalsh@redhat.com" "SELinux API documentation"
|
2008-09-29 19:12:38 +00:00
|
|
|
.SH "NAME"
|
2012-11-13 20:15:34 +00:00
|
|
|
getkeycreatecon, setkeycreatecon \- get or set the SELinux security context used for creating a new kernel keyrings
|
|
|
|
.
|
2008-09-29 19:12:38 +00:00
|
|
|
.SH "SYNOPSIS"
|
|
|
|
.B #include <selinux/selinux.h>
|
|
|
|
.sp
|
|
|
|
.BI "int getkeycreatecon(security_context_t *" con );
|
2012-11-13 20:15:34 +00:00
|
|
|
.sp
|
2008-09-29 19:12:38 +00:00
|
|
|
.BI "int setkeycreatecon(security_context_t "context );
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-09-29 19:12:38 +00:00
|
|
|
.SH "DESCRIPTION"
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR getkeycreatecon ()
|
2008-09-29 19:12:38 +00:00
|
|
|
retrieves the context used for creating a new kernel keyring.
|
2012-11-13 20:15:34 +00:00
|
|
|
This returned context should be freed with
|
|
|
|
.BR freecon (3)
|
|
|
|
if non-NULL.
|
|
|
|
.BR getkeycreatecon ()
|
|
|
|
sets *con to NULL if no keycreate context has been explicitly
|
2008-09-29 19:12:38 +00:00
|
|
|
set by the program (i.e. using the default policy behavior).
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR setkeycreatecon ()
|
2008-09-29 19:12:38 +00:00
|
|
|
sets the context used for creating a new kernel keyring.
|
|
|
|
NULL can be passed to
|
2012-11-13 20:15:34 +00:00
|
|
|
.BR setkeycreatecon ()
|
|
|
|
to reset to the default policy behavior.
|
|
|
|
The keycreate context is automatically reset after the next
|
|
|
|
.BR execve (2),
|
|
|
|
so a program doesn't need to explicitly sanitize it upon startup.
|
|
|
|
|
|
|
|
.BR setkeycreatecon ()
|
|
|
|
can be applied prior to library
|
2008-09-29 19:12:38 +00:00
|
|
|
functions that internally perform an file creation,
|
|
|
|
in order to set an file context on the objects.
|
|
|
|
|
2012-11-13 20:15:34 +00:00
|
|
|
.B Note:
|
|
|
|
Signal handlers that perform a
|
|
|
|
.BR setkeycreatecon ()
|
|
|
|
must take care to
|
2008-09-29 19:12:38 +00:00
|
|
|
save, reset, and restore the keycreate context to avoid unexpected behavior.
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-09-29 19:12:38 +00:00
|
|
|
.SH "RETURN VALUE"
|
2012-11-13 20:15:34 +00:00
|
|
|
On error \-1 is returned.
|
2008-09-29 19:12:38 +00:00
|
|
|
On success 0 is returned.
|
2012-11-13 20:15:34 +00:00
|
|
|
.
|
2008-09-29 19:12:38 +00:00
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR selinux "(8), " freecon "(3), " getcon "(3), " getexeccon "(3)"
|