From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTP id 51F2C5A026F for ; Wed, 16 Aug 2023 11:10:36 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692177035; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=eF0pcyRNKQtgIvuSOkYvrlYb32i7AC9wuXkj30csVZ8=; b=Awu15urfv58A/pwGMMhBgBou3smdMXKnSoBJAdCnLp8xxQgJstOUu8ctICBCyVyllgtjxV BZT8Y7bWXOiw4DaGF5yoQTcjaP1Ogf0QIDI9TYs+fPLMfIf6+VPkoOOu1MkerCTP6nW8QW IAd9+X44VtqEjqcQO2jmWrI37Q7RJYc= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-453-FEkSpyMJOfGsVUldlGoigg-1; Wed, 16 Aug 2023 05:10:33 -0400 X-MC-Unique: FEkSpyMJOfGsVUldlGoigg-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 4B10E8DC671; Wed, 16 Aug 2023 09:10:33 +0000 (UTC) Received: from localhost (unknown [10.42.28.15]) by smtp.corp.redhat.com (Postfix) with ESMTP id EB38D1121314; Wed, 16 Aug 2023 09:10:32 +0000 (UTC) Date: Wed, 16 Aug 2023 10:10:32 +0100 From: "Richard W.M. Jones" To: Stefano Brivio Subject: Re: [PATCH 5/7] selinux: Add rules for sysctl and /proc/net accesses Message-ID: <20230816091032.GE7636@redhat.com> References: <20230816060038.870746-1-sbrivio@redhat.com> <20230816060038.870746-6-sbrivio@redhat.com> MIME-Version: 1.0 In-Reply-To: <20230816060038.870746-6-sbrivio@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Scanned-By: MIMEDefang 3.1 on 10.11.54.3 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Message-ID-Hash: ZW4VWJDTLGFD662LGTIQWMJBDNT5724Y X-Message-ID-Hash: ZW4VWJDTLGFD662LGTIQWMJBDNT5724Y X-MailFrom: rjones@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On Wed, Aug 16, 2023 at 08:00:36AM +0200, Stefano Brivio wrote: > That's what we actually need to check networking-related sysctls, > to scan for bound ports, and to manipulate bits of network > configuration inside pasta's target namespaces. > > Signed-off-by: Stefano Brivio > --- > contrib/selinux/passt.te | 1 + > contrib/selinux/pasta.te | 3 +++ > 2 files changed, 4 insertions(+) > > diff --git a/contrib/selinux/passt.te b/contrib/selinux/passt.te > index a0c0526..948d1b1 100644 > --- a/contrib/selinux/passt.te > +++ b/contrib/selinux/passt.te > @@ -101,6 +101,7 @@ allow passt_t net_conf_t:file { open read }; > allow passt_t net_conf_t:lnk_file read; > allow passt_t tmp_t:sock_file { create unlink write }; > allow passt_t self:netlink_route_socket { bind create nlmsg_read read write setopt }; > +kernel_search_network_sysctl(passt_t) > > corenet_tcp_bind_all_nodes(passt_t) > corenet_udp_bind_all_nodes(passt_t) > diff --git a/contrib/selinux/pasta.te b/contrib/selinux/pasta.te > index 28265dc..b3ddc6a 100644 > --- a/contrib/selinux/pasta.te > +++ b/contrib/selinux/pasta.te > @@ -133,6 +133,7 @@ allow syslogd_t self:cap_userns sys_ptrace; > allow pasta_t proc_net_t:file { open read }; > allow pasta_t net_conf_t:file { open read }; > allow pasta_t self:netlink_route_socket { bind create nlmsg_read nlmsg_write setopt read write }; > +kernel_search_network_sysctl(pasta_t) > > allow pasta_t tmp_t:sock_file { create unlink write }; > > @@ -186,4 +187,6 @@ allow pasta_t sysctl_net_t:dir search; > allow pasta_t sysctl_net_t:file { open write }; > allow pasta_t kernel_t:system module_request; > > +allow pasta_t net_conf_t:lnk_file read; > +allow pasta_t proc_net_t:lnk_file read; Acked-by: Richard W.M. Jones -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com Fedora Windows cross-compiler. Compile Windows programs, test, and build Windows installers. Over 100 libraries supported. http://fedoraproject.org/wiki/MinGW