From a478b5edae69ef9efae865e0ed122fe3866c4130 Mon Sep 17 00:00:00 2001 From: Chris PeBenito Date: Wed, 5 Apr 2006 20:27:25 +0000 Subject: [PATCH] add nessus, bug 1532 --- refpolicy/Changelog | 1 + refpolicy/policy/modules/services/nessus.fc | 10 ++ refpolicy/policy/modules/services/nessus.if | 21 +++ refpolicy/policy/modules/services/nessus.te | 121 ++++++++++++++++++ refpolicy/policy/modules/system/userdomain.if | 4 + refpolicy/policy/modules/system/userdomain.te | 2 +- 6 files changed, 158 insertions(+), 1 deletion(-) create mode 100644 refpolicy/policy/modules/services/nessus.fc create mode 100644 refpolicy/policy/modules/services/nessus.if create mode 100644 refpolicy/policy/modules/services/nessus.te diff --git a/refpolicy/Changelog b/refpolicy/Changelog index aa38ecc36..7df1baabb 100644 --- a/refpolicy/Changelog +++ b/refpolicy/Changelog @@ -40,6 +40,7 @@ games mozilla mplayer + nessus postgrey pxe qmail (Petre Rodan) diff --git a/refpolicy/policy/modules/services/nessus.fc b/refpolicy/policy/modules/services/nessus.fc new file mode 100644 index 000000000..74da57f8e --- /dev/null +++ b/refpolicy/policy/modules/services/nessus.fc @@ -0,0 +1,10 @@ + +/etc/nessus/nessusd\.conf -- gen_context(system_u:object_r:nessusd_etc_t,s0) + +/usr/lib(64)?/nessus/plugins/.* -- gen_context(system_u:object_r:nessusd_exec_t,s0) + +/usr/sbin/nessusd -- gen_context(system_u:object_r:nessusd_exec_t,s0) + +/var/lib/nessus(/.*)? gen_context(system_u:object_r:nessusd_db_t,s0) + +/var/log/nessus(/.*)? gen_context(system_u:object_r:nessusd_log_t,s0) diff --git a/refpolicy/policy/modules/services/nessus.if b/refpolicy/policy/modules/services/nessus.if new file mode 100644 index 000000000..c5683d51c --- /dev/null +++ b/refpolicy/policy/modules/services/nessus.if @@ -0,0 +1,21 @@ +## Nessus network scanning daemon + +######################################## +## +## Connect to nessus over a TCP socket +## +## +## +## Domain allowed access. +## +## +# +interface(`nessus_tcp_connect',` + gen_require(` + type nessus_t; + ') + + allow $1 nessus_t:tcp_socket { connectto recvfrom }; + allow nessus_t $1:tcp_socket { acceptfrom recvfrom }; + kernel_tcp_recvfrom($1) +') diff --git a/refpolicy/policy/modules/services/nessus.te b/refpolicy/policy/modules/services/nessus.te new file mode 100644 index 000000000..a7c50ee63 --- /dev/null +++ b/refpolicy/policy/modules/services/nessus.te @@ -0,0 +1,121 @@ + +policy_module(nessus,1.0.0) + +######################################## +# +# Local policy +# + +type nessusd_t; +type nessusd_exec_t; +init_daemon_domain(nessusd_t,nessusd_exec_t) + +type nessusd_db_t; +files_type(nessusd_db_t) + +type nessusd_etc_t; +files_config_file(nessusd_etc_t) + +type nessusd_log_t; +logging_log_file(nessusd_log_t) + +type nessusd_var_run_t; +files_pid_file(nessusd_var_run_t) + +######################################## +# +# Declarations +# + +allow nessusd_t self:capability net_raw; +dontaudit nessusd_t self:capability sys_tty_config; +allow nessusd_t self:process { setsched signal_perms }; +allow nessusd_t self:fifo_file { getattr read write }; +allow nessusd_t self:tcp_socket create_stream_socket_perms; +allow nessusd_t self:udp_socket create_socket_perms; +allow nessusd_t self:rawip_socket create_socket_perms; +allow nessusd_t self:packet_socket create_socket_perms; + +# Allow access to the nessusd authentication database +allow nessusd_t nessusd_db_t:dir create_dir_perms; +allow nessusd_t nessusd_db_t:file create_file_perms; +allow nessusd_t nessusd_db_t:lnk_file create_lnk_perms; +files_list_var_lib(nessusd_t) + +allow nessusd_t nessusd_etc_t:file { getattr read }; +files_search_etc(nessusd_t) + +allow nessusd_t nessusd_log_t:file create_file_perms; +allow nessusd_t nessusd_log_t:dir rw_dir_perms; +logging_log_filetrans(nessusd_t,nessusd_log_t,{ file dir }) + +allow nessusd_t nessusd_var_run_t:file create_file_perms; +allow nessusd_t nessusd_var_run_t:dir rw_dir_perms; +files_pid_filetrans(nessusd_t,nessusd_var_run_t,file) + +kernel_read_system_state(nessusd_t) +kernel_read_kernel_sysctls(nessusd_t) +kernel_tcp_recvfrom(nessusd_t) + +# for nmap etc +corecmd_exec_bin(nessusd_t) + +corenet_tcp_sendrecv_generic_if(nessusd_t) +corenet_udp_sendrecv_generic_if(nessusd_t) +corenet_raw_sendrecv_generic_if(nessusd_t) +corenet_tcp_sendrecv_all_nodes(nessusd_t) +corenet_udp_sendrecv_all_nodes(nessusd_t) +corenet_raw_sendrecv_all_nodes(nessusd_t) +corenet_tcp_sendrecv_all_ports(nessusd_t) +corenet_udp_sendrecv_all_ports(nessusd_t) +corenet_non_ipsec_sendrecv(nessusd_t) +corenet_tcp_bind_all_nodes(nessusd_t) +corenet_udp_bind_all_nodes(nessusd_t) +corenet_tcp_bind_nessus_port(nessusd_t) +corenet_tcp_connect_all_ports(nessusd_t) + +dev_read_sysfs(nessusd_t) +dev_read_urand(nessusd_t) + +domain_use_interactive_fds(nessusd_t) + +files_read_etc_files(nessusd_t) +files_read_etc_runtime_files(nessusd_t) + +fs_getattr_all_fs(nessusd_t) +fs_search_auto_mountpoints(nessusd_t) + +term_dontaudit_use_console(nessusd_t) + +init_use_fds(nessusd_t) +init_use_script_ptys(nessusd_t) + +libs_use_ld_so(nessusd_t) +libs_use_shared_libs(nessusd_t) + +logging_send_syslog_msg(nessusd_t) + +miscfiles_read_localization(nessusd_t) + +sysnet_read_config(nessusd_t) + +userdom_dontaudit_use_unpriv_user_fds(nessusd_t) +userdom_dontaudit_search_sysadm_home_dirs(nessusd_t) + +ifdef(`targeted_policy',` + term_dontaudit_use_unallocated_ttys(nessusd_t) + term_dontaudit_use_generic_ptys(nessusd_t) + files_dontaudit_read_root_files(nessusd_t) +') + +optional_policy(` + nis_use_ypbind(nessusd_t) +') + +optional_policy(` + seutil_sigchld_newrole(nessusd_t) +') + +optional_policy(` + udev_read_db(nessusd_t) +') diff --git a/refpolicy/policy/modules/system/userdomain.if b/refpolicy/policy/modules/system/userdomain.if index 336f06b99..e164247fe 100644 --- a/refpolicy/policy/modules/system/userdomain.if +++ b/refpolicy/policy/modules/system/userdomain.if @@ -390,6 +390,10 @@ template(`base_user_template',` ') ') + optional_policy(` + nessus_tcp_connect($1_t) + ') + optional_policy(` nscd_socket_use($1_t) ') diff --git a/refpolicy/policy/modules/system/userdomain.te b/refpolicy/policy/modules/system/userdomain.te index d27778b1a..ec133d3cc 100644 --- a/refpolicy/policy/modules/system/userdomain.te +++ b/refpolicy/policy/modules/system/userdomain.te @@ -1,5 +1,5 @@ -policy_module(userdomain,1.3.8) +policy_module(userdomain,1.3.9) gen_require(` role sysadm_r, staff_r, user_r;