add content
This commit is contained in:
10
sec-policy/selinux-knot/files/knot.fc
Normal file
10
sec-policy/selinux-knot/files/knot.fc
Normal file
@@ -0,0 +1,10 @@
|
||||
/usr/sbin/knotd -- gen_context(system_u:object_r:knotd_exec_t,s0)
|
||||
|
||||
/usr/sbin/knotc -- gen_context(system_u:object_r:knotc_exec_t,s0)
|
||||
|
||||
/var/run/knot(/.*)? gen_context(system_u:object_r:knot_var_run_t,s0)
|
||||
|
||||
/var/lib/knot(/.*)? gen_context(system_u:object_r:knot_var_lib_t,s0)
|
||||
|
||||
/etc/knot(/.*)? gen_context(system_u:object_r:knot_etc_t,s0)
|
||||
|
||||
198
sec-policy/selinux-knot/files/knot.if
Normal file
198
sec-policy/selinux-knot/files/knot.if
Normal file
@@ -0,0 +1,198 @@
|
||||
|
||||
## <summary>policy for knotc</summary>
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Execute knotd_exec_t in the knotd domain.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed to transition.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knotd_domtrans',`
|
||||
gen_require(`
|
||||
type knotd_t, knotd_exec_t;
|
||||
')
|
||||
|
||||
corecmd_search_bin($1)
|
||||
domtrans_pattern($1, knotd_exec_t, knotd_t)
|
||||
')
|
||||
|
||||
######################################
|
||||
## <summary>
|
||||
## Execute knotd in the caller domain.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed access.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knotd_exec',`
|
||||
gen_require(`
|
||||
type knotd_exec_t;
|
||||
')
|
||||
|
||||
corecmd_search_bin($1)
|
||||
can_exec($1, knotd_exec_t)
|
||||
')
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Knotd /run files transitions.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed access.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knot_var_run_trans',`
|
||||
gen_require(`
|
||||
type knot_var_run_t;
|
||||
type var_run_t;
|
||||
type tmpfiles_t;
|
||||
')
|
||||
|
||||
manage_dirs_pattern($1, knot_var_run_t, knot_var_run_t)
|
||||
manage_files_pattern($1, knot_var_run_t, knot_var_run_t)
|
||||
manage_lnk_files_pattern($1, knot_var_run_t, knot_var_run_t)
|
||||
manage_sock_files_pattern($1, knot_var_run_t, knot_var_run_t)
|
||||
search_dirs_pattern($1, knot_var_run_t, knot_var_run_t)
|
||||
files_pid_filetrans($1, knot_var_run_t, { file dir sock_file})
|
||||
filetrans_pattern(tmpfiles_t, var_run_t, knot_var_run_t, dir, "knot")
|
||||
')
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Knot /var/lib files mamange.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed access.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knot_var_lib_manage',`
|
||||
gen_require(`
|
||||
type knot_var_lib_t;
|
||||
')
|
||||
|
||||
manage_dirs_pattern($1, knot_var_lib_t, knot_var_lib_t)
|
||||
manage_files_pattern($1, knot_var_lib_t, knot_var_lib_t)
|
||||
manage_lnk_files_pattern($1, knot_var_lib_t, knot_var_lib_t)
|
||||
allow $1 knot_var_lib_t:file map;
|
||||
files_var_lib_filetrans($1, knot_var_lib_t, { file dir })
|
||||
')
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Knotd /var/lib files transitions.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed access.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knot_var_lib_trans',`
|
||||
gen_require(`
|
||||
type knot_var_lib_t;
|
||||
type var_lib_t;
|
||||
type tmpfiles_t;
|
||||
')
|
||||
|
||||
knot_var_lib_manage($1)
|
||||
filetrans_pattern(tmpfiles_t, var_lib_t, knot_var_lib_t, dir, "knot")
|
||||
')
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Knot /etc/knot files read.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed access.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knot_etc_t_read',`
|
||||
gen_require(`
|
||||
type knot_etc_t;
|
||||
type initrc_t;
|
||||
')
|
||||
|
||||
mmap_read_files_pattern($1, knot_etc_t, knot_etc_t)
|
||||
read_files_pattern(initrc_t, knot_etc_t, knot_etc_t)
|
||||
')
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Knot /tmp files transitions.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed access.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knot_tmp_trans',`
|
||||
gen_require(`
|
||||
type knot_tmp_t;
|
||||
')
|
||||
|
||||
files_tmp_filetrans($1, knot_tmp_t, { file dir })
|
||||
allow $1 knot_tmp_t:file map;
|
||||
allow $1 knot_tmp_t:file manage_file_perms;
|
||||
allow $1 knot_tmp_t:dir manage_dir_perms;
|
||||
')
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Execute knotc_exec_t in the knotc domain.
|
||||
## </summary>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## Domain allowed to transition.
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knotc_domtrans',`
|
||||
gen_require(`
|
||||
type knotc_t, knotc_exec_t;
|
||||
')
|
||||
|
||||
corecmd_search_bin($1)
|
||||
domtrans_pattern($1, knotc_exec_t, knotc_t)
|
||||
')
|
||||
|
||||
########################################
|
||||
## <summary>
|
||||
## Role access for knotc
|
||||
## </summary>
|
||||
## <param name="role">
|
||||
## <summary>
|
||||
## Role allowed access
|
||||
## </summary>
|
||||
## </param>
|
||||
## <param name="domain">
|
||||
## <summary>
|
||||
## User domain for the role
|
||||
## </summary>
|
||||
## </param>
|
||||
#
|
||||
interface(`knotc_role',`
|
||||
gen_require(`
|
||||
type knotc_t;
|
||||
attribute_role knotc_roles;
|
||||
')
|
||||
|
||||
roleattribute $1 knotc_roles;
|
||||
|
||||
knotc_domtrans($2)
|
||||
|
||||
ps_process_pattern($2, knotc_t)
|
||||
allow $2 knotc_t:process { signull signal sigkill };
|
||||
')
|
||||
95
sec-policy/selinux-knot/files/knot.te
Normal file
95
sec-policy/selinux-knot/files/knot.te
Normal file
@@ -0,0 +1,95 @@
|
||||
policy_module(knot, 1.0.0)
|
||||
|
||||
########################################
|
||||
#
|
||||
# Declarations
|
||||
#
|
||||
|
||||
type knotd_t;
|
||||
type knotd_exec_t;
|
||||
init_daemon_domain(knotd_t, knotd_exec_t)
|
||||
|
||||
type knotc_t;
|
||||
type knotc_exec_t;
|
||||
application_domain(knotc_t, knotc_exec_t)
|
||||
init_daemon_domain(knotc_t, knotc_exec_t)
|
||||
role knotc_roles types knotc_t;
|
||||
|
||||
attribute_role knotc_roles;
|
||||
roleattribute system_r knotc_roles;
|
||||
|
||||
type knot_etc_t;
|
||||
files_type(knot_etc_t)
|
||||
|
||||
type knot_var_run_t;
|
||||
files_pid_file(knot_var_run_t)
|
||||
|
||||
type knot_var_lib_t;
|
||||
files_type(knot_var_lib_t)
|
||||
|
||||
type knot_tmp_t;
|
||||
files_tmp_file(knot_tmp_t)
|
||||
|
||||
########################################
|
||||
#
|
||||
# knotd local policy
|
||||
#
|
||||
allow knotd_t self:capability { setgid setuid dac_read_search };
|
||||
allow knotd_t self:process { fork signal_perms getcap getsched setsched };
|
||||
allow knotd_t self:tcp_socket create_stream_socket_perms;
|
||||
allow knotd_t self:udp_socket create_stream_socket_perms;
|
||||
allow knotd_t self:unix_stream_socket { listen accept };
|
||||
|
||||
corenet_tcp_bind_generic_node(knotd_t)
|
||||
corenet_udp_bind_generic_node(knotd_t)
|
||||
corenet_tcp_bind_dns_port(knotd_t)
|
||||
corenet_udp_bind_dns_port(knotd_t)
|
||||
|
||||
knot_etc_t_read(knotd_t)
|
||||
knot_var_run_trans(knotd_t)
|
||||
knot_var_lib_trans(knotd_t)
|
||||
knot_tmp_trans(knotd_t)
|
||||
|
||||
kernel_read_kernel_sysctls(knotd_t)
|
||||
|
||||
fs_getattr_xattr_fs(knotd_t)
|
||||
fs_dontaudit_getattr_tmpfs(knotd_t)
|
||||
|
||||
files_read_etc_files(knotd_t)
|
||||
|
||||
auth_use_nsswitch(knotd_t)
|
||||
|
||||
logging_send_syslog_msg(knotd_t)
|
||||
|
||||
miscfiles_read_localization(knotd_t)
|
||||
|
||||
########################################
|
||||
#
|
||||
# knotc local policy
|
||||
#
|
||||
|
||||
allow knotc_t self:capability { dac_override dac_read_search };
|
||||
allow knotc_t knotd_t:unix_stream_socket connectto;
|
||||
allow knotc_t knot_var_run_t:dir search;
|
||||
allow knotc_t knot_var_run_t:sock_file write_sock_file_perms;
|
||||
|
||||
knot_etc_t_read(knotc_t)
|
||||
knot_tmp_trans(knotc_t)
|
||||
knot_var_lib_manage(knotc_t)
|
||||
|
||||
fs_dontaudit_getattr_tmpfs(knotc_t)
|
||||
files_dontaudit_search_var_lib(knotc_t)
|
||||
|
||||
domain_use_interactive_fds(knotc_t)
|
||||
userdom_use_user_ptys(knotc_t)
|
||||
|
||||
miscfiles_read_localization(knotc_t)
|
||||
|
||||
optional_policy(`
|
||||
gen_require(`
|
||||
type sysadm_t;
|
||||
role sysadm_r;
|
||||
')
|
||||
|
||||
knotc_role(sysadm_r, sysadm_t)
|
||||
')
|
||||
Reference in New Issue
Block a user