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=-1.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,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 17AFEC43387 for ; Sun, 23 Dec 2018 16:16:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CBBEA2184D for ; Sun, 23 Dec 2018 16:16:11 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="S2BPUbQX" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729608AbeLWQQK (ORCPT ); Sun, 23 Dec 2018 11:16:10 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:35361 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725832AbeLWQQJ (ORCPT ); Sun, 23 Dec 2018 11:16:09 -0500 Received: by mail-ed1-f67.google.com with SMTP id x30so8576393edx.2 for ; Sun, 23 Dec 2018 08:16:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to:user-agent; bh=tCFCSRDZVrwWIeQU3DnP2QJHWb0zEonRiAuixxlacQ4=; b=S2BPUbQXMBSDDsyjZa6SCnp9hvD+7mg11O1zYcm0D/slYJ6Cq6YR0V5UA9p1lXeP12 3kR6Fd6ybYRTC6MnD04uAwftOxCmAsfO1PrGqSrJqtQnHIBLjz44YLgBWuQP6+/hierh yMM1hYQe1LTc9303wLRESDFzEGC92azfcPaMb3VJGcltkAZMXofIZ3sE3J4yN5QB0yJ3 DZZHqkmIGjxcDTUXwFF5I2BCEB2InfBC9NmFw2/9atZ2F66LEH78esDJuw9GhiApDQwn /Iqw4XgdDRtvNubjdk5njeNLf19KOuLv87Q/AteQsItoZSvOR0EYPxugdtQKhrwqxQo6 QYTQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mail-followup-to :references:mime-version:content-disposition:in-reply-to:user-agent; bh=tCFCSRDZVrwWIeQU3DnP2QJHWb0zEonRiAuixxlacQ4=; b=hSIWocx21ONJIYdUlwN25OjSOYBwh9vZ/tDEDSwfjz+Uh5KAab9WGoVBax0+qU2CH/ qUYhS4iA/zWuJvgJKl7hipnBInGJmWake6hujGCfrRehMOL1vXcuxSboAucVJq15b0fx jswwQGpTMfSJsjUnPiLv4yZypJk4R5AYxchKU9wexm9UGdG0cZEGQxiU1XXYcGWScnPz vkHYtUs/EEEkN750Q8VBjheZ6j3DzfDFIYeB4jDPRIDAIfSXeQYXtZk66muLOi1zxCF+ +M/ivSqRILVJuw+mfgGZASHWTcI4vAnmT1OZrk62/tVh2VOQIxoxV0R3PsyBusjkwgoB 2UEw== X-Gm-Message-State: AA+aEWblGxiy1RUSLo4Qbr/ukkHwxe7oGZZr+nZJHDpGOP+iwZ0oaJW/ 1ShaozhvqffBhzmMlQUfBsx7MtMu X-Google-Smtp-Source: AFSGD/WkNqCLJZM32rt9JQhxB+yzBaH1c56uBtEJW5Am9Duurkt67rDgGWLORoMnYOM6YRBYe008WQ== X-Received: by 2002:a50:b1af:: with SMTP id m44mr8124154edd.47.1545581768051; Sun, 23 Dec 2018 08:16:08 -0800 (PST) Received: from brutus.lan ([2001:985:d55d::438]) by smtp.gmail.com with ESMTPSA id b14sm8180060edt.6.2018.12.23.08.16.07 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 23 Dec 2018 08:16:07 -0800 (PST) Date: Sun, 23 Dec 2018 17:16:05 +0100 From: Dominick Grift To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" Subject: Re: [PATCH 2/2] pam_faillock creates files in /run/faillock Message-ID: <20181223161605.GE20992@brutus.lan> Mail-Followup-To: "Sugar, David" , "selinux-refpolicy@vger.kernel.org" References: <20181221014026.2867-1-dsugar@tresys.com> <20181221014026.2867-2-dsugar@tresys.com> <20181221103416.GA4520@brutus.lan> <2d2d6c7f-3084-d6f6-ce1b-42c9d9535969@tresys.com> <20181223102000.GA20992@brutus.lan> <20181223104648.GB20992@brutus.lan> <20181223160921.GD20992@brutus.lan> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Rgf3q3z9SdmXC6oT" Content-Disposition: inline In-Reply-To: <20181223160921.GD20992@brutus.lan> User-Agent: Every email client sucks, this one just sucks less. X-PGP-Key: https://sks-keyservers.net/pks/lookup?op=get&search=0x3B6C5F1D2C7B6B02 Sender: selinux-refpolicy-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: selinux-refpolicy@vger.kernel.org --Rgf3q3z9SdmXC6oT Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Dec 23, 2018 at 05:09:21PM +0100, Dominick Grift wrote: > On Sun, Dec 23, 2018 at 11:46:48AM +0100, Dominick Grift wrote: > > On Sun, Dec 23, 2018 at 11:20:00AM +0100, Dominick Grift wrote: > > > On Sat, Dec 22, 2018 at 02:58:41AM +0000, Sugar, David wrote: > > > >=20 > > > > On 12/21/18 5:34 AM, Dominick Grift wrote: > > > > > On Fri, Dec 21, 2018 at 01:41:25AM +0000, David Sugar wrote: > > > > >> 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 lo= gins > > > > >> attempts. > > > > > The pam stuff has become a bit broken in my view. > > > > > > > > > > We use to use auth_use_pam() for these kinds of things but the in= terface was forgotten and not updated properly. > > > > > > > > > > So for example sudo does not even call auth_use_pam() and a lot o= f stuff was added directly to the login_pgm domain that should have been ad= ded to auth_use_pam() instead. > > > > > > > > > > My opinion is that this belongs in auth_use_pam() > > > >=20 > > > > Dominick, > > > >=20 > > > > I see those interfaces.=A0 It looks like xdm_t already uses=20 > > > > auth_login_pgm_domain(xdm_t).=A0 It also isn't really clear to me w= hat the=20 > > > > difference is between auth_login_pgm_domain() and auth_use_pam().= =A0 I=20 > > > > will make updates moving my change into auth_use_pam() and also upd= ate=20 > > > > sudo_role_template() to use (I think) auth_login_pgm_domain (). > > >=20 > > > sudo is not an auth_login_pgm_domain() i believe > > >=20 > > > the auth_use_pam() is a subset of auth_login_pgm_domain() > > >=20 > > > so login_pgm domains are pam clients plus extras needed to log in use= rs > > >=20 > > > a auth_use_pam() (pam client) has a pam stack but it might not actual= ly do logins > > >=20 > > > sudo uses pam but its not a real login program, so afaik sudo should = call auth_use_pam() > > > xdm is a login_pgm, so is sshd etc > > >=20 > > > systemd is also a pam client, but not a login program > >=20 > > And yes systemd needs to be able to create these /run/faillock/USER fil= es as well, but if you test this on RHEL then you wont see it because > > RHEL doesnt use /etc/pam.d/systemd-user (i suppose) > >=20 > > so: > >=20 > > 1. auth_use_pam() =3D=3D "pam clients" (programs that have a file in /e= tc/pam.d), they use pam for authentication of some sort > > 2, auth_login_pgm_domain() =3D=3D superset (special pam clients that ne= ed permissions to do actual logins) >=20 > Another interesting detail is that pam_faillock clients need cap_dac_over= ride to be able to write records to /run/faillock/USER files > I wonder whether that is a bug >=20 > for example sshd (root) creates /run/faillock/joe with joe.root and 0600 = but then sshd (root) needs cap_dac_override to write records to that file > Probably should have created the files with 0660 ... to avoid the need fo= r cap_dac_override... I filed a bugzilla for this, just to be sure: https://bugzilla.redhat.com/s= how_bug.cgi?id=3D1661822 >=20 > >=20 > > >=20 > > > >=20 > > > > I will resubmit this patch, > > > >=20 > > > > --- snip --- > > >=20 > > > --=20 > > > Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 > > > https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7= B6B02 > > > Dominick Grift > >=20 > >=20 > >=20 > > --=20 > > Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 > > https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6= B02 > > Dominick Grift >=20 >=20 >=20 > --=20 > Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 > https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6B02 > Dominick Grift --=20 Key fingerprint =3D 5F4D 3CDB D3F8 3652 FBD8 02D5 3B6C 5F1D 2C7B 6B02 https://sks-keyservers.net/pks/lookup?op=3Dget&search=3D0x3B6C5F1D2C7B6B02 Dominick Grift --Rgf3q3z9SdmXC6oT Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAEBCAAdFiEEujmXliIBLFTc2Y4AJXSOVTf5R2kFAlwftMEACgkQJXSOVTf5 R2l1mgwAgS/k9Cd356fgQV2taagfHzks1qnNNNhxz4y+rnSBakhzrXoTTMcXq03k KISlPp7Mv1oXAx5RPMh66fEjbkJgo5d9o2EDiqViSjnEPxCazZA1gicLUTZAOK+0 yKe8Yvfbb26AbrYU2caI1Y+FfsrNJh+LxMKd/gfLByzbnjDndEn1fiF32oV2m7Uq 690VCdsAiurOIng958TJdKPhfuTzMMOu2cKNFuXFUbTwMEy3gwAWfcnCnecMCtpi S7e6v0+E22SHA0y2XfKnqZYkLhO8G/P88diPAqP0c5H9gQtGGw3ec9B5n1uhk55h vEYKKeOu1huzU+GokYR7G8pA1z9bsc3om9zILgNIk0LDn+90Ew8CyCo/Pox56owZ M2PGFZYl7GhWMLtyo1ZCWJRi5AKNXDmR/AgwpgBfyIwoJBQPCHIAS9NKVKqgk1QG A5Cjh6TNsDmh+iuxROUM5aZPchhlxjbar5htB66LfZopziS7bD209uyV8iV0t0Xg JSjVY3RV =2JjS -----END PGP SIGNATURE----- --Rgf3q3z9SdmXC6oT--