From patchwork Wed Mar 24 16:52:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 28066 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 0F5A327BC5D; Wed, 24 Mar 2021 16:54:34 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,MAILING_LIST_MULTI,SPF_HELO_PASS, T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 1F4A527BC5C for ; Wed, 24 Mar 2021 16:54:33 +0000 (GMT) Received: from localhost ([::1]:51142 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lP6m8-0000VT-1u for patchwork@mira.cbaines.net; Wed, 24 Mar 2021 12:54:32 -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 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+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * 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)