From patchwork Wed Mar 24 16:52:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Oleg Pykhalov X-Patchwork-Id: 28065 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 8CCC527BC5C; Wed, 24 Mar 2021 16:53:12 +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=unavailable 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 D56BC27BC59 for ; Wed, 24 Mar 2021 16:53:11 +0000 (GMT) Received: from localhost ([::1]:50054 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lP6kp-0008Rs-3C for patchwork@mira.cbaines.net; Wed, 24 Mar 2021 12:53:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:45982) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lP6kh-0008R9-25 for guix-patches@gnu.org; Wed, 24 Mar 2021 12:53:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:52686) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lP6kg-00075o-Pp for guix-patches@gnu.org; Wed, 24 Mar 2021 12:53:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lP6kg-0006iC-Ne for guix-patches@gnu.org; Wed, 24 Mar 2021 12:53:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#47364] [PATCH 1/2] gnu: Add pam-gnupg. References: <20210324164938.27674-1-go.wigust@gmail.com> In-Reply-To: <20210324164938.27674-1-go.wigust@gmail.com> Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 24 Mar 2021 16:53: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.161660477525778 (code B ref 47364); Wed, 24 Mar 2021 16:53:02 +0000 Received: (at 47364) by debbugs.gnu.org; 24 Mar 2021 16:52:55 +0000 Received: from localhost ([127.0.0.1]:35996 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lP6kY-0006hh-IH for submit@debbugs.gnu.org; Wed, 24 Mar 2021 12:52:54 -0400 Received: from mail-lf1-f47.google.com ([209.85.167.47]:33759) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lP6kW-0006hR-Un for 47364@debbugs.gnu.org; Wed, 24 Mar 2021 12:52:53 -0400 Received: by mail-lf1-f47.google.com with SMTP id o126so23493388lfa.0 for <47364@debbugs.gnu.org>; Wed, 24 Mar 2021 09:52:52 -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:mime-version :content-transfer-encoding; bh=FBfVjS8rogJpUhBxbHo1fdwCOQU4j0AZXH543UOzDIc=; b=HxCrTTjHF14gU1ksiReIS2otZxtN4wHE6afrUupa1JD+4aUH7nQX4c9hkUK3TE5tKN 1aH3e/8RD6AFjht+lSv3XaTAWaQm/r+v5fouiMIys0sh1Jfxwoz9rF53roiVVPiKjy61 X7sMG/bc49UepWEvfir63zfhnC9FvClNH1wI+Gk+Ii8ALpkQCJQsOfH3NTiRC7SHW4Dh 7cLCAA9yYmJaAEkrS1bRF87rDlkClUHyviO1b7pXCdSPM60D+Vo1XkJhJgg+Xk1zSfsC vnslTqdknCX3OrKgKAwWz4J56DEJekxAg9TOGiy4Cojh//vRgV0WMS8t96exVv50hhYb M0zw== 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:mime-version :content-transfer-encoding; bh=FBfVjS8rogJpUhBxbHo1fdwCOQU4j0AZXH543UOzDIc=; b=shc8CnXAg7QaBpfEiDHiAniZPwCEkVA1tMYYFLAtVd4Grjs/AhMHzlYXqesyeX+gOF xmHQ0w4ELyywVIgbGXzw9FgYlarcu1di+VFLLVaSCmWSCaBGnlQYTyLYbeu3Xg9CyO7K 7RcUqTRncjFc/NTxjgzxB3SVORpxh4VDWBF/wZNVfMb3aTg1ZmnmMQuf1aMoMYP90heO h8GMMOHLwmwpLNxcUAFYMBVhEIMjroHdNch1pe7+LosOfJLpR48qt9X9qShiQ9U/DBKw iZ4hWuKc7UssSZP4dE+QnXYw4rpQXZN4FHhxou+Kb/OxGNe7DWVM8Yz3APxTOne95ajo CUlg== X-Gm-Message-State: AOAM531ygGSgedN+aVVLAkKgQdWtRQZELMuJdtbgSW4YnOyMFZqXsDEF 1qkcKmqFc5AfVBe2qoioWQq6GiE/lwI= X-Google-Smtp-Source: ABdhPJzAFi4afC4AuYlEogLNsCn8M/l2yNDg/4Rw8bsaxxe9NobDnsUZHxHEK5Py4dGyv5TWu4YyQQ== X-Received: by 2002:a05:6512:ba2:: with SMTP id b34mr2414993lfv.24.1616604766290; Wed, 24 Mar 2021 09:52:46 -0700 (PDT) Received: from localhost.localdomain ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id e30sm274625lfc.261.2021.03.24.09.52.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 24 Mar 2021 09:52:45 -0700 (PDT) From: Oleg Pykhalov Date: Wed, 24 Mar 2021 19:52:32 +0300 Message-Id: <20210324165233.28428-1-go.wigust@gmail.com> X-Mailer: git-send-email 2.30.2 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/packages/linux.scm (pam-gnupg): New variable. --- gnu/packages/linux.scm | 37 ++++++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/gnu/packages/linux.scm b/gnu/packages/linux.scm index 0eaf014b5c..fff4a1789e 100644 --- a/gnu/packages/linux.scm +++ b/gnu/packages/linux.scm @@ -38,7 +38,7 @@ ;;; Copyright © 2019 Pierre Langlois ;;; Copyright © 2019, 2020 Brice Waegeneire ;;; Copyright © 2019 Kei Kebreau -;;; Copyright © 2020 Oleg Pykhalov +;;; Copyright © 2020, 2021 Oleg Pykhalov ;;; Copyright © 2020 Pierre Neidhardt ;;; Copyright © 2020 Chris Marusich ;;; Copyright © 2020 Vincent Legoll @@ -99,6 +99,7 @@ #:use-module (gnu packages gcc) #:use-module (gnu packages gettext) #:use-module (gnu packages glib) + #:use-module (gnu packages gnupg) #:use-module (gnu packages golang) #:use-module (gnu packages gperf) #:use-module (gnu packages gstreamer) @@ -1482,6 +1483,40 @@ at login. Local and dynamic reconfiguration are its key features.") (description "This package provides a PAM interface using @code{ctypes}.") (license license:expat))) +(define-public pam-gnupg + (package + (name "pam-gnupg") + (version "0.3") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/cruegge/pam-gnupg") + (commit (string-append "v" version)))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1bf91gi6zmfzzmczxm7pajxdlgnikasvg5xsd3j0a368rcr7lf9l")))) + (build-system gnu-build-system) + (inputs + `(("gnupg" ,gnupg) + ("linux-pam" ,linux-pam))) + (native-inputs + `(("autoconf" ,autoconf) + ("automake" ,automake) + ("libtool" ,libtool))) + (arguments + `(#:tests? #f ;no tests suite + #:configure-flags + (list (string-append "--with-moduledir=" + (assoc-ref %outputs "out") "/lib/security")))) + + (home-page "https://github.com/cruegge/pam-gnupg") + (synopsis "Unlock GnuPG keys on login") + (description "This package provides a PAM module that hands over your +login password to @code{gpg-agent}. This can be useful if you are using a +GnuPG-based password manager like @code{pass}.") + (license license:gpl3+))) + ;;; ;;; Miscellaneous. 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)