From nobody Fri May 3 10:03:28 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 1509024141876966.736883580194; Thu, 26 Oct 2017 06:22:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 4522A62E9A; Thu, 26 Oct 2017 13:22:20 +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 20D4B7B536; Thu, 26 Oct 2017 13:22:20 +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 D60DF1805961; Thu, 26 Oct 2017 13:22:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QDMIV0021575 for ; Thu, 26 Oct 2017 09:22:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB5447B5E5; Thu, 26 Oct 2017 13:22:18 +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 E60BC7B536 for ; Thu, 26 Oct 2017 13:22:16 +0000 (UTC) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D3D83C04CE62 for ; Thu, 26 Oct 2017 13:22:15 +0000 (UTC) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1e7i6w-0007Xx-N8; Thu, 26 Oct 2017 13:22:14 +0000 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 4522A62E9A Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ext-mx10.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 4522A62E9A DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com D3D83C04CE62 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=christian.ehrhardt@canonical.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com D3D83C04CE62 From: Christian Ehrhardt To: Libvirt Devel Date: Thu, 26 Oct 2017 15:22:10 +0200 Message-Id: <1509024131-25849-2-git-send-email-christian.ehrhardt@canonical.com> In-Reply-To: <1509024131-25849-1-git-send-email-christian.ehrhardt@canonical.com> References: <1509024131-25849-1-git-send-email-christian.ehrhardt@canonical.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]); Thu, 26 Oct 2017 13:22:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Thu, 26 Oct 2017 13:22:16 +0000 (UTC) for IP:'91.189.89.112' DOMAIN:'youngberry.canonical.com' HELO:'youngberry.canonical.com' FROM:'christian.ehrhardt@canonical.com' RCPT:'' X-RedHat-Spam-Score: -2.321 (RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD) 91.189.89.112 youngberry.canonical.com 91.189.89.112 youngberry.canonical.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.32 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Jamie Strandboge , Guido Guenther , Christian Ehrhardt Subject: [libvirt] [PATCH 1/2] virt-aa-helper: apparmor wildcards to forbidden chars 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Thu, 26 Oct 2017 13:22:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Some globbing chars in the domain name could be used to break out of apparmor rules, so lets forbid these when in virt-aa-helper. Also adding a test to ensure all those cases were detected as bad char. Signed-off-by: Christian Ehrhardt --- src/security/virt-aa-helper.c | 2 +- tests/virt-aa-helper-test | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/src/security/virt-aa-helper.c b/src/security/virt-aa-helper.c index ef1bf01..4f1c195 100644 --- a/src/security/virt-aa-helper.c +++ b/src/security/virt-aa-helper.c @@ -449,7 +449,7 @@ valid_name(const char *name) { /* just try to filter out any dangerous characters in the name that ca= n be * used to subvert the profile */ - const char *bad =3D "/[]*"; + const char *bad =3D "/[]{}?^,\"*"; =20 if (strlen(name) =3D=3D 0) return -1; diff --git a/tests/virt-aa-helper-test b/tests/virt-aa-helper-test index 0599046..e837668 100755 --- a/tests/virt-aa-helper-test +++ b/tests/virt-aa-helper-test @@ -211,6 +211,26 @@ testme "1" "-c with no os.type" "-c -u $valid_uuid" "$= test_xml" sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,hvm,= hvm_invalid,g" "$template_xml" > "$test_xml" testme "1" "-c with invalid hvm" "-c -u $valid_uuid" "$test_xml" =20 +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-/,g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char /" "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-[,g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char [" "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-],g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char ]" "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-{,g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char {" "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-},g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char }" "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-?,g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char ?" "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-^,g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char ^" "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-\,,g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char ," "-c -u $valid_uuid" "$test= _xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-\",g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char \"" "-c -u $valid_uuid" "$tes= t_xml" +sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" -e "s,virt-aa-hel= per-test,virt-aa-helper-test-*,g" "$template_xml" > "$test_xml" +testme "1" "-c with invalid domain name char *" "-c -u $valid_uuid" "$test= _xml" =20 echo "Expected pass:" >$output sed -e "s,###UUID###,$uuid,g" -e "s,###DISK###,$disk1,g" "$template_xml" >= "$test_xml" --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri May 3 10:03:28 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 1509024141815455.235749465269; Thu, 26 Oct 2017 06:22:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 30E8BA63ED; Thu, 26 Oct 2017 13:22:20 +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 0BF3860602; Thu, 26 Oct 2017 13:22:20 +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 A71B61805960; Thu, 26 Oct 2017 13:22:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v9QDMI20021576 for ; Thu, 26 Oct 2017 09:22:18 -0400 Received: by smtp.corp.redhat.com (Postfix) id EB5947B8F0; Thu, 26 Oct 2017 13:22:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E642F7B8F8 for ; Thu, 26 Oct 2017 13:22:17 +0000 (UTC) Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id BA47425C40 for ; Thu, 26 Oct 2017 13:22:16 +0000 (UTC) Received: from 1.general.paelzer.uk.vpn ([10.172.196.172] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1e7i6x-0007Xx-KG; Thu, 26 Oct 2017 13:22:15 +0000 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 30E8BA63ED Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ext-mx01.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 30E8BA63ED DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com BA47425C40 Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=canonical.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=none smtp.mailfrom=christian.ehrhardt@canonical.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com BA47425C40 From: Christian Ehrhardt To: Libvirt Devel Date: Thu, 26 Oct 2017 15:22:11 +0200 Message-Id: <1509024131-25849-3-git-send-email-christian.ehrhardt@canonical.com> In-Reply-To: <1509024131-25849-1-git-send-email-christian.ehrhardt@canonical.com> References: <1509024131-25849-1-git-send-email-christian.ehrhardt@canonical.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.30]); Thu, 26 Oct 2017 13:22:16 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 26 Oct 2017 13:22:16 +0000 (UTC) for IP:'91.189.89.112' DOMAIN:'youngberry.canonical.com' HELO:'youngberry.canonical.com' FROM:'christian.ehrhardt@canonical.com' RCPT:'' X-RedHat-Spam-Score: -2.321 (RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RP_MATCHES_RCVD) 91.189.89.112 youngberry.canonical.com 91.189.89.112 youngberry.canonical.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Cc: Jamie Strandboge , Guido Guenther , Christian Ehrhardt Subject: [libvirt] [PATCH 2/2] virt-aa-helper-test: only fails go to stdout by default 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.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Thu, 26 Oct 2017 13:22:20 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" By Default (without -d) the tests will only print Failures. So a log should follow general "no message is a good message" style. But the testfw checks always emit the skip info to stdout. Instead they should use the redirection that is controlled by -d. This avoids mesages like the following to clutter the log: Skipping FW AAVMF32 test. Could not find /usr/share/AAVMF/AAVMF32_CODE.fd Signed-off-by: Christian Ehrhardt --- tests/virt-aa-helper-test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/virt-aa-helper-test b/tests/virt-aa-helper-test index e837668..d2a557e 100755 --- a/tests/virt-aa-helper-test +++ b/tests/virt-aa-helper-test @@ -155,7 +155,7 @@ testfw() { -e "s,,$fwpath,g" "$template_xml" > "$test_xml" testme "0" "$title" "-r -u $valid_uuid" "$test_xml" else - echo "Skipping FW $title test. Could not find $fwpath" + echo "Skipping FW $title test. Could not find $fwpath" >$output fi } =20 --=20 2.7.4 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list