unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
From: muradm <mail@muradm.net>
To: 63198@debbugs.gnu.org, maxim.cournoyer@gmail.com
Subject: bug#63198: [PATCH] services: cups: Add cups PAM service.
Date: Sat, 13 May 2023 21:38:00 +0300	[thread overview]
Message-ID: <0c6858607cfd59a8da92f0a0780d8b45dc4b3afd.1684003079.git.mail@muradm.net> (raw)
In-Reply-To: <87wn1s695u.fsf@gmail.com>

Fixes <https://issues.guix.gnu.org/63198>.

Makes CUPS service to extend pam-root-service-type providing minimal
configuration to authenticate users. Since PAM authentication is
provided, cups package can be used as default.

* gnu/services/cups.scm (cups-configuration) [cups]: Use cups.
[allow-empty-password?]: PAM service configuration permitting empty passwords.
(opaque-cups-configuration): Likewise.
(cups-pam-service): cups PAM service.
(cups-service-type): Extend pam-root-service-type with cups-pam-service.
---
 gnu/services/cups.scm | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/gnu/services/cups.scm b/gnu/services/cups.scm
index c6099d77e7..d95c38b4d9 100644
--- a/gnu/services/cups.scm
+++ b/gnu/services/cups.scm
@@ -5,6 +5,7 @@
 ;;; Copyright © 2019 Alex Griffin <a@ajgrf.com>
 ;;; Copyright © 2019 Tobias Geerinckx-Rice <me@tobias.gr>
 ;;; Copyright © 2021 Maxime Devos <maximedevos@telenet.be>
+;;; Copyright © 2023 muradm <mail@muradm.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -25,6 +26,7 @@ (define-module (gnu services cups)
   #:use-module (gnu services)
   #:use-module (gnu services shepherd)
   #:use-module (gnu services configuration)
+  #:use-module (gnu system pam)
   #:use-module (gnu system shadow)
   #:use-module (gnu packages admin)
   #:use-module (gnu packages cups)
@@ -500,8 +502,11 @@ (define (serialize-package-list field-name val)
 
 (define-configuration cups-configuration
   (cups
-   (file-like cups-minimal)
+   (file-like cups)
    "The CUPS package.")
+  (allow-empty-password?
+   (boolean #f)
+   "Specifies whether empty passwords will be allowed when authenticating via PAM.")
   (extensions
    (package-list (list brlaser cups-filters epson-inkjet-printer-escpr
                        foomatic-filters hplip-minimal splix))
@@ -841,8 +846,11 @@ (define-configuration cups-configuration
 
 (define-configuration opaque-cups-configuration
   (cups
-   (package cups-minimal)
+   (package cups)
    "The CUPS package.")
+  (allow-empty-password?
+   (boolean #f)
+   "Specifies whether empty passwords will be allowed when authenticating via PAM.")
   (extensions
    (package-list '())
    "Drivers and other extensions to the CUPS package.")
@@ -1006,6 +1014,14 @@ (define (cups-shepherd-service config)
                            "-f" "-c" #$cupsd.conf "-s" #$cups-files.conf)))
            (stop #~(make-kill-destructor))))))
 
+(define (cups-pam-service config)
+  (let ((allow-empty-password?
+         (if (opaque-cups-configuration? config)
+             (opaque-cups-configuration-allow-empty-password? config)
+             (cups-configuration-allow-empty-password? config))))
+    (list (unix-pam-service "cups"
+                            #:allow-empty-passwords? allow-empty-password?))))
+
 (define cups-service-type
   (service-type (name 'cups)
                 (extensions
@@ -1013,6 +1029,8 @@ (define cups-service-type
                                           cups-shepherd-service)
                        (service-extension activation-service-type
                                           (const %cups-activation))
+                       (service-extension pam-root-service-type
+                                          cups-pam-service)
                        (service-extension account-service-type
                                           (const %cups-accounts))))
 

base-commit: ed1e7920393c9ae5b2ae31fc46bae88136239b13
-- 
2.40.1





  parent reply	other threads:[~2023-05-13 18:39 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-01  3:08 bug#63198: cups-service-type uses PAM-enabled 'cups' by default which prevents authentication Maxim Cournoyer
2023-05-03 12:46 ` Maxim Cournoyer
2023-05-13 13:43 ` muradm
2023-05-13 13:48   ` muradm
2023-05-15 15:13     ` Maxim Cournoyer
2023-05-15 15:12   ` Maxim Cournoyer
2023-05-13 18:38 ` muradm [this message]
2023-05-15 15:24   ` Maxim Cournoyer
2023-05-16  5:17     ` muradm
2023-05-24  0:46       ` Maxim Cournoyer
2023-05-24 11:37         ` muradm
2023-05-23 22:14 ` Ricardo Wurmus
2023-05-24 11:07   ` bug#63198: End-to-end tests Was: " Csepp
2023-05-24 11:28     ` muradm

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0c6858607cfd59a8da92f0a0780d8b45dc4b3afd.1684003079.git.mail@muradm.net \
    --to=mail@muradm.net \
    --cc=63198@debbugs.gnu.org \
    --cc=maxim.cournoyer@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).