Skip to content

Commit

Permalink
Fixup SELinux policy
Browse files Browse the repository at this point in the history
  • Loading branch information
Bownairo committed Aug 15, 2024
1 parent ff461c7 commit aae5593
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions ic-os/components/selinux/filebeat/filebeat.te
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ require {
search_dirs_pattern(filebeat_t, bin_t, bin_t)

# Allow to read `/sys/fs/cgroup/unified/system.slice/filebeat.service/cgroup.controllers`
require { type cgroup_t; }
fs_read_cgroup_files(filebeat_t)
allow filebeat_t cgroup_t:dir read;

Expand Down
1 change: 1 addition & 0 deletions ic-os/components/selinux/ic-node/ic-node.te
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ allow ic_canister_sandbox_t ic_canister_mem_t : file { map read write getattr };
allow ic_replica_t ic_canister_mem_t : file { map read write getattr };

# Wants to read its own control group. Should deny that.
require { type cgroup_t; }
dontaudit ic_canister_sandbox_t cgroup_t : dir { search };
dontaudit ic_canister_sandbox_t cgroup_t : file { open read getattr };

Expand Down
6 changes: 3 additions & 3 deletions ic-os/components/selinux/manageboot/manageboot.te
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ application_domain(ic_manageboot_t, ic_manageboot_exec_t)
# write upgrades into partition). Allow entering sudo, and return
# to the original domain when sudo re-executes the script (so
# it is now running same domain, but with root privileges).
sudo_role_template(ic_manageboot, system_r, ic_manageboot_t)
sudo_role_template(ic_manageboot, ic_manageboot_t, ic_manageboot_exec_t, system_r)
domtrans_pattern(ic_manageboot_sudo_t, ic_manageboot_exec_t, ic_manageboot_t)
# Under certain circumstances, sudo signals its children.
allow ic_manageboot_sudo_t ic_manageboot_t : process { signal };
Expand Down Expand Up @@ -123,7 +123,7 @@ allow ic_manageboot_t ic_manageboot_t : unix_stream_socket { connect create geta
# Allow searching runtime process directories (/var/run which is symlinked to /run).
# It is not perfectly clear what/why it is doing that, but it is harmless
# enough. May to to forbid it and see if it still works.
files_search_pids(ic_manageboot_t)
files_search_runtime(ic_manageboot_t)

# Allow reading /opt/ic/share/version.txt
read_files_pattern(ic_manageboot_t, usr_t, usr_t)
read_files_pattern(ic_manageboot_t, usr_t, usr_t)
2 changes: 2 additions & 0 deletions ic-os/components/selinux/misc-fixes/misc-fixes.te
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ permissive unconfined_t;
require { type lvm_t; }

# Note that "cryptsetup" is also running as lvm_t.
require { type initrc_t; }
allow lvm_t initrc_t : sem rw_sem_perms;

# cryptsetup needs to create /run/cryptsetup: This is its lockfile directory to
# track which devices, which is the lockfile directory tracking devices on
Expand Down

0 comments on commit aae5593

Please sign in to comment.