From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id QEShNNmb1mazEAAAqHPOHw:P1 (envelope-from ) for ; Tue, 03 Sep 2024 05:17:14 +0000 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0.migadu.com with LMTPS id QEShNNmb1mazEAAAqHPOHw (envelope-from ) for ; Tue, 03 Sep 2024 07:17:13 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=TFXxuogc; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1725340633; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=9jNNTyixb7JcPxPYYX9fcEokllKIb+obmXekRdXYtIA=; b=ToFWW9rdLC8qH7liObGxjDncGSQpiiFy1uki0FezOD4vK+ThHgFaSD7kQHb5lWi/Z/AyQA afJO3YFx8SukygHfpvcuC0aAImgq5Ib8QschlI5krGoju/B/WCPujJGLkQaHXD10V0oMx6 17jB9/ZM89npIAt/sebT4MHrjmU+/pChKJfoBcExuxeRZ8o6H1/bIRlqkFEpPhrrBFcuUv ePhzd4HuzXeJ93Vn5yEwKheRJFwNtfEYJj9G29aXInjhgXJukfpLsivO2Xfh9KRDx/N70k 12SqBvc5/3rGnjCyNyeF9fgJDf69Hft0nc+II5nTLro8ZsCi87AUVvg3yACzkg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1725340633; a=rsa-sha256; cv=none; b=Gj1kgLzNAobu2USw2W0nDaolxHaXDFvpAkVQK0n606QgYcLq4D+yYRKwdHVSd1K+XnwgbA nPKInqlzUlznpG8sa1HLUPhsp8sQuTM2ORkd5yMjqCvZPvEcKW6xbOHtwfUQChCVY81oZI Ntjjk/nWKCNeJcHzjgt+2WC+7wluK27W4p/PRxtlJ4z6BxgcuSlWnnbWJtMaEAd4TN3/mR pub4bOwot7ZMaYUfdtW0POJPON3mHoFnWvD4YstYAg8sl2im6rbYjv8dsnFpbY+w+giecU u3dD4dnXs71wdyNH/8Tz7LOV4L00N6atrK7uVZXve0WCPmwtnlQmUEaJsJg9Dw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=posteo.net header.s=2017 header.b=TFXxuogc; dmarc=pass (policy=none) header.from=posteo.net; spf=pass (aspmx1.migadu.com: domain of "help-guix-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="help-guix-bounces+larch=yhetil.org@gnu.org" Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id BA333740AF for ; Tue, 3 Sep 2024 07:17:13 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1slLpM-00072f-WD; Tue, 03 Sep 2024 01:11:41 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slLpL-00072P-Gm for help-guix@gnu.org; Tue, 03 Sep 2024 01:11:39 -0400 Received: from mout01.posteo.de ([185.67.36.65]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1slLpJ-0005FV-2O for help-guix@gnu.org; Tue, 03 Sep 2024 01:11:39 -0400 Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id D62F3240027 for ; Tue, 3 Sep 2024 07:11:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1725340292; bh=qTARwq6ZlkxlamaSdUA5EWCg+R0ulXarJt5RgLg3OtI=; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type:From; b=TFXxuogc8YwKlARIyjKnIpFo2wjmHJRkMJmVKj8BmX5ykMbAP6zqO24u0ScjewzJM A9q3TgYuYn0qB8syumR1v4GhMMUFmhFWs7mwruhU77oC6jW82bdI32J7YDJYDyilAr MVMjGLxohYyfU0EQ+63aIJrXz4L0SKAlyQqjUoNk7OeNhkMFvtID+KvecaAJ/MsWbR dLQGI6uMQfkLUUvztj5xFQ24oXlLWW9qSYggbcy06v0pOn+9CxPOxNBY244csCLNnb 9fCoPhaa7o81waE+ZhmCbpygEraUrSYsv0Qm/9xqni4rgYijlK/GEBuE6UX+C8FHFT RkykujqXbPvvQ== Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4WyYcz54wqz6tm4; Tue, 3 Sep 2024 07:11:31 +0200 (CEST) From: Fredrik Salomonsson To: Felix Lechner , help-guix Subject: Re: Question about PAM service In-Reply-To: <877ccrc3ub.fsf@posteo.net> References: <87zfpu3bwa.fsf@posteo.net> <87ttfydb4w.fsf@lease-up.com> <877ccrc3ub.fsf@posteo.net> Date: Tue, 03 Sep 2024 05:11:29 +0000 Message-ID: <87r0a1b9tq.fsf@posteo.net> MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=185.67.36.65; envelope-from=plattfot@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-guix@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-guix-bounces+larch=yhetil.org@gnu.org Sender: help-guix-bounces+larch=yhetil.org@gnu.org X-Migadu-Flow: FLOW_IN X-Migadu-Country: US X-Migadu-Queue-Id: BA333740AF X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -8.70 X-Spam-Score: -8.70 X-TUID: 5FX845+MPPUi Just to follow up as I finally got some time to sit down and tinker with this. Fredrik Salomonsson writes: > Hi Felix, > > Felix Lechner writes: > >>> it does not look supertrivial to modify a PAM service. >> >> One way in Linux-PAM would be to skip the pam_unix.so module when the >> pam_u2f.so module returned PAM_SUCCESS, like this >> >> auth [success=1 new_authtok_reqd=1 ignore=ignore default=bad] pam_u2f.so >> auth required pam_unix.so >> >> The mechanism is described here [1] but I haven't used in a while. > > Thanks! I'll try that ones I get some time I can sit down and tinker > with this. > >> I'd probably do that only for the 'auth' stage, so that a locked or >> expired password still prevents logins during the 'account' stage, >> although it would be a matter of personal preference. > > Yeah, my idea is to just have this for swaylock i.e. when the > screensaver kicks in. And let the rest be guarded by a password. > >> In Guix, you'll probably end up replacing 'pam-services' in your >> operating-system record. >> >> As an aside, I am also the upstream author of Guile-PAM [1] which could >> potentially allow you to write something like this: >> >> (lambda (action handle flags options) >> (case action >> ((pam_sm_authenticate) >> (if (or (eq? 'PAM_SUCCESS (call-legacy-module "pam_u2f.so")) >> (eq? 'PAM_SUCCESS (call-legacy-module "pam_unix.so")) >> 'PAM_SUCCESS >> 'PAM_AUTH_DENIED))) >> (else >> ...))) >> >> Guile-PAM is experimental, however, and the code above is untested. > > Interesting. I would not mind testing this out. But I think I'll do > this in stages. First get things working with plain old Linux-PAM then > I might test out Guile-PAM. Is it packaged for Guix? > >> [1] https://www.chiark.greenend.org.uk/doc/libpam-doc/html/sag-configuration-file.html >> [2] https://juix.org/guile-pam/ I ended up just writing service that modifies a `unix-pam-service`, you can find it here [1]. Then use that instead of the pam service the `screen-locker-service-type` generates. Works quite well, I need to hit enter to activate the u2f key when the screen is locked. And also wait for u2f to timeout if I want to log in with just the password. But quite nice to not needing to type in my password to unlock the screen. Anyone know if it is a good idea to check in the u2f_keys mapping file? I have not find any info if that file contains any sensitive information sensitive or not. Would be nice to have all that configured with guix. [1] https://git.sr.ht/~plattfot/plt/tree/edc7b4da848b31926ae5cb8bb4d92f33c7e65d70/item/plt/system/u2f.scm [2] https://git.sr.ht/~plattfot/plt/tree/edc7b4da848b31926ae5cb8bb4d92f33c7e65d70/item/plt/system/machines.scm -- s/Fred[re]+i[ck]+/Fredrik/g