Debian Codegraph @

libselinux/man/man3/security_load_policy.3

raw
1 .TH "security_load_policy" "3" "3 November 2009" "[email protected]" "SELinux API documentation"
2 .SH "NAME"
3 security_load_policy \- load a new SELinux policy
4 .
5 .SH "SYNOPSIS"
6 .B #include <selinux/selinux.h>
7 .sp
8 .BI "int security_load_policy(void *" data ", size_t "len );
9 .sp
10 .BI "int selinux_mkload_policy(int " preservebools ");"
11 .sp
12 .BI "int selinux_init_load_policy(int *" enforce ");"
13 .
14 .SH "DESCRIPTION"
15 .BR security_load_policy ()
16 loads a new policy, returns 0 for success and \-1 for error.
17
18 .BR selinux_mkload_policy ()
19 makes a policy image and loads it. This function provides a higher level
20 interface for loading policy than
21 .BR \%security_load_policy (),
22 internally determining the right policy version, locating and opening
23 the policy file, mapping it into memory, manipulating it as needed for
24 current boolean settings and/or local definitions, and then calling
25 security_load_policy to load it.
26 .I preservebools
27 is a boolean flag indicating whether current policy boolean values should
28 be preserved into the new policy (if 1) or reset to the saved policy
29 settings (if 0). The former case is the default for policy reloads, while
30 the latter case is an option for policy reloads but is primarily used for
31 the initial policy load.
32 .BR selinux_init_load_policy ()
33 performs the initial policy load. This function determines the desired
34 enforcing mode, sets the
35 .I enforce
36 argument accordingly for the caller to use, sets the SELinux kernel
37 enforcing status to match it, and loads the policy. It also internally
38 handles the initial selinuxfs mount required to perform these actions.
39 .sp
40 It should also be noted that after the initial policy load, the SELinux
41 kernel code cannot anymore be disabled and the selinuxfs cannot be
42 unmounted using a call to
43 .BR security_disable (3).
44 Therefore, after the initial policy load, the only operational changes
45 are those permitted by
46 .BR security_setenforce (3)
47 (i.e. eventually setting the framework in permissive mode rather than
48 in enforcing one).
49 .
50 .SH "RETURN VALUE"
51 Returns zero on success or \-1 on error.
52 .
53 .SH "AUTHOR"
54 This manual page has been written by Guido Trentalancia <[email protected]>
55 .
56 .SH "SEE ALSO"
57 .BR selinux "(8), " security_disable "(3), " setenforce "(8)