2019-04-14 02:37:07

by Sugar, David

[permalink] [raw]
Subject: [PATCH v2] Add kernel_dgram_send() into logging_send_syslog_msg()

This patch is based on comments from previous a patch to
remove the many uses of kernel_dgram_send() and incorporate
it into logging_send_syslog_msg().

v2 - enclose in ifdef for redhat

Signed-off-by: Dave Sugar <[email protected]>
---
policy/modules/admin/aide.te | 1 -
policy/modules/admin/usermanage.te | 5 -----
policy/modules/services/dbus.te | 3 ---
policy/modules/system/authlogin.te | 5 -----
policy/modules/system/init.if | 2 --
policy/modules/system/init.te | 3 ---
policy/modules/system/logging.if | 4 ++++
policy/modules/system/logging.te | 4 ----
policy/modules/system/systemd.te | 5 -----
policy/modules/system/udev.te | 1 -
10 files changed, 4 insertions(+), 29 deletions(-)

diff --git a/policy/modules/admin/aide.te b/policy/modules/admin/aide.te
index 30deba09..f5e64a86 100644
--- a/policy/modules/admin/aide.te
+++ b/policy/modules/admin/aide.te
@@ -44,7 +44,6 @@ logging_log_filetrans(aide_t, aide_log_t, file)
files_read_all_files(aide_t)
files_read_all_symlinks(aide_t)

-kernel_dgram_send(aide_t)
kernel_read_crypto_sysctls(aide_t)

logging_send_audit_msgs(aide_t)
diff --git a/policy/modules/admin/usermanage.te b/policy/modules/admin/usermanage.te
index 5753741b..4a10bf84 100644
--- a/policy/modules/admin/usermanage.te
+++ b/policy/modules/admin/usermanage.te
@@ -366,11 +366,6 @@ userdom_read_user_tmp_files(passwd_t)
# on user home dir
userdom_dontaudit_search_user_home_content(passwd_t)

