Introduce allow_bluetooth boolean
PATCH 1/1 Introduce allow_bluetooth boolean
Because of new bluetooth_socket which is part of extended_socket_class policy capability, it's possible to control which SELinux domains can use bluetooth wireless technology. Default value of the boolean is turned off.
--- policy/global_tunables | 7 +++++++ policy/modules/admin/netutils.te | 4 ++++ policy/modules/services/arpwatch.te | 4 ++++ policy/modules/services/bluetooth.if | 4 ++++ policy/modules/services/bluetooth.te | 4 ++++ policy/modules/services/ntop.te | 4 ++++ policy/modules/system/userdomain.if | 8 ++++++++ 7 files changed, 35 insertions(+)
policy/global_tunables +7 -0
@@ -4,6 +4,13 @@ # file should be used. # +## <desc> +## <p> +## Allow all system processes and Linux users to use bluetooth wireless technology. +## </p> +## </desc> +gen_tunable(allow_bluetooth,false) + ## <desc> ## <p> ## Allow unconfined executables to make their heap memory executable. Doing this is a really bad idea. Probably indicates a badly coded executable, but could indicate an attack. This executable should be reported in bugzilla
policy/modules/admin/netutils.te +4 -0
@@ -99,6 +99,10 @@ optional_policy(` xen_append_log(netutils_t) ') +tunable_policy(`allow_bluetooth',` + allow netutils_t self:bluetooth_socket create_stream_socket_perms; +') + ######################################## # # Ping local policy
policy/modules/services/arpwatch.te +4 -0
@@ -77,6 +77,10 @@ miscfiles_read_localization(arpwatch_t) userdom_dontaudit_search_user_home_dirs(arpwatch_t) userdom_dontaudit_use_unpriv_user_fds(arpwatch_t) +tunable_policy(`allow_bluetooth',` + allow arpwatch_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` mta_send_mail(arpwatch_t) ')
policy/modules/services/bluetooth.if +4 -0
@@ -68,6 +68,10 @@ interface(`bluetooth_stream_connect',` files_search_pids($1) allow $1 bluetooth_t:socket rw_socket_perms; stream_connect_pattern($1, bluetooth_var_run_t, bluetooth_var_run_t, bluetooth_t) + + tunable_policy(`deny_bluetooth',`',` + allow $1 bluetooth_t:bluetooth_socket rw_socket_perms; + ') ') ########################################
policy/modules/services/bluetooth.te +4 -0
@@ -133,6 +133,10 @@ userdom_dontaudit_use_unpriv_user_fds(bluetooth_t) userdom_dontaudit_use_user_terminals(bluetooth_t) userdom_dontaudit_search_user_home_dirs(bluetooth_t) +tunable_policy(`allow_bluetooth',` + allow bluetooth_t self:bluetooth_socket create_stream_socket_perms; +') + optional_policy(` dbus_system_bus_client(bluetooth_t) dbus_connect_system_bus(bluetooth_t)
policy/modules/services/ntop.te +4 -0
@@ -96,6 +96,10 @@ miscfiles_read_localization(ntop_t) userdom_dontaudit_use_unpriv_user_fds(ntop_t) userdom_dontaudit_search_user_home_dirs(ntop_t) +tunable_policy(`allow_bluetooth',` + allow ntop_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` apache_read_sys_content(ntop_t) ')
policy/modules/system/userdomain.if +8 -0
@@ -1189,6 +1189,10 @@ template(`userdom_unpriv_user_template', ` corenet_udp_bind_generic_port($1_t) ') + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_socket_perms; + ') + optional_policy(` netutils_run_ping_cond($1_t, $1_r) netutils_run_traceroute_cond($1_t, $1_r)
@@ -1362,6 +1366,10 @@ template(`userdom_admin_user_template',` userdom_manage_user_home_content_sockets($1_t) userdom_user_home_dir_filetrans_user_home_content($1_t, { dir file lnk_file fifo_file sock_file }) + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_stream_socket_perms; + ') + optional_policy(` postgresql_unconfined($1_t) ')
Signature · 1 line
2.20.1
Quoted 69 lines · Lukas Vrabec
Because of new
bluetooth_socketwhich is part ofextended_socket_classpolicy capability, it's possible to control which SELinux domains can use bluetooth wireless technology. Default value of the boolean is turned off.Signed-off-by Lukas Vrabec <[email protected]>--- policy/global_tunables | 7 +++++++ policy/modules/admin/netutils.te | 4 ++++ policy/modules/services/arpwatch.te | 4 ++++ policy/modules/services/bluetooth.if | 4 ++++ policy/modules/services/bluetooth.te | 4 ++++ policy/modules/services/ntop.te | 4 ++++ policy/modules/system/userdomain.if | 8 ++++++++ 7 files changed, 35 insertions(+)policy/global_tunables +7
-0@@ -4,6 +4,13 @@ # file should be used. # +## <desc> +## <p> +## Allow all system processes and Linux users to use bluetooth wireless technology. +## </p> +## </desc> +gen_tunable(allow_bluetooth,false) + ## <desc> ## <p> ## Allow unconfined executables to make their heap memory executable. Doing this is a really bad idea. Probably indicates a badly coded executable, but could indicate an attack. This executable should be reported in bugzillapolicy/modules/admin/netutils.te +4
-0@@ -99,6 +99,10 @@ optional_policy(` xen_append_log(netutils_t) ') +tunable_policy(`allow_bluetooth',` + allow netutils_t self:bluetooth_socket create_stream_socket_perms; +') + ######################################## # # Ping local policypolicy/modules/services/arpwatch.te +4
-0@@ -77,6 +77,10 @@ miscfiles_read_localization(arpwatch_t) userdom_dontaudit_search_user_home_dirs(arpwatch_t) userdom_dontaudit_use_unpriv_user_fds(arpwatch_t) +tunable_policy(`allow_bluetooth',` + allow arpwatch_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` mta_send_mail(arpwatch_t) ')policy/modules/services/bluetooth.if +0
-0
policy/modules/services/bluetooth.if interface(`bluetooth_stream_connect',` · line 72
Quoted 5 lines
policy/modules/services/bluetooth.if +2
-0@@ -68,6 +68,10 @@ interface(`bluetooth_stream_connect',` files_search_pids($1) allow $1 bluetooth_t:socket rw_socket_perms; stream_connect_pattern($1, bluetooth_var_run_t, bluetooth_var_run_t, bluetooth_t) + + tunable_policy(`deny_bluetooth',`',`
Missed a deny_bluetooth.
I'm also a little uneasy with adding this access here, as this would seem to be a side effect to a simple stream socket connection. Perhaps there should be a new interface like bluetooth_client(). It might also make sense in bluetooth_role(), as there is a generic socket class rule in there too.
Quoted 62 lines
policy/modules/services/bluetooth.if +2
-0+ allow $1 bluetooth_t:bluetooth_socket rw_socket_perms; + ') ') ########################################policy/modules/services/bluetooth.te +4
-0@@ -133,6 +133,10 @@ userdom_dontaudit_use_unpriv_user_fds(bluetooth_t) userdom_dontaudit_use_user_terminals(bluetooth_t) userdom_dontaudit_search_user_home_dirs(bluetooth_t) +tunable_policy(`allow_bluetooth',` + allow bluetooth_t self:bluetooth_socket create_stream_socket_perms; +') + optional_policy(` dbus_system_bus_client(bluetooth_t) dbus_connect_system_bus(bluetooth_t)policy/modules/services/ntop.te +4
-0@@ -96,6 +96,10 @@ miscfiles_read_localization(ntop_t) userdom_dontaudit_use_unpriv_user_fds(ntop_t) userdom_dontaudit_search_user_home_dirs(ntop_t) +tunable_policy(`allow_bluetooth',` + allow ntop_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` apache_read_sys_content(ntop_t) ')policy/modules/system/userdomain.if +8
-0@@ -1189,6 +1189,10 @@ template(`userdom_unpriv_user_template', ` corenet_udp_bind_generic_port($1_t) ') + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_socket_perms; + ') + optional_policy(` netutils_run_ping_cond($1_t, $1_r) netutils_run_traceroute_cond($1_t, $1_r)@@ -1362,6 +1366,10 @@ template(`userdom_admin_user_template',` userdom_manage_user_home_content_sockets($1_t) userdom_user_home_dir_filetrans_user_home_content($1_t, { dir file lnk_file fifo_file sock_file }) + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_stream_socket_perms; + ') + optional_policy(` postgresql_unconfined($1_t) ')
Signature · 1 line
Chris PeBenito
Quoted 84 lines · Chris PeBenito
Quoted 74 lines · Lukas Vrabec
Because of new
bluetooth_socketwhich is part ofextended_socket_classpolicy capability, it's possible to control which SELinux domains can use bluetooth wireless technology. Default value of the boolean is turned off.Signed-off-by Lukas Vrabec <[email protected]>---
policy/global_tunables | 7 +++++++ policy/modules/admin/netutils.te | 4 ++++ policy/modules/services/arpwatch.te | 4 ++++ policy/modules/services/bluetooth.if | 4 ++++ policy/modules/services/bluetooth.te | 4 ++++ policy/modules/services/ntop.te | 4 ++++ policy/modules/system/userdomain.if | 8 ++++++++7 files changed, 35 insertions(+)policy/global_tunables +0
-0@@ -4,6 +4,13 @@ # file should be used. #+## <desc>
policy/global_tunables +2
-0+## <p> +## Allow all system processes and Linux users to use bluetoothwireless technology.
policy/global_tunables +4
-0+## </p> +## </desc> +gen_tunable(allow_bluetooth,false) +## <desc>
## <p>
## Allow unconfined executables to make their heap memory executable. Doing this is a really bad idea. Probably indicates a badly coded executable, but could indicate an attack. This executable should be reported in bugzillapolicy/modules/admin/netutils.te +0
-0@@ -99,6 +99,10 @@ optional_policy(` xen_append_log(netutils_t) ')+tunable_policy(
allow_bluetooth',
+ allownetutils_tself:bluetooth_socketcreate_stream_socket_perms;
+')
+
########################################
#
# Ping local policypolicy/modules/services/arpwatch.te +0
-0@@ -77,6 +77,10 @@ miscfiles_read_localization(arpwatch_t) userdom_dontaudit_search_user_home_dirs(arpwatch_t) userdom_dontaudit_use_unpriv_user_fds(arpwatch_t)+tunable_policy(
allow_bluetooth',
+ allowarpwatch_tself:bluetooth_socketcreate_socket_perms; +')
+
optional_policy(`
mta_send_mail(arpwatch_t)
')policy/modules/services/bluetooth.if +0
-0policy/modules/services/bluetooth.if interface(`bluetooth_stream_connect',` · line 73
Quoted 6 lines
policy/modules/services/bluetooth.if +2
-0@@ -68,6 +68,10 @@ interface(`bluetooth_stream_connect',` files_search_pids($1) allow $1 bluetooth_t:socket rw_socket_perms; stream_connect_pattern($1, bluetooth_var_run_t, bluetooth_var_run_t, bluetooth_t) + + tunable_policy(`deny_bluetooth',`',`Missed a
deny_bluetooth.
Quoted 6 lines
I'm also a little uneasy with adding this access here, as this would seem to be a side effect to a simple stream socket connection. Perhaps there should be a new interface like bluetooth_client(). It might also make sense in
bluetooth_role(), as there is a generic socket class rule in there too.
Hi Chris,
I'll update deny_bluetooth() to allow_bluetooth().
So, you're suggesting create new interface bluetooth_client() but all bluetooth related stuff there, and use this interface in tunable_policy block instead of just allowing using bluetooth socket?
bluetooth_role() should be fixed to use only bluetooth_socket, not the general one. I'll create PR also for it.
Thanks,
Lukas.
Quoted 65 lines
Quoted 63 lines
policy/modules/services/bluetooth.if +2
-0+ allow $1 bluetooth_t:bluetooth_socket rw_socket_perms; + ') ') ########################################policy/modules/services/bluetooth.te +0
-0@@ -133,6 +133,10 @@ userdom_dontaudit_use_unpriv_user_fds(bluetooth_t) userdom_dontaudit_use_user_terminals(bluetooth_t) userdom_dontaudit_search_user_home_dirs(bluetooth_t)+tunable_policy(
allow_bluetooth',
+ allowbluetooth_tself:bluetooth_socketcreate_stream_socket_perms; +')
+
optional_policy(`
dbus_system_bus_client(bluetooth_t)dbus_connect_system_bus(bluetooth_t)policy/modules/services/ntop.te +0
-0@@ -96,6 +96,10 @@ miscfiles_read_localization(ntop_t) userdom_dontaudit_use_unpriv_user_fds(ntop_t) userdom_dontaudit_search_user_home_dirs(ntop_t)+tunable_policy(
allow_bluetooth',
+ allowntop_tself:bluetooth_socketcreate_socket_perms; +')
+
optional_policy(`apache_read_sys_content(ntop_t)
')policy/modules/system/userdomain.if +0
-0@@ -1189,6 +1189,10 @@ template(`userdom_unpriv_user_template', ` corenet_udp_bind_generic_port($1_t) ')+ tunable_policy(
allow_bluetooth',
+ allow $1_t self:bluetooth_socketcreate_socket_perms; + ')
+
optional_policy(`
netutils_run_ping_cond($1_t, $1_r)netutils_run_traceroute_cond($1_t, $1_r)policy/modules/system/userdomain.if +0
-0@@ -1362,6 +1366,10 @@ template(`userdom_admin_user_template',` userdom_manage_user_home_content_sockets($1_t)
userdom_user_home_dir_filetrans_user_home_content($1_t, { dir file lnk_file fifo_file sock_file })
+ tunable_policy(allow_bluetooth',
+ allow $1_t self:bluetooth_socketcreate_stream_socket_perms; + ')
+
optional_policy(`
postgresql_unconfined($1_t)
')
Signature · 3 lines
Lukas Vrabec Senior Software Engineer, Security Technologies Red Hat, Inc.
Quoted 92 lines · Lukas Vrabec
Quoted 84 lines · Chris PeBenito
Quoted 74 lines · Lukas Vrabec
Because of new
bluetooth_socketwhich is part ofextended_socket_classpolicy capability, it's possible to control which SELinux domains can use bluetooth wireless technology. Default value of the boolean is turned off.Signed-off-by Lukas Vrabec <[email protected]>--- policy/global_tunables | 7 +++++++ policy/modules/admin/netutils.te | 4 ++++ policy/modules/services/arpwatch.te | 4 ++++ policy/modules/services/bluetooth.if | 4 ++++ policy/modules/services/bluetooth.te | 4 ++++ policy/modules/services/ntop.te | 4 ++++ policy/modules/system/userdomain.if | 8 ++++++++ 7 files changed, 35 insertions(+)policy/global_tunables +2
-0@@ -4,6 +4,13 @@ # file should be used. # +## <desc> +## <p> +## Allow all system processes and Linux users to use bluetoothwireless technology.
policy/global_tunables +4
-0+## </p> +## </desc> +gen_tunable(allow_bluetooth,false) + ## <desc> ## <p> ## Allow unconfined executables to make their heap memoryexecutable. Doing this is a really bad idea. Probably indicates a badly coded executable, but could indicate an attack. This executable should be reported in bugzilla
policy/modules/admin/netutils.te +3
-0@@ -99,6 +99,10 @@ optional_policy(` xen_append_log(netutils_t) ') +tunable_policy(`allow_bluetooth',` + allow netutils_t self:bluetooth_socket create_stream_socket_perms; +') + ######################################## # # Ping local policypolicy/modules/services/arpwatch.te +3
-0@@ -77,6 +77,10 @@ miscfiles_read_localization(arpwatch_t) userdom_dontaudit_search_user_home_dirs(arpwatch_t) userdom_dontaudit_use_unpriv_user_fds(arpwatch_t) +tunable_policy(`allow_bluetooth',` + allow arpwatch_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` mta_send_mail(arpwatch_t) ')policy/modules/services/bluetooth.if +0
-0policy/modules/services/bluetooth.if interface(`bluetooth_stream_connect',` · line 73
Quoted 6 lines
policy/modules/services/bluetooth.if +2
-0@@ -68,6 +68,10 @@ interface(`bluetooth_stream_connect',` files_search_pids($1) allow $1 bluetooth_t:socket rw_socket_perms; stream_connect_pattern($1, bluetooth_var_run_t, bluetooth_var_run_t, bluetooth_t) + + tunable_policy(`deny_bluetooth',`',`Missed a
deny_bluetooth.Quoted 6 lines
I'm also a little uneasy with adding this access here, as this would seem to be a side effect to a simple stream socket connection. Perhaps there should be a new interface like bluetooth_client(). It might also make sense in
bluetooth_role(), as there is a generic socket class rule in there too.
Quoted 7 lines
Hi Chris,
I'll update
deny_bluetooth()toallow_bluetooth().So, you're suggesting create new interface
bluetooth_client()but all bluetooth related stuff there, and use this interface intunable_policyblock instead of just allowing using bluetooth socket?
bluetooth_client() would have the rules of bluetooth_stream_connect() and then the allow_bluetooth conditional rule. The stream socket connection can remain unconditional, if the bluetooth_socket access is sufficient to block bluetooth use.
Quoted 73 lines
bluetooth_role()should be fixed to use onlybluetooth_socket, not the general one. I'll create PR also for it.Thanks,
Lukas.Quoted 65 lines
Quoted 63 lines
policy/modules/services/bluetooth.if +2
-0+ allow $1 bluetooth_t:bluetooth_socket rw_socket_perms; + ') ') ########################################policy/modules/services/bluetooth.te +3
-0@@ -133,6 +133,10 @@ userdom_dontaudit_use_unpriv_user_fds(bluetooth_t) userdom_dontaudit_use_user_terminals(bluetooth_t) userdom_dontaudit_search_user_home_dirs(bluetooth_t) +tunable_policy(`allow_bluetooth',` + allow bluetooth_t self:bluetooth_socket create_stream_socket_perms; +') + optional_policy(` dbus_system_bus_client(bluetooth_t) dbus_connect_system_bus(bluetooth_t)policy/modules/services/ntop.te +3
-0@@ -96,6 +96,10 @@ miscfiles_read_localization(ntop_t) userdom_dontaudit_use_unpriv_user_fds(ntop_t) userdom_dontaudit_search_user_home_dirs(ntop_t) +tunable_policy(`allow_bluetooth',` + allow ntop_t self:bluetooth_socket create_socket_perms; +') + optional_policy(` apache_read_sys_content(ntop_t) ')policy/modules/system/userdomain.if +6
-0@@ -1189,6 +1189,10 @@ template(`userdom_unpriv_user_template', ` corenet_udp_bind_generic_port($1_t) ') + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_socket_perms; + ') + optional_policy(` netutils_run_ping_cond($1_t, $1_r) netutils_run_traceroute_cond($1_t, $1_r)@@ -1362,6 +1366,10 @@ template(`userdom_admin_user_template',` userdom_manage_user_home_content_sockets($1_t) userdom_user_home_dir_filetrans_user_home_content($1_t, { dir file lnk_file fifo_file sock_file }) + tunable_policy(`allow_bluetooth',` + allow $1_t self:bluetooth_socket create_stream_socket_perms; + ') + optional_policy(` postgresql_unconfined($1_t) ')
Signature · 1 line
Chris PeBenito