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=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,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 84AB7C43387 for ; Sun, 6 Jan 2019 12:34:44 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 48F04206B7 for ; Sun, 6 Jan 2019 12:34:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=tresys.onmicrosoft.com header.i=@tresys.onmicrosoft.com header.b="uUbuLcxG" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726189AbfAFMeo (ORCPT ); Sun, 6 Jan 2019 07:34:44 -0500 Received: from mail-eopbgr750092.outbound.protection.outlook.com ([40.107.75.92]:6209 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726264AbfAFMen (ORCPT ); Sun, 6 Jan 2019 07:34:43 -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=21hdbwqLZr4nykAMSUMz5B86Gcb4s5hez3e7Wagtn54=; b=uUbuLcxG77XhgjGxQCdr9X094XgeNEWCnXHuvnHhvarZXnyDZyvVojzfmveU5dvZDVSpaxm5a2QRP965ZY+1hu8hZd3iNhNbgKjKEviBB+GRflEVHpfLeZmn0dd2De1iR2VKncyrdT7PQBdZKodUI6gW5rNdeUGpAC6/5SdP9wE= Received: from BN6PR15MB1507.namprd15.prod.outlook.com (10.172.151.147) by BN6PR15MB1506.namprd15.prod.outlook.com (10.172.151.146) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1495.7; Sun, 6 Jan 2019 12:34:36 +0000 Received: from BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::6d82:5bd:50b3:6a10]) by BN6PR15MB1507.namprd15.prod.outlook.com ([fe80::6d82:5bd:50b3:6a10%3]) with mapi id 15.20.1495.011; Sun, 6 Jan 2019 12:34:35 +0000 From: "Sugar, David" To: "selinux-refpolicy@vger.kernel.org" Subject: [PATCH 2/2 v2] pam_faillock creates files in /run/faillock Thread-Topic: [PATCH 2/2 v2] pam_faillock creates files in /run/faillock Thread-Index: AQHUpbwu3+2PQqAaJUWeYTAjv47qow== Date: Sun, 6 Jan 2019 12:34:35 +0000 Message-ID: <20190106123358.18395-2-dsugar@tresys.com> References: <20190106123358.18395-1-dsugar@tresys.com> In-Reply-To: <20190106123358.18395-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: BN6PR11CA0044.namprd11.prod.outlook.com (2603:10b6:404:4b::30) 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;BN6PR15MB1506;6:mquSwMngC0vPukAmuP9/USWGINv38qX9tEcqXuTn+N0ey///Ln8/LNpJkcZKa/w1jysYuL23jUSv/FPCfEmqpZaaSE+8Q6O0HJCAv/fA1vJnKJ0V8fQN4kaeHoHZo8BjLNIkuraBFR4LdPykePLHfLwxIuRvFS+krZiRh5eHCULpseiiy3CZA7Qs65FTDOAEPTt3SrU3FgxaW5kLGu6YymPusPjq3iVeBoskGGwS4NVwB95P6B8a9YRfQa85HPd4Vv3FpnlNvrnvOn9YvH0oJhqq0kkur1scPpS36Jgknp4QY9mBDYg6PadfYCpjtfIPp2THFZ8PqeB20SpYzhGIOfkcYguaHZKeLZtErR+qHF6/lD0agYwNpKIbp1e1H4Qz4+xR/X9qUBC0up3kNXB1LTAqf0Wyjw3lyQzUE7+IMTTiTpKKrxEWwoTTtmhHzCnp7ofsQ9nPw8ecgMoNtGR8pg==;5:xVVStX1VKUFS6ZQAtGre97v/XnKegINTwiLrI0vOGbqqJx6m0M968coucz9s4xuNgD6UVi8zMa7QvfvGmdYfJ7AWTMEPb6+57rZLsvZB2G70ixX06N3CL12ozi2ikZKEkGwYyfx9mGa2f8WiqHmaiNHm57e8lzKOxW2SnOrqAIxjUCP27C2ZWOvgG4Q1RrTIcUb+GqATEtdfHjE6eAwlCg==;7:GzvxrAYQaSjBPdXtfqfGaufrPsUr24F1VH4jbqZkJPwIqgniLVRi0jcr0wvmWDOybdQw4orL+srpOZO3IhZpe2FI7ItAtXf+rdWxo7V2qy8BapD1uvhsueOGtIwqUZL6K+UtZCnt8qvOL9lNjZhuEw== x-ms-office365-filtering-correlation-id: 8366d877-317d-42e3-e305-08d673d350f5 x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390118)(7020095)(4652040)(7021145)(8989299)(5600109)(711020)(4534185)(7022145)(4603075)(4627221)(201702281549075)(8990200)(7048125)(7024125)(7027125)(7023125)(2017052603328)(7153060)(7193020);SRVR:BN6PR15MB1506; x-ms-traffictypediagnostic: BN6PR15MB1506: x-microsoft-antispam-prvs: x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(3230021)(908002)(999002)(5005026)(6040522)(8220060)(2401047)(8121501046)(3002001)(3231475)(944501520)(52105112)(93006095)(93001095)(10201501046)(6041310)(20161123558120)(20161123564045)(20161123560045)(2016111802025)(20161123562045)(6043046)(201708071742011)(7699051)(76991095);SRVR:BN6PR15MB1506;BCL:0;PCL:0;RULEID:;SRVR:BN6PR15MB1506; x-forefront-prvs: 09090B6B69 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(366004)(376002)(136003)(39830400003)(346002)(199004)(189003)(36756003)(52116002)(256004)(476003)(2501003)(6116002)(6436002)(508600001)(6512007)(3846002)(99286004)(97736004)(53936002)(6916009)(105586002)(6506007)(106356001)(5660300001)(386003)(316002)(68736007)(66066001)(575784001)(86362001)(186003)(26005)(7736002)(102836004)(305945005)(25786009)(71190400001)(71200400001)(76176011)(2906002)(8676002)(8936002)(81156014)(81166006)(5640700003)(1076003)(14444005)(446003)(551544002)(14454004)(486006)(6486002)(11346002)(2616005)(2351001);DIR:OUT;SFP:1102;SCL:1;SRVR:BN6PR15MB1506;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-ms-exchange-senderadcheck: 1 x-microsoft-antispam-message-info: eRYP/D9EG7UwA94oMVBI5XO02u2+BZOTDQ8TiTaeYgZKgfLkiCJh9d4rOFtt9EnTnOqO2YNakjt4Vpouqs/O765styXVlBrpl/hgs3o7rzKBY4+4E/eKImyMxRBoU8gRU9vOq+4zGOkf/ZCupeXbDs+NtOVzzkFDyXSgYT5vIF+nbkHwgVWrs9GeC2xdPPN6HdtqfoffO8Sc2Zmo8MpSM32v7KNmkVbAQTBhXghuw7RZ72xb+bTOJdpKVf+TpnisX6bqqpWpsPxNO/PiP5NrSbkCr3/zIyePtwyOjkn38GHQQ3mHmYQfiSOg/VYD1FNU 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: 8366d877-317d-42e3-e305-08d673d350f5 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jan 2019 12:34:35.6839 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: a0d45667-6c07-4e88-868f-4ac9af95c7ed X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR15MB1506 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 creates 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 login 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 | 2 +- policy/modules/services/xserver.te | 1 - policy/modules/system/authlogin.if | 21 +++++++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/policy/modules/admin/sudo.if b/policy/modules/admin/sudo.if index 01f408ef..1c1fbe7b 100644 --- a/policy/modules/admin/sudo.if +++ b/policy/modules/admin/sudo.if @@ -116,8 +116,8 @@ template(`sudo_role_template',` auth_run_chk_passwd($1_sudo_t, $2) # sudo stores a token in the pam_pid directory auth_manage_pam_pid($1_sudo_t) + auth_use_pam($1_sudo_t) auth_pid_filetrans_pam_var_run($1_sudo_t, dir, "sudo") - auth_use_nsswitch($1_sudo_t) =20 init_rw_utmp($1_sudo_t) =20 diff --git a/policy/modules/services/xserver.te b/policy/modules/services/x= server.te index cc717e7f..37fb2a71 100644 --- a/policy/modules/services/xserver.te +++ b/policy/modules/services/xserver.te @@ -484,7 +484,6 @@ term_setattr_unallocated_ttys(xdm_t) auth_domtrans_pam_console(xdm_t) auth_manage_pam_pid(xdm_t) auth_manage_pam_console_data(xdm_t) -auth_rw_faillog(xdm_t) auth_write_login_records(xdm_t) =20 # Run telinit->init to shutdown. diff --git a/policy/modules/system/authlogin.if b/policy/modules/system/aut= hlogin.if index 9b5e0fe0..8d79af78 100644 --- a/policy/modules/system/authlogin.if +++ b/policy/modules/system/authlogin.if @@ -47,6 +47,7 @@ interface(`auth_use_pam',` # for encrypted homedir dev_read_sysfs($1) =20 + auth_create_faillog($1) auth_domtrans_chk_passwd($1) auth_domtrans_upd_passwd($1) auth_dontaudit_read_shadow($1) @@ -744,6 +745,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.20.1