diff --git a/refpolicy/Changelog b/refpolicy/Changelog index f5387ab..74dcdcc 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -2,6 +2,7 @@ build phase instead of during the generation phase. - DISTRO=redhat now implies DIRECT_INITRC=y. - Added policies: + canna cyrus dovecot distcc diff --git a/refpolicy/policy/modules/services/canna.fc b/refpolicy/policy/modules/services/canna.fc new file mode 100644 index 0000000..14c323c --- /dev/null +++ b/refpolicy/policy/modules/services/canna.fc @@ -0,0 +1,22 @@ + +# +# /usr +# +/usr/bin/cannaping -- gen_context(system_u:object_r:canna_exec_t,s0) +/usr/bin/catdic -- gen_context(system_u:object_r:canna_exec_t,s0) + +/usr/sbin/cannaserver -- gen_context(system_u:object_r:canna_exec_t,s0) +/usr/sbin/jserver -- gen_context(system_u:object_r:canna_exec_t,s0) + +# +# /var +# +/var/lib/canna/dic(/.*)? gen_context(system_u:object_r:canna_var_lib_t,s0) +/var/lib/wnn/dic(/.*)? gen_context(system_u:object_r:canna_var_lib_t,s0) + +/var/log/canna(/.*)? gen_context(system_u:object_r:canna_log_t,s0) +/var/log/wnn(/.*)? gen_context(system_u:object_r:canna_log_t,s0) + +/var/run/\.iroha_unix -d gen_context(system_u:object_r:canna_var_run_t,s0) +/var/run/\.iroha_unix/.* -s gen_context(system_u:object_r:canna_var_run_t,s0) +/var/run/wnn-unix(/.*) gen_context(system_u:object_r:canna_var_run_t,s0) diff --git a/refpolicy/policy/modules/services/canna.if b/refpolicy/policy/modules/services/canna.if new file mode 100644 index 0000000..ee1e298 --- /dev/null +++ b/refpolicy/policy/modules/services/canna.if @@ -0,0 +1,20 @@ +## Canna - kana-kanji conversion server + +######################################## +## +## Connect to Canna using a unix domain stream socket. +## +## +## Domain allowed access. +## +# +interface(`canna_stream_connect',` + gen_require(` + type canna_t, canna_var_run_t; + ') + + files_search_pids($1) + allow $1 canna_var_run_t:dir search; + allow $1 canna_var_run_t:sock_file write; + allow $1 canna_t:unix_stream_socket connectto; +') diff --git a/refpolicy/policy/modules/services/canna.te b/refpolicy/policy/modules/services/canna.te new file mode 100644 index 0000000..62e42d2 --- /dev/null +++ b/refpolicy/policy/modules/services/canna.te @@ -0,0 +1,116 @@ + + +policy_module(canna,1.0) + +######################################## +# +# Declarations +# + +type canna_t; +type canna_exec_t; +init_daemon_domain(canna_t,canna_exec_t) + +type canna_log_t; +logging_log_file(canna_log_t) + +type canna_var_lib_t; +files_type(canna_var_lib_t) + +type canna_var_run_t; +files_pid_file(canna_var_run_t) + +######################################## +# +# Local policy +# + +allow canna_t self:capability { setgid setuid }; +dontaudit canna_t self:capability sys_tty_config; +allow canna_t self:process signal_perms; +allow canna_t self:unix_stream_socket { connectto create_stream_socket_perms}; +allow canna_t self:unix_dgram_socket create_stream_socket_perms; +allow canna_t self:tcp_socket create_stream_socket_perms; + +allow canna_t canna_log_t:file create_file_perms; +allow canna_t canna_log_t:dir rw_dir_perms; +logging_create_log(canna_t,canna_log_t,{ file dir }) + +allow canna_t canna_var_lib_t:dir create_dir_perms; +allow canna_t canna_var_lib_t:file create_file_perms; +allow canna_t canna_var_lib_t:lnk_file create_lnk_perms; +files_create_var_lib(canna_t,canna_var_lib_t) + +allow canna_t canna_var_run_t:dir rw_dir_perms; +allow canna_t canna_var_run_t:file create_file_perms; +allow canna_t canna_var_run_t:sock_file create_file_perms; +files_create_pid(canna_t, canna_var_run_t, { file sock_file }) + +kernel_read_kernel_sysctl(canna_t) +kernel_read_system_state(canna_t) +kernel_dontaudit_use_fd(canna_t) + +corenet_tcp_sendrecv_all_if(canna_t) +corenet_raw_sendrecv_all_if(canna_t) +corenet_tcp_sendrecv_all_nodes(canna_t) +corenet_raw_sendrecv_all_nodes(canna_t) +corenet_tcp_bind_all_nodes(canna_t) +corenet_tcp_connect_all_ports(canna_t) + +dev_read_sysfs(canna_t) + +fs_getattr_all_fs(canna_t) +fs_search_auto_mountpoints(canna_t) + +term_dontaudit_use_console(canna_t) + +domain_use_wide_inherit_fd(canna_t) + +files_read_etc_files(canna_t) +files_read_etc_runtime_files(canna_t) +files_read_usr_files(canna_t) +files_search_tmp(canna_t) +files_dontaudit_read_root_file(canna_t) + +init_use_fd(canna_t) +init_use_script_pty(canna_t) + +libs_use_ld_so(canna_t) +libs_use_shared_libs(canna_t) + +logging_send_syslog_msg(canna_t) + +miscfiles_read_localization(canna_t) + +sysnet_read_config(canna_t) + +userdom_dontaudit_use_unpriv_user_fd(canna_t) +userdom_dontaudit_search_sysadm_home_dir(canna_t) + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_tty(canna_t) + term_dontaudit_use_generic_pty(canna_t) + files_dontaudit_read_root_file(canna_t) +') + +optional_policy(`nis.te',` + nis_use_ypbind(canna_t) +') + +optional_policy(`selinuxutil.te',` + seutil_sigchld_newrole(canna_t) +') + +optional_policy(`udev.te',` + udev_read_db(canna_t) +') + +ifdef(`TODO',` +optional_policy(`rhgb.te',` + rhgb_domain(canna_t) +') + +optional_policy(`canna.te',` + canna_stream_connect(i18n_input_t) +') +') diff --git a/refpolicy/policy/modules/system/userdomain.if b/refpolicy/policy/modules/system/userdomain.if index 740867d..0183c29 100644 --- a/refpolicy/policy/modules/system/userdomain.if +++ b/refpolicy/policy/modules/system/userdomain.if @@ -304,6 +304,10 @@ template(`base_user_template',` term_getattr_all_user_ttys($1_t) ') + optional_policy(`canna.te',` + canna_stream_connect($1_t) + ') + optional_policy(`dbus.te',` dbus_system_bus_client_template($1,$1_t) ')