Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_PASS, USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B960FC43387 for ; Fri, 4 Jan 2019 07:33:23 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 75A9C2184B for ; Fri, 4 Jan 2019 07:33:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=coker.com.au header.i=@coker.com.au header.b="KCkugrmK" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726036AbfADHdX (ORCPT ); Fri, 4 Jan 2019 02:33:23 -0500 Received: from smtp.sws.net.au ([46.4.88.250]:39552 "EHLO smtp.sws.net.au" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725958AbfADHdX (ORCPT ); Fri, 4 Jan 2019 02:33:23 -0500 Received: from liv.coker.com.au (localhost [127.0.0.1]) by smtp.sws.net.au (Postfix) with ESMTP id E51C0EFEB for ; Fri, 4 Jan 2019 18:33:19 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=coker.com.au; s=2008; t=1546587200; bh=VTWpunPuRt5f/cvx/uiFAe/M+ZIDcUvgZ6O4lRAJfE8=; l=8056; h=Date:From:To:Subject:From; b=KCkugrmKO5yuH/gKQwBiOHgqmEkbuy5R9V+OIcA0uy6UxZVOGc+3L4Ezv7Pu8dJOF skmiXxpdQFK6sIa/TDsK2f8nyDVproRi0Fu+ZTt3StkvRCmzQ+BvYaW+EcxPxLccEy MxLDy2z8sQo5LP5Y0b3yhiXFOrtbc50KQpIFfpCc= Received: by liv.coker.com.au (Postfix, from userid 1000) id 28D582D1E64; Fri, 4 Jan 2019 18:33:12 +1100 (AEDT) Date: Fri, 4 Jan 2019 18:33:12 +1100 From: Russell Coker To: selinux-refpolicy@vger.kernel.org Subject: [PATCH] misc interfaces Message-ID: <20190104073312.GA11256@aaa.coker.com.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org This patch has some small interface changes as well as the policy patches to use the new interfaces. Index: refpolicy-2.20180701/policy/modules/admin/apt.if =================================================================== --- refpolicy-2.20180701.orig/policy/modules/admin/apt.if +++ refpolicy-2.20180701/policy/modules/admin/apt.if @@ -171,7 +171,7 @@ interface(`apt_read_cache',` files_search_var($1) allow $1 apt_var_cache_t:dir list_dir_perms; - allow $1 apt_var_cache_t:file read_file_perms; + allow $1 apt_var_cache_t:file mmap_read_file_perms; ') ######################################## @@ -191,7 +191,7 @@ interface(`apt_manage_cache',` files_search_var($1) allow $1 apt_var_cache_t:dir manage_dir_perms; - allow $1 apt_var_cache_t:file manage_file_perms; + allow $1 apt_var_cache_t:file { manage_file_perms map }; ') ######################################## Index: refpolicy-2.20180701/policy/modules/admin/dpkg.if =================================================================== --- refpolicy-2.20180701.orig/policy/modules/admin/dpkg.if +++ refpolicy-2.20180701/policy/modules/admin/dpkg.if @@ -319,3 +319,21 @@ interface(`dpkg_map_script_tmp_files',` allow $1 dpkg_script_tmp_t:file map; ') + +######################################## +## +## read dpkg_script_tmp_t links +## +## +## +## Domain allowed access. +## +## +# +interface(`dpkg_read_script_tmp_links',` + gen_require(` + type dpkg_script_tmp_t; + ') + + allow $1 dpkg_script_tmp_t:lnk_file read_lnk_file_perms; +') Index: refpolicy-2.20180701/policy/modules/services/gpm.if =================================================================== --- refpolicy-2.20180701.orig/policy/modules/services/gpm.if +++ refpolicy-2.20180701/policy/modules/services/gpm.if @@ -59,6 +59,7 @@ interface(`gpm_dontaudit_getattr_gpmctl' ') dontaudit $1 gpmctl_t:sock_file getattr_sock_file_perms; + dontaudit $1 gpmctl_t:fifo_file getattr_fifo_file_perms; ') ######################################## Index: refpolicy-2.20180701/policy/modules/system/authlogin.if =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/authlogin.if +++ refpolicy-2.20180701/policy/modules/system/authlogin.if @@ -823,6 +823,25 @@ interface(`auth_append_lastlog',` ####################################### ## +## relabel the last logins log. +## +## +## +## Domain allowed access. +## +## +# +interface(`auth_relabel_lastlog',` + gen_require(` + type lastlog_t; + ') + + logging_search_logs($1) + allow $1 lastlog_t:file { relabelfrom relabelto }; +') + +####################################### +## ## Read and write to the last logins log. ## ## @@ -841,6 +860,25 @@ interface(`auth_rw_lastlog',` ') ######################################## +## +## Manage the last logins log. +## +## +## +## Domain allowed access. +## +## +# +interface(`auth_manage_lastlog',` + gen_require(` + type lastlog_t; + ') + + allow $1 lastlog_t:file manage_file_perms; + logging_rw_generic_log_dirs($1) +') + +######################################## ## ## Execute pam programs in the pam domain. ## Index: refpolicy-2.20180701/policy/modules/system/raid.if =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/raid.if +++ refpolicy-2.20180701/policy/modules/system/raid.if @@ -48,6 +48,26 @@ interface(`raid_run_mdadm',` ######################################## ## +## read mdadm pid files. +## +## +## +## Domain allowed access. +## +## +# +interface(`raid_read_mdadm_pid',` + gen_require(` + type mdadm_var_run_t; + ') + + files_search_pids($1) + allow $1 mdadm_var_run_t:dir list_dir_perms; + allow $1 mdadm_var_run_t:file read_file_perms; +') + +######################################## +## ## Create, read, write, and delete ## mdadm pid files. ## Index: refpolicy-2.20180701/policy/modules/system/sysnetwork.if =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/sysnetwork.if +++ refpolicy-2.20180701/policy/modules/system/sysnetwork.if @@ -755,6 +755,10 @@ interface(`sysnet_dns_name_resolve',` optional_policy(` nscd_use($1) ') + optional_policy(` + # for /etc/resolv.conf symlink + networkmanager_read_pid_files($1) + ') ifdef(`init_systemd',` optional_policy(` Index: refpolicy-2.20180701/policy/modules/system/modutils.te =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/modutils.te +++ refpolicy-2.20180701/policy/modules/system/modutils.te @@ -136,6 +136,7 @@ optional_policy(` # for postinst of a new kernel package dpkg_manage_script_tmp_files(kmod_t) dpkg_map_script_tmp_files(kmod_t) + dpkg_read_script_tmp_links(kmod_t) ') optional_policy(` Index: refpolicy-2.20180701/policy/modules/system/systemd.te =================================================================== --- refpolicy-2.20180701.orig/policy/modules/system/systemd.te +++ refpolicy-2.20180701/policy/modules/system/systemd.te @@ -970,14 +970,19 @@ files_relabelto_etc_dirs(systemd_tmpfile # for /etc/mtab files_manage_etc_symlinks(systemd_tmpfiles_t) +fs_getattr_tmpfs(systemd_tmpfiles_t) +fs_getattr_tmpfs_dirs(systemd_tmpfiles_t) fs_getattr_xattr_fs(systemd_tmpfiles_t) selinux_get_fs_mount(systemd_tmpfiles_t) selinux_search_fs(systemd_tmpfiles_t) +auth_append_lastlog(systemd_tmpfiles_t) auth_manage_faillog(systemd_tmpfiles_t) +auth_manage_lastlog(systemd_tmpfiles_t) auth_manage_login_records(systemd_tmpfiles_t) auth_manage_var_auth(systemd_tmpfiles_t) +auth_relabel_lastlog(systemd_tmpfiles_t) auth_relabel_login_records(systemd_tmpfiles_t) auth_setattr_login_records(systemd_tmpfiles_t) Index: refpolicy-2.20180701/policy/modules/admin/bootloader.te =================================================================== --- refpolicy-2.20180701.orig/policy/modules/admin/bootloader.te +++ refpolicy-2.20180701/policy/modules/admin/bootloader.te @@ -95,6 +95,7 @@ mls_file_read_all_levels(bootloader_t) mls_file_write_all_levels(bootloader_t) term_getattr_all_ttys(bootloader_t) +term_getattr_generic_ptys(bootloader_t) term_dontaudit_manage_pty_dirs(bootloader_t) corecmd_exec_all_executables(bootloader_t) @@ -102,6 +103,7 @@ corecmd_exec_all_executables(bootloader_ domain_use_interactive_fds(bootloader_t) files_create_boot_dirs(bootloader_t) +files_getattr_default_dirs(bootloader_t) files_manage_boot_files(bootloader_t) files_manage_boot_symlinks(bootloader_t) files_read_etc_files(bootloader_t) @@ -118,6 +120,7 @@ files_manage_etc_runtime_files(bootloade files_etc_filetrans_etc_runtime(bootloader_t, file) files_dontaudit_search_home(bootloader_t) +fs_list_hugetlbfs(bootloader_t) fs_mount_fusefs(bootloader_t) fs_mount_xattr_fs(bootloader_t) fs_mounton_fusefs(bootloader_t) @@ -172,7 +175,7 @@ ifdef(`distro_debian',` # for apt-cache apt_read_db(bootloader_t) - apt_read_cache(bootloader_t) + apt_manage_cache(bootloader_t) dpkg_read_db(bootloader_t) dpkg_rw_pipes(bootloader_t) @@ -204,6 +207,10 @@ optional_policy(` ') optional_policy(` + gpm_getattr_gpmctl(bootloader_t) +') + +optional_policy(` hal_dontaudit_append_lib_files(bootloader_t) hal_write_log(bootloader_t) ') @@ -230,5 +237,9 @@ optional_policy(` ') optional_policy(` + raid_read_mdadm_pid(bootloader_t) +') + +optional_policy(` rpm_rw_pipes(bootloader_t) ')