From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id 13ZQKspuW2BDWwAA0tVLHw (envelope-from ) for ; Wed, 24 Mar 2021 16:54:34 +0000 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id +Gq4JcpuW2C5VgAAB5/wlQ (envelope-from ) for ; Wed, 24 Mar 2021 16:54:34 +0000 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 032F41A779 for ; Wed, 24 Mar 2021 17:54:34 +0100 (CET) Received: from localhost ([::1]:51142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lP6m9-0000VT-3X for larch@yhetil.org; Wed, 24 Mar 2021 12:54:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:46454) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lP6le-0000Nc-Sc for guix-patches@gnu.org; Wed, 24 Mar 2021 12:54:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52687) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lP6le-0007ol-Fy for guix-patches@gnu.org; Wed, 24 Mar 2021 12:54:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lP6le-0006jp-FC for guix-patches@gnu.org; Wed, 24 Mar 2021 12:54:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47364] [PATCH 2/2] services: slim: Add pam-gnupg support. Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 24 Mar 2021 16:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 47364 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 47364@debbugs.gnu.org Cc: Oleg Pykhalov Received: via spool by 47364-submit@debbugs.gnu.org id=B47364.161660478925832 (code B ref 47364); Wed, 24 Mar 2021 16:54:02 +0000 Received: (at 47364) by debbugs.gnu.org; 24 Mar 2021 16:53:09 +0000 Received: from localhost ([127.0.0.1]:35999 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lP6kg-0006i7-1e for submit@debbugs.gnu.org; Wed, 24 Mar 2021 12:53:09 -0400 Received: from mail-lj1-f176.google.com ([209.85.208.176]:36488) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lP6ke-0006hi-1d for 47364@debbugs.gnu.org; Wed, 24 Mar 2021 12:53:01 -0400 Received: by mail-lj1-f176.google.com with SMTP id z25so31075749lja.3 for <47364@debbugs.gnu.org>; Wed, 24 Mar 2021 09:52:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=CObp1eom1Sf9S3irGgCD801w8X6IddNchudcdMNGRdk=; b=OSZwa4PjQWIKUkNPLMwXUKFmNOVjgKRhKhCSP2FygypYEGlB2ZJHM7Wb1YM7zLpwtL eQkvWORj92P4wQQLm6S87yK9sajUr9ibs++cq0C7olc1duvTa5gIu1MvezE9OqxYuQ5Z avXiDLDdWDCypW9jxuQCpmwn5WG3f+vZ4WkUaLVQn5Mj/n1i9HbP60QIVvoqdg9ZEAOR oGu4/hb2lxboSuhADFfKKeVMmDdNBgH+qCOSd3Okw7jfdfznLzrHVC4HtkAEVFesJbT0 +xZO+QFASS8F1tx0mmWOk8k0ElycvSmbP6+HgQwU9EJUer/Za8+rQVCLGsBnETbxw5nx QVAg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=CObp1eom1Sf9S3irGgCD801w8X6IddNchudcdMNGRdk=; b=BRRcCFF/+8KN7KdPYr4eaiy/iQxVzSnl1etDDsDh05Om0yWpGe2nC1CpOQgAia4j+I pQ3+IK+33Md1cB3l1l5BfwgWd10jUXX0+3mm2ggAhsQH+XB2dHl/nn2XrMW+ZbgrTHAN M1WOY/8XO27vIuqUuzLB8uVpWPnvyLKjBMScP7Mqlfmp/fuZvDyKr2/3nWBmHmk0jYqs mpzWl0s7V9cSluK2NS2wPisReFCfA+OnKHrzIu9OuHne/MyybwWhcnUGGaKMwoyGuXOx 05u5vYn1Smko0JQwqXSfHdWu6g6LkAk4M041Co84ai/o5GandlDQvvjCJpv8FFhnAyf/ A9bw== X-Gm-Message-State: AOAM533b9xuGJfiIaLnATiGWwHfCtCslmkEUc/HYWUkXP8KteD2tbE7b /XVPlm8Lo70KGC5HFQlLGHt01WDMNc8= X-Google-Smtp-Source: ABdhPJz+c8lfPLpq0VNs9L50zHt1sszM/jxQjQGLBgmoYb7IMq7jHmaFkuhHDJvKJF77/iNGRv3uGw== X-Received: by 2002:a2e:9ec6:: with SMTP id h6mr2715276ljk.12.1616604773418; Wed, 24 Mar 2021 09:52:53 -0700 (PDT) Received: from localhost.localdomain ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id e30sm274625lfc.261.2021.03.24.09.52.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 09:52:53 -0700 (PDT) From: Oleg Pykhalov Date: Wed, 24 Mar 2021 19:52:33 +0300 Message-Id: <20210324165233.28428-2-go.wigust@gmail.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210324165233.28428-1-go.wigust@gmail.com> References: <20210324165233.28428-1-go.wigust@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1616604874; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=CObp1eom1Sf9S3irGgCD801w8X6IddNchudcdMNGRdk=; b=asGvRgP/dXyN1fMsZzyl4IdrF6aF4vb2ec7RtPIHMkUwVho6DtHkk1rBlHQsNnygfr1pcE MtqDxsMez6ZGRDJ+OnLjPzc1eT56FFhIkaWT5rt0VZ91Jpy+JpdH9dMKH2omI7ORPQmjXx C2eigBywWTcbBqtfS6QNUNW76SjA9rOL9m76FxBpNbLm7iJ05Nv0J2+avH7VkjclnPwuo1 DkTOCasj5B+Cc0EtcaI5VaumKWjndIpugyXjM6PkdAwqjaO1y35S5MztMBsiUKyCKqbrP4 2rT+nRUnz1e/jPIceewWDb+ZtqsZj32Z4+vl5jWK1bmkt7FLrvquuwY2oTomgw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1616604874; a=rsa-sha256; cv=none; b=PB0+dCoq3BNIVKJQ++vzFoY080MMMnuCiXg/z8jA8X0AOIu5rfRXUzmm2T1WiWoJVgf9OI J74K1xtHcOSs6uZr9aKtftHe66LXyn94eDAt1sVM3RdqJebq6pA2ofh0/sdgiURmPQSH+S gvZv9So7xoCuOCmbP+R0gV71WqN+TINlpkfgsYWywYsj4BmmpiGggVki6OttuGkuLlNsec E12wkTemX2iws/T9XO0wQhvP+BLMR1ZyvktFXmnoXJ+gPFpj0GHjCzePaGjAAp1ThQTQHe WnD32zNw8IKBEX439a8G7U27E0f0kyEhpF7euf4oBfMHAM1CNF6yiaUtCtKNcQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=OSZwa4Pj; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Spam-Score: -1.87 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20161025 header.b=OSZwa4Pj; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Migadu-Queue-Id: 032F41A779 X-Spam-Score: -1.87 X-Migadu-Scanner: scn0.migadu.com X-TUID: Rz0sN1/4fanP * gnu/system/pam.scm (unix-pam-service): Add account and session PAM entries for pam-gnupg. * doc/guix.texi (X Window): Document this. * gnu/services/xorg.scm ()[gnupg?]: New record field. (slim-pam-service): Pass "#:gnupg?" argument to "unix-pam-service". --- doc/guix.texi | 8 ++++++++ gnu/services/xorg.scm | 7 ++++++- gnu/system/pam.scm | 15 +++++++++++++-- 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 94ecd2c247..f549930c63 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -17765,6 +17765,14 @@ Data type representing the configuration of @code{slim-service-type}. @item @code{allow-empty-passwords?} (default: @code{#t}) Whether to allow logins with empty passwords. +@item @code{gnupg?} (default: @code{#f}) +If enabled, @code{pam-gnupg} will attempt to automatically unlock the +user's GPG keys with the login password via @code{gpg-agent}. The +keygrips of all keys to be unlocked should be written to +@file{~/.pam-gnupg}, and can be queried with @code{gpg -K +--with-keygrip}. Presetting passphrases must be enabled by adding +@code{allow-preset-passphrase} in @file{~/.gnupg/gpg-agent.conf}. + @item @code{auto-login?} (default: @code{#f}) @itemx @code{default-user} (default: @code{""}) When @code{auto-login?} is false, SLiM presents a log-in screen. diff --git a/gnu/services/xorg.scm b/gnu/services/xorg.scm index 60611dc77d..65b138b4f4 100644 --- a/gnu/services/xorg.scm +++ b/gnu/services/xorg.scm @@ -8,6 +8,7 @@ ;;; Copyright © 2020 shtwzrd ;;; Copyright © 2020 Jakub Kądziołka ;;; Copyright © 2020 Alex Griffin +;;; Copyright © 2021 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -541,6 +542,8 @@ a `service-extension', as used by `set-xorg-configuration'." (default slim)) (allow-empty-passwords? slim-configuration-allow-empty-passwords? (default #t)) + (gnupg? slim-configuration-gnupg? + (default #f)) (auto-login? slim-configuration-auto-login? (default #f)) (default-user slim-configuration-default-user @@ -570,7 +573,9 @@ a `service-extension', as used by `set-xorg-configuration'." "slim" #:login-uid? #t #:allow-empty-passwords? - (slim-configuration-allow-empty-passwords? config)))) + (slim-configuration-allow-empty-passwords? config) + #:gnupg? + (slim-configuration-gnupg? config)))) (define (slim-shepherd-service config) (let* ((xinitrc (xinitrc #:fallback-session diff --git a/gnu/system/pam.scm b/gnu/system/pam.scm index ad02586be8..75edd01908 100644 --- a/gnu/system/pam.scm +++ b/gnu/system/pam.scm @@ -27,6 +27,7 @@ #:use-module (srfi srfi-11) #:use-module (srfi srfi-26) #:use-module ((guix utils) #:select (%current-system)) + #:use-module (gnu packages linux) #:export (pam-service pam-service-name pam-service-account @@ -208,7 +209,7 @@ dumped in /etc/pam.d/NAME, where NAME is the name of SERVICE." (control "required") (module "pam_env.so")))) (lambda* (name #:key allow-empty-passwords? (allow-root? #f) motd - login-uid?) + login-uid? (gnupg? #f)) "Return a standard Unix-style PAM service for NAME. When ALLOW-EMPTY-PASSWORDS? is true, allow empty passwords. When ALLOW-ROOT? is true, allow root to run the command without authentication. When MOTD is @@ -229,7 +230,12 @@ When LOGIN-UID? is true, require the 'pam_loginuid' module; that module sets (control "required") (module "pam_unix.so") (arguments '("nullok"))) - unix)))) + unix)) + (if gnupg? + (list (pam-entry + (control "required") + (module (file-append pam-gnupg "/lib/security/pam_gnupg.so")))) + '()))) (password (list (pam-entry (control "required") (module "pam_unix.so") @@ -247,6 +253,11 @@ When LOGIN-UID? is true, require the 'pam_loginuid' module; that module sets (control "required") (module "pam_loginuid.so"))) '()) + ,@(if gnupg? + (list (pam-entry + (control "required") + (module (file-append pam-gnupg "/lib/security/pam_gnupg.so")))) + '()) ,env ,unix)))))) (define (rootok-pam-service command) -- 2.30.2