Couchdb policy updates
The following patch series supersedes my previous patch proposal for the couchdb policy. The first patch is for refpolicy.git, the others are for refpolicy-contrib.git
--
Luis Ressel <[email protected]>
GPG fpr: F08D 2AF6 655E 25DE 52BC E53D 08F5 7F90 3029 B5BD
PATCH 1/1 kernel/files.if: Add files_dontaudit_list_var interface
This is required for an update of the couchdb policy.
--- policy/modules/kernel/files.if | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
policy/modules/kernel/files.if +19 -0
@@ -5181,6 +5181,25 @@ interface(`files_list_var',` ######################################## ## <summary> +## Do not audit attempts to list +## the contents of /var. +## </summary> +## <param name="domain"> +## <summary> +## Domain to not audit. +## </summary> +## </param> +# +interface(`files_dontaudit_list_var',` + gen_require(` + type var_t; + ') + + dontaudit $1 var_t:dir list_dir_perms; +') + +######################################## +## <summary> ## Create, read, write, and delete directories ## in the /var directory. ## </summary>
Signature · 1 line
1.8.5.3
PATCH 1/1 kernel/files.if: Add files_dontaudit_list_var interface
Quoted 25 lines · Luis Ressel
This is required for an update of the couchdb policy.
--- policy/modules/kernel/files.if | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)policy/modules/kernel/files.if +12
-0@@ -5181,6 +5181,25 @@ interface(`files_list_var',` ######################################## ## <summary> +## Do not audit attempts to list +## the contents of /var. +## </summary> +## <param name="domain"> +## <summary> +## Domain to not audit. +## </summary> +## </param> +# +interface(`files_dontaudit_list_var',` + gen_require(` + type var_t;
policy/modules/kernel/files.if interface(`files_list_var',` · line 5205
Quoted 10 lines
policy/modules/kernel/files.if +7
-0+ ') + + dontaudit $1 var_t:dir list_dir_perms; +') + +######################################## +## <summary> ## Create, read, write, and delete directories ## in the /var directory. ## </summary>
Merged.
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
PATCH 1/5 Minor updates to couchdb policy
In reply to Luis Ressel--- couchdb.fc | 2 ++ couchdb.te | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)
couchdb.fc +2 -0
@@ -2,6 +2,8 @@ /etc/rc\.d/init\.d/couchdb -- gen_context(system_u:object_r:couchdb_initrc_exec_t,s0) +/usr/lib/couchdb/erlang/lib/couch-[0-9.]+/priv/couchspawnkillable -- gen_context(system_u:object_r:bin_t,s0) + /usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0) /var/lib/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_lib_t,s0)
couchdb.te +3 -1
@@ -26,13 +26,14 @@ files_type(couchdb_var_lib_t) type couchdb_var_run_t; files_pid_file(couchdb_var_run_t) +init_daemon_run_dir(couchdb_var_run_t, "couchdb") ######################################## # # Local policy # -allow couchdb_t self:process { setsched signal signull sigkill }; +allow couchdb_t self:process { getsched setsched signal signull sigkill }; allow couchdb_t self:fifo_file rw_fifo_file_perms; allow couchdb_t self:unix_stream_socket create_stream_socket_perms; allow couchdb_t self:tcp_socket { accept listen };
@@ -70,6 +71,7 @@ corenet_all_recvfrom_netlabel(couchdb_t) corenet_tcp_sendrecv_generic_if(couchdb_t) corenet_tcp_sendrecv_generic_node(couchdb_t) corenet_tcp_bind_generic_node(couchdb_t) +corenet_udp_bind_generic_node(couchdb_t) corenet_sendrecv_couchdb_server_packets(couchdb_t) corenet_tcp_bind_couchdb_port(couchdb_t)
Signature · 1 line
1.8.5.3
PATCH 2/5 couchdb: Add separate domain for couchjs
couchjs requires 'execmem', which isn't neccessary for the rest of couchdb.
--- couchdb.fc | 1 + couchdb.te | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)
couchdb.fc +1 -0
@@ -2,6 +2,7 @@ /etc/rc\.d/init\.d/couchdb -- gen_context(system_u:object_r:couchdb_initrc_exec_t,s0) +/usr/lib/couchdb/bin/couchjs -- gen_context(system_u:object_r:couchdb_js_exec_t,s0) /usr/lib/couchdb/erlang/lib/couch-[0-9.]+/priv/couchspawnkillable -- gen_context(system_u:object_r:bin_t,s0) /usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0)
couchdb.te +17 -1
@@ -9,6 +9,10 @@ type couchdb_t; type couchdb_exec_t; init_daemon_domain(couchdb_t, couchdb_exec_t) +type couchdb_js_t; +type couchdb_js_exec_t; +init_daemon_domain(couchdb_js_t, couchdb_js_exec_t) + type couchdb_initrc_exec_t; init_script_file(couchdb_initrc_exec_t)
@@ -30,7 +34,7 @@ init_daemon_run_dir(couchdb_var_run_t, "couchdb") ######################################## # -# Local policy +# couchdb policy # allow couchdb_t self:process { getsched setsched signal signull sigkill };
@@ -88,3 +92,15 @@ fs_getattr_xattr_fs(couchdb_t) auth_use_nsswitch(couchdb_t) miscfiles_read_localization(couchdb_t) + +domtrans_pattern(couchdb_t, couchdb_js_exec_t, couchdb_js_t) + +######################################## +# +# couchdb_js policy +# + +allow couchdb_js_t self:process { execmem getsched setsched }; + +files_read_usr_files(couchdb_js_t) +miscfiles_read_localization(couchdb_js_t)
Signature · 1 line
1.8.5.3
PATCH 2/5 couchdb: Add separate domain for couchjs
Quoted 44 lines · Luis Ressel
couchjs requires 'execmem', which isn't neccessary for the rest of couchdb.
--- couchdb.fc | 1 + couchdb.te | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-)couchdb.fc +1
-0@@ -2,6 +2,7 @@ /etc/rc\.d/init\.d/couchdb -- gen_context(system_u:object_r:couchdb_initrc_exec_t,s0) +/usr/lib/couchdb/bin/couchjs -- gen_context(system_u:object_r:couchdb_js_exec_t,s0) /usr/lib/couchdb/erlang/lib/couch-[0-9.]+/priv/couchspawnkillable -- gen_context(system_u:object_r:bin_t,s0) /usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0)couchdb.te +5
-1@@ -9,6 +9,10 @@ type couchdb_t; type couchdb_exec_t; init_daemon_domain(couchdb_t, couchdb_exec_t) +type couchdb_js_t; +type couchdb_js_exec_t; +init_daemon_domain(couchdb_js_t, couchdb_js_exec_t) + type couchdb_initrc_exec_t; init_script_file(couchdb_initrc_exec_t)@@ -30,7 +34,7 @@ init_daemon_run_dir(couchdb_var_run_t, "couchdb") ######################################## # -# Local policy +# couchdb policy # allow couchdb_t self:process { getsched setsched signal signull sigkill };
couchdb.te fs_getattr_xattr_fs(couchdb_t) · line 96
Quoted 5 lines
couchdb.te +2
-0@@ -88,3 +92,15 @@ fs_getattr_xattr_fs(couchdb_t) auth_use_nsswitch(couchdb_t) miscfiles_read_localization(couchdb_t) + +domtrans_pattern(couchdb_t, couchdb_js_exec_t, couchdb_js_t)
Moved this line up. Otherwise merged.
Quoted 10 lines
couchdb.te +9
-0+######################################## +# +# couchdb_js policy +# + +allow couchdb_js_t self:process { execmem getsched setsched }; + +files_read_usr_files(couchdb_js_t) +miscfiles_read_localization(couchdb_js_t)
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
PATCH 3/5 couchdb: Dontaudit denials caused by Erlang's disksup
In reply to Luis Ressel--- couchdb.te | 5 +++++ 1 file changed, 5 insertions(+)
couchdb.te +5 -0
@@ -87,7 +87,12 @@ dev_read_urand(couchdb_t) files_read_usr_files(couchdb_t) +# disksup tries to monitor the local disks fs_getattr_xattr_fs(couchdb_t) +fs_dontaudit_getattr_all_fs(couchdb_t) +files_dontaudit_getattr_lost_found_dirs(couchdb_t) +files_dontaudit_list_var(couchdb_t) +files_dontaudit_search_all_mountpoints(couchdb_t) auth_use_nsswitch(couchdb_t)
Signature · 1 line
1.8.5.3
PATCH 3/5 couchdb: Dontaudit denials caused by Erlang's disksup
Quoted 10 lines · Luis Ressel
--- couchdb.te | 5 +++++ 1 file changed, 5 insertions(+)couchdb.te +0
-0@@ -87,7 +87,12 @@ dev_read_urand(couchdb_t)
couchdb.te dev_read_urand(couchdb_t) · line 97
Quoted 10 lines
couchdb.te +5
-0files_read_usr_files(couchdb_t) +# disksup tries to monitor the local disks fs_getattr_xattr_fs(couchdb_t) +fs_dontaudit_getattr_all_fs(couchdb_t) +files_dontaudit_getattr_lost_found_dirs(couchdb_t) +files_dontaudit_list_var(couchdb_t) +files_dontaudit_search_all_mountpoints(couchdb_t) auth_use_nsswitch(couchdb_t)
Merged.
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
PATCH 4/5 Reformat couchdb.fc
In reply to Luis Ressel--- couchdb.fc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)
couchdb.fc +5 -9
@@ -1,14 +1,10 @@ -/etc/couchdb(/.*)? gen_context(system_u:object_r:couchdb_conf_t,s0) - +/etc/couchdb(/.*)? gen_context(system_u:object_r:couchdb_conf_t,s0) /etc/rc\.d/init\.d/couchdb -- gen_context(system_u:object_r:couchdb_initrc_exec_t,s0) +/usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0) /usr/lib/couchdb/bin/couchjs -- gen_context(system_u:object_r:couchdb_js_exec_t,s0) /usr/lib/couchdb/erlang/lib/couch-[0-9.]+/priv/couchspawnkillable -- gen_context(system_u:object_r:bin_t,s0) -/usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0) - -/var/lib/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_lib_t,s0) - -/var/log/couchdb(/.*)? gen_context(system_u:object_r:couchdb_log_t,s0) - -/var/run/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_run_t,s0) +/var/lib/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_lib_t,s0) +/var/log/couchdb(/.*)? gen_context(system_u:object_r:couchdb_log_t,s0) +/var/run/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_run_t,s0)
Signature · 1 line
1.8.5.3
PATCH 4/5 Reformat couchdb.fc
Quoted 18 lines · Luis Ressel
--- couchdb.fc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-)couchdb.fc +2
-2@@ -1,14 +1,10 @@ -/etc/couchdb(/.*)? gen_context(system_u:object_r:couchdb_conf_t,s0) - +/etc/couchdb(/.*)? gen_context(system_u:object_r:couchdb_conf_t,s0) /etc/rc\.d/init\.d/couchdb -- gen_context(system_u:object_r:couchdb_initrc_exec_t,s0) +/usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0) /usr/lib/couchdb/bin/couchjs -- gen_context(system_u:object_r:couchdb_js_exec_t,s0) /usr/lib/couchdb/erlang/lib/couch-[0-9.]+/priv/couchspawnkillable -- gen_context(system_u:object_r:bin_t,s0)
couchdb.fc line 10
Quoted 10 lines
couchdb.fc +3
-7-/usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0) - -/var/lib/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_lib_t,s0) - -/var/log/couchdb(/.*)? gen_context(system_u:object_r:couchdb_log_t,s0) - -/var/run/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_run_t,s0) +/var/lib/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_lib_t,s0) +/var/log/couchdb(/.*)? gen_context(system_u:object_r:couchdb_log_t,s0) +/var/run/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_run_t,s0)
Merged.
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com
PATCH 5/5 couchdb: Module version bump
In reply to Luis Ressel--- couchdb.te | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
couchdb.te +1 -1
@@ -1,4 +1,4 @@ -policy_module(couchdb, 1.1.1) +policy_module(couchdb, 1.1.2) ######################################## #
Signature · 1 line
1.8.5.3
PATCH 1/5 Minor updates to couchdb policy
In reply to Luis ResselQuoted 10 lines · Luis Ressel
--- couchdb.fc | 2 ++ couchdb.te | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)couchdb.fc +0
-0
couchdb.fc line 5
Quoted 4 lines
couchdb.fc +1
-0@@ -2,6 +2,8 @@ /etc/rc\.d/init\.d/couchdb -- gen_context(system_u:object_r:couchdb_initrc_exec_t,s0) +/usr/lib/couchdb/erlang/lib/couch-[0-9.]+/priv/couchspawnkillable -- gen_context(system_u:object_r:bin_t,s0)
I moved this to corecommands. Otherwise merged.
Quoted 32 lines
couchdb.fc +0
-0/usr/bin/couchdb -- gen_context(system_u:object_r:couchdb_exec_t,s0) /var/lib/couchdb(/.*)? gen_context(system_u:object_r:couchdb_var_lib_t,s0)couchdb.te +3
-1@@ -26,13 +26,14 @@ files_type(couchdb_var_lib_t) type couchdb_var_run_t; files_pid_file(couchdb_var_run_t) +init_daemon_run_dir(couchdb_var_run_t, "couchdb") ######################################## # # Local policy # -allow couchdb_t self:process { setsched signal signull sigkill }; +allow couchdb_t self:process { getsched setsched signal signull sigkill }; allow couchdb_t self:fifo_file rw_fifo_file_perms; allow couchdb_t self:unix_stream_socket create_stream_socket_perms; allow couchdb_t self:tcp_socket { accept listen };@@ -70,6 +71,7 @@ corenet_all_recvfrom_netlabel(couchdb_t) corenet_tcp_sendrecv_generic_if(couchdb_t) corenet_tcp_sendrecv_generic_node(couchdb_t) corenet_tcp_bind_generic_node(couchdb_t) +corenet_udp_bind_generic_node(couchdb_t) corenet_sendrecv_couchdb_server_packets(couchdb_t) corenet_tcp_bind_couchdb_port(couchdb_t)
Signature · 3 lines
Chris PeBenito Tresys Technology, LLC www.tresys.com | oss.tresys.com