From 8d9352340942286dd52f6beba48518ed50552d17 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Sep 06 2005 18:37:27 +0000 Subject: add inn --- diff --git a/refpolicy/Changelog b/refpolicy/Changelog index 097ef49..d4323a2 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -7,6 +7,7 @@ dhcp dictd hal + inn ntp squid diff --git a/refpolicy/policy/modules/services/inn.fc b/refpolicy/policy/modules/services/inn.fc new file mode 100644 index 0000000..ffd00f9 --- /dev/null +++ b/refpolicy/policy/modules/services/inn.fc @@ -0,0 +1,61 @@ + +# +# /etc +# +/etc/news(/.*)? context_template(system_u:object_r:innd_etc_t,s0) +/etc/news/boot -- context_template(system_u:object_r:innd_exec_t,s0) + +# +# /usr +# +/usr/bin/inews -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/bin/rnews -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/bin/rpost -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/bin/suck -- context_template(system_u:object_r:innd_exec_t,s0) + +/usr/sbin/in\.nnrpd -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/sbin/innd.* -- context_template(system_u:object_r:innd_exec_t,s0) + +/var/lib/news(/.*)? context_template(system_u:object_r:innd_var_lib_t,s0) + +/usr/lib(64)?/news/bin/innd -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/actsync -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/archive -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/batcher -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/buffchan -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/convdate -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/ctlinnd -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/cvtbatch -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/expire -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/expireover -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/fastrm -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/filechan -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/getlist -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/grephistory -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/inews -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/innconfval -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/inndf -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/inndstart -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/innfeed -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/innxbatch -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/innxmit -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/makedbz -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/makehistory -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/newsrequeue -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/nnrpd -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/nntpget -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/ovdb_recover -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/overchan -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/prunehistory -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/rnews -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/shlock -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/shrinkfile -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/sm -- context_template(system_u:object_r:innd_exec_t,s0) +/usr/lib(64)?/news/bin/startinnfeed -- context_template(system_u:object_r:innd_exec_t,s0) + +/var/log/news(/.*)? context_template(system_u:object_r:innd_log_t,s0) + +/var/run/innd(/.*)? context_template(system_u:object_r:innd_var_run_t,s0) +/var/run/news(/.*)? context_template(system_u:object_r:innd_var_run_t,s0) + +/var/spool/news(/.*)? context_template(system_u:object_r:news_spool_t,s0) diff --git a/refpolicy/policy/modules/services/inn.if b/refpolicy/policy/modules/services/inn.if new file mode 100644 index 0000000..e165690 --- /dev/null +++ b/refpolicy/policy/modules/services/inn.if @@ -0,0 +1,155 @@ +## Internet News NNTP server + +######################################## +## +## Allow the specified domain to execute innd +## in the caller domain. +## +## +## Domain allowed access. +## +# +interface(`inn_exec',` + gen_require(` + type innd_t; + ') + + can_exec($1,innd_t) +') + +######################################## +## +## Allow the specified domain to execute +## inn configuration files in /etc. +## +## +## Domain allowed access. +## +# +interface(`inn_exec_config',` + gen_require(` + type innd_etc_t; + ') + + can_exec($1,innd_etc_t) +') + +######################################## +## +## Create, read, write, and delete the innd log. +## +## +## Domain allowed access. +## +# +interface(`inn_manage_log',` + gen_require(` + type innd_log_t; + class file create_file_perms; + ') + + logging_rw_log_dir($1) + allow $1 innd_log_t:dir search; + allow $1 innd_log_t:file create_file_perms; +') + +######################################## +## +## Create, read, write, and delete the innd pid files. +## +## +## Domain allowed access. +## +# +interface(`inn_manage_pid',` + gen_require(` + type innd_var_run_t; + class dir rw_dir_perms; + class file create_file_perms; + ') + + files_search_pids($1) + allow $1 innd_var_run_t:dir rw_dir_perms; + allow $1 innd_var_run_t:file create_file_perms; + allow $1 innd_var_run_t:lnk_file create_lnk_perms; +') + +######################################## +## +## Read innd configuration files. +## +## +## Domain allowed access. +## +# +interface(`inn_read_config',` + gen_require(` + type innd_etc_t; + class dir { getattr read search }; + class file { read getattr }; + class lnk_file { getattr read }; + ') + + allow $1 innd_etc_t:dir { getattr read search }; + allow $1 innd_etc_t:file { read getattr }; + allow $1 innd_etc_t:lnk_file { getattr read }; +') + +######################################## +## +## Read innd news library files. +## +## +## Domain allowed access. +## +# +interface(`inn_read_news_lib',` + gen_require(` + type innd_var_lib_t; + class dir { getattr read search }; + class file { read getattr }; + class lnk_file { getattr read }; + ') + + allow $1 innd_var_lib_t:dir { getattr read search }; + allow $1 innd_var_lib_t:file { read getattr }; + allow $1 innd_var_lib_t:lnk_file { getattr read }; +') + +######################################## +## +## Read innd news library files. +## +## +## Domain allowed access. +## +# +interface(`inn_read_news_spool',` + gen_require(` + type news_spool_t; + class dir { getattr read search }; + class file { read getattr }; + class lnk_file { getattr read }; + ') + + allow $1 news_spool_t:dir { getattr read search }; + allow $1 news_spool_t:file { read getattr }; + allow $1 news_spool_t:lnk_file { getattr read }; +') + +######################################## +## +## Send to a innd unix dgram socket. +## +## +## Domain allowed access. +## +# +interface(`inn_sendto_unix_dgram_socket',` + gen_require(` + type innd_t; + class unix_dgram_socket sendto; + ') + + allow $1 innd_t:unix_dgram_socket sendto; +') diff --git a/refpolicy/policy/modules/services/inn.te b/refpolicy/policy/modules/services/inn.te new file mode 100644 index 0000000..475788c --- /dev/null +++ b/refpolicy/policy/modules/services/inn.te @@ -0,0 +1,150 @@ + +policy_module(inn,1.0) + +######################################## +# +# Declarations +# +type innd_t; +type innd_exec_t; +init_daemon_domain(innd_t,innd_exec_t) + +type innd_etc_t; #, usercanread; +files_type(innd_etc_t) + +type innd_log_t; +logging_log_file(innd_log_t) + +type innd_var_lib_t; +files_type(innd_var_lib_t) + +type innd_var_run_t; +files_pid_file(innd_var_run_t) + +type news_spool_t; +files_type(news_spool_t) + +######################################## +# +# Local policy +# +allow innd_t self:capability { dac_override kill setgid setuid }; +dontaudit innd_t self:capability sys_tty_config; +allow innd_t self:process setsched; +allow innd_t self:fifo_file rw_file_perms; +allow innd_t self:tcp_socket create_stream_socket_perms; +allow innd_t self:udp_socket create_socket_perms; +allow innd_t self:unix_dgram_socket create_socket_perms; +allow innd_t self:unix_stream_socket { connectto create_stream_socket_perms }; + +allow innd_t innd_etc_t:file r_file_perms; +allow innd_t innd_etc_t:dir r_dir_perms; +allow innd_t innd_etc_t:lnk_file { getattr read }; + +can_exec(innd_t, innd_exec_t) + +allow innd_t innd_log_t:file { create ra_file_perms }; +allow innd_t innd_log_t:dir { setattr ra_dir_perms }; +logging_create_log(innd_t,innd_log_t) + +allow innd_t innd_var_lib_t:dir create_dir_perms; +allow innd_t innd_var_lib_t:file create_file_perms; +files_create_var_lib(innd_t,innd_var_lib_t) + +allow innd_t innd_var_run_t:dir create_dir_perms; +allow innd_t innd_var_run_t:file create_file_perms; +allow innd_t innd_var_run_t:sock_file create_file_perms; +files_create_pid(innd_t,innd_var_run_t) + +allow innd_t news_spool_t:dir create_dir_perms; +allow innd_t news_spool_t:file create_file_perms; +allow innd_t news_spool_t:lnk_file create_lnk_perms; + +kernel_read_kernel_sysctl(innd_t) +kernel_read_system_state(innd_t) + +corenet_raw_sendrecv_all_if(innd_t) +corenet_tcp_sendrecv_all_if(innd_t) +corenet_udp_sendrecv_all_if(innd_t) +corenet_raw_sendrecv_all_nodes(innd_t) +corenet_tcp_sendrecv_all_nodes(innd_t) +corenet_udp_sendrecv_all_nodes(innd_t) +corenet_tcp_sendrecv_all_ports(innd_t) +corenet_udp_sendrecv_all_ports(innd_t) +corenet_tcp_bind_all_nodes(innd_t) +corenet_udp_bind_all_nodes(innd_t) +corenet_tcp_bind_innd_port(innd_t) + +dev_read_sysfs(innd_t) +dev_read_urand(innd_t) + +fs_getattr_all_fs(innd_t) +fs_search_auto_mountpoints(innd_t) + +term_dontaudit_use_console(innd_t) + +corecmd_exec_bin(innd_t) +corecmd_exec_shell(innd_t) + +domain_use_wide_inherit_fd(innd_t) + +files_list_spool(innd_t) +files_read_etc_files(innd_t) +files_read_etc_runtime_files(innd_t) +files_read_usr_files(innd_t) + +init_use_fd(innd_t) +init_use_script_pty(innd_t) + +libs_use_ld_so(innd_t) +libs_use_shared_libs(innd_t) + +logging_send_syslog_msg(innd_t) + +miscfiles_read_localization(innd_t) + +seutil_dontaudit_search_config(innd_t) + +sysnet_read_config(innd_t) + +userdom_dontaudit_use_unpriv_user_fd(innd_t) +userdom_dontaudit_search_sysadm_home_dir(innd_t) + +mta_send_mail(innd_t) + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_tty(innd_t) + term_dontaudit_use_generic_pty(innd_t) + files_dontaudit_read_root_file(innd_t) +') + +optional_policy(`cron.te',` + cron_system_entry(innd_t, innd_exec_t) +') + +optional_policy(`hostname.te',` + hostname_exec(innd_t) +') + +optional_policy(`mount.te',` + mount_send_nfs_client_request(innd_t) +') + +optional_policy(`nis.te',` + nis_use_ypbind(innd_t) +') + +optional_policy(`selinuxutil.te',` + seutil_sigchld_newrole(innd_t) +') + +optional_policy(`udev.te',` + udev_read_db(innd_t) +') + +ifdef(`TODO',` +optional_policy(`rhgb.te',` + rhgb_domain(innd_t) +') +allow innd_t sysadm_t:unix_dgram_socket sendto; +') diff --git a/refpolicy/policy/modules/system/corecommands.fc b/refpolicy/policy/modules/system/corecommands.fc index 78e9755..7a47a58 100644 --- a/refpolicy/policy/modules/system/corecommands.fc +++ b/refpolicy/policy/modules/system/corecommands.fc @@ -70,7 +70,9 @@ ifdef(`distro_gentoo', ` /usr/lib(64)?/ipsec/.* -- context_template(system_u:object_r:sbin_t,s0) -/usr/lib(64)?/misc/sftp-server -- context_template(system_u:object_r:bin_t,s0) +/usr/lib(64)?/misc/sftp-server -- context_template(system_u:object_r:bin_t,s0) + +/usr/lib(64)?/news/bin(/.*)? context_template(system_u:object_r:bin_t,s0) ifdef(`distro_suse', ` /usr/lib(64)?/ssh/.* -- context_template(system_u:object_r:bin_t,s0)