selinux-policy/refpolicy/policy/modules/kernel/terminal.if

554 lines
14 KiB
Plaintext
Raw Normal View History

## <module name="terminal" layer="kernel">
## <summary>Policy for terminals.</summary>
2005-04-20 19:07:16 +00:00
########################################
#
# terminal_make_pseudoterminal(type)
#
define(`terminal_make_pseudoterminal',`
requires_block_template(`$0'_depend)
allow $1 devpts_t:filesystem associate;
typeattribute $1 ptynode;
')
define(`terminal_make_pseudoterminal_depend',`
attribute ptynode;
type devpts_t;
class filesystem associate;
')
########################################
#
# terminal_make_user_pseudoterminal(domain,type)
#
define(`terminal_make_user_pseudoterminal',`
requires_block_template(`$0'_depend)
terminal_make_pseudoterminal($1)
type_change $1 server_ptynode:chr_file $2;
')
define(`terminal_make_user_pseudoterminal_depend',`
attribute server_ptynode;
')
########################################
#
# terminal_make_service_pseudoterminal(type)
#
define(`terminal_make_service_pseudoterminal',`
requires_block_template(`$0'_depend)
terminal_make_pseudoterminal($1)
typeattribute $1 server_ptynode;
')
define(`terminal_make_service_pseudoterminal_depend',`
attribute server_ptynode;
')
########################################
#
# terminal_make_physical_terminal(domain,type)
#
define(`terminal_make_physical_terminal',`
requires_block_template(`$0'_depend)
typeattribute $2 ttynode;
type_change $1 tty_device_t:chr_file $2;
# Debian login is from shadow utils and does not allow resetting the perms.
# have to fix this!
tunable_policy(`distro_debian',`
type_change $1 ttyfile:chr_file $2;
')
2005-05-30 21:17:20 +00:00
tunable_policy(`distro_redhat',`
2005-05-31 13:45:37 +00:00
filesystem_tmpfs_associate($2)
2005-05-30 21:17:20 +00:00
')
')
define(`terminal_make_physical_terminal_depend',`
attribute ttynode;
type tty_device_t;
')
########################################
#
# terminal_create_private_pseudoterminal(domain,ptytype)
#
define(`terminal_create_private_pseudoterminal',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 ptmx_t:chr_file { getattr read write };
allow $1 devpts_t:dir { getattr search read };
allow $1 devpts_t:filesystem getattr;
dontaudit $1 bsdpty_device_t:chr_file { getattr read write };
type_transition $1 devpts_t:chr_file $2;
')
define(`terminal_create_pseudoterminal_depend',`
type ptmx_t, devpts_t;
class filesystem getattr;
class dir { getattr search read };
class chr_file { getattr read write };
')
########################################
#
# terminal_use_all_terminals(domain)
#
define(`terminal_use_all_terminals',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 devpts_t:dir r_dir_perms;
allow $1 { console_device_t tty_device_t ttynode ptynode }:chr_file rw_file_perms;
')
define(`terminal_use_all_terminals_depend',`
attribute ttynode, ptynode;
2005-05-30 21:17:20 +00:00
type console_device_t, devpts_t, tty_device_t;
class dir r_dir_perms;
class chr_file rw_file_perms;
')
########################################
## <interface name="terminal_write_console">
## <description>
## Write to the console.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## <infoflow type="write" weight="10"/>
## </interface>
#
define(`terminal_write_console',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 console_device_t:chr_file write;
')
define(`terminal_use_console_depend',`
type console_device_t;
class chr_file write;
')
########################################
## <interface name="terminal_use_console">
## <description>
## Read from and write to the console.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## <infoflow type="both" weight="10"/>
## </interface>
#
2005-05-13 14:37:13 +00:00
define(`terminal_use_console',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 console_device_t:chr_file rw_file_perms;
')
2005-05-13 14:37:13 +00:00
define(`terminal_use_console_depend',`
type console_device_t;
class chr_file rw_file_perms;
')
########################################
## <interface name="terminal_ignore_use_console">
## <description>
## Do not audit read from or write to the console.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## <infoflow type="both" weight="10"/>
## </interface>
#
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_use_console',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
dontaudit $1 console_device_t:chr_file { read write };
')
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_use_console_depend',`
type console_device_t;
class chr_file { read write };
')
########################################
#
2005-05-13 14:37:13 +00:00
# terminal_set_console_attributes(domain)
#
2005-05-13 14:37:13 +00:00
define(`terminal_set_console_attributes',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
devices_list_device_nodes($1,optional)
allow $1 console_device_t:chr_file setattr;
')
2005-05-13 14:37:13 +00:00
define(`terminal_set_console_attributes_depend',`
type console_device_t;
class chr_file setattr;
devices_list_device_nodes_depend
')
########################################
#
2005-05-13 14:37:13 +00:00
# terminal_list_pseudoterminals(domain)
#
2005-05-13 14:37:13 +00:00
define(`terminal_list_pseudoterminals',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 devpts_t:dir { getattr search read };
')
2005-05-13 14:37:13 +00:00
define(`terminal_list_pseudoterminals_depend',`
type devpts_t;
class dir { getattr search read };
2005-05-13 14:37:13 +00:00
devices_list_device_nodes_depend
')
########################################
#
2005-05-13 14:37:13 +00:00
# terminal_ignore_list_pseudoterminals(domain)
#
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_list_pseudoterminals',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
dontaudit $1 devpts_t:dir { getattr search read };
')
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_list_pseudoterminals_depend',`
type devpts_t;
class dir { getattr search read };
')
########################################
#
2005-05-13 14:37:13 +00:00
# terminal_use_general_pseudoterminal(domain)
#
2005-05-13 14:37:13 +00:00
define(`terminal_use_general_pseudoterminal',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
devices_list_device_nodes($1)
allow $1 devpts_t:chr_file { read write };
')
2005-05-13 14:37:13 +00:00
define(`terminal_use_general_pseudoterminal_depend',`
type devpts_t;
class chr_file { read write };
')
2005-04-14 20:18:17 +00:00
########################################
#
2005-05-13 14:37:13 +00:00
# terminal_ignore_use_general_pseudoterminal(domain)
2005-04-14 20:18:17 +00:00
#
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_use_general_pseudoterminal',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
dontaudit $1 devpts_t:chr_file { read write };
2005-04-14 20:18:17 +00:00
')
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_use_general_pseudoterminal_depend',`
type devpts_t;
2005-04-14 20:18:17 +00:00
class chr_file { read write };
')
2005-04-27 21:54:39 +00:00
########################################
#
2005-05-13 14:37:13 +00:00
# terminal_use_controlling_terminal(domain)
2005-04-27 21:54:39 +00:00
#
2005-05-13 14:37:13 +00:00
define(`terminal_use_controlling_terminal',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
devices_list_device_nodes($1)
2005-05-26 20:38:45 +00:00
allow $1 devtty_t:chr_file { getattr read write ioctl };
2005-04-27 21:54:39 +00:00
')
2005-05-13 14:37:13 +00:00
define(`terminal_use_controlling_terminal_depend',`
type devtty_t;
2005-05-26 20:38:45 +00:00
class chr_file { getattr read write ioctl };
2005-04-27 21:54:39 +00:00
')
2005-04-28 15:47:50 +00:00
########################################
#
2005-05-13 14:37:13 +00:00
# terminal_ignore_use_pseudoterminal_multiplexer(domain)
2005-04-28 15:47:50 +00:00
#
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_use_pseudoterminal_multiplexer',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
dontaudit $1 ptmx_t:chr_file { getattr read write };
2005-04-28 15:47:50 +00:00
')
2005-05-13 14:37:13 +00:00
define(`terminal_ignore_use_pseudoterminal_multiplexer_depend',`
type ptmx_t;
class chr_file { getattr read write };
2005-04-28 15:47:50 +00:00
')
2005-04-14 20:18:17 +00:00
########################################
#
# terminal_get_all_private_pseudoterminal_attributes(domain)
2005-04-14 20:18:17 +00:00
#
define(`terminal_get_all_private_pseudoterminal_attributes',`
requires_block_template(`$0'_depend)
2005-05-05 17:44:11 +00:00
devices_list_device_nodes($1)
2005-05-13 14:37:13 +00:00
allow $1 devpts_t:dir { getattr search read };
allow $1 ptynode:chr_file getattr;
2005-04-14 20:18:17 +00:00
')
define(`terminal_get_all_private_pseudoterminal_attributes_depend',`
2005-05-13 14:37:13 +00:00
attribute ptynode;
class dir { getattr search read };
class chr_file getattr;
')
########################################
#
# terminal_use_all_private_pseudoterminals(domain)
2005-05-13 14:37:13 +00:00
#
define(`terminal_use_all_private_pseudoterminals',`
2005-05-13 14:37:13 +00:00
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 devpts_t:dir { getattr read search };
allow $1 ptynode:chr_file { getattr read write ioctl };
2005-05-13 14:37:13 +00:00
')
define(`terminal_use_all_private_pseudoterminals_depend',`
2005-05-13 14:37:13 +00:00
attribute ptynode;
class dir { getattr search read };
class chr_file { getattr read write ioctl };
2005-05-05 17:44:11 +00:00
')
########################################
#
# terminal_ignore_use_all_private_pseudoterminals(domain)
2005-05-05 17:44:11 +00:00
#
define(`terminal_ignore_use_all_private_pseudoterminals',`
2005-05-05 17:44:11 +00:00
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
dontaudit $1 ptynode:chr_file { read write };
2005-05-05 17:44:11 +00:00
')
define(`terminal_ignore_use_all_private_pseudoterminals_depend',`
2005-05-13 14:37:13 +00:00
attribute ptynode;
2005-05-05 17:44:11 +00:00
class chr_file { read write };
2005-04-14 20:18:17 +00:00
')
2005-05-13 14:37:13 +00:00
########################################
#
# terminal_get_general_physical_terminal_attributes(domain)
#
define(`terminal_get_general_physical_terminal_attributes',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 tty_device_t:chr_file getattr;
')
define(`terminal_get_general_physical_terminal_attributes_depend',`
type tty_device_t;
class chr_file getattr;
')
########################################
#
# terminal_set_general_physical_terminal_attributes(domain)
#
define(`terminal_set_general_physical_terminal_attributes',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 tty_device_t:chr_file setattr;
')
define(`terminal_set_general_physical_terminal_attributes_depend',`
type tty_device_t;
class chr_file setattr;
')
########################################
#
# terminal_relabel_general_physical_terminal(domain)
#
define(`terminal_relabel_general_physical_terminal',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 tty_device_t:chr_file { relabelfrom relabelto };
')
define(`terminal_relabel_general_physical_terminal_depend',`
type tty_device_t;
class chr_file { relabelfrom relabelto };
')
2005-04-14 20:18:17 +00:00
########################################
#
# terminal_reset_physical_terminal_labels(domain)
2005-04-14 20:18:17 +00:00
#
define(`terminal_reset_physical_terminal_labels',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 ttynode:chr_file relabelfrom;
allow $1 tty_device_t:chr_file relabelto;
2005-04-14 20:18:17 +00:00
')
define(`terminal_reset_physical_terminal_labels_depend',`
attribute ttynode;
type tty_device_t;
class chr_file { relabelfrom relabelto };
2005-04-14 20:18:17 +00:00
')
########################################
## <interface name="terminal_write_general_physical_terminal">
## <description>
## Write to general ttys. Has a backchannel of
## getting all tty attributes.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## <infoflow type="write" weight="10"/>
## </interface>
#
define(`terminal_write_general_physical_terminal',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 tty_device_t:chr_file { getattr write };
')
define(`terminal_write_general_physical_terminal_depend',`
type tty_device_t;
class chr_file { read write };
')
2005-04-14 20:18:17 +00:00
########################################
#
# terminal_use_general_physical_terminal(domain)
#
define(`terminal_use_general_physical_terminal',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 tty_device_t:chr_file { getattr read write ioctl };
')
define(`terminal_use_general_physical_terminal_depend',`
type tty_device_t;
class chr_file { getattr read write ioctl };
')
########################################
2005-04-14 20:18:17 +00:00
#
# terminal_ignore_use_general_physical_terminal(domain)
#
define(`terminal_ignore_use_general_physical_terminal',`
requires_block_template(`$0'_depend)
dontaudit $1 tty_device_t:chr_file { read write };
')
define(`terminal_ignore_use_general_physical_terminal_depend',`
type tty_device_t;
class chr_file { read write };
')
########################################
#
# terminal_get_all_private_physical_terminal_attributes(domain)
#
define(`terminal_get_all_private_physical_terminal_attributes',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
devices_list_device_nodes($1)
allow $1 ttynode:chr_file getattr;
')
define(`terminal_get_all_private_physical_terminal_attributes_depend',`
2005-05-13 14:37:13 +00:00
attribute ttynode;
class chr_file getattr;
')
########################################
#
# terminal_set_all_private_physical_terminal_attributes(domain)
#
define(`terminal_set_all_private_physical_terminal_attributes',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 ttynode:chr_file setattr;
')
define(`terminal_set_all_private_physical_terminal_attributes_depend',`
attribute ttynode;
class chr_file setattr;
')
2005-04-14 20:18:17 +00:00
########################################
#
# terminal_ignore_get_all_private_physical_terminal_attributes(domain)
2005-04-14 20:18:17 +00:00
#
define(`terminal_ignore_get_all_private_physical_terminal_attributes',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
dontaudit $1 ttynode:chr_file getattr;
2005-04-14 20:18:17 +00:00
')
define(`terminal_ignore_get_all_private_physical_terminal_attributes_depend',`
2005-05-13 14:37:13 +00:00
attribute ttynode;
class chr_file getattr;
2005-04-14 20:18:17 +00:00
')
2005-04-28 21:41:09 +00:00
########################################
#
# terminal_relabel_all_private_physical_terminals(domain)
#
define(`terminal_relabel_all_private_physical_terminals',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 ttynode:chr_file { relabelfrom relabelto };
')
define(`terminal_relabel_all_private_physical_terminals_depend',`
attribute ttynode;
class chr_file { relabelfrom relabelto };
')
########################################
## <interface name="terminal_write_all_private_physical_terminals">
## <description>
## Write to all private ttys. Has a backchannel of
## getting all private tty attributes.
## </description>
## <parameter name="domain">
## The type of the process performing this action.
## </parameter>
## <infoflow type="write" weight="10"/>
## </interface>
#
define(`terminal_write_all_private_physical_terminals',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 ttynode:chr_file { getattr write };
')
define(`terminal_write_all_private_physical_terminals_depend',`
attribute ttynode;
class chr_file { getattr write };
')
2005-04-28 21:41:09 +00:00
########################################
#
# terminal_use_all_private_physical_terminals(domain)
2005-04-28 21:41:09 +00:00
#
define(`terminal_use_all_private_physical_terminals',`
requires_block_template(`$0'_depend)
devices_list_device_nodes($1)
allow $1 ttynode:chr_file { getattr read write ioctl };
2005-04-28 21:41:09 +00:00
')
define(`terminal_use_all_private_physical_terminals_depend',`
2005-05-13 14:37:13 +00:00
attribute ttynode;
class chr_file { getattr read write ioctl };
')
########################################
#
# terminal_ignore_use_all_private_physical_terminals(domain)
#
define(`terminal_ignore_use_all_private_physical_terminals',`
requires_block_template(`$0'_depend)
2005-05-13 14:37:13 +00:00
dontaudit $1 ttynode:chr_file { read write };
')
define(`terminal_ignore_use_all_private_physical_terminals_depend',`
2005-05-13 14:37:13 +00:00
attribute ttynode;
class chr_file { read write };
2005-04-28 21:41:09 +00:00
')
## </module>