Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp3482788ybi; Tue, 2 Jul 2019 08:31:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqwg8kNsfakYiC6bnevUuPUXdRtlNe7tBOuLN2+uExXxa/0507Y8y+tcvUG41amUXNJqwnCP X-Received: by 2002:a17:902:2bcb:: with SMTP id l69mr36093878plb.155.1562081465487; Tue, 02 Jul 2019 08:31:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562081465; cv=none; d=google.com; s=arc-20160816; b=up028msOPBkUA+6QMQWIkOvtT4P6QLB6yfV8ROAsdMuohD2jLL5iPjGvIthsuF2Y/d UpKADTAG1JNfMRPi10vlHQRg6KiuR+3cRa+Oq0xQX3+0bVqGBogS1yQw7TbsUBbR1LBQ ahkzapfLhA4ZPLJ2zDzr9SL8gmi7C7sMc6gSZTgm3f0p7DfKjwhq2zQEoZFz//E+xaam d05UYICrxEkB1E3+52c2HyCJz8eEE5UbaEsB/6PBTqhb9F9vK4yLuQCetEXwiQzvgBHj eQitQOPIqlLcrSsuGcJYUwq8eCWRRRXFZ7HUiroAcNkM/AQ8Jcm4fTp8xph6jRT/umyP 2Ing== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:in-reply-to:references:message-id :date:thread-index:thread-topic:subject:to:from:dkim-signature; bh=Jwmx5kDK+4c9pnyhXJbyk1abvoBDmfv3Z4BkwS5aTjQ=; b=h9T/8VxLqCjxor/0KNnDOxHPpdVLJtOvlp5EYJHORdhZhi06vkmhifGgGw6Y6ww3rW gbNrblLuHRFT0K3t4dgfuOTcVyQJDVIPGo2mtzwulj5VKHBw06aALic7+K6nar3R6fTr PXwDHgOU7Ojz1x3PsDFTfaUdClPpVAHmUUDdUm84F1mzC7bfQ4h5DRNGz+2A6QCmKua6 6gyX/QUySNvmkqNJmy/sGKieMziQXnO16dcnRCn832LFstnvAAGrk8johw45r85I+jM3 4TmF6TMwMbzESiC9AwWN6Kz5L9dvnd3nSD2rH3SHKV4kMRx2LGgMql1Nx11H4uN1KsI3 XLxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tresys.onmicrosoft.com header.s=selector2-tresys-onmicrosoft-com header.b="Wfkj/Bhc"; 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 u24si13815168plq.430.2019.07.02.08.31.03; Tue, 02 Jul 2019 08:31:05 -0700 (PDT) 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=@tresys.onmicrosoft.com header.s=selector2-tresys-onmicrosoft-com header.b="Wfkj/Bhc"; 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 S1725780AbfGBPar (ORCPT + 11 others); Tue, 2 Jul 2019 11:30:47 -0400 Received: from mail-eopbgr700116.outbound.protection.outlook.com ([40.107.70.116]:63562 "EHLO NAM04-SN1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725972AbfGBPar (ORCPT ); Tue, 2 Jul 2019 11:30:47 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tresys.onmicrosoft.com; s=selector2-tresys-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Jwmx5kDK+4c9pnyhXJbyk1abvoBDmfv3Z4BkwS5aTjQ=; b=Wfkj/BhcAG6fEgSVGFFFhM+p8R6E55Un6TQ58l4d8bndiYuTGvasE+g5FvKqixXFqRLrA7nqUP+PmC6aCizW+GVFLxyYVy3QNtCxUCzVAs1uyhL6igWgbkD1xJrv4OwvZjK2vKJ2S8zd66jYh3KR3toCVByDaufrW3Y8fgNgB98= Received: from BN6PR15MB1507.namprd15.prod.outlook.com (10.172.151.147) by BN6PR15MB1170.namprd15.prod.outlook.com (10.172.206.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2032.18; Tue, 2 Jul 2019 15:30:31 +0000 Received: from BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::80fc:6403:1abc:cb23]) by BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::80fc:6403:1abc:cb23%6]) with mapi id 15.20.2032.019; Tue, 2 Jul 2019 15:30:30 +0000 From: "Sugar, David" To: "selinux-refpolicy@vger.kernel.org" Subject: [PATCH 2/5] grant permission for rpm to write to audit log Thread-Topic: [PATCH 2/5] grant permission for rpm to write to audit log Thread-Index: AQHVMOsUpLfILmfTT0qWwWclCs8RAA== Date: Tue, 2 Jul 2019 15:30:30 +0000 Message-ID: <20190702153014.14097-3-dsugar@tresys.com> References: <20190702153014.14097-1-dsugar@tresys.com> In-Reply-To: <20190702153014.14097-1-dsugar@tresys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [96.244.17.66] x-clientproxiedby: BN8PR03CA0034.namprd03.prod.outlook.com (2603:10b6:408:94::47) To BN6PR15MB1507.namprd15.prod.outlook.com (2603:10b6:404:c6::19) authentication-results: spf=none (sender IP is ) smtp.mailfrom=dsugar@tresys.com; x-ms-exchange-messagesentrepresentingtype: 1 x-mailer: git-send-email 2.21.0 x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 46096461-ce84-4a28-319e-08d6ff02370b x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600148)(711020)(4605104)(1401327)(2017052603328)(7193020);SRVR:BN6PR15MB1170; x-ms-traffictypediagnostic: BN6PR15MB1170: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:2512; x-forefront-prvs: 008663486A x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(4636009)(136003)(376002)(39830400003)(346002)(396003)(366004)(189003)(199004)(2616005)(305945005)(14444005)(446003)(86362001)(476003)(2906002)(486006)(11346002)(66476007)(66556008)(64756008)(66446008)(5660300002)(14454004)(186003)(76176011)(25786009)(102836004)(6116002)(3846002)(2501003)(26005)(316002)(6506007)(508600001)(50226002)(66946007)(1076003)(386003)(5640700003)(52116002)(256004)(8676002)(66066001)(6916009)(6486002)(99286004)(6436002)(53936002)(36756003)(6512007)(81166006)(2351001)(7736002)(81156014)(73956011)(8936002)(71200400001)(71190400001)(68736007);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1170;H:BN6PR15MB1507.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: tresys.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: WwJx+JIlR3d6x/V41jT7JM9t0IcbTp9slEXJfGeARzJBzP1XyimeEoS90lkNteVLVGrmQ0hvLdtRE3CSurtj5wyDmgHyWO72Cr1Xax7C/JbckSo/DIDOIMXiRm87sLJGFbY13MX6m2bbZ+rI96yLDm8bJFboYgnV6UhXdyfoFJl84Vhs0/dL2B4tLuqNI2LALKsr21E8FnyQvNioNqO+E4i34BB3ALXphVwdK/1rRG1O4n7MEaeW4oiQ59F6JjEMPAkZgWnzqad7q0mJ82f0BXlkXDy8Clfjsw4CPs5Xa2JjL/imgNi0xCxA5Qm484ynppi5VJnTcaWqnQa7Ld64vSmjnIWL3KN0FU7B0SU8hRQu86KbFHSDhgKM5ZK4okZZ+x/zf79VlkFfShEGVsJ4BXA9vwjaCdFZdWb7nV5bGgs= Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: tresys.com X-MS-Exchange-CrossTenant-Network-Message-Id: 46096461-ce84-4a28-319e-08d6ff02370b X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Jul 2019 15:30:30.3776 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a0d45667-6c07-4e88-868f-4ac9af95c7ed X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: dsugar@tresys.com X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1170 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org Messages like this are added to the audit log when an rpm is installed: type=3DSOFTWARE_UPDATE msg=3Daudit(1560913896.581:244): pid=3D1265 uid=3D0 = auid=3D4294967295 ses=3D4294967295 subj=3Dsystem_u:system_r:rpm_t:s0 msg=3D= 'sw=3D"ntpdate-4.2.6p5-25.el7_3.2.x86_64" sw_type=3Drpm key_enforce=3D0 gpg= _res=3D0 root_dir=3D"/" comm=3D"rpm" exe=3D"/usr/bin/rpm" hostname=3D? addr= =3D? terminal=3D? res=3Dsuccess' These are the denials that I'm seeing: type=3DAVC msg=3Daudit(1560913896.581:243): avc: denied { audit_write } f= or pid=3D1265 comm=3D"rpm" capability=3D29 scontext=3Dsystem_u:system_r:rp= m_t:s0 tcontext=3Dsystem_u:system_r:rpm_t:s0 tclass=3Dcapability permissive= =3D1 type=3DAVC msg=3Daudit(1561298132.446:240): avc: denied { create } for pi= d=3D1266 comm=3D"rpm" scontext=3Dsystem_u:system_r:rpm_t:s0 tcontext=3Dsyst= em_u:system_r:rpm_t:s0 tclass=3Dnetlink_audit_socket permissive=3D1 type=3DAVC msg=3Daudit(1561298132.446:241): avc: denied { write } for pid= =3D1266 comm=3D"rpm" scontext=3Dsystem_u:system_r:rpm_t:s0 tcontext=3Dsyste= m_u:system_r:rpm_t:s0 tclass=3Dnetlink_audit_socket permissive=3D1 type=3DAVC msg=3Daudit(1561298132.446:241): avc: denied { nlmsg_relay } f= or pid=3D1266 comm=3D"rpm" scontext=3Dsystem_u:system_r:rpm_t:s0 tcontext= =3Dsystem_u:system_r:rpm_t:s0 tclass=3Dnetlink_audit_socket permissive=3D1 type=3DAVC msg=3Daudit(1561298132.447:243): avc: denied { read } for pid= =3D1266 comm=3D"rpm" scontext=3Dsystem_u:system_r:rpm_t:s0 tcontext=3Dsyste= m_u:system_r:rpm_t:s0 tclass=3Dnetlink_audit_socket permissive=3D1 Signed-off-by: Dave Sugar --- policy/modules/admin/rpm.te | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/policy/modules/admin/rpm.te b/policy/modules/admin/rpm.te index 0e6e9c03..a28a24d3 100644 --- a/policy/modules/admin/rpm.te +++ b/policy/modules/admin/rpm.te @@ -73,7 +73,7 @@ files_tmpfs_file(rpm_script_tmpfs_t) # rpm Local policy # =20 -allow rpm_t self:capability { chown dac_override fowner fsetid ipc_lock mk= nod setfcap setgid setuid sys_chroot sys_nice sys_tty_config }; +allow rpm_t self:capability { audit_write chown dac_override fowner fsetid= ipc_lock mknod setfcap setgid setuid sys_chroot sys_nice sys_tty_config }; allow rpm_t self:process { transition signal_perms getsched setsched getse= ssion getpgid setpgid getcap setcap share getattr setexec setfscreate noats= ecure siginh setrlimit rlimitinh dyntransition execmem setkeycreate setsock= create getrlimit }; allow rpm_t self:fd use; allow rpm_t self:fifo_file rw_fifo_file_perms; @@ -87,6 +87,7 @@ allow rpm_t self:msgq create_msgq_perms; allow rpm_t self:msg { send receive }; allow rpm_t self:file rw_file_perms; allow rpm_t self:netlink_kobject_uevent_socket create_socket_perms; +allow rpm_t self:netlink_audit_socket { nlmsg_relay create_socket_perms }; =20 allow rpm_t rpm_log_t:file { append_file_perms create_file_perms setattr_f= ile_perms }; logging_log_filetrans(rpm_t, rpm_log_t, file) --=20 2.21.0