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=-8.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,LONGWORDS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_PASS 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 995F2C43387 for ; Sat, 12 Jan 2019 20:04:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5192E20836 for ; Sat, 12 Jan 2019 20:04:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=ieee.org header.i=@ieee.org header.b="Pmvpa9vV" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbfALUEq (ORCPT ); Sat, 12 Jan 2019 15:04:46 -0500 Received: from mail-qt1-f193.google.com ([209.85.160.193]:43742 "EHLO mail-qt1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725876AbfALUEq (ORCPT ); Sat, 12 Jan 2019 15:04:46 -0500 Received: by mail-qt1-f193.google.com with SMTP id i7so22577601qtj.10 for ; Sat, 12 Jan 2019 12:04:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ieee.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=gp1yhwrmpo1su1XjwG8OyB9vsTOou2qO3nA2PZaDZQ4=; b=Pmvpa9vVUB3caPKoNaNL0woH7j/EgBADOQ/Jr7p4Q7ho6lECv1C56lWLiNJGgLMuHc NG8slm669p7qhJvSY88WZoaQcJX018MkI5eV2pkrLbXz8fK4kPNGs6+PSTTk6OSrx9OK L4xdB4jxqSqbDpUYvO0b++TpBASv/yJ7S2pwY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=gp1yhwrmpo1su1XjwG8OyB9vsTOou2qO3nA2PZaDZQ4=; b=t0sBv5ng2GKvS/hnQOOwb8Zu92tRwuO/Uw1N77Cg9HqKMFUjXOmBvEI39ul3jVce0m 2WMl7tOp1gR2lUaJwvfyd5hMerZ/OURGnlXxSt/PNiryHIMEpieU+cYAF2zeQTrGY2Uu JR9OsM7RiCMd4G3aZPt99EqfF6SCz2F44Q5tjcLWwOJnVfKA7MZm0LoJnAfCsP4aW3kN DgoQyVgZ14NSiIzQRtTRSkxxWEWM6nMDEz1jQ7RD+7WmIQYVt+60capoS5f74iCeMzCX m9RUPEms9DCODfM65Ey0bU4vkz5xAAkXc7dbNi2XjSDNRUlOcfMzN9tN73jAe9RE4cMp EgzQ== X-Gm-Message-State: AJcUukfoDuz7h5DRw7f7qmrG5RM6V0CyKD9yrOkCkXqEdZB29nYvHCfn tXM3tLM01sN7WBoS6NIjPNukdkLt3Mw= X-Google-Smtp-Source: ALg8bN4mHKYklgcpc2xz3e+Eq8SUzqpAbz+gnfYSFHqFJkfKBw55ze8W6tnwAqYX9MCTlKPhD2IGJA== X-Received: by 2002:aed:2c87:: with SMTP id g7mr18231404qtd.52.1547323484832; Sat, 12 Jan 2019 12:04:44 -0800 (PST) Received: from [192.168.1.190] (pool-108-15-23-247.bltmmd.fios.verizon.net. [108.15.23.247]) by smtp.gmail.com with ESMTPSA id m41sm56814981qtc.58.2019.01.12.12.04.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Jan 2019 12:04:44 -0800 (PST) Subject: Re: [PATCH] some little stuff To: Russell Coker , selinux-refpolicy@vger.kernel.org References: <20190111103043.GA22910@xev> From: Chris PeBenito Message-ID: <4df64def-6cfe-af47-5c2a-dcdbf0d507e4@ieee.org> Date: Sat, 12 Jan 2019 14:28:35 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: <20190111103043.GA22910@xev> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org On 1/11/19 5:30 AM, Russell Coker wrote: > Tiny and I think they are all obvious. > > 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 > @@ -147,7 +147,9 @@ miscfiles_read_localization(bootloader_t > > mount_rw_runtime_files(bootloader_t) > > +selinux_getattr_fs(bootloader_t) > seutil_read_bin_policy(bootloader_t) > +seutil_read_file_contexts(bootloader_t) > seutil_read_loadpolicy(bootloader_t) > seutil_dontaudit_search_config(bootloader_t) > > Index: refpolicy-2.20180701/policy/modules/admin/logrotate.te > =================================================================== > --- refpolicy-2.20180701.orig/policy/modules/admin/logrotate.te > +++ refpolicy-2.20180701/policy/modules/admin/logrotate.te > @@ -37,7 +37,8 @@ role system_r types logrotate_mail_t; > # Local policy > # > > -allow logrotate_t self:capability { chown dac_override dac_read_search fowner fsetid kill setgid setuid sys_nice sys_resource }; > +# sys_ptrace is for systemctl > +allow logrotate_t self:capability { chown dac_override dac_read_search fowner fsetid kill setgid setuid sys_ptrace sys_nice sys_resource }; I didn't merge this because it seems peculiar. There is no process ptrace permission and also because it doesn't seem like it should be allowed to ptrace anyway. > # systemctl asks for net_admin > dontaudit logrotate_t self:capability net_admin; > allow logrotate_t self:process { transition signal_perms getsched setsched getsession getpgid setpgid getcap setcap share getattr setfscreate noatsecure siginh setrlimit rlimitinh dyntransition setkeycreate setsockcreate getrlimit }; > Index: refpolicy-2.20180701/policy/modules/services/dhcp.te > =================================================================== > --- refpolicy-2.20180701.orig/policy/modules/services/dhcp.te > +++ refpolicy-2.20180701/policy/modules/services/dhcp.te > @@ -105,6 +105,7 @@ auth_use_nsswitch(dhcpd_t) > > logging_send_syslog_msg(dhcpd_t) > > +miscfiles_read_generic_certs(dhcpd_t) > miscfiles_read_localization(dhcpd_t) > > sysnet_read_dhcp_config(dhcpd_t) > Index: refpolicy-2.20180701/policy/modules/services/ssh.te > =================================================================== > --- refpolicy-2.20180701.orig/policy/modules/services/ssh.te > +++ refpolicy-2.20180701/policy/modules/services/ssh.te > @@ -333,6 +333,7 @@ optional_policy(` > > optional_policy(` > xserver_domtrans_xauth(sshd_t) > + xserver_link_xdm_keys(sshd_t) > ') > > ######################################## > Index: refpolicy-2.20180701/policy/modules/services/xserver.if > =================================================================== > --- refpolicy-2.20180701.orig/policy/modules/services/xserver.if > +++ refpolicy-2.20180701/policy/modules/services/xserver.if > @@ -1634,6 +1634,24 @@ interface(`xserver_rw_xdm_keys',` > > ######################################## > ## > +## Manage keys for xdm. > +## > +## > +## > +## Domain allowed access. > +## > +## > +# > +interface(`xserver_link_xdm_keys',` > + gen_require(` > + type xdm_t; > + ') > + > + allow $1 xdm_t:key link; > +') > + > +######################################## > +## > ## Read and write the mesa shader cache. > ## > ## > Index: refpolicy-2.20180701/policy/modules/services/xserver.te > =================================================================== > --- refpolicy-2.20180701.orig/policy/modules/services/xserver.te > +++ refpolicy-2.20180701/policy/modules/services/xserver.te > @@ -708,6 +708,9 @@ allow xserver_t mesa_shader_cache_t:file > xdg_cache_filetrans(xserver_t, mesa_shader_cache_t, dir, "mesa_shader_cache") > xdg_generic_user_home_dir_filetrans_cache(xserver_t, dir, ".cache") > > +# for writing to ~/.local/share/sddm/xorg-session.log > +xdg_manage_data(xauth_t) > domtrans_pattern(xserver_t, xauth_exec_t, xauth_t) > allow xserver_t xauth_home_t:file read_file_perms; > > 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 > @@ -337,6 +337,10 @@ optional_policy(` > networkmanager_dbus_chat(systemd_hostnamed_t) > ') > > +optional_policy(` > + unconfined_dbus_send(systemd_hostnamed_t) > +') This comment: https://github.com/SELinuxProject/refpolicy/issues/18#issuecomment-452316615 makes me rethink all dbus sends to unconfined domains, especially unconfined_t. This here isn't all confined domains, but I want more consideration for the perm. > ######################################### > # > # hw local policy > @@ -431,6 +435,7 @@ dev_rw_input_dev(systemd_logind_t) > dev_rw_sysfs(systemd_logind_t) > dev_setattr_dri_dev(systemd_logind_t) > dev_setattr_generic_usb_dev(systemd_logind_t) > +dev_setattr_input_dev(systemd_logind_t) > dev_setattr_kvm_dev(systemd_logind_t) > dev_setattr_sound_dev(systemd_logind_t) > dev_setattr_video_dev(systemd_logind_t) > @@ -680,10 +685,11 @@ miscfiles_read_localization(systemd_noti > # Nspawn local policy > # > > -allow systemd_nspawn_t self:process { getcap setcap setfscreate setrlimit sigkill }; > +allow systemd_nspawn_t self:process { signal getcap setcap setfscreate setrlimit sigkill }; > allow systemd_nspawn_t self:capability { dac_override dac_read_search fsetid mknod net_admin setgid setuid setpcap sys_admin sys_chroot }; > allow systemd_nspawn_t self:capability2 wake_alarm; > allow systemd_nspawn_t self:unix_dgram_socket connected_socket_perms; > +allow systemd_nspawn_t self:unix_stream_socket create_stream_socket_perms; > > allow systemd_nspawn_t systemd_journal_t:dir search; > > Index: refpolicy-2.20180701/policy/modules/admin/usermanage.te > =================================================================== > --- refpolicy-2.20180701.orig/policy/modules/admin/usermanage.te > +++ refpolicy-2.20180701/policy/modules/admin/usermanage.te > @@ -252,6 +252,10 @@ userdom_use_unpriv_users_fds(groupadd_t) > userdom_dontaudit_search_user_home_dirs(groupadd_t) > > optional_policy(` > + apt_use_fds(groupadd_t) > +') > + > +optional_policy(` > dbus_system_bus_client(groupadd_t) > ') > > @@ -546,6 +550,10 @@ optional_policy(` > ') > > optional_policy(` > + apt_use_fds(groupadd_t) > +') > + > +optional_policy(` > dbus_system_bus_client(useradd_t) > ') > > -- Chris PeBenito