-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
selinux-policy: adjust kernel permissions for NFS #205
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,10 +166,28 @@ | |
; Subjects that must run verified code can execute immutable objects, since | ||
; those are all protected by dm-verity. | ||
(allow verified_s immutable_o (files (execute))) | ||
(allow kernel_t immutable_o (files (execute))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is necessary because |
||
|
||
; Subjects that must run verified code cannot execute mutable objects. | ||
(neverallow verified_s mutable_o (files (execute))) | ||
|
||
; Ideally the kernel would also be denied permission to execute mutable | ||
; objects. However, this breaks certain scenarios such as serving files | ||
; over NFS, where the kernel's permissions are checked. | ||
(allow kernel_t mutable_o (file (execute))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the actual fix to the NFS serving issue. Note that |
||
|
||
; Prevent the kernel from executing mutable objects by blocking execution | ||
; unless there's a defined transition. | ||
(neverallow kernel_t mutable_o (file (execute_no_trans))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This prevents execution because of this check in the "no transition" branch. |
||
|
||
; Backstop against kernel execution of mutable objects by defining a type | ||
; transition, which is then explicitly disallowed. | ||
(typetransition kernel_t mutable_o process forbidden_t) | ||
(neverallow kernel_t forbidden_t (processes (transform))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This prevents execution because of this check in the "transition" branch. |
||
|
||
; Block the use of any object as an entry point to the forbidden type. | ||
(neverallow forbidden_t all_o (files (enter))) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This causes the next check in the "transition" branch to fail. |
||
|
||
; All subjects are allowed to write to objects with their own label. | ||
; This includes files like the ones under /proc/self. | ||
(allow all_s self (files (mutate))) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -68,12 +68,18 @@ | |
(roletype system_r super_t) | ||
(context admin (system_u system_r super_t s0)) | ||
|
||
; Processes that should never exist. | ||
(type forbidden_t) | ||
(roletype system_r forbidden_t) | ||
(context forbidden (system_u system_r forbidden_t s0)) | ||
Comment on lines
+71
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is boilerplate to define the |
||
|
||
; The set of all subjects. | ||
(typeattribute all_s) | ||
(typeattributeset all_s ( | ||
kernel_t init_t system_t mount_t api_t | ||
network_t clock_t bus_t runtime_t | ||
container_t control_t super_t)) | ||
container_t control_t super_t | ||
forbidden_t)) | ||
Comment on lines
+81
to
+82
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add |
||
|
||
; Subjects that are treated as a privileged part of the OS. | ||
(typeattribute privileged_s) | ||
|
@@ -121,7 +127,8 @@ | |
|
||
; Subjects shipped with the OS that should only execute verified code. | ||
(typeattribute verified_s) | ||
(typeattributeset verified_s (xor (host_s) (runtime_t mount_t api_t init_t))) | ||
(typeattributeset verified_s (xor (host_s) ( | ||
runtime_t mount_t api_t init_t kernel_t))) | ||
Comment on lines
+130
to
+131
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This drops
|
||
|
||
; Subjects that are allowed to manage the system clock. | ||
(typeattribute clock_s) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added this so that any rules related to process transitions wouldn't be affected by the presence of MLS categories on the label. Previously it was a blanket "allow this for trusted subjects" and now it is "allow this for trusted subjects, unless the target context is forbidden".