|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
policy_module(lpd,1.0)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
########################################
|
|
Chris PeBenito |
ad3b9d |
#
|
|
Chris PeBenito |
ad3b9d |
# Declarations
|
|
Chris PeBenito |
ad3b9d |
#
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type checkpc_t;
|
|
Chris PeBenito |
ad3b9d |
type checkpc_exec_t;
|
|
Chris PeBenito |
ad3b9d |
init_system_domain(checkpc_t,checkpc_exec_t)
|
|
Chris PeBenito |
ad3b9d |
role system_r types checkpc_t;
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type checkpc_log_t;
|
|
Chris PeBenito |
ad3b9d |
logging_log_file(checkpc_log_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type lpd_t;
|
|
Chris PeBenito |
ad3b9d |
type lpd_exec_t;
|
|
Chris PeBenito |
ad3b9d |
init_daemon_domain(lpd_t,lpd_exec_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type lpd_tmp_t;
|
|
Chris PeBenito |
ad3b9d |
files_tmp_file(lpd_tmp_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type lpd_var_run_t;
|
|
Chris PeBenito |
ad3b9d |
files_pid_file(lpd_var_run_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type print_spool_t;
|
|
Chris PeBenito |
ad3b9d |
files_tmp_file(print_spool_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type printer_t;
|
|
Chris PeBenito |
ad3b9d |
files_type(printer_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
type printconf_t;
|
|
Chris PeBenito |
ad3b9d |
files_type(printconf_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
########################################
|
|
Chris PeBenito |
ad3b9d |
#
|
|
Chris PeBenito |
ad3b9d |
# Checkpc local policy
|
|
Chris PeBenito |
ad3b9d |
#
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
# Allow checkpc to access the lpd spool so it can check & fix it.
|
|
Chris PeBenito |
ad3b9d |
# This requires that /usr/sbin/checkpc have type checkpc_t.
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t self:capability { setgid setuid dac_override };
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t self:process { fork signal_perms };
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t self:unix_stream_socket create_socket_perms;
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t checkpc_log_t:file create_file_perms;
|
|
Chris PeBenito |
ad3b9d |
logging_create_log(checkpc_t,checkpc_log_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t lpd_var_run_t:dir { search getattr };
|
|
Chris PeBenito |
ad3b9d |
files_search_pids(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t print_spool_t:file { rw_file_perms unlink };
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t print_spool_t:dir { read write search add_name remove_name getattr };
|
|
Chris PeBenito |
ad3b9d |
files_search_spool(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t printconf_t:file getattr;
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t printconf_t:dir { getattr search read };
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
kernel_read_system_state(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
ad3b9d |
allow checkpc_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_sendrecv_all_if(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_sendrecv_all_if(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_raw_sendrecv_all_if(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_sendrecv_all_nodes(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_sendrecv_all_nodes(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_raw_sendrecv_all_nodes(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_sendrecv_all_ports(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_sendrecv_all_ports(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_bind_all_nodes(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_bind_all_nodes(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_connect_all_ports(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
dev_append_printer(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
# This is less desirable, but checkpc demands /bin/bash and /bin/chown:
|
|
Chris PeBenito |
ad3b9d |
corecmd_exec_shell(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
corecmd_exec_bin(checkpc_t)
|
|
Chris PeBenito |
33acca |
corecmd_search_sbin(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
domain_use_wide_inherit_fd(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
files_read_etc_files(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
files_read_etc_runtime_files(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
init_use_script_pty(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
# Allow access to /dev/console through the fd:
|
|
Chris PeBenito |
ad3b9d |
init_use_fd(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
libs_use_ld_so(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
libs_use_shared_libs(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
sysnet_read_config(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
33acca |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
33acca |
term_use_generic_pty(checkpc_t)
|
|
Chris PeBenito |
33acca |
term_use_unallocated_tty(checkpc_t)
|
|
Chris PeBenito |
33acca |
')
|
|
Chris PeBenito |
33acca |
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`cron.te',`
|
|
Chris PeBenito |
ad3b9d |
cron_system_entry(checkpc_t,checkpc_exec_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`logging.te',`
|
|
Chris PeBenito |
ad3b9d |
logging_send_syslog_msg(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
ad3b9d |
nis_use_ypbind(checkpc_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
########################################
|
|
Chris PeBenito |
ad3b9d |
#
|
|
Chris PeBenito |
ad3b9d |
# Lpd local policy
|
|
Chris PeBenito |
ad3b9d |
#
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t self:capability { setgid setuid net_bind_service dac_read_search dac_override chown fowner };
|
|
Chris PeBenito |
ad3b9d |
dontaudit lpd_t self:capability sys_tty_config;
|
|
Chris PeBenito |
2e0a88 |
allow lpd_t self:process signal_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t lpd_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t lpd_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
ad3b9d |
files_create_tmp_files(lpd_t, lpd_tmp_t, { file dir })
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t lpd_var_run_t:dir rw_dir_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t lpd_var_run_t:file create_file_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t lpd_var_run_t:sock_file create_file_perms;
|
|
Chris PeBenito |
ad3b9d |
files_create_pid(lpd_t,lpd_var_run_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
# Write to /var/spool/lpd.
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t print_spool_t:dir rw_dir_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t print_spool_t:file create_file_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t print_spool_t:file rw_file_perms;
|
|
Chris PeBenito |
ad3b9d |
files_search_spool(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
# lpd must be able to execute the filter utilities in /usr/share/printconf.
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t printconf_t:dir { getattr search read };
|
|
Chris PeBenito |
ad3b9d |
can_exec(lpd_t, printconf_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
# Create and bind to /dev/printer.
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t printer_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
ad3b9d |
dev_create_dev_node(lpd_t,printer_t,lnk_file)
|
|
Chris PeBenito |
ad3b9d |
# cjp: I believe these have no effect:
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t printer_t:unix_stream_socket name_bind;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t printer_t:unix_dgram_socket name_bind;
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
kernel_read_kernel_sysctl(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
# bash wants access to /proc/meminfo
|
|
Chris PeBenito |
ad3b9d |
kernel_read_system_state(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t self:tcp_socket create_stream_socket_perms;
|
|
Chris PeBenito |
ad3b9d |
allow lpd_t self:udp_socket create_stream_socket_perms;
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_sendrecv_all_if(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_sendrecv_all_if(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_raw_sendrecv_all_if(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_sendrecv_all_nodes(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_sendrecv_all_nodes(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_raw_sendrecv_all_nodes(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_sendrecv_all_ports(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_sendrecv_all_ports(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_bind_all_nodes(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_udp_bind_all_nodes(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corenet_tcp_bind_printer_port(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
dev_read_sysfs(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
dev_rw_printer(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
fs_getattr_all_fs(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
fs_search_auto_mountpoints(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
term_dontaudit_use_console(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
# Filter scripts may be shell scripts, and may invoke progs like /bin/mktemp
|
|
Chris PeBenito |
ad3b9d |
corecmd_exec_bin(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corecmd_exec_sbin(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
corecmd_exec_shell(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
domain_use_wide_inherit_fd(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
files_read_etc_runtime_files(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
files_read_usr_files(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
# for defoma
|
|
Chris PeBenito |
ad3b9d |
files_list_world_readable(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
files_read_world_readable_files(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
files_read_world_readable_symlinks(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
files_list_var_lib(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
files_read_var_lib_files(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
files_read_var_lib_symlinks(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
# config files for lpd are of type etc_t, probably should change this
|
|
Chris PeBenito |
ad3b9d |
files_read_etc_files(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
init_use_fd(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
init_use_script_pty(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
libs_use_ld_so(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
libs_use_shared_libs(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
logging_send_syslog_msg(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
miscfiles_read_fonts(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
miscfiles_read_localization(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
sysnet_read_config(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
userdom_dontaudit_use_unpriv_user_fd(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
userdom_dontaudit_search_sysadm_home_dir(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
ad3b9d |
term_dontaudit_use_unallocated_tty(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
term_dontaudit_use_generic_pty(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
files_dontaudit_read_root_file(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
ad3b9d |
nis_use_ypbind(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
nis_tcp_connect_ypbind(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`portmap.te',`
|
|
Chris PeBenito |
ad3b9d |
portmap_udp_sendto(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`selinuxutil.te',`
|
|
Chris PeBenito |
ad3b9d |
seutil_sigchld_newrole(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`udev.te', `
|
|
Chris PeBenito |
ad3b9d |
udev_read_db(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
|
|
Chris PeBenito |
ad3b9d |
ifdef(`TODO',`
|
|
Chris PeBenito |
ad3b9d |
optional_policy(`rhgb.te',`
|
|
Chris PeBenito |
ad3b9d |
rhgb_domain(lpd_t)
|
|
Chris PeBenito |
ad3b9d |
')
|
|
Chris PeBenito |
ad3b9d |
') dnl end TODO
|
|
Chris PeBenito |
ad3b9d |
|