SERefpolicy for Debian patches
Hi,
I've recently been working a bit on bringing SERefPoliy to Debian. See also http://selinux.alioth.debian.org/experimental/
and the SELinux on Debian mailing lists.
Attached is a diff for the reference policy to add dpkg/apt-get policies.
Note that this might break apt-get on Redhat, since I have no idea about that interaction... But having /usr/bin/apt-get labeled rpm_exec_t sounds weird to me anyway. ;-)
Also: is there a way to make the sendmail and postfix modules conflict? They seem to interfere rather badly.
The dpkg policy doesn't use dpkg_script_t yet properly. When extracting a new package, the new packages' scripts are not labeled correctly. I guess a dpkg patch is required to fix that. But basic package installation and removal hopefully should be okay now. Anyway, it's a start... ;-)
No way to run refpolicy on Debian in full enforcing mode yet, though.
best regards,
Erich Schubert
Signature · 3 lines
erich@(vitavonni.de|debian.org) -- GPG Key ID: 4B3A135C (o_
The best things in life are free: Friendship and Love. //\
Ein Freund ist ein Geschenk, das man sich selbst macht. V_/_? policy/modules/admin/apt.fc
? policy/modules/admin/apt.if
? policy/modules/admin/apt.te
? policy/modules/admin/dpkg.fc
? policy/modules/admin/dpkg.if
? policy/modules/admin/dpkg.te
Index: policy/modules/admin/rpm.fc
===================================================================
RCS file: /cvsroot/serefpolicy/refpolicy/policy/modules/admin/rpm.fc,v retrieving revision 1.7
modules/admin/rpm.fc +0 -3
@@ -2,9 +2,6 @@ /bin/rpm -- gen_context(system_u:object_r:rpm_exec_t,s0) /usr/bin/smart -- gen_context(system_u:object_r:rpm_exec_t,s0) -/usr/bin/apt-get -- gen_context(system_u:object_r:rpm_exec_t,s0) -/usr/bin/apt-shell -- gen_context(system_u:object_r:rpm_exec_t,s0) -/usr/bin/synaptic -- gen_context(system_u:object_r:rpm_exec_t,s0) /usr/bin/yum -- gen_context(system_u:object_r:rpm_exec_t,s0) /usr/lib(64)?/rpm/rpmd -- gen_context(system_u:object_r:bin_t,s0)
Index: policy/modules/admin/usermanage.te
===================================================================
RCS file: /cvsroot/serefpolicy/refpolicy/policy/modules/admin/usermanage.te,v retrieving revision 1.28
modules/admin/usermanage.te +10 -0
@@ -261,6 +261,11 @@ optional_policy(`rpm',` rpm_rw_pipes(groupadd_t) ') +optional_policy(`dpkg',` + dpkg_use_fd(groupadd_t) + dpkg_rw_pipes(groupadd_t) +') + ######################################## # # Passwd local policy
@@ -523,3 +528,8 @@ optional_policy(`rpm',` rpm_use_fd(useradd_t) rpm_rw_pipes(useradd_t) ') + +optional_policy(`dpkg',` + dpkg_use_fd(useradd_t) + dpkg_rw_pipes(useradd_t) +')
Index: policy/modules/system/userdomain.te
===================================================================
RCS file: /cvsroot/serefpolicy/refpolicy/policy/modules/system/userdomain.te,v retrieving revision 1.58
modules/system/userdomain.te +8 -0
@@ -340,6 +340,14 @@ ifdef(`targeted_policy',` rpm_run(sysadm_t,sysadm_r,admin_terminal) ') + optional_policy(`apt',` + apt_run(sysadm_t,sysadm_r,admin_terminal) + ') + + optional_policy(`dpkg',` + dpkg_run(sysadm_t,sysadm_r,admin_terminal) + ') + optional_policy(`samba',` samba_run_net(sysadm_t,sysadm_r,admin_terminal) samba_run_winbind_helper(sysadm_t,sysadm_r,admin_terminal)
/usr/bin/apt-get -- gen_context(system_u:object_r:apt_exec_t,s0)
# apt-shell is redhat specific /usr/bin/apt-shell -- gen_context(system_u:object_r:apt_exec_t,s0) # other package managers /usr/bin/aptitude -- gen_context(system_u:object_r:apt_exec_t,s0) /usr/sbin/synaptic -- gen_context(system_u:object_r:apt_exec_t,s0) # these don't need special privileges /usr/bin/apt-cache -- gen_context(system_u:object_r:bin_t,s0) /usr/bin/apt-config -- gen_context(system_u:object_r:bin_t,s0)
/usr/lib(64)?/apt/methods.+ -- gen_context(system_u:object_r:bin_t,s0)
# package list repository /var/lib/apt(/.*)? gen_context(system_u:object_r:apt_var_lib_t,s0) # package cache repository /var/cache/apt(/.*)? gen_context(system_u:object_r:apt_var_cache_t,s0)
## <summary>Policy for the APT advanced package toll.</summary>
########################################
## <summary>
## Execute apt programs in the apt domain.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(apt_domtrans',
gen_require(` type apt_t, apt_exec_t; ') files_search_usr($1) corecmd_search_bin($1) domain_auto_trans($1,apt_exec_t,apt_t) # allow basic communication allow $1 apt_t:fd use; allow apt_t $1:fd use; allow apt_t $1:fifo_file rw_file_perms; allow apt_t $1:process sigchld;
')
########################################
## <summary>
## Execute apt programs in the apt domain.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
## <param name="role">
## <summary>
## The role to allow the apt domain.
## </summary>
## </param>
## <param name="terminal">
## <summary>
## The type of the terminal allow the apt domain to use.
## </summary>
## </param>
#
interface(apt_run',
apt_domtrans($1) role $2 types apt_t; allow apt_t $3:chr_file rw_term_perms; # TODO: we'll likely have to add dpkg_run here.
')
########################################
## <summary>
## Inherit and use file descriptors from apt.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(apt_use_fd',
gen_require(` type apt_t; ') allow $1 apt_t:fd use; # TODO: enforce dpkg_use_fd?
')
########################################
## <summary>
## Read from an unnamed apt pipe.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(apt_read_pipes',
gen_require(` type apt_t; ') allow $1 apt_t:fifo_file r_file_perms; # TODO: enforce dpkg_read_pipes?
')
########################################
## <summary>
## Read and write an unnamed apt pipe.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(apt_rw_pipes',
gen_require(` type apt_t; ') allow $1 apt_t:fifo_file rw_file_perms; # TODO: enforce dpkg_rw_pipes?
')
########################################
## <summary>
## Read the apt package database.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(apt_read_db',
gen_require(`
type apt_var_lib_t;
')
files_search_var_lib($1)
allow $1 apt_var_lib_t:dir r_dir_perms;
allow $1 apt_var_lib_t:file { getattr read };
allow $1 apt_var_lib_t:lnk_file r_file_perms;')
########################################
## <summary>
## Create, read, write, and delete the apt package database.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(apt_manage_db',
gen_require(`
type apt_var_lib_t;
')
files_search_var_lib($1)
allow $1 apt_var_lib_t:dir rw_dir_perms;
allow $1 apt_var_lib_t:file { getattr create read write append unlink };
allow $1 apt_var_lib_t:lnk_file { getattr read write unlink };')
########################################
## <summary>
## Do not audit attempts to create, read,
## write, and delete the apt package database.
## </summary>
## <param name="domain">
## <summary>
## Domain to not audit.
## </summary>
## </param>
#
interface(apt_dontaudit_manage_db',
gen_require(` type apt_var_lib_t; ') dontaudit $1 apt_var_lib_t:dir rw_dir_perms; dontaudit $1 apt_var_lib_t:file create_file_perms; dontaudit $1 apt_var_lib_t:lnk_file create_lnk_perms;
')
policy_module(apt,0.1.0)
########################################
#
# Declarations
#
type apt_t;
type apt_exec_t;
role system_r types apt_t;init_system_domain(apt_t,apt_exec_t)domain_system_change_exemption(apt_t)domain_getattr_all_domains(apt_t)
type apt_tmp_t;files_tmp_file(apt_tmp_t)
type apt_tmpfs_t;files_tmpfs_file(apt_tmpfs_t)
# status files type apt_var_lib_t; files_type(apt_var_lib_t) typealias apt_var_lib_t alias var_lib_apt_t;
# package cache type apt_var_cache_t; files_type(apt_var_cache_t) typealias apt_var_cache_t alias var_cache_apt_t;
########################################
#
# apt Local policy #
allow apt_t self:capability { chown dac_override fowner fsetid }; allow apt_t self:process { signal setpgid fork };
allow apt_t self:fd use;
allow apt_t self:fifo_file rw_file_perms;
allow apt_t self:unix_dgram_socket create_socket_perms; allow apt_t self:unix_stream_socket rw_stream_socket_perms; allow apt_t self:unix_dgram_socket sendto;
allow apt_t self:unix_stream_socket connectto;
allow apt_t self:udp_socket { connect };
allow apt_t self:udp_socket create_socket_perms;
allow apt_t self:tcp_socket create_stream_socket_perms; allow apt_t self:shm create_shm_perms;
allow apt_t self:sem create_sem_perms;
allow apt_t self:msgq create_msgq_perms;
allow apt_t self:msg { send receive };
allow apt_t self:dir search;
allow apt_t self:file r_file_perms;
allow apt_t apt_tmp_t:dir create_dir_perms; allow apt_t apt_tmp_t:file create_file_perms; files_filetrans_tmp(apt_t, apt_tmp_t, { file dir })
allow apt_t apt_tmpfs_t:dir create_dir_perms;
allow apt_t apt_tmpfs_t:file create_file_perms;
allow apt_t apt_tmpfs_t:lnk_file create_file_perms;
allow apt_t apt_tmpfs_t:sock_file create_file_perms;
allow apt_t apt_tmpfs_t:fifo_file create_file_perms; fs_filetrans_tmpfs(apt_t,apt_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
# Access /var/lib/apt files
allow apt_t apt_var_lib_t:file create_file_perms;
allow apt_t apt_var_lib_t:dir rw_dir_perms;files_filetrans_var_lib(apt_t,apt_var_lib_t,dir)
# Access /var/cache/apt files
allow apt_t apt_var_cache_t:file create_file_perms; allow apt_t apt_var_cache_t:dir rw_dir_perms; files_filetrans_var(apt_t,apt_var_cache_t,dir)
kernel_read_system_state(apt_t)kernel_read_kernel_sysctls(apt_t)
optional_policy(dpkg',
# dpkg interaction dpkg_read_db(apt_t) dpkg_domtrans(apt_t) dpkg_lock_db(apt_t) ') optional_policy(`rpm',` # rpm interaction - guessed rpm_read_db(apt_t) rpm_domtrans(apt_t) rpm_manage_db(apt_t) ')
corenet_tcp_sendrecv_all_if(apt_t)corenet_udp_sendrecv_all_if(apt_t)corenet_tcp_sendrecv_all_nodes(apt_t)corenet_udp_sendrecv_all_nodes(apt_t)corenet_tcp_sendrecv_all_ports(apt_t)corenet_udp_sendrecv_all_ports(apt_t)corenet_non_ipsec_sendrecv(apt_t)
# TODO: reall allow all these?corenet_tcp_bind_all_nodes(apt_t)corenet_udp_bind_all_nodes(apt_t)corenet_tcp_connect_all_ports(apt_t)
dev_read_urand(apt_t)
# to launch dpkg-preconfigure corecmd_exec_bin(apt_t) corecmd_exec_shell(apt_t) corecmd_exec_sbin(apt_t) files_exec_usr_files(apt_t)
term_list_ptys(apt_t)term_use_all_terms(apt_t)seutil_use_newrole_fd(apt_t)
libs_use_ld_so(apt_t)libs_use_shared_libs(apt_t)libs_exec_ld_so(apt_t)libs_exec_lib_files(apt_t)miscfiles_read_localization(apt_t)files_read_etc_files(apt_t)
logging_send_syslog_msg(apt_t)
sysnet_read_config(apt_t)
ifdef(targeted_policy',
unconfined_domain(apt_t)
')
# with boolean, for cron-apt and such? #optional_policy(`cron',` # cron_system_entry(apt_t,apt_exec_t) #')
optional_policy(nis',
nis_use_ypbind(apt_t)
')
files_read_etc_runtime_files(apt_t)
# Debian package manager/usr/bin/dpkg -- gen_context(system_u:object_r:dpkg_exec_t,s0)/usr/bin/debsums -- gen_context(system_u:object_r:dpkg_exec_t,s0)/usr/sbin/dpkg-reconfigure -- gen_context(system_u:object_r:dpkg_exec_t,s0)/usr/sbin/dpkg-preconfigure -- gen_context(system_u:object_r:dpkg_exec_t,s0)
# not sure if dselect should be in apt instead? /usr/bin/dselect -- gen_context(system_u:object_r:dpkg_exec_t,s0)
/usr/lib(64)?/dpkg/.+ -- gen_context(system_u:object_r:bin_t,s0)/usr/bin/update-menus -- gen_context(system_u:object_r:bin_t,s0)/usr/share/debconf/.+ -- gen_context(system_u:object_r:bin_t,s0)
/var/lib/dpkg(/.*)? gen_context(system_u:object_r:dpkg_var_lib_t,s0)
# lockfile is treated specially, since used by apt, too /var/lib/dpkg/(meth)?lock -- gen_context(system_u:object_r:dpkg_lock_t,s0) # this is where package scripts live /var/lib/dpkg/info/.+\.(pre|post)(rm|inst) -- gen_context(system_u:object_r:dpkg_script_exec_t,s0) /var/lib/dpkg/info/.+\.config -- gen_context(system_u:object_r:dpkg_script_exec_t,s0) # temp file locations for new packages being installed /var/lib/dpkg/tmp\.ci/(post|pre)(rm|inst) -- gen_context(system_u:object_r:dpkg_script_exec_t,s0) /var/lib/dpkg/tmp\.ci/config -- gen_context(system_u:object_r:dpkg_script_exec_t,s0)
## <summary>Policy for the Debian package manager.</summary> # TODO: need debconf policy
# TODO: need install-menu policy
########################################
## <summary>
## Execute dpkg programs in the dpkg domain.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_domtrans',
gen_require(` type dpkg_t, dpkg_exec_t; ') files_search_usr($1) corecmd_search_bin($1) domain_auto_trans($1,dpkg_exec_t,dpkg_t) # allow basic communication allow $1 dpkg_t:fd use; allow dpkg_t $1:fd use; allow dpkg_t $1:fifo_file rw_file_perms; allow dpkg_t $1:process sigchld;
')
# TODO: will we actually use a dpkg_script domain?
########################################
## <summary>
## Execute dpkg_script programs in the dpkg_script domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(dpkg_domtrans_script',
gen_require(` type dpkg_script_t; ') # transition to dpkg script: corecmd_shell_domtrans($1,dpkg_script_t) allow $1 dpkg_script_t:fd use; allow dpkg_script_t $1:fd use; allow dpkg_script_t $1:fifo_file rw_file_perms; allow dpkg_script_t $1:process sigchld;
')
########################################
## <summary>
## Execute dpkg programs in the dpkg domain.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
## <param name="role">
## <summary>
## The role to allow the dpkg domain.
## </summary>
## </param>
## <param name="terminal">
## <summary>
## The type of the terminal allow the dpkg domain to use.
## </summary>
## </param>
#
interface(dpkg_run',
gen_require(` type dpkg_t, dpkg_script_t; ') dpkg_domtrans($1) role $2 types dpkg_t; role $2 types dpkg_script_t; seutil_run_loadpolicy(dpkg_script_t,$2,$3) allow dpkg_t $3:chr_file rw_term_perms;
')
########################################
## <summary>
## Inherit and use file descriptors from dpkg.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_use_fd',
gen_require(` type dpkg_t; ') allow $1 dpkg_t:fd use;
')
########################################
## <summary>
## Read from an unnamed dpkg pipe.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_read_pipes',
gen_require(` type dpkg_t; ') allow $1 dpkg_t:fifo_file r_file_perms;
')
########################################
## <summary>
## Read and write an unnamed dpkg pipe.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_rw_pipes',
gen_require(` type dpkg_t; ') allow $1 dpkg_t:fifo_file rw_file_perms;
')
########################################
## <summary>
## Inherit and use file descriptors from dpkg scripts.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_use_script_fd',
gen_require(` type dpkg_script_t; ') allow $1 dpkg_script_t:fd use;
')
########################################
## <summary>
## Read the dpkg package database.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_read_db',
gen_require(`
type dpkg_var_lib_t;
')
files_search_var_lib($1)
allow $1 dpkg_var_lib_t:dir r_dir_perms;
allow $1 dpkg_var_lib_t:file { getattr read };
allow $1 dpkg_var_lib_t:lnk_file r_file_perms;')
########################################
## <summary>
## Create, read, write, and delete the dpkg package database.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_manage_db',
gen_require(`
type dpkg_var_lib_t;
')
files_search_var_lib($1)
allow $1 dpkg_var_lib_t:dir rw_dir_perms;
allow $1 dpkg_var_lib_t:file { getattr create read write append unlink };
allow $1 dpkg_var_lib_t:lnk_file { getattr read write unlink };')
########################################
## <summary>
## Do not audit attempts to create, read,
## write, and delete the dpkg package database.
## </summary>
## <param name="domain">
## <summary>
## Domain to not audit.
## </summary>
## </param>
#
interface(dpkg_dontaudit_manage_db',
gen_require(` type dpkg_var_lib_t; ') dontaudit $1 dpkg_var_lib_t:dir rw_dir_perms; dontaudit $1 dpkg_var_lib_t:file create_file_perms; dontaudit $1 dpkg_var_lib_t:lnk_file create_lnk_perms;
')
########################################
## <summary>
## Lock the dpkg package database.
## </summary>
## <param name="domain">
## <summary>
## The type of the process performing this action.
## </summary>
## </param>
#
interface(dpkg_lock_db',
gen_require(`
type dpkg_lock_t;
')
files_search_var_lib($1)
allow $1 dpkg_var_lib_t:dir r_dir_perms;
allow $1 dpkg_lock_t:file { getattr create read write append unlink lock };')
policy_module(dpkg,0.1.0)
########################################
#
# Declarations
#
type dpkg_t;
type dpkg_exec_t;
# dpkg can start/stop services init_system_domain(dpkg_t,dpkg_exec_t) # dpkg can change file labels, roles, IO domain_obj_id_change_exemption(dpkg_t) domain_role_change_exemption(dpkg_t) domain_system_change_exemption(dpkg_t) domain_wide_inherit_fd(dpkg_t) role system_r types dpkg_t;
type dpkg_tmp_t;files_tmp_file(dpkg_tmp_t)
type dpkg_tmpfs_t;files_tmpfs_file(dpkg_tmpfs_t)
# status files type dpkg_var_lib_t; files_type(dpkg_var_lib_t) typealias dpkg_var_lib_t alias var_lib_dpkg_t;
# lockfile type dpkg_lock_t; files_type(dpkg_lock_t) typealias dpkg_lock_t alias var_lib_dpkg_lock_t;
# TODO: actually use dpkg_script_t
# package scripts type dpkg_script_t; type dpkg_script_exec_t; # also have enhanced permissions domain_obj_id_change_exemption(dpkg_script_t) domain_system_change_exemption(dpkg_script_t) corecmd_shell_entry_type(dpkg_script_t) domain_type(dpkg_script_t) domain_entry_file(dpkg_t,dpkg_script_exec_t) domain_wide_inherit_fd(dpkg_script_t) role system_r types dpkg_script_t;
type dpkg_script_tmp_t;files_tmp_file(dpkg_script_tmp_t)
type dpkg_script_tmpfs_t;files_tmpfs_file(dpkg_script_tmpfs_t)
########################################
#
# dpkg Local policy #
allow dpkg_t self:capability { chown dac_override fowner fsetid setgid setuid kill sys_tty_config sys_nice sys_resource mknod linux_immutable }; #allow dpkg_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow dpkg_t self:process { setpgid fork getsched setfscreate };
allow dpkg_t self:fd use;
allow dpkg_t self:fifo_file rw_file_perms;
allow dpkg_t self:unix_dgram_socket create_socket_perms;
allow dpkg_t self:unix_stream_socket rw_stream_socket_perms;
allow dpkg_t self:unix_dgram_socket sendto;
allow dpkg_t self:unix_stream_socket connectto;
allow dpkg_t self:udp_socket { connect };
allow dpkg_t self:udp_socket create_socket_perms;
allow dpkg_t self:tcp_socket create_stream_socket_perms;
allow dpkg_t self:shm create_shm_perms;
allow dpkg_t self:sem create_sem_perms;
allow dpkg_t self:msgq create_msgq_perms;
allow dpkg_t self:msg { send receive };
allow dpkg_t self:dir search;
allow dpkg_t self:file rw_file_perms;;
allow dpkg_t dpkg_tmp_t:dir create_dir_perms; allow dpkg_t dpkg_tmp_t:file create_file_perms; files_filetrans_tmp(dpkg_t, dpkg_tmp_t, { file dir })
allow dpkg_t dpkg_tmpfs_t:dir create_dir_perms;
allow dpkg_t dpkg_tmpfs_t:file create_file_perms;
allow dpkg_t dpkg_tmpfs_t:lnk_file create_file_perms;
allow dpkg_t dpkg_tmpfs_t:sock_file create_file_perms;
allow dpkg_t dpkg_tmpfs_t:fifo_file create_file_perms; fs_filetrans_tmpfs(dpkg_t,dpkg_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
# Access /var/lib/dpkg files
allow dpkg_t dpkg_var_lib_t:file create_file_perms; allow dpkg_t dpkg_var_lib_t:dir rw_dir_perms; files_filetrans_var_lib(dpkg_t,dpkg_var_lib_t,dir)
# Lockfile
allow dpkg_t dpkg_lock_t:file create_file_perms;
kernel_read_system_state(dpkg_t)kernel_read_kernel_sysctls(dpkg_t)
# TODO: do we really need all networking?corenet_tcp_sendrecv_all_if(dpkg_t)corenet_raw_sendrecv_all_if(dpkg_t)corenet_udp_sendrecv_all_if(dpkg_t)corenet_tcp_sendrecv_all_nodes(dpkg_t)corenet_raw_sendrecv_all_nodes(dpkg_t)corenet_udp_sendrecv_all_nodes(dpkg_t)corenet_tcp_sendrecv_all_ports(dpkg_t)corenet_udp_sendrecv_all_ports(dpkg_t)corenet_non_ipsec_sendrecv(dpkg_t)corenet_tcp_bind_all_nodes(dpkg_t)corenet_udp_bind_all_nodes(dpkg_t)corenet_tcp_connect_all_ports(dpkg_t)
dev_list_sysfs(dpkg_t)dev_list_usbfs(dpkg_t)dev_read_urand(dpkg_t)
#devices_manage_all_device_types(dpkg_t)
fs_manage_nfs_dirs(dpkg_t)fs_manage_nfs_files(dpkg_t)fs_manage_nfs_symlinks(dpkg_t)fs_getattr_all_fs(dpkg_t)fs_search_auto_mountpoints(dpkg_t)
mls_file_read_up(dpkg_t)mls_file_write_down(dpkg_t)mls_file_upgrade(dpkg_t)
selinux_get_fs_mount(dpkg_t)selinux_validate_context(dpkg_t)selinux_compute_access_vector(dpkg_t)selinux_compute_create_context(dpkg_t)selinux_compute_relabel_context(dpkg_t)selinux_compute_user_contexts(dpkg_t)
storage_raw_write_fixed_disk(dpkg_t)
# for installing kernel packages storage_raw_read_fixed_disk(dpkg_t)
term_list_ptys(dpkg_t)
auth_relabel_all_files_except_shadow(dpkg_t)auth_manage_all_files_except_shadow(dpkg_t)auth_dontaudit_read_shadow(dpkg_t)
corecmd_exec_bin(dpkg_t)corecmd_exec_sbin(dpkg_t)
# transition to dpkg script: dpkg_domtrans_script(dpkg_t) # since the scripts aren't labeled correctly yet... allow dpkg_t dpkg_var_lib_t:file execute;
domain_exec_all_entry_files(dpkg_t) domain_read_all_domains_state(dpkg_t) domain_getattr_all_domains(dpkg_t) domain_dontaudit_ptrace_all_domains(dpkg_t) domain_use_wide_inherit_fd(dpkg_t) domain_dontaudit_getattr_all_pipes(dpkg_t) domain_dontaudit_getattr_all_tcp_sockets(dpkg_t) domain_dontaudit_getattr_all_udp_sockets(dpkg_t) domain_dontaudit_getattr_all_packet_sockets(dpkg_t) domain_dontaudit_getattr_all_raw_sockets(dpkg_t) domain_dontaudit_getattr_all_stream_sockets(dpkg_t) domain_dontaudit_getattr_all_dgram_sockets(dpkg_t)
files_exec_etc_files(dpkg_t)
init_domtrans_script(dpkg_t)
libs_use_ld_so(dpkg_t)libs_use_shared_libs(dpkg_t)libs_exec_ld_so(dpkg_t)libs_exec_lib_files(dpkg_t)libs_domtrans_ldconfig(dpkg_t)
logging_send_syslog_msg(dpkg_t)
# allow compiling and loading new policy seutil_manage_src_policy(dpkg_t) seutil_manage_bin_policy(dpkg_t)
sysnet_read_config(dpkg_t)
userdom_use_unpriv_users_fd(dpkg_t)
ifdef(targeted_policy',
unconfined_domain(dpkg_t)
')
# TODO: allow?
#optional_policy(cron',
# cron_system_entry(dpkg_t,dpkg_exec_t)
#')
optional_policy(mount',
mount_send_nfs_client_request(dpkg_t)
')
optional_policy(nis',
nis_use_ypbind(dpkg_t)
')
# TODO: the following was copied from dpkg_script_t, and could probably
# be removed again when they dpkg_script_t is actually used... domain_signal_all_domains(dpkg_t) domain_signull_all_domains(dpkg_t) files_read_etc_runtime_files(dpkg_t) files_exec_usr_files(dpkg_t) miscfiles_read_localization(dpkg_t) modutils_domtrans_depmod(dpkg_t) modutils_domtrans_insmod(dpkg_t) seutil_domtrans_loadpolicy(dpkg_t) seutil_domtrans_restorecon(dpkg_t) userdom_use_all_users_fd(dpkg_t) optional_policy(`mta',` mta_send_mail(dpkg_t) ') optional_policy(`usermanage',` usermanage_domtrans_groupadd(dpkg_t) usermanage_domtrans_useradd(dpkg_t) ')
########################################
#
# dpkg-script Local policy #
allow dpkg_script_t self:capability { chown dac_override dac_read_search fowner fsetid setgid setuid ipc_lock sys_chroot sys_nice mknod kill }; allow dpkg_script_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
allow dpkg_script_t self:fd use;
allow dpkg_script_t self:fifo_file rw_file_perms;
allow dpkg_script_t self:unix_dgram_socket create_socket_perms;
allow dpkg_script_t self:unix_stream_socket rw_stream_socket_perms;
allow dpkg_script_t self:unix_dgram_socket sendto;
allow dpkg_script_t self:unix_stream_socket connectto;
allow dpkg_script_t self:shm create_shm_perms;
allow dpkg_script_t self:sem create_sem_perms;
allow dpkg_script_t self:msgq create_msgq_perms;
allow dpkg_script_t self:msg { send receive };
allow dpkg_script_t dpkg_tmp_t:file r_file_perms;
allow dpkg_script_t dpkg_script_tmp_t:dir mounton;
allow dpkg_script_t dpkg_script_tmp_t:dir create_dir_perms; allow dpkg_script_t dpkg_script_tmp_t:file create_file_perms; files_filetrans_tmp(dpkg_script_t, dpkg_script_tmp_t, { file dir })
allow dpkg_script_t dpkg_script_tmpfs_t:dir create_dir_perms;
allow dpkg_script_t dpkg_script_tmpfs_t:file create_file_perms;
allow dpkg_script_t dpkg_script_tmpfs_t:lnk_file create_lnk_perms;
allow dpkg_script_t dpkg_script_tmpfs_t:sock_file create_file_perms;
allow dpkg_script_t dpkg_script_tmpfs_t:fifo_file create_file_perms; fs_filetrans_tmpfs(dpkg_script_t,dpkg_script_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
allow dpkg_t dpkg_script_t:fd use;
allow dpkg_script_t dpkg_t:fd use;
allow dpkg_script_t dpkg_t:fifo_file rw_file_perms; allow dpkg_script_t dpkg_t:process sigchld;
kernel_read_kernel_sysctls(dpkg_script_t)kernel_read_system_state(dpkg_script_t)
dev_list_sysfs(dpkg_script_t)
# ideally we would not need this dev_manage_generic_blk_files(dpkg_script_t) dev_manage_generic_chr_files(dpkg_script_t) dev_manage_all_blk_files(dpkg_script_t) dev_manage_all_chr_files(dpkg_script_t)
fs_manage_nfs_files(dpkg_script_t)fs_getattr_nfs(dpkg_script_t)
# why is this not using mount? fs_getattr_xattr_fs(dpkg_script_t) fs_mount_xattr_fs(dpkg_script_t) fs_unmount_xattr_fs(dpkg_script_t) fs_search_auto_mountpoints(dpkg_script_t)
mls_file_read_up(dpkg_script_t)mls_file_write_down(dpkg_script_t)
selinux_get_fs_mount(dpkg_script_t)selinux_validate_context(dpkg_script_t)selinux_compute_access_vector(dpkg_script_t)selinux_compute_create_context(dpkg_script_t)selinux_compute_relabel_context(dpkg_script_t)selinux_compute_user_contexts(dpkg_script_t)
storage_raw_read_fixed_disk(dpkg_script_t)storage_raw_write_fixed_disk(dpkg_script_t)
term_getattr_unallocated_ttys(dpkg_script_t)term_list_ptys(dpkg_script_t)term_use_all_terms(dpkg_script_t)
auth_dontaudit_getattr_shadow(dpkg_script_t)
# ideally we would not need this auth_manage_all_files_except_shadow(dpkg_script_t)
corecmd_exec_bin(dpkg_script_t)corecmd_exec_sbin(dpkg_script_t)
domain_read_all_domains_state(dpkg_script_t) domain_getattr_all_domains(dpkg_script_t) domain_dontaudit_ptrace_all_domains(dpkg_script_t) domain_use_wide_inherit_fd(dpkg_script_t) domain_exec_all_entry_files(dpkg_script_t) domain_signal_all_domains(dpkg_script_t) domain_signull_all_domains(dpkg_script_t)
files_exec_etc_files(dpkg_script_t)files_read_etc_runtime_files(dpkg_script_t)files_exec_usr_files(dpkg_script_t)
init_domtrans_script(dpkg_script_t)
libs_use_ld_so(dpkg_script_t)libs_use_shared_libs(dpkg_script_t)libs_exec_ld_so(dpkg_script_t)libs_exec_lib_files(dpkg_script_t)libs_domtrans_ldconfig(dpkg_script_t)
logging_send_syslog_msg(dpkg_script_t)
miscfiles_read_localization(dpkg_script_t)
modutils_domtrans_depmod(dpkg_script_t)modutils_domtrans_insmod(dpkg_script_t)
seutil_domtrans_loadpolicy(dpkg_script_t)seutil_domtrans_restorecon(dpkg_script_t)
userdom_use_all_users_fd(dpkg_script_t)
ifdef(distro_redhat',
unconfined_domain(dpkg_script_t)
')
ifdef(targeted_policy',
unconfined_domain(dpkg_script_t)
',`
optional_policy(`bootloader',` bootloader_domtrans(dpkg_script_t) ')
')
optional_policy(mta',
mta_send_mail(dpkg_script_t)
')
tunable_policy(allow_execmem',
allow dpkg_script_t self:process execmem;
')
optional_policy(nis',
nis_use_ypbind(dpkg_script_t)
')
optional_policy(usermanage',
usermanage_domtrans_groupadd(dpkg_script_t) usermanage_domtrans_useradd(dpkg_script_t)
')