Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp835077ybl; Fri, 13 Dec 2019 05:25:57 -0800 (PST) X-Google-Smtp-Source: APXvYqyQyS6Q2n+R8Wy7rVkVyvE9y6ZGRyY6hB1WgT85J7Vfv7+3Z/+P5GdSg+vZORHSGZrJN7hS X-Received: by 2002:a9d:554f:: with SMTP id h15mr15258556oti.338.1576243557070; Fri, 13 Dec 2019 05:25:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576243557; cv=none; d=google.com; s=arc-20160816; b=bgo4QRIQ17MG04S7gU2I4Awectb8oo9YFPJIIOtfhby7ITdRksxWKCR+GoV0EDp338 lm5plIyxQAczbyhyug2zlCdbEnBygCFPvoSTEyRXPgmiUl4ol50HjeAq0jZauuCcOiJW xad/ej/vSO6/7WZHpQ95y7NCzK45e2HfI+Vpyn6W4rahgzUoIf7ZNaQNR70UnWCQO2pZ CnmuL4sHQYpFzRZ9DRRYCkQIprTogPk6hmTW05XY9gDVPfAjBkAIgl+E6E2gE96zpb1w jbqCxscju9iT2QOEkwTvrsQAMfXR51Uwkm7PwFrW63HGNYRdpE1IZeoknMl5UY+XveuB OCSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=spvhtMxmpvgiaA74RMQMHM2z68B1z34pnRYfdf1siSw=; b=NlIRdMnf5iecrQxmdb05MRe4oTom/9mYNKVIUB+D882lkhNOfh0TXieBk6LaXkugCT 6lFfLB+cdXd7upxqREvKktT51s4MhiDHFlLgeK6nzCqkvseQJL24P10AVDlR9m8imoWt t3nMyatj4JLde93PzE0zPGMJF45HBcfrcWkkoZefPWiPCu8zqYUkZFRchsySMgKa0DFC sLShhKxzMbf4tFrXQtvG8sE60N0StJ1gGRYIm1kZon0/bG5BDrNDiAqIR8ldEH+0uyRN Ah1FymLBDualIbi64/8ABvdWpz0XzT8jih1RZ0gepct1+FF2vHR0akc3emjIewdA77im kn+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bigon.be header.s=key1 header.b=DANL6kaJ; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i203si5364357oia.74.2019.12.13.05.25.55; Fri, 13 Dec 2019 05:25:57 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@bigon.be header.s=key1 header.b=DANL6kaJ; spf=pass (google.com: best guess record for domain of selinux-refpolicy-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=selinux-refpolicy-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727359AbfLMNZu (ORCPT + 12 others); Fri, 13 Dec 2019 08:25:50 -0500 Received: from ithil.bigon.be ([163.172.57.153]:33698 "EHLO ithil.bigon.be" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726930AbfLMNZu (ORCPT ); Fri, 13 Dec 2019 08:25:50 -0500 Received: from localhost (localhost [IPv6:::1]) by ithil.bigon.be (Postfix) with ESMTP id 7F0341FF6D for ; Fri, 13 Dec 2019 14:20:24 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=bigon.be; h= content-transfer-encoding:mime-version:references:in-reply-to :x-mailer:message-id:date:date:subject:subject:from:from :received:received:received; s=key1; t=1576243224; x=1578057625; bh=Hb5pnqhl+62FEd54hMpW8aiuu7YavZ92l0zRFLNq0BA=; b=DANL6kaJVSp1 nnAVeJ9YgKPTb0XS+jR6m8h/OzuJhMVyhCBCRuCN6d3+7P30pjalSZZqkW+4haVD 1Fs93spdRdhX46THYpmeres0ANBQS3ZLrIfq7QUjrv0qShagIaBW2m9djECjRpdI eFsh4vCwmxdQBa5ifuC4F3yXnDCq5wM= Received: from ithil.bigon.be ([IPv6:::1]) by localhost (ithil.bigon.be [IPv6:::1]) (amavisd-new, port 10026) with ESMTP id 2N0Aybo4Myci for ; Fri, 13 Dec 2019 14:20:24 +0100 (CET) Received: from edoras.bigon.be (unknown [193.53.238.198]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bigon@bigon.be) by ithil.bigon.be (Postfix) with ESMTPSA for ; Fri, 13 Dec 2019 14:20:24 +0100 (CET) Received: from bigon (uid 1000) (envelope-from bigon@bigon.be) id 231c2 by edoras.bigon.be (DragonFly Mail Agent v0.12); Fri, 13 Dec 2019 14:20:23 +0100 From: Laurent Bigonville To: selinux-refpolicy@vger.kernel.org Subject: [RFC 3/3] Add policy for acngtool Date: Fri, 13 Dec 2019 14:20:16 +0100 Message-Id: <20191213132016.308556-4-bigon@debian.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191213132016.308556-1-bigon@debian.org> References: <20191213132016.308556-1-bigon@debian.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org From: Laurent Bigonville Signed-off-by: Laurent Bigonville --- policy/modules/services/aptcacher.fc | 2 ++ policy/modules/services/aptcacher.te | 33 +++++++++++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/policy/modules/services/aptcacher.fc b/policy/modules/services/aptcacher.fc index 6835bab0..b0b5a800 100644 --- a/policy/modules/services/aptcacher.fc +++ b/policy/modules/services/aptcacher.fc @@ -1,5 +1,7 @@ /etc/apt-cacher-ng(/.*)? gen_context(system_u:object_r:aptcacher_etc_t,s0) +/usr/lib/apt-cacher-ng/acngtool -- gen_context(system_u:object_r:acngtool_exec_t,s0) + /usr/sbin/apt-cacher-ng -- gen_context(system_u:object_r:aptcacher_exec_t,s0) /run/apt-cacher-ng(/.*)? gen_context(system_u:object_r:aptcacher_runtime_t,s0) diff --git a/policy/modules/services/aptcacher.te b/policy/modules/services/aptcacher.te index 502ce6e6..6780891f 100644 --- a/policy/modules/services/aptcacher.te +++ b/policy/modules/services/aptcacher.te @@ -5,6 +5,10 @@ policy_module(aptcacher, 1.0.0) # Declarations # +type acngtool_t; +type acngtool_exec_t; +application_domain(acngtool_t, acngtool_exec_t) + type aptcacher_t; type aptcacher_exec_t; init_daemon_domain(aptcacher_t, aptcacher_exec_t) @@ -37,6 +41,8 @@ allow aptcacher_t self:tcp_socket create_stream_socket_perms; allow aptcacher_t self:unix_dgram_socket create_socket_perms; allow aptcacher_t self:unix_stream_socket create_stream_socket_perms; +can_exec(aptcacher_t, acngtool_exec_t) + allow aptcacher_t aptcacher_etc_t:file map; list_dirs_pattern(aptcacher_t, aptcacher_etc_t, aptcacher_etc_t) read_files_pattern(aptcacher_t, aptcacher_etc_t, aptcacher_etc_t) @@ -60,7 +66,8 @@ manage_sock_files_pattern(aptcacher_t, aptcacher_runtime_t, aptcacher_runtime_t) kernel_read_vm_overcommit_sysctl(aptcacher_t) -##corecmd_exec_shell(aptcacher_t) +# Calls system() +corecmd_exec_shell(aptcacher_t) corenet_tcp_bind_aptcacher_port(aptcacher_t) corenet_tcp_bind_generic_node(aptcacher_t) @@ -79,3 +86,27 @@ miscfiles_read_localization(aptcacher_t) # For some reasons it's trying to mmap /etc/hosts.deny sysnet_map_config(aptcacher_t) + +####################################### +# +# acngtool local policy +# + +allow acngtool_t self:netlink_route_socket r_netlink_socket_perms; +allow acngtool_t self:tcp_socket create_stream_socket_perms; +allow acngtool_t self:unix_stream_socket create_stream_socket_perms; + +allow acngtool_t aptcacher_etc_t:file map; +list_dirs_pattern(acngtool_t, aptcacher_etc_t, aptcacher_etc_t) +read_files_pattern(acngtool_t, aptcacher_etc_t, aptcacher_etc_t) + +corenet_tcp_connect_aptcacher_port(acngtool_t) + +auth_use_nsswitch(acngtool_t) + +# For some reasons it's trying to mmap /etc/hosts.deny +sysnet_map_config(acngtool_t) + +optional_policy(` + cron_system_entry(acngtool_t, acngtool_exec_t) +') -- 2.24.0