Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0AE17C43387 for ; Fri, 21 Dec 2018 01:42:04 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A099420874 for ; Fri, 21 Dec 2018 01:42:03 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=tresys.onmicrosoft.com header.i=@tresys.onmicrosoft.com header.b="ZLhvPLQy" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388087AbeLUBmD (ORCPT ); Thu, 20 Dec 2018 20:42:03 -0500 Received: from mail-eopbgr710126.outbound.protection.outlook.com ([40.107.71.126]:27323 "EHLO NAM05-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2388019AbeLUBmD (ORCPT ); Thu, 20 Dec 2018 20:42:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tresys.onmicrosoft.com; s=selector1-tresys-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WsTWkQyULksjILk/VFHfU/P92rR+9J2k0QdMLt4x18A=; b=ZLhvPLQy2Id5rTdTBr09ZchcDsIvVav9EC7RYKYWknhIcRtYyqFRa43g1Jee2PV/A+T0vCO79MAK6/EY05VZQRR04Aah6+si//fizGqtpJA13cKlrz100Z8LJUQ/hPpVnhj2t3yQdLoUZN+aytw89vOiyJGGkZADejidzeKLUz8= Received: from BN6PR15MB1507.namprd15.prod.outlook.com (10.172.151.147) by BN6PR15MB1252.namprd15.prod.outlook.com (10.172.206.14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1446.19; Fri, 21 Dec 2018 01:41:26 +0000 Received: from BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::9512:b464:7045:df6d]) by BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::9512:b464:7045:df6d%7]) with mapi id 15.20.1425.025; Fri, 21 Dec 2018 01:41:26 +0000 From: David Sugar To: "selinux-refpolicy@vger.kernel.org" Subject: [PATCH 2/2] pam_faillock creates files in /run/faillock Thread-Topic: [PATCH 2/2] pam_faillock creates files in /run/faillock Thread-Index: AQHUmM5JchfQlUxYuUS4LDXSCHU4QQ== Date: Fri, 21 Dec 2018 01:41:25 +0000 Message-ID: <20181221014026.2867-2-dsugar@tresys.com> References: <20181221014026.2867-1-dsugar@tresys.com> In-Reply-To: <20181221014026.2867-1-dsugar@tresys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [73.180.141.176] x-clientproxiedby: BN6PR10CA0028.namprd10.prod.outlook.com (2603:10b6:404:109::14) 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-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;BN6PR15MB1252;6:sttrNKo9tlth8XI5L77pW6mfAEHgxN+CRw82B1BWxdRnAY2nSpcNGIUEujG5ifYrgBRH/lZB8V7ovABJGwNSelZw5+6YqnBRZ6iqnvGlPcafvmSK63A0WR9ozfN8873mduQ9eNt0m0bgPebTeSlZH5Gw78xwyNWNpdidSFBUecg75IQDuv4j6xS6YsQou9jY3fBuv6VI189xjsk8v3O74Egka/ftYlXYgvek9TaSmcwiyWazZ+0F0kYoncYlIM/B/3bVGc4INdIK+nfCEhkJ/t7+OnU9HvqL/h9vIuIqlWnETIiuT9DfHZCD/C0pdHLuPMFfjiKc9gou4bndTGmZMtvXgdmujD8NLq6+k6KtZEkUmT4KP/LYQce4+fqMxq5DVxSDDevUwqG1ULlyshGRHspNWe8ZIc4U2tlFeBPop9/NfIJAPnggydhRxTXdzXYQiUdgl8iYxkt8tRFuMFwlYA==;5:mQtonIl7LQpHNzxibnqKB6/Gima96kJonUUv0gVuxiYyoMDC4xmMtFFGty7VFakidIvK7KnzhvDzpnbB01be3XajMB9Vm6h6RiL8ySR2FM8rrzd4YVcL+h2GY8R+UMpeI70HmGZRdB3WZ3IHfYemXhvs6HH9GX1TjYOgU/B1To4=;7:FHbNXmipC14bLVOEoOIDoSm7Y8fEKFx4uwFvdrORLmf6w+RId6ytIv3JBUXXEAs3wiPo2/heXULCEm3pp8BXOjQHoxpxb36SAPPgMXin8voaNlIuJGGE9otLsIN0T8He9NqBsOGyh5JPobZC5QODdA== x-ms-office365-filtering-correlation-id: 9c555b0d-02e5-4671-215e-08d666e56b53 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(5600074)(711020)(2017052603328)(7153060)(7193020);SRVR:BN6PR15MB1252; x-ms-traffictypediagnostic: BN6PR15MB1252: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(999002)(5005026)(6040522)(2401047)(8121501046)(3231475)(944501520)(52105112)(93006095)(93001095)(3002001)(10201501046)(149066)(150057)(6041310)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(2016111802025)(6043046)(201708071742011)(7699051)(76991095);SRVR:BN6PR15MB1252;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1252; x-forefront-prvs: 0893636978 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(366004)(376002)(136003)(346002)(39830400003)(199004)(189003)(81156014)(186003)(6506007)(508600001)(386003)(551544002)(76176011)(81166006)(52116002)(486006)(14454004)(25786009)(7736002)(14444005)(256004)(97736004)(68736007)(2501003)(6512007)(8936002)(305945005)(26005)(1076003)(5640700003)(36756003)(102836004)(53936002)(2906002)(66066001)(2351001)(8676002)(99286004)(105586002)(6116002)(3846002)(6436002)(446003)(71190400001)(476003)(575784001)(86362001)(5660300001)(316002)(6916009)(71200400001)(11346002)(2616005)(6486002)(106356001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1252;H:BN6PR15MB1507.namprd15.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: tresys.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: d64m+1hIVA8IUgL/sfyovHpZgzJ+tw0fWJCbSwXLLDdV9JS71wLN4Anw84YsmSM+lBVyzwECSYwGziRTIVh5SoZYKMLrpmO453Xk+feclhZ6iCb9XgCGJGP60nbHs2+PVy1puTLWZ1u8kq9LfnlRneqdgRCz/uktRZtFsI0Vk2Aq2aNuWTXGcpUqDpDmQtN9kr6I1eRGS6xfPIk1WEIWTZHzcWU8DzyUvAICHi1lsdxOV6PVkqBeMch8mMRPx9VPYU08HVkCvIAHj4McBOCCKl2ZzJzsQ30SQwNSsNqq/RB3w7BtaillFfmV6WiH+64v spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM 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: 9c555b0d-02e5-4671-215e-08d666e56b53 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Dec 2018 01:41:25.7220 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a0d45667-6c07-4e88-868f-4ac9af95c7ed X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1252 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org These are changes needed when pam_fallock created files in /run/faillock (which is labeled faillog_t). sudo and xdm (and probably other domains) will create files in this directory for successful and failed logins attempts. type=3DAVC msg=3Daudit(1545153126.899:210): avc: denied { search } for pi= d=3D8448 comm=3D"lightdm" name=3D"faillock" dev=3D"tmpfs" ino=3D39318 scont= ext=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:f= aillog_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1545153131.090:214): avc: denied { write } for pid= =3D8448 comm=3D"lightdm" name=3D"faillock" dev=3D"tmpfs" ino=3D39318 sconte= xt=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:fa= illog_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1545153131.090:214): avc: denied { add_name } for = pid=3D8448 comm=3D"lightdm" name=3D"dsugar" scontext=3Dsystem_u:system_r:xd= m_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:faillog_t:s0 tclass=3Ddir p= ermissive=3D1 type=3DAVC msg=3Daudit(1545153131.090:214): avc: denied { create } for pi= d=3D8448 comm=3D"lightdm" name=3D"dsugar" scontext=3Dsystem_u:system_r:xdm_= t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:faillog_t:s0 tclass=3Dfile pe= rmissive=3D1 type=3DAVC msg=3Daudit(1545153131.091:215): avc: denied { setattr } for p= id=3D8448 comm=3D"lightdm" name=3D"dsugar" dev=3D"tmpfs" ino=3D87599 sconte= xt=3Dsystem_u:system_r:xdm_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:fa= illog_t:s0 tclass=3Dfile permissive=3D1 type=3DAVC msg=3Daudit(1545167205.531:626): avc: denied { search } for pi= d=3D8264 comm=3D"sudo" name=3D"faillock" dev=3D"tmpfs" ino=3D35405 scontext= =3Dsysadm_u:sysadm_r:cleaner_applyconfig_sudo_t:s0-s0:c0.c1023 tcontext=3Ds= ystem_u:object_r:faillog_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1545167205.531:627): avc: denied { write } for pid= =3D8264 comm=3D"sudo" name=3D"faillock" dev=3D"tmpfs" ino=3D35405 scontext= =3Dsysadm_u:sysadm_r:cleaner_applyconfig_sudo_t:s0-s0:c0.c1023 tcontext=3Ds= ystem_u:object_r:faillog_t:s0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1545167205.531:627): avc: denied { add_name } for = pid=3D8264 comm=3D"sudo" name=3D"root" scontext=3Dsysadm_u:sysadm_r:cleaner= _applyconfig_sudo_t:s0-s0:c0.c1023 tcontext=3Dsystem_u:object_r:faillog_t:s= 0 tclass=3Ddir permissive=3D1 type=3DAVC msg=3Daudit(1545167205.531:627): avc: denied { create } for pi= d=3D8264 comm=3D"sudo" name=3D"root" scontext=3Dsysadm_u:sysadm_r:cleaner_a= pplyconfig_sudo_t:s0-s0:c0.c1023 tcontext=3Dsysadm_u:object_r:faillog_t:s0 = tclass=3Dfile permissive=3D1 Signed-off-by: Dave Sugar --- policy/modules/admin/sudo.if | 1 + policy/modules/services/xserver.te | 1 + policy/modules/system/authlogin.if | 20 ++++++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/policy/modules/admin/sudo.if b/policy/modules/admin/sudo.if index 7661a2f3..5fab0d04 100644 --- a/policy/modules/admin/sudo.if +++ b/policy/modules/admin/sudo.if @@ -113,6 +113,7 @@ template(`sudo_role_template',` term_relabel_all_ttys($1_sudo_t) term_relabel_all_ptys($1_sudo_t) =20 + auth_create_faillog($1_sudo_t) auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) diff --git a/policy/modules/services/xserver.te b/policy/modules/services/x= server.te index 12ad3a87..fd89a95b 100644 --- a/policy/modules/services/xserver.te +++ b/policy/modules/services/xserver.te @@ -481,6 +481,7 @@ term_setattr_console(xdm_t) term_use_unallocated_ttys(xdm_t) term_setattr_unallocated_ttys(xdm_t) =20 +auth_create_faillog(xdm_t) auth_domtrans_pam_console(xdm_t) auth_manage_pam_pid(xdm_t) auth_manage_pam_console_data(xdm_t) diff --git a/policy/modules/system/authlogin.if b/policy/modules/system/aut= hlogin.if index 7f8c002e..5521aec3 100644 --- a/policy/modules/system/authlogin.if +++ b/policy/modules/system/authlogin.if @@ -744,6 +744,26 @@ interface(`auth_append_faillog',` allow $1 faillog_t:file append_file_perms; ') =20 +######################################## +## +## Create fail log lock (in /run/faillock). +## +## +## +## Domain allowed access. +## +## +# +interface(`auth_create_faillog',` + gen_require(` + type faillog_t; + ') + + auth_rw_faillog($1) + create_files_pattern($1, faillog_t, faillog_t) + setattr_files_pattern($1, faillog_t, faillog_t) +') + ######################################## ## ## Read and write the login failure log. --=20 2.19.2