-ifdef(`init_systemd',`
- # for journald /dev/log
- kernel_dgram_send(passwd_t)
-')
-
optional_policy(`
nscd_run(passwd_t, passwd_roles)
')
diff --git a/policy/modules/services/dbus.te b/policy/modules/services/dbus.te
index 9c085876..c05370dd 100644
--- a/policy/modules/services/dbus.te
+++ b/policy/modules/services/dbus.te
@@ -162,9 +162,6 @@ ifdef(`init_systemd', `
# for /run/systemd/dynamic-uid/
init_list_pids(system_dbusd_t)
init_read_runtime_symlinks(system_dbusd_t)
-
- # for journald /dev/log
- kernel_dgram_send(system_dbusd_t)
')

optional_policy(`
diff --git a/policy/modules/system/authlogin.te b/policy/modules/system/authlogin.te
index 28f74bac..2cf86952 100644
--- a/policy/modules/system/authlogin.te
+++ b/policy/modules/system/authlogin.te
@@ -144,11 +144,6 @@ ifdef(`distro_ubuntu',`
')
')

-ifdef(`init_systemd',`
- # for journald /dev/log
- kernel_dgram_send(chkpwd_t)
-')
-
optional_policy(`
# apache leaks file descriptors
apache_dontaudit_rw_tcp_sockets(chkpwd_t)
diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if
index fef2c88e..00bd4991 100644
--- a/policy/modules/system/init.if
+++ b/policy/modules/system/init.if
@@ -306,8 +306,6 @@ interface(`init_daemon_domain',`

ifdef(`init_systemd',`
init_domain($1, $2)
- # this may be because of late labelling
- kernel_dgram_send($1)

allow $1 init_t:unix_dgram_socket sendto;
')
diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
index a12d151b..3e8eb2da 100644
--- a/policy/modules/system/init.te
+++ b/policy/modules/system/init.te
@@ -272,7 +272,6 @@ ifdef(`init_systemd',`

kernel_dyntrans_to(init_t)
kernel_read_network_state(init_t)
- kernel_dgram_send(init_t)
kernel_stream_connect(init_t)
kernel_getattr_proc(init_t)
kernel_read_fs_sysctls(init_t)
@@ -969,8 +968,6 @@ ifdef(`init_systemd',`
allow initrc_t systemdunit:service reload;
allow initrc_t init_script_file_type:service { stop start status reload };

- kernel_dgram_send(initrc_t)
-
# run systemd misc initializations
# in the initrc_t domain, as would be
# done in traditional sysvinit/upstart.
diff --git a/policy/modules/system/logging.if b/policy/modules/system/logging.if
index 7b7644f7..e7321d3e 100644
--- a/policy/modules/system/logging.if
+++ b/policy/modules/system/logging.if
@@ -642,6 +642,10 @@ interface(`logging_send_syslog_msg',`
ifdef(`init_systemd',`
# Allow systemd-journald to check whether the process died
allow syslogd_t $1:process signull;
+
+ ifdef(`distro_redhat',`
+ kernel_dgram_send($1)
+ ')
')
')

diff --git a/policy/modules/system/logging.te b/policy/modules/system/logging.te
index 0c5be1cd..02f268ea 100644
--- a/policy/modules/system/logging.te
+++ b/policy/modules/system/logging.te
@@ -271,10 +271,6 @@ miscfiles_read_localization(audisp_t)

sysnet_dns_name_resolve(audisp_t)

-ifdef(`init_systemd',`
- kernel_dgram_send(audisp_t)
-')
-
optional_policy(`
dbus_system_bus_client(audisp_t)
')
diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
index f6455f6f..cf9241c0 100644
--- a/policy/modules/system/systemd.te
+++ b/policy/modules/system/systemd.te
@@ -266,7 +266,6 @@ systemd_log_parse_environment(systemd_gpt_generator_t)
allow systemd_cgroups_t self:capability net_admin;

kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
-kernel_dgram_send(systemd_cgroups_t)
# for /proc/cmdline
kernel_read_system_state(systemd_cgroups_t)

@@ -642,7 +641,6 @@ manage_dirs_pattern(systemd_networkd_t, systemd_networkd_var_run_t, systemd_netw
manage_files_pattern(systemd_networkd_t, systemd_networkd_var_run_t, systemd_networkd_var_run_t)
manage_lnk_files_pattern(systemd_networkd_t, systemd_networkd_var_run_t, systemd_networkd_var_run_t)

-kernel_dgram_send(systemd_networkd_t)
kernel_read_system_state(systemd_networkd_t)
kernel_read_kernel_sysctls(systemd_networkd_t)
kernel_read_network_state(systemd_networkd_t)
@@ -667,8 +665,6 @@ auth_use_nsswitch(systemd_networkd_t)
init_dgram_send(systemd_networkd_t)
init_read_state(systemd_networkd_t)

-logging_send_syslog_msg(systemd_networkd_t)
-
miscfiles_read_localization(systemd_networkd_t)

sysnet_read_config(systemd_networkd_t)
@@ -945,7 +941,6 @@ init_pid_filetrans(systemd_resolved_t, systemd_resolved_var_run_t, dir)

dev_read_sysfs(systemd_resolved_t)

-kernel_dgram_send(systemd_resolved_t)
kernel_read_crypto_sysctls(systemd_resolved_t)
kernel_read_kernel_sysctls(systemd_resolved_t)
kernel_read_net_sysctls(systemd_resolved_t)
diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te
index ff564280..f00de30d 100644
--- a/policy/modules/system/udev.te
+++ b/policy/modules/system/udev.te
@@ -99,7 +99,6 @@ kernel_read_modprobe_sysctls(udev_t)
kernel_read_kernel_sysctls(udev_t)
kernel_rw_hotplug_sysctls(udev_t)
kernel_rw_unix_dgram_sockets(udev_t)
-kernel_dgram_send(udev_t)
kernel_signal(udev_t)
kernel_search_debugfs(udev_t)
kernel_search_key(udev_t)
--
2.20.1


2019-04-14 06:17:03

by Russell Coker

[permalink] [raw]
Subject: Re: [PATCH v2] Add kernel_dgram_send() into logging_send_syslog_msg()

Looks good to me.

On Sunday, 14 April 2019 12:37:01 PM AEST Sugar, David wrote:
> This patch is based on comments from previous a patch to
> remove the many uses of kernel_dgram_send() and incorporate
> it into logging_send_syslog_msg().
>
> v2 - enclose in ifdef for redhat
>
> Signed-off-by: Dave Sugar <[email protected]>
> ---
> policy/modules/admin/aide.te | 1 -
> policy/modules/admin/usermanage.te | 5 -----
> policy/modules/services/dbus.te | 3 ---
> policy/modules/system/authlogin.te | 5 -----
> policy/modules/system/init.if | 2 --
> policy/modules/system/init.te | 3 ---
> policy/modules/system/logging.if | 4 ++++
> policy/modules/system/logging.te | 4 ----
> policy/modules/system/systemd.te | 5 -----
> policy/modules/system/udev.te | 1 -
> 10 files changed, 4 insertions(+), 29 deletions(-)
>
> diff --git a/policy/modules/admin/aide.te b/policy/modules/admin/aide.te
> index 30deba09..f5e64a86 100644
> --- a/policy/modules/admin/aide.te
> +++ b/policy/modules/admin/aide.te
> @@ -44,7 +44,6 @@ logging_log_filetrans(aide_t, aide_log_t, file)
> files_read_all_files(aide_t)
> files_read_all_symlinks(aide_t)
>
> -kernel_dgram_send(aide_t)
> kernel_read_crypto_sysctls(aide_t)
>
> logging_send_audit_msgs(aide_t)
> diff --git a/policy/modules/admin/usermanage.te
> b/policy/modules/admin/usermanage.te
index 5753741b..4a10bf84 100644
> --- a/policy/modules/admin/usermanage.te
> +++ b/policy/modules/admin/usermanage.te
> @@ -366,11 +366,6 @@ userdom_read_user_tmp_files(passwd_t)
> # on user home dir
> userdom_dontaudit_search_user_home_content(passwd_t)
>
> -ifdef(`init_systemd',`
> - # for journald /dev/log
> - kernel_dgram_send(passwd_t)
> -')
> -
> optional_policy(`
> nscd_run(passwd_t, passwd_roles)
> ')
> diff --git a/policy/modules/services/dbus.te
> b/policy/modules/services/dbus.te
index 9c085876..c05370dd 100644
> --- a/policy/modules/services/dbus.te
> +++ b/policy/modules/services/dbus.te
> @@ -162,9 +162,6 @@ ifdef(`init_systemd', `
> # for /run/systemd/dynamic-uid/
> init_list_pids(system_dbusd_t)
> init_read_runtime_symlinks(system_dbusd_t)
> -
> - # for journald /dev/log
> - kernel_dgram_send(system_dbusd_t)
> ')
>
> optional_policy(`
> diff --git a/policy/modules/system/authlogin.te
> b/policy/modules/system/authlogin.te
index 28f74bac..2cf86952 100644
> --- a/policy/modules/system/authlogin.te
> +++ b/policy/modules/system/authlogin.te
> @@ -144,11 +144,6 @@ ifdef(`distro_ubuntu',`
> ')
> ')
>
> -ifdef(`init_systemd',`
> - # for journald /dev/log
> - kernel_dgram_send(chkpwd_t)
> -')
> -
> optional_policy(`
> # apache leaks file descriptors
> apache_dontaudit_rw_tcp_sockets(chkpwd_t)
> diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if
> index fef2c88e..00bd4991 100644
> --- a/policy/modules/system/init.if
> +++ b/policy/modules/system/init.if
> @@ -306,8 +306,6 @@ interface(`init_daemon_domain',`
>
> ifdef(`init_systemd',`
> init_domain($1, $2)
> - # this may be because of late labelling
> - kernel_dgram_send($1)
>
> allow $1 init_t:unix_dgram_socket sendto;
> ')
> diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
> index a12d151b..3e8eb2da 100644
> --- a/policy/modules/system/init.te
> +++ b/policy/modules/system/init.te
> @@ -272,7 +272,6 @@ ifdef(`init_systemd',`
>
> kernel_dyntrans_to(init_t)
> kernel_read_network_state(init_t)
> - kernel_dgram_send(init_t)
> kernel_stream_connect(init_t)
> kernel_getattr_proc(init_t)
> kernel_read_fs_sysctls(init_t)
> @@ -969,8 +968,6 @@ ifdef(`init_systemd',`
> allow initrc_t systemdunit:service reload;
> allow initrc_t init_script_file_type:service { stop start status reload
> };

> - kernel_dgram_send(initrc_t)
> -
> # run systemd misc initializations
> # in the initrc_t domain, as would be
> # done in traditional sysvinit/upstart.
> diff --git a/policy/modules/system/logging.if
> b/policy/modules/system/logging.if
index 7b7644f7..e7321d3e 100644
> --- a/policy/modules/system/logging.if
> +++ b/policy/modules/system/logging.if
> @@ -642,6 +642,10 @@ interface(`logging_send_syslog_msg',`
> ifdef(`init_systemd',`
> # Allow systemd-journald to check whether the process died
> allow syslogd_t $1:process signull;
> +
> + ifdef(`distro_redhat',`
> + kernel_dgram_send($1)
> + ')
> ')
> ')
>
> diff --git a/policy/modules/system/logging.te
> b/policy/modules/system/logging.te
index 0c5be1cd..02f268ea 100644
> --- a/policy/modules/system/logging.te
> +++ b/policy/modules/system/logging.te
> @@ -271,10 +271,6 @@ miscfiles_read_localization(audisp_t)
>
> sysnet_dns_name_resolve(audisp_t)
>
> -ifdef(`init_systemd',`
> - kernel_dgram_send(audisp_t)
> -')
> -
> optional_policy(`
> dbus_system_bus_client(audisp_t)
> ')
> diff --git a/policy/modules/system/systemd.te
> b/policy/modules/system/systemd.te
index f6455f6f..cf9241c0 100644
> --- a/policy/modules/system/systemd.te
> +++ b/policy/modules/system/systemd.te
> @@ -266,7 +266,6 @@ systemd_log_parse_environment(systemd_gpt_generator_t)
> allow systemd_cgroups_t self:capability net_admin;
>
> kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
> -kernel_dgram_send(systemd_cgroups_t)
> # for /proc/cmdline
> kernel_read_system_state(systemd_cgroups_t)
>
> @@ -642,7 +641,6 @@ manage_dirs_pattern(systemd_networkd_t,
> systemd_networkd_var_run_t, systemd_netw
> manage_files_pattern(systemd_networkd_t, systemd_networkd_var_run_t,
> systemd_networkd_var_run_t) manage_lnk_files_pattern(systemd_networkd_t,
> systemd_networkd_var_run_t, systemd_networkd_var_run_t)
> -kernel_dgram_send(systemd_networkd_t)
> kernel_read_system_state(systemd_networkd_t)
> kernel_read_kernel_sysctls(systemd_networkd_t)
> kernel_read_network_state(systemd_networkd_t)
> @@ -667,8 +665,6 @@ auth_use_nsswitch(systemd_networkd_t)
> init_dgram_send(systemd_networkd_t)
> init_read_state(systemd_networkd_t)
>
> -logging_send_syslog_msg(systemd_networkd_t)
> -
> miscfiles_read_localization(systemd_networkd_t)
>
> sysnet_read_config(systemd_networkd_t)
> @@ -945,7 +941,6 @@ init_pid_filetrans(systemd_resolved_t,
> systemd_resolved_var_run_t, dir)

> dev_read_sysfs(systemd_resolved_t)
>
> -kernel_dgram_send(systemd_resolved_t)
> kernel_read_crypto_sysctls(systemd_resolved_t)
> kernel_read_kernel_sysctls(systemd_resolved_t)
> kernel_read_net_sysctls(systemd_resolved_t)
> diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te
> index ff564280..f00de30d 100644
> --- a/policy/modules/system/udev.te
> +++ b/policy/modules/system/udev.te
> @@ -99,7 +99,6 @@ kernel_read_modprobe_sysctls(udev_t)
> kernel_read_kernel_sysctls(udev_t)
> kernel_rw_hotplug_sysctls(udev_t)
> kernel_rw_unix_dgram_sockets(udev_t)
> -kernel_dgram_send(udev_t)
> kernel_signal(udev_t)
> kernel_search_debugfs(udev_t)
> kernel_search_key(udev_t)
> --
> 2.20.1
>


--
My Main Blog http://etbe.coker.com.au/
My Documents Blog http://doc.coker.com.au/


2019-04-14 17:51:14

by Chris PeBenito

[permalink] [raw]
Subject: Re: [PATCH v2] Add kernel_dgram_send() into logging_send_syslog_msg()

On 4/13/19 10:37 PM, Sugar, David wrote:
> This patch is based on comments from previous a patch to
> remove the many uses of kernel_dgram_send() and incorporate
> it into logging_send_syslog_msg().
>
> v2 - enclose in ifdef for redhat

Would you doublecheck that your repo is up to date? For some reason this
won't apply for me. Alternatively send pull request via GitHub.


> Signed-off-by: Dave Sugar <[email protected]>
> ---
> policy/modules/admin/aide.te | 1 -
> policy/modules/admin/usermanage.te | 5 -----
> policy/modules/services/dbus.te | 3 ---
> policy/modules/system/authlogin.te | 5 -----
> policy/modules/system/init.if | 2 --
> policy/modules/system/init.te | 3 ---
> policy/modules/system/logging.if | 4 ++++
> policy/modules/system/logging.te | 4 ----
> policy/modules/system/systemd.te | 5 -----
> policy/modules/system/udev.te | 1 -
> 10 files changed, 4 insertions(+), 29 deletions(-)
>
> diff --git a/policy/modules/admin/aide.te b/policy/modules/admin/aide.te
> index 30deba09..f5e64a86 100644
> --- a/policy/modules/admin/aide.te
> +++ b/policy/modules/admin/aide.te
> @@ -44,7 +44,6 @@ logging_log_filetrans(aide_t, aide_log_t, file)
> files_read_all_files(aide_t)
> files_read_all_symlinks(aide_t)
>
> -kernel_dgram_send(aide_t)
> kernel_read_crypto_sysctls(aide_t)
>
> logging_send_audit_msgs(aide_t)
> diff --git a/policy/modules/admin/usermanage.te b/policy/modules/admin/usermanage.te
> index 5753741b..4a10bf84 100644
> --- a/policy/modules/admin/usermanage.te
> +++ b/policy/modules/admin/usermanage.te
> @@ -366,11 +366,6 @@ userdom_read_user_tmp_files(passwd_t)
> # on user home dir
> userdom_dontaudit_search_user_home_content(passwd_t)
>
> -ifdef(`init_systemd',`
> - # for journald /dev/log
> - kernel_dgram_send(passwd_t)
> -')
> -
> optional_policy(`
> nscd_run(passwd_t, passwd_roles)
> ')
> diff --git a/policy/modules/services/dbus.te b/policy/modules/services/dbus.te
> index 9c085876..c05370dd 100644
> --- a/policy/modules/services/dbus.te
> +++ b/policy/modules/services/dbus.te
> @@ -162,9 +162,6 @@ ifdef(`init_systemd', `
> # for /run/systemd/dynamic-uid/
> init_list_pids(system_dbusd_t)
> init_read_runtime_symlinks(system_dbusd_t)
> -
> - # for journald /dev/log
> - kernel_dgram_send(system_dbusd_t)
> ')
>
> optional_policy(`
> diff --git a/policy/modules/system/authlogin.te b/policy/modules/system/authlogin.te
> index 28f74bac..2cf86952 100644
> --- a/policy/modules/system/authlogin.te
> +++ b/policy/modules/system/authlogin.te
> @@ -144,11 +144,6 @@ ifdef(`distro_ubuntu',`
> ')
> ')
>
> -ifdef(`init_systemd',`
> - # for journald /dev/log
> - kernel_dgram_send(chkpwd_t)
> -')
> -
> optional_policy(`
> # apache leaks file descriptors
> apache_dontaudit_rw_tcp_sockets(chkpwd_t)
> diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if
> index fef2c88e..00bd4991 100644
> --- a/policy/modules/system/init.if
> +++ b/policy/modules/system/init.if
> @@ -306,8 +306,6 @@ interface(`init_daemon_domain',`
>
> ifdef(`init_systemd',`
> init_domain($1, $2)
> - # this may be because of late labelling
> - kernel_dgram_send($1)
>
> allow $1 init_t:unix_dgram_socket sendto;
> ')
> diff --git a/policy/modules/system/init.te b/policy/modules/system/init.te
> index a12d151b..3e8eb2da 100644
> --- a/policy/modules/system/init.te
> +++ b/policy/modules/system/init.te
> @@ -272,7 +272,6 @@ ifdef(`init_systemd',`
>
> kernel_dyntrans_to(init_t)
> kernel_read_network_state(init_t)
> - kernel_dgram_send(init_t)
> kernel_stream_connect(init_t)
> kernel_getattr_proc(init_t)
> kernel_read_fs_sysctls(init_t)
> @@ -969,8 +968,6 @@ ifdef(`init_systemd',`
> allow initrc_t systemdunit:service reload;
> allow initrc_t init_script_file_type:service { stop start status reload };
>
> - kernel_dgram_send(initrc_t)
> -
> # run systemd misc initializations
> # in the initrc_t domain, as would be
> # done in traditional sysvinit/upstart.
> diff --git a/policy/modules/system/logging.if b/policy/modules/system/logging.if
> index 7b7644f7..e7321d3e 100644
> --- a/policy/modules/system/logging.if
> +++ b/policy/modules/system/logging.if
> @@ -642,6 +642,10 @@ interface(`logging_send_syslog_msg',`
> ifdef(`init_systemd',`
> # Allow systemd-journald to check whether the process died
> allow syslogd_t $1:process signull;
> +
> + ifdef(`distro_redhat',`
> + kernel_dgram_send($1)
> + ')
> ')
> ')
>
> diff --git a/policy/modules/system/logging.te b/policy/modules/system/logging.te
> index 0c5be1cd..02f268ea 100644
> --- a/policy/modules/system/logging.te
> +++ b/policy/modules/system/logging.te
> @@ -271,10 +271,6 @@ miscfiles_read_localization(audisp_t)
>
> sysnet_dns_name_resolve(audisp_t)
>
> -ifdef(`init_systemd',`
> - kernel_dgram_send(audisp_t)
> -')
> -
> optional_policy(`
> dbus_system_bus_client(audisp_t)
> ')
> diff --git a/policy/modules/system/systemd.te b/policy/modules/system/systemd.te
> index f6455f6f..cf9241c0 100644
> --- a/policy/modules/system/systemd.te
> +++ b/policy/modules/system/systemd.te
> @@ -266,7 +266,6 @@ systemd_log_parse_environment(systemd_gpt_generator_t)
> allow systemd_cgroups_t self:capability net_admin;
>
> kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
> -kernel_dgram_send(systemd_cgroups_t)
> # for /proc/cmdline
> kernel_read_system_state(systemd_cgroups_t)
>
> @@ -642,7 +641,6 @@ manage_dirs_pattern(systemd_networkd_t, systemd_networkd_var_run_t, systemd_netw
> manage_files_pattern(systemd_networkd_t, systemd_networkd_var_run_t, systemd_networkd_var_run_t)
> manage_lnk_files_pattern(systemd_networkd_t, systemd_networkd_var_run_t, systemd_networkd_var_run_t)
>
> -kernel_dgram_send(systemd_networkd_t)
> kernel_read_system_state(systemd_networkd_t)
> kernel_read_kernel_sysctls(systemd_networkd_t)
> kernel_read_network_state(systemd_networkd_t)
> @@ -667,8 +665,6 @@ auth_use_nsswitch(systemd_networkd_t)
> init_dgram_send(systemd_networkd_t)
> init_read_state(systemd_networkd_t)
>
> -logging_send_syslog_msg(systemd_networkd_t)
> -
> miscfiles_read_localization(systemd_networkd_t)
>
> sysnet_read_config(systemd_networkd_t)
> @@ -945,7 +941,6 @@ init_pid_filetrans(systemd_resolved_t, systemd_resolved_var_run_t, dir)
>
> dev_read_sysfs(systemd_resolved_t)
>
> -kernel_dgram_send(systemd_resolved_t)
> kernel_read_crypto_sysctls(systemd_resolved_t)
> kernel_read_kernel_sysctls(systemd_resolved_t)
> kernel_read_net_sysctls(systemd_resolved_t)
> diff --git a/policy/modules/system/udev.te b/policy/modules/system/udev.te
> index ff564280..f00de30d 100644
> --- a/policy/modules/system/udev.te
> +++ b/policy/modules/system/udev.te
> @@ -99,7 +99,6 @@ kernel_read_modprobe_sysctls(udev_t)
> kernel_read_kernel_sysctls(udev_t)
> kernel_rw_hotplug_sysctls(udev_t)
> kernel_rw_unix_dgram_sockets(udev_t)
> -kernel_dgram_send(udev_t)
> kernel_signal(udev_t)
> kernel_search_debugfs(udev_t)
> kernel_search_key(udev_t)
>


--
Chris PeBenito

2019-04-15 02:10:47

by Sugar, David

[permalink] [raw]
Subject: Re: [PATCH v2] Add kernel_dgram_send() into logging_send_syslog_msg()



On 4/14/19 1:51 PM, Chris PeBenito wrote:
> On 4/13/19 10:37 PM, Sugar, David wrote:
>> This patch is based on comments from previous a patch to
>> remove the many uses of kernel_dgram_send() and incorporate
>> it into logging_send_syslog_msg().
>>
>> v2 - enclose in ifdef for redhat
>
> Would you doublecheck that your repo is up to date? For some reason this
> won't apply for me.  Alternatively send pull request via GitHub.
>
>

This patch's parent was 32ce73f9b81c97710af55b6faff2ce827f1617a7 I
updated my repo to e41def136a9b2246ceba671421caafa893814cdb and rebuilt
the patch. It came out exactly the same. I applied it locally (with
git am) to a new clone and it applied cleanly. I will resubmit as v3
and hopefully it will resolve the issue.

>> Signed-off-by: Dave Sugar <[email protected]>
>> ---
>>   policy/modules/admin/aide.te       | 1 -
>>   policy/modules/admin/usermanage.te | 5 -----
>>   policy/modules/services/dbus.te    | 3 ---
>>   policy/modules/system/authlogin.te | 5 -----
>>   policy/modules/system/init.if      | 2 --
>>   policy/modules/system/init.te      | 3 ---
>>   policy/modules/system/logging.if   | 4 ++++
>>   policy/modules/system/logging.te   | 4 ----
>>   policy/modules/system/systemd.te   | 5 -----
>>   policy/modules/system/udev.te      | 1 -
>>   10 files changed, 4 insertions(+), 29 deletions(-)
>>
>> diff --git a/policy/modules/admin/aide.te b/policy/modules/admin/aide.te
>> index 30deba09..f5e64a86 100644
>> --- a/policy/modules/admin/aide.te
>> +++ b/policy/modules/admin/aide.te
>> @@ -44,7 +44,6 @@ logging_log_filetrans(aide_t, aide_log_t, file)
>>   files_read_all_files(aide_t)
>>   files_read_all_symlinks(aide_t)
>> -kernel_dgram_send(aide_t)
>>   kernel_read_crypto_sysctls(aide_t)
>>   logging_send_audit_msgs(aide_t)
>> diff --git a/policy/modules/admin/usermanage.te
>> b/policy/modules/admin/usermanage.te
>> index 5753741b..4a10bf84 100644
>> --- a/policy/modules/admin/usermanage.te
>> +++ b/policy/modules/admin/usermanage.te
>> @@ -366,11 +366,6 @@ userdom_read_user_tmp_files(passwd_t)
>>   # on user home dir
>>   userdom_dontaudit_search_user_home_content(passwd_t)
>> -ifdef(`init_systemd',`
>> -    # for journald /dev/log
>> -    kernel_dgram_send(passwd_t)
>> -')
>> -
>>   optional_policy(`
>>       nscd_run(passwd_t, passwd_roles)
>>   ')
>> diff --git a/policy/modules/services/dbus.te
>> b/policy/modules/services/dbus.te
>> index 9c085876..c05370dd 100644
>> --- a/policy/modules/services/dbus.te
>> +++ b/policy/modules/services/dbus.te
>> @@ -162,9 +162,6 @@ ifdef(`init_systemd', `
>>       # for /run/systemd/dynamic-uid/
>>       init_list_pids(system_dbusd_t)
>>       init_read_runtime_symlinks(system_dbusd_t)
>> -
>> -    # for journald /dev/log
>> -    kernel_dgram_send(system_dbusd_t)
>>   ')
>>   optional_policy(`
>> diff --git a/policy/modules/system/authlogin.te
>> b/policy/modules/system/authlogin.te
>> index 28f74bac..2cf86952 100644
>> --- a/policy/modules/system/authlogin.te
>> +++ b/policy/modules/system/authlogin.te
>> @@ -144,11 +144,6 @@ ifdef(`distro_ubuntu',`
>>       ')
>>   ')
>> -ifdef(`init_systemd',`
>> -    # for journald /dev/log
>> -    kernel_dgram_send(chkpwd_t)
>> -')
>> -
>>   optional_policy(`
>>       # apache leaks file descriptors
>>       apache_dontaudit_rw_tcp_sockets(chkpwd_t)
>> diff --git a/policy/modules/system/init.if
>> b/policy/modules/system/init.if
>> index fef2c88e..00bd4991 100644
>> --- a/policy/modules/system/init.if
>> +++ b/policy/modules/system/init.if
>> @@ -306,8 +306,6 @@ interface(`init_daemon_domain',`
>>       ifdef(`init_systemd',`
>>           init_domain($1, $2)
>> -        # this may be because of late labelling
>> -        kernel_dgram_send($1)
>>           allow $1 init_t:unix_dgram_socket sendto;
>>       ')
>> diff --git a/policy/modules/system/init.te
>> b/policy/modules/system/init.te
>> index a12d151b..3e8eb2da 100644
>> --- a/policy/modules/system/init.te
>> +++ b/policy/modules/system/init.te
>> @@ -272,7 +272,6 @@ ifdef(`init_systemd',`
>>       kernel_dyntrans_to(init_t)
>>       kernel_read_network_state(init_t)
>> -    kernel_dgram_send(init_t)
>>       kernel_stream_connect(init_t)
>>       kernel_getattr_proc(init_t)
>>       kernel_read_fs_sysctls(init_t)
>> @@ -969,8 +968,6 @@ ifdef(`init_systemd',`
>>       allow initrc_t systemdunit:service reload;
>>       allow initrc_t init_script_file_type:service { stop start status
>> reload };
>> -    kernel_dgram_send(initrc_t)
>> -
>>       # run systemd misc initializations
>>       # in the initrc_t domain, as would be
>>       # done in traditional sysvinit/upstart.
>> diff --git a/policy/modules/system/logging.if
>> b/policy/modules/system/logging.if
>> index 7b7644f7..e7321d3e 100644
>> --- a/policy/modules/system/logging.if
>> +++ b/policy/modules/system/logging.if
>> @@ -642,6 +642,10 @@ interface(`logging_send_syslog_msg',`
>>       ifdef(`init_systemd',`
>>           # Allow systemd-journald to check whether the process died
>>           allow syslogd_t $1:process signull;
>> +
>> +        ifdef(`distro_redhat',`
>> +            kernel_dgram_send($1)
>> +        ')
>>       ')
>>   ')
>> diff --git a/policy/modules/system/logging.te
>> b/policy/modules/system/logging.te
>> index 0c5be1cd..02f268ea 100644
>> --- a/policy/modules/system/logging.te
>> +++ b/policy/modules/system/logging.te
>> @@ -271,10 +271,6 @@ miscfiles_read_localization(audisp_t)
>>   sysnet_dns_name_resolve(audisp_t)
>> -ifdef(`init_systemd',`
>> -    kernel_dgram_send(audisp_t)
>> -')
>> -
>>   optional_policy(`
>>       dbus_system_bus_client(audisp_t)
>>   ')
>> diff --git a/policy/modules/system/systemd.te
>> b/policy/modules/system/systemd.te
>> index f6455f6f..cf9241c0 100644
>> --- a/policy/modules/system/systemd.te
>> +++ b/policy/modules/system/systemd.te
>> @@ -266,7 +266,6 @@
>> systemd_log_parse_environment(systemd_gpt_generator_t)
>>   allow systemd_cgroups_t self:capability net_admin;
>>   kernel_domtrans_to(systemd_cgroups_t, systemd_cgroups_exec_t)
>> -kernel_dgram_send(systemd_cgroups_t)
>>   # for /proc/cmdline
>>   kernel_read_system_state(systemd_cgroups_t)
>> @@ -642,7 +641,6 @@ manage_dirs_pattern(systemd_networkd_t,
>> systemd_networkd_var_run_t, systemd_netw
>>   manage_files_pattern(systemd_networkd_t, systemd_networkd_var_run_t,
>> systemd_networkd_var_run_t)
>>   manage_lnk_files_pattern(systemd_networkd_t,
>> systemd_networkd_var_run_t, systemd_networkd_var_run_t)
>> -kernel_dgram_send(systemd_networkd_t)
>>   kernel_read_system_state(systemd_networkd_t)
>>   kernel_read_kernel_sysctls(systemd_networkd_t)
>>   kernel_read_network_state(systemd_networkd_t)
>> @@ -667,8 +665,6 @@ auth_use_nsswitch(systemd_networkd_t)
>>   init_dgram_send(systemd_networkd_t)
>>   init_read_state(systemd_networkd_t)
>> -logging_send_syslog_msg(systemd_networkd_t)
>> -
>>   miscfiles_read_localization(systemd_networkd_t)
>>   sysnet_read_config(systemd_networkd_t)
>> @@ -945,7 +941,6 @@ init_pid_filetrans(systemd_resolved_t,
>> systemd_resolved_var_run_t, dir)
>>   dev_read_sysfs(systemd_resolved_t)
>> -kernel_dgram_send(systemd_resolved_t)
>>   kernel_read_crypto_sysctls(systemd_resolved_t)
>>   kernel_read_kernel_sysctls(systemd_resolved_t)
>>   kernel_read_net_sysctls(systemd_resolved_t)
>> diff --git a/policy/modules/system/udev.te
>> b/policy/modules/system/udev.te
>> index ff564280..f00de30d 100644
>> --- a/policy/modules/system/udev.te
>> +++ b/policy/modules/system/udev.te
>> @@ -99,7 +99,6 @@ kernel_read_modprobe_sysctls(udev_t)
>>   kernel_read_kernel_sysctls(udev_t)
>>   kernel_rw_hotplug_sysctls(udev_t)
>>   kernel_rw_unix_dgram_sockets(udev_t)
>> -kernel_dgram_send(udev_t)
>>   kernel_signal(udev_t)
>>   kernel_search_debugfs(udev_t)
>>   kernel_search_key(udev_t)
>>
>
>