]> git.ipfire.org Git - people/stevee/selinux-policy.git/blobdiff - policy/modules/admin/apt.te
Remove module for backup.
[people/stevee/selinux-policy.git] / policy / modules / admin / apt.te
index e0fa44a41c7ad1a88fbc0487fb3ff9629a56b668..3491c7f8fa7adf89d5be2cb705dbda3af7fd4ca6 100644 (file)
@@ -1,5 +1,4 @@
-
-policy_module(apt,1.1.0)
+policy_module(apt, 1.6.0)
 
 ########################################
 #
@@ -8,23 +7,35 @@ policy_module(apt,1.1.0)
 
 type apt_t;
 type apt_exec_t;
-init_system_domain(apt_t,apt_exec_t)
+init_system_domain(apt_t, apt_exec_t)
 domain_system_change_exemption(apt_t)
 role system_r types apt_t;
 
+# pseudo terminal for running dpkg
+type apt_devpts_t;
+term_pty(apt_devpts_t)
+
+# aptitude lock file
+type apt_lock_t;
+files_lock_file(apt_lock_t)
+
 type apt_tmp_t;
 files_tmp_file(apt_tmp_t)
 
 type apt_tmpfs_t;
 files_tmpfs_file(apt_tmpfs_t)
 
+# package cache
+type apt_var_cache_t alias var_cache_apt_t;
+files_type(apt_var_cache_t)
+
 # status files
 type apt_var_lib_t alias var_lib_apt_t;
 files_type(apt_var_lib_t)
 
-# package cache
-type apt_var_cache_t alias var_cache_apt_t;
-files_type(apt_var_cache_t)
+# aptitude log file
+type apt_var_log_t;
+logging_log_file(apt_var_log_t)
 
 ########################################
 #
@@ -45,25 +56,36 @@ 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 };
+# Run update
+allow apt_t self:netlink_route_socket r_netlink_socket_perms;
 
-# Access /var/cache/apt files
-manage_files_pattern(apt_t,apt_var_cache_t,apt_var_cache_t)
-files_var_filetrans(apt_t,apt_var_cache_t,dir)
+# lock files
+allow apt_t apt_lock_t:dir manage_dir_perms;
+allow apt_t apt_lock_t:file manage_file_perms;
+files_lock_filetrans(apt_t, apt_lock_t, {dir file})
 
-manage_dirs_pattern(apt_t,apt_tmp_t,apt_tmp_t)
-manage_files_pattern(apt_t,apt_tmp_t,apt_tmp_t)
+manage_dirs_pattern(apt_t, apt_tmp_t, apt_tmp_t)
+manage_files_pattern(apt_t, apt_tmp_t, apt_tmp_t)
 files_tmp_filetrans(apt_t, apt_tmp_t, { file dir })
 
-manage_dirs_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
-manage_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
-manage_lnk_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
-manage_fifo_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
-manage_sock_files_pattern(apt_t,apt_tmpfs_t,apt_tmpfs_t)
-fs_tmpfs_filetrans(apt_t,apt_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
+manage_dirs_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
+manage_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
+manage_lnk_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
+manage_fifo_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
+manage_sock_files_pattern(apt_t, apt_tmpfs_t, apt_tmpfs_t)
+fs_tmpfs_filetrans(apt_t, apt_tmpfs_t, { dir file lnk_file sock_file fifo_file })
+
+# Access /var/cache/apt files
+manage_files_pattern(apt_t, apt_var_cache_t, apt_var_cache_t)
+files_var_filetrans(apt_t, apt_var_cache_t, dir)
 
 # Access /var/lib/apt files
-manage_files_pattern(apt_t,apt_var_lib_t,apt_var_lib_t)
-files_var_lib_filetrans(apt_t,apt_var_lib_t,dir)
+manage_files_pattern(apt_t, apt_var_lib_t, apt_var_lib_t)
+files_var_lib_filetrans(apt_t, apt_var_lib_t, dir)
+
+# log files
+allow apt_t apt_var_log_t:file manage_file_perms;
+logging_log_filetrans(apt_t, apt_var_log_t, file)
 
 kernel_read_system_state(apt_t)
 kernel_read_kernel_sysctls(apt_t)
@@ -71,18 +93,18 @@ kernel_read_kernel_sysctls(apt_t)
 # to launch dpkg-preconfigure
 corecmd_exec_bin(apt_t)
 corecmd_exec_shell(apt_t)
-corecmd_exec_sbin(apt_t)
 
-corenet_non_ipsec_sendrecv(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_all_recvfrom_unlabeled(apt_t)
+corenet_all_recvfrom_netlabel(apt_t)
+corenet_tcp_sendrecv_generic_if(apt_t)
+corenet_udp_sendrecv_generic_if(apt_t)
+corenet_tcp_sendrecv_generic_node(apt_t)
+corenet_udp_sendrecv_generic_node(apt_t)
 corenet_tcp_sendrecv_all_ports(apt_t)
 corenet_udp_sendrecv_all_ports(apt_t)
-# TODO: reall allow all these?
-corenet_tcp_bind_all_nodes(apt_t)
-corenet_udp_bind_all_nodes(apt_t)
+# TODO: really allow all these?
+corenet_tcp_bind_generic_node(apt_t)
+corenet_udp_bind_generic_node(apt_t)
 corenet_tcp_connect_all_ports(apt_t)
 corenet_sendrecv_all_client_packets(apt_t)
 
@@ -97,11 +119,10 @@ files_read_etc_runtime_files(apt_t)
 
 fs_getattr_all_fs(apt_t)
 
+term_create_pty(apt_t, apt_devpts_t)
 term_list_ptys(apt_t)
-term_use_all_terms(apt_t)
+term_use_all_inherited_terms(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)
 
@@ -113,9 +134,7 @@ seutil_use_newrole_fds(apt_t)
 
 sysnet_read_config(apt_t)
 
-ifdef(`targeted_policy',`
-       unconfined_domain(apt_t)
-')
+userdom_use_inherited_user_terminals(apt_t)
 
 # with boolean, for cron-apt and such?
 #optional_policy(`
@@ -137,3 +156,7 @@ optional_policy(`
        rpm_read_db(apt_t)
        rpm_domtrans(apt_t)
 ')
+
+optional_policy(`
+       unconfined_domain(apt_t)
+')