From nobody Thu Apr 25 23:28:18 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1506123737561366.12209777389046; Fri, 22 Sep 2017 16:42:17 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B46927CB80; Fri, 22 Sep 2017 23:42:15 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 966CD5C269; Fri, 22 Sep 2017 23:42:15 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 35AAB1855944; Fri, 22 Sep 2017 23:42:15 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v8MN3GZO005202 for ; Fri, 22 Sep 2017 19:03:16 -0400 Received: by smtp.corp.redhat.com (Postfix) id 42EF95C269; Fri, 22 Sep 2017 23:03:16 +0000 (UTC) Received: from mx1.redhat.com (ext-mx08.extmail.prod.ext.phx2.redhat.com [10.5.110.32]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3E4FB679C3 for ; Fri, 22 Sep 2017 23:03:14 +0000 (UTC) Received: from smtp2.provo.novell.com (smtp2.provo.novell.com [137.65.250.81]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 01F20C04DBC5 for ; Fri, 22 Sep 2017 23:03:13 +0000 (UTC) Received: from linux-tbji.provo.novell.com (prv-ext-foundry1int.gns.novell.com [137.65.251.240]) by smtp2.provo.novell.com with ESMTP (NOT encrypted); Fri, 22 Sep 2017 17:03:06 -0600 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com B46927CB80 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com B46927CB80 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 01F20C04DBC5 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=suse.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jfehlig@suse.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 01F20C04DBC5 From: Jim Fehlig To: libvir-list@redhat.com Date: Fri, 22 Sep 2017 17:02:42 -0600 Message-Id: <20170922230242.21336-1-jfehlig@suse.com> X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 205 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 22 Sep 2017 23:03:13 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Fri, 22 Sep 2017 23:03:13 +0000 (UTC) for IP:'137.65.250.81' DOMAIN:'smtp2.provo.novell.com' HELO:'smtp2.provo.novell.com' FROM:'jfehlig@suse.com' RCPT:'' X-RedHat-Spam-Score: -2.301 (RCVD_IN_DNSWL_MED, SPF_PASS) 137.65.250.81 smtp2.provo.novell.com 137.65.250.81 smtp2.provo.novell.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com Cc: agx@sigxcpu.org, stefan.bader@canonical.com Subject: [libvirt] [PATCH V3] apparmor: support ptrace checks X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Fri, 22 Sep 2017 23:42:16 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Kernel 4.13 introduced finer-grained ptrace checks https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git/com= mit/?h=3Dv4.13.2&id=3D290f458a4f16f9cf6cb6562b249e69fe1c3c3a07 With kernel 4.13 and apparmor 2.11, simply starting libvirtd results in the following apparmor denial type=3DAVC msg=3Daudit(1506112085.645:954): apparmor=3D"DENIED" operation=3D"ptrace" profile=3D"/usr/sbin/libvirtd" pid=3D6984 comm=3D"libvirtd" requested_mask=3D"trace" denied_mask=3D"trace" peer=3D"unconfined" Attempting to start an unconfined domain results in type=3DAVC msg=3Daudit(1506112301.227:1112): apparmor=3D"DENIED" operation=3D"ptrace" profile=3D"/usr/sbin/libvirtd" pid=3D7498 comm=3D"libvirtd" requested_mask=3D"trace" denied_mask=3D"trace" peer=3D"/usr/sbin/libvirtd" And attempting to start a confined domain results in type=3DAVC msg=3Daudit(1506112631.408:1312): apparmor=3D"DENIED" operation=3D"open" profile=3D"virt-aa-helper" name=3D"/etc/libnl/classid" pid=3D8283 comm=3D"virt-aa-helper" requested_mask=3D"r" denied_mask=3D"r" fsuid=3D0 ouid=3D0 type=3DAVC msg=3Daudit(1506112631.530:1319): apparmor=3D"DENIED" operation=3D"open" profile=3D"virt-aa-helper" name=3D"/etc/libnl/classid" pid=3D8289 comm=3D"virt-aa-helper" requested_mask=3D"r" denied_mask=3D"r" fsuid=3D0 ouid=3D0 type=3DAVC msg=3Daudit(1506112632.186:1324): apparmor=3D"DENIED" operation=3D"ptrace" profile=3D"/usr/sbin/libvirtd" pid=3D8342 comm=3D"libvirtd" requested_mask=3D"trace" denied_mask=3D"trace" peer=3D"libvirt-66154842-e926-4f92-92f0-1c1bf61dd1ff" Add ptrace rules to allow the trace operations. Resolves: https://bugzilla.suse.com/show_bug.cgi?id=3D1058847 Signed-off-by: Jim Fehlig Reviewed-By: Guido G=C3=BCnther --- V3: fix ptrace rule for per-domain profiles V2: restrict ptrace permissions drop support for dbus, signal, and unix =20 examples/apparmor/usr.sbin.libvirtd | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/apparmor/usr.sbin.libvirtd b/examples/apparmor/usr.sb= in.libvirtd index acb59e071..fa4ebb355 100644 --- a/examples/apparmor/usr.sbin.libvirtd +++ b/examples/apparmor/usr.sbin.libvirtd @@ -37,6 +37,10 @@ network packet dgram, network packet raw, =20 + ptrace (trace) peer=3Dunconfined, + ptrace (trace) peer=3D/usr/sbin/libvirtd, + ptrace (trace) peer=3Dlibvirt-*, + # Very lenient profile for libvirtd since we want to first focus on conf= ining # the guests. Guests will have a very restricted profile. / r, --=20 2.14.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list