ceph/selinux/ceph.te

164 lines
4.6 KiB
Plaintext
Raw Normal View History

policy_module(ceph, 1.1.1)
require {
type sysfs_t;
type configfs_t;
type commplex_main_port_t;
type http_cache_port_t;
type rpm_exec_t;
type rpm_var_lib_t;
type kernel_t;
type var_run_t;
type random_device_t;
type urandom_device_t;
type setfiles_t;
type nvme_device_t;
type targetd_etc_rw_t;
type amqp_port_t;
type soundd_port_t;
class sock_file unlink;
class tcp_socket name_connect_t;
class lnk_file { create getattr read unlink };
class dir { add_name create getattr open read remove_name rmdir search write };
selinux: Fix ceph-iscsi configfs access This fixes the the following selinux error when using ceph-iscsi's rbd-target-api daemon (rbd-target-gw has the same issue). They are a result of the a python library, rtslib, which the daemons use. Additional Information: Source Context system_u:system_r:ceph_t:s0 Target Context system_u:object_r:configfs_t:s0 Target Objects /sys/kernel/config/target/iscsi/iqn.2003-01.com.re dhat:ceph-iscsi/tpgt_1/attrib/authentication [ file ] Source rbd-target-api Source Path /usr/libexec/platform-python3.6 Port <Unknown> Host ans8 Source RPM Packages platform-python-3.6.8-15.1.el8.x86_64 Target RPM Packages Policy RPM selinux-policy-3.14.3-20.el8.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name ans8 Platform Linux ans8 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 Alert Count 1 First Seen 2020-01-08 18:39:47 EST Last Seen 2020-01-08 18:39:47 EST Local ID 6f8c3415-7a50-4dc8-b3d2-2621e1d00ca3 Raw Audit Messages type=AVC msg=audit(1578526787.577:68): avc: denied { ioctl } for pid=995 comm="rbd-target-api" path="/sys/kernel/config/target/iscsi/iqn.2003-01.com.redhat:ceph-iscsi/tpgt_1/attrib/authentication" dev="configfs" ino=25703 ioctlcmd=0x5401 scontext=system_u:system_r:ceph_t:s0 tcontext=system_u:object_r:configfs_t:s0 tclass=file permissive=1 type=SYSCALL msg=audit(1578526787.577:68): arch=x86_64 syscall=ioctl success=no exit=ENOTTY a0=34 a1=5401 a2=7ffd4f8f1f60 a3=3052cd2d95839b96 items=0 ppid=1 pid=995 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=rbd-target-api exe=/usr/libexec/platform-python3.6 subj=system_u:system_r:ceph_t:s0 key=(null) Hash: rbd-target-api,ceph_t,configfs_t,file,ioctl Signed-off-by: Mike Christie <mchristi@redhat.com>
2020-01-09 00:03:40 +00:00
class file { create getattr open read rename unlink write ioctl };
class blk_file { getattr ioctl open read write };
class capability2 block_suspend;
class process2 { nnp_transition nosuid_transition };
}
########################################
#
# Declarations
#
type ceph_t;
type ceph_exec_t;
init_daemon_domain(ceph_t, ceph_exec_t)
ceph_exec(ceph_t)
permissive ceph_t;
type ceph_initrc_exec_t;
init_script_file(ceph_initrc_exec_t)
type ceph_log_t;
logging_log_file(ceph_log_t)
type ceph_var_lib_t;
files_type(ceph_var_lib_t)
type ceph_var_run_t;
files_pid_file(ceph_var_run_t)
########################################
#
# ceph local policy
#
allow ceph_t self:process { signal_perms };
allow ceph_t self:fifo_file rw_fifo_file_perms;
allow ceph_t self:unix_stream_socket create_stream_socket_perms;
allow ceph_t self:capability { setuid setgid dac_override dac_read_search };
allow ceph_t self:capability2 block_suspend;
manage_dirs_pattern(ceph_t, ceph_log_t, ceph_log_t)
manage_files_pattern(ceph_t, ceph_log_t, ceph_log_t)
manage_lnk_files_pattern(ceph_t, ceph_log_t, ceph_log_t)
manage_dirs_pattern(ceph_t, ceph_var_lib_t, ceph_var_lib_t)
manage_files_pattern(ceph_t, ceph_var_lib_t, ceph_var_lib_t)
manage_lnk_files_pattern(ceph_t, ceph_var_lib_t, ceph_var_lib_t)
manage_dirs_pattern(ceph_t, ceph_var_run_t, ceph_var_run_t)
manage_files_pattern(ceph_t, ceph_var_run_t, ceph_var_run_t)
manage_lnk_files_pattern(ceph_t, ceph_var_run_t, ceph_var_run_t)
kernel_read_system_state(ceph_t)
kernel_read_network_state(ceph_t)
allow ceph_t kernel_t:system module_request;
corenet_all_recvfrom_unlabeled(ceph_t)
corenet_all_recvfrom_netlabel(ceph_t)
corenet_udp_sendrecv_generic_if(ceph_t)
corenet_udp_sendrecv_generic_node(ceph_t)
corenet_udp_bind_generic_node(ceph_t)
corenet_tcp_bind_generic_node(ceph_t)
corenet_sendrecv_cyphesis_server_packets(ceph_t)
corenet_tcp_bind_cyphesis_port(ceph_t)
corenet_tcp_sendrecv_cyphesis_port(ceph_t)
allow ceph_t commplex_main_port_t:tcp_socket name_connect;
allow ceph_t http_cache_port_t:tcp_socket name_connect;
allow ceph_t amqp_port_t:tcp_socket name_connect;
allow ceph_t soundd_port_t:tcp_socket name_connect;
corecmd_exec_bin(ceph_t)
corecmd_exec_shell(ceph_t)
allow ceph_t rpm_exec_t:file getattr;
allow ceph_t rpm_var_lib_t:dir { add_name write };
allow ceph_t rpm_var_lib_t:file { create open };
dev_read_urand(ceph_t)
domain_read_all_domains_state(ceph_t)
fs_getattr_all_fs(ceph_t)
auth_use_nsswitch(ceph_t)
logging_send_syslog_msg(ceph_t)
sysnet_dns_name_resolve(ceph_t)
udev_read_db(ceph_t)
allow ceph_t nvme_device_t:blk_file { getattr ioctl open read write };
# basis for future security review
allow ceph_t ceph_var_run_t:sock_file { create unlink write setattr };
allow ceph_t self:capability { sys_rawio chown };
allow ceph_t self:tcp_socket { accept listen };
corenet_tcp_connect_cyphesis_port(ceph_t)
corenet_tcp_connect_generic_port(ceph_t)
files_list_tmp(ceph_t)
files_manage_generic_tmp_files(ceph_t)
fstools_exec(ceph_t)
nis_use_ypbind_uncond(ceph_t)
storage_raw_rw_fixed_disk(ceph_t)
files_manage_generic_locks(ceph_t)
libs_exec_ldconfig(ceph_t)
fs_list_hugetlbfs(ceph_t)
fs_list_tmpfs(ceph_t)
fs_read_cgroup_files(ceph_t)
fs_read_tmpfs_symlinks(ceph_t)
fs_search_cgroup_dirs(ceph_t)
ceph_read_lib_files(init_t)
allow ceph_t sysfs_t:dir read;
allow ceph_t sysfs_t:file { read getattr open };
allow ceph_t sysfs_t:lnk_file { read getattr };
allow ceph_t configfs_t:dir { add_name create getattr open read remove_name rmdir search write };
selinux: Fix ceph-iscsi configfs access This fixes the the following selinux error when using ceph-iscsi's rbd-target-api daemon (rbd-target-gw has the same issue). They are a result of the a python library, rtslib, which the daemons use. Additional Information: Source Context system_u:system_r:ceph_t:s0 Target Context system_u:object_r:configfs_t:s0 Target Objects /sys/kernel/config/target/iscsi/iqn.2003-01.com.re dhat:ceph-iscsi/tpgt_1/attrib/authentication [ file ] Source rbd-target-api Source Path /usr/libexec/platform-python3.6 Port <Unknown> Host ans8 Source RPM Packages platform-python-3.6.8-15.1.el8.x86_64 Target RPM Packages Policy RPM selinux-policy-3.14.3-20.el8.noarch Selinux Enabled True Policy Type targeted Enforcing Mode Enforcing Host Name ans8 Platform Linux ans8 4.18.0-147.el8.x86_64 #1 SMP Thu Sep 26 15:52:44 UTC 2019 x86_64 x86_64 Alert Count 1 First Seen 2020-01-08 18:39:47 EST Last Seen 2020-01-08 18:39:47 EST Local ID 6f8c3415-7a50-4dc8-b3d2-2621e1d00ca3 Raw Audit Messages type=AVC msg=audit(1578526787.577:68): avc: denied { ioctl } for pid=995 comm="rbd-target-api" path="/sys/kernel/config/target/iscsi/iqn.2003-01.com.redhat:ceph-iscsi/tpgt_1/attrib/authentication" dev="configfs" ino=25703 ioctlcmd=0x5401 scontext=system_u:system_r:ceph_t:s0 tcontext=system_u:object_r:configfs_t:s0 tclass=file permissive=1 type=SYSCALL msg=audit(1578526787.577:68): arch=x86_64 syscall=ioctl success=no exit=ENOTTY a0=34 a1=5401 a2=7ffd4f8f1f60 a3=3052cd2d95839b96 items=0 ppid=1 pid=995 auid=4294967295 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=(none) ses=4294967295 comm=rbd-target-api exe=/usr/libexec/platform-python3.6 subj=system_u:system_r:ceph_t:s0 key=(null) Hash: rbd-target-api,ceph_t,configfs_t,file,ioctl Signed-off-by: Mike Christie <mchristi@redhat.com>
2020-01-09 00:03:40 +00:00
allow ceph_t configfs_t:file { getattr open read write ioctl };
allow ceph_t configfs_t:lnk_file { create getattr read unlink };
allow ceph_t random_device_t:chr_file getattr;
allow ceph_t urandom_device_t:chr_file getattr;
allow ceph_t self:process setpgid;
allow ceph_t self:process setsched;
allow ceph_t var_run_t:dir { write create add_name };
allow ceph_t var_run_t:file { read write create open getattr };
allow ceph_t init_var_run_t:file getattr;
allow init_t ceph_t:process2 { nnp_transition nosuid_transition };
allow ceph_t targetd_etc_rw_t:dir { getattr search };
fsadm_manage_pid(ceph_t)
#============= setfiles_t ==============
allow setfiles_t ceph_var_lib_t:file write;