From fe7b59c6b1200fcc10bda954c2370eca63af5299 Mon Sep 17 00:00:00 2001 From: Leo Prikler Date: Sat, 9 Nov 2019 16:14:45 +0100 Subject: services: Add GNOME Keyring service. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * gnu/services/desktop.scm: (): New record type. (pam-gnome-keyring): New procedure. (gnome-keyring-service-type): New variable. * doc/guix.texi (Desktop Services): Document it. Signed-off-by: Ludovic Courtès --- gnu/services/desktop.scm | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'gnu/services') diff --git a/gnu/services/desktop.scm b/gnu/services/desktop.scm index 4a5898fbb9..b40622a637 100644 --- a/gnu/services/desktop.scm +++ b/gnu/services/desktop.scm @@ -137,6 +137,10 @@ polkit-wheel-service + gnome-keyring-configuration + gnome-keyring-configuration? + gnome-keyring-service-type + %desktop-services)) ;;; Commentary: @@ -1066,6 +1070,55 @@ as expected."))) (description "Return a service that runs inputattach on a device and dispatches events from it."))) + +;;; +;;; gnome-keyring-service-type +;;; + +(define-record-type* gnome-keyring-configuration + make-gnome-keyring-configuration + gnome-keyring-configuration? + (keyring gnome-keyring-package (default gnome-keyring)) + (pam-services gnome-keyring-pam-services (default '(("gdm-password" . login) + ("passwd" . passwd))))) + +(define (pam-gnome-keyring config) + (define (%pam-keyring-entry . arguments) + (pam-entry + (control "optional") + (module (file-append (gnome-keyring-package config) + "/lib/security/pam_gnome_keyring.so")) + (arguments arguments))) + + (list + (lambda (service) + (case (assoc-ref (gnome-keyring-pam-services config) + (pam-service-name service)) + ((login) + (pam-service + (inherit service) + (auth (append (pam-service-auth service) + (list (%pam-keyring-entry)))) + (session (append (pam-service-session service) + (list (%pam-keyring-entry "auto_start")))))) + ((passwd) + (pam-service + (inherit service) + (password (append (pam-service-password service) + (list (%pam-keyring-entry)))))) + (else service))))) + +(define gnome-keyring-service-type + (service-type + (name 'gnome-keyring) + (extensions (list + (service-extension pam-root-service-type pam-gnome-keyring))) + (default-value (gnome-keyring-configuration)) + (description "Return a service, that adds the @code{gnome-keyring} package +to the system profile and extends PAM with entries using +@code{pam_gnome_keyring.so}, unlocking a user's login keyring when they log in +or setting its password with passwd."))) + ;;; ;;; polkit-wheel-service -- Allow wheel group to perform admin actions -- cgit v1.2.3