From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 78C661382C5 for ; Mon, 11 Jan 2021 01:27:09 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 82D62E0AA3; Mon, 11 Jan 2021 01:27:08 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 6DCEAE0AA3 for ; Mon, 11 Jan 2021 01:27:08 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 67F0234105B for ; Mon, 11 Jan 2021 01:27:07 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 1E71D493 for ; Mon, 11 Jan 2021 01:27:06 +0000 (UTC) From: "Jason Zaman" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Jason Zaman" Message-ID: <1610310514.f3249bbaff9ae98c9b741ad362fd4ed8e9b7deba.perfinion@gentoo> Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/system/ X-VCS-Repository: proj/hardened-refpolicy X-VCS-Files: policy/modules/system/authlogin.te policy/modules/system/init.if policy/modules/system/systemd.if X-VCS-Directories: policy/modules/system/ X-VCS-Committer: perfinion X-VCS-Committer-Name: Jason Zaman X-VCS-Revision: f3249bbaff9ae98c9b741ad362fd4ed8e9b7deba X-VCS-Branch: master Date: Mon, 11 Jan 2021 01:27:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 6b694e16-490a-4b0e-9bed-f4b4c21fbf3d X-Archives-Hash: 853fc334e599639ce45bd73b8df77ec7 commit: f3249bbaff9ae98c9b741ad362fd4ed8e9b7deba Author: bauen1 gmail com> AuthorDate: Thu Jun 4 15:45:35 2020 +0000 Commit: Jason Zaman gentoo org> CommitDate: Sun Jan 10 20:28:34 2021 +0000 URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=f3249bba authlogin: connect to userdb Signed-off-by: bauen1 gmail.com> Signed-off-by: Jason Zaman gentoo.org> policy/modules/system/authlogin.te | 4 ++++ policy/modules/system/init.if | 19 +++++++++++++++++++ policy/modules/system/systemd.if | 21 +++++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/policy/modules/system/authlogin.te b/policy/modules/system/authlogin.te index d6931831..7692abb6 100644 --- a/policy/modules/system/authlogin.te +++ b/policy/modules/system/authlogin.te @@ -426,6 +426,10 @@ files_read_etc_files(nsswitch_domain) sysnet_dns_name_resolve(nsswitch_domain) +ifdef(`init_systemd', ` + systemd_stream_connect_userdb(nsswitch_domain) +') + tunable_policy(`authlogin_nsswitch_use_ldap',` miscfiles_read_generic_certs(nsswitch_domain) sysnet_use_ldap(nsswitch_domain) diff --git a/policy/modules/system/init.if b/policy/modules/system/init.if index ff8f7db7..540cd0c7 100644 --- a/policy/modules/system/init.if +++ b/policy/modules/system/init.if @@ -923,6 +923,25 @@ interface(`init_stream_connect',` allow $1 init_t:unix_stream_socket getattr; ') +######################################## +## +## Connect to init with a unix socket. +## Without any additional permissions. +## +## +## +## Domain allowed access. +## +## +# +interface(`init_unix_stream_socket_connectto',` + gen_require(` + type init_t; + ') + + allow $1 init_t:unix_stream_socket connectto; +') + ######################################## ## ## Inherit and use file descriptors from init. diff --git a/policy/modules/system/systemd.if b/policy/modules/system/systemd.if index 895437e7..c8f33d51 100644 --- a/policy/modules/system/systemd.if +++ b/policy/modules/system/systemd.if @@ -462,6 +462,27 @@ interface(`systemd_manage_userdb_runtime_sock_files', ` manage_sock_files_pattern($1, systemd_userdb_runtime_t, systemd_userdb_runtime_t) ') +######################################## +## +## Connect to /run/systemd/userdb/io.systemd.DynamicUser . +## +## +## +## Domain allowed access. +## +## +# +interface(`systemd_stream_connect_userdb', ` + gen_require(` + type systemd_userdb_runtime_t; + ') + + init_search_runtime($1) + allow $1 systemd_userdb_runtime_t:dir list_dir_perms; + allow $1 systemd_userdb_runtime_t:sock_file write_sock_file_perms; + init_unix_stream_socket_connectto($1) +') + ######################################## ## ## Allow reading /run/systemd/machines