GNU bug report logs

#77001 [PATCH 0/8] Improve Kerberos support

PackageSource(s)Maintainer(s)
guix-patches PTS Buildd Popcon
Reply or subscribe to this bug. View this bug as an mbox, status mbox, or maintainer mbox

Report forwarded to ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:19:02 GMT) (full text, mbox, link).


Acknowledgement sent to Tomas Volf <~@wolfsden.cz>:
New bug report received and forwarded. Copy sent to ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org. (Thu, 13 Mar 2025 22:19:02 GMT) (full text, mbox, link).


Message #5 received at submit@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: guix-patches@gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 0/8] Improve Kerberos support
Date: Thu, 13 Mar 2025 23:17:47 +0100
Couple of style fixes and feature additions for krb5-service-type.

Tomas Volf (8):
  services: krb5-realm: Delete trailing whitespace.
  services: krb5-realm: Unify style of documentation strings.
  services: krb5-realm: Add default-principal-flags field.
  services: krb5-configuration: Fix indentation.
  services: krb5-configuration: Unify style of documentation strings.
  services: krb5-configuration: Add dns-lookup-realm? field.
  services: kerberos: Fix order of definitions.
  services: krb5-service-type: Support launching KDC daemon.

 doc/guix.texi             |  12 +--
 gnu/services/kerberos.scm | 168 ++++++++++++++++++++++++++------------
 2 files changed, 122 insertions(+), 58 deletions(-)

--
2.48.1




Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:02 GMT) (full text, mbox, link).


Message #8 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 3/8] services: krb5-realm: Add default-principal-flags field.
Date: Thu, 13 Mar 2025 23:19:46 +0100
* gnu/services/kerberos.scm (krb5-realm): Add default-principal-flags field.
(serialize-comma-separated-string-list/unset, comma-separated-string-list?)
(comma-separated-string-list/unset?): New procedures.

Change-Id: Ie5f787ca0745dd6234ea4577b39a58d71e4fa6d2
---
 gnu/services/kerberos.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index d3ac7ca8b9..61d3a323fb 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -106,6 +106,19 @@ (define (space-separated-string-list? val)
 (define space-separated-string-list/unset?
   (predicate/unset space-separated-string-list?))
 
+(define (serialize-comma-separated-string-list/unset field-name val)
+  (unless (eq? val unset-field)
+      (serialize-field* field-name (string-join val ","))))
+
+(define (comma-separated-string-list? val)
+  (and (list? val)
+       (and-map (lambda (x)
+                  (and (string? x) (not (string-index x #\,))))
+                val)))
+
+(define comma-separated-string-list/unset?
+  (predicate/unset comma-separated-string-list?))
+
 (define comma-separated-integer-list/unset?
   (predicate/unset (lambda (val)
                      (and (list? val)
@@ -198,6 +211,13 @@ (define-configuration krb5-realm
    (string/unset unset-field)
    "The server where password changes are performed.")
 
+  (default-principal-flags
+   (comma-separated-string-list/unset unset-field)
+   "Specifies the default attributes of principals created in this realm.  The
+format for this string is a list of strings, with '+' before each flag that
+should be enabled and '-' before each flag that should be disabled.  See the
+manual page for details on available flags.")
+
   (auth-to-local
    (free-form-fields '())
    "Rules to map between principals and local users.")
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:02 GMT) (full text, mbox, link).


Message #11 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 1/8] services: krb5-realm: Delete trailing whitespace.
Date: Thu, 13 Mar 2025 23:19:44 +0100
* gnu/services/kerberos.scm (krb5-realm): Delete trailing whitespace.

Change-Id: I3e92d53b0910660aeed318015841ec0ca8892430
---
 gnu/services/kerberos.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index a6f540a9b6..fd12b518e6 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -191,7 +191,7 @@ (define-configuration krb5-realm
 
   (master-kdc
    (string/unset unset-field)
-   "If an attempt to get credentials fails because of an invalid password, 
+   "If an attempt to get credentials fails because of an invalid password,
 the client software will attempt to contact the master KDC.")
 
   (kpasswd-server
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:03 GMT) (full text, mbox, link).


Message #14 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 2/8] services: krb5-realm: Unify style of documentation strings.
Date: Thu, 13 Mar 2025 23:19:45 +0100
* gnu/services/kerberos.scm (krb5-realm): Add trailing periods where missing.
Remove double space.

Change-Id: I5dc47326c598548075f13a5ec48c24a0886a9a69
---
 gnu/services/kerberos.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index fd12b518e6..d3ac7ca8b9 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -214,7 +214,7 @@ (define-configuration krb5-realm
   (default-domain
     (string/unset unset-field)
     "The domain used to expand host names when translating Kerberos 4 service
-principals to Kerberos 5 principals")
+principals to Kerberos 5 principals.")
 
   (v4-instance-convert
    (free-form-fields '())
@@ -222,8 +222,8 @@ (define-configuration krb5-realm
 
   (v4-realm
    (string/unset unset-field)
-   "Used  when the V4 realm name and the V5 realm name are not the same, but
-still share the same principal names and passwords"))
+   "Used when the V4 realm name and the V5 realm name are not the same, but
+still share the same principal names and passwords."))
 
 
 
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:03 GMT) (full text, mbox, link).


Message #17 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 5/8] services: krb5-configuration: Unify style of documentation strings.
Date: Thu, 13 Mar 2025 23:19:48 +0100
* gnu/services/kerberos.scm (krb5-configuration): Add trailing periods where
missing.  Add double space.  Add @file.

Change-Id: Id2d985df1e55566cb62f7355c2e4f0ca7d9924f2
---
 gnu/services/kerberos.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index 8d08a27365..f2f2adda88 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -301,11 +301,11 @@ (define-configuration krb5-configuration
   (dns-lookup-kdc?
    (boolean/unset unset-field)
    "Should DNS SRV records should be used to locate the KDCs and other servers
-not appearing in the realm specification")
+not appearing in the realm specification.")
 
   (err-fmt
    (string/unset unset-field)
-   "Custom error message formatting. If not #f error messages will be
+   "Custom error message formatting.  If not #f error messages will be
 formatted by substituting a normal error message for %M and an error code for
 %C in the value.")
 
@@ -323,7 +323,7 @@ (define-configuration krb5-configuration
   (k5login-authoritative?
    (boolean/unset unset-field)
    "If this flag is true, principals must be listed in a local user's k5login
-file to be granted login access, if a ~/.k5login file exists.")
+file to be granted login access, if a @file{~/.k5login} file exists.")
 
   (k5login-directory
    (string/unset unset-field)
@@ -352,8 +352,8 @@ (define-configuration krb5-configuration
 
   (kdc-req-checksum-type
    (non-negative-integer/unset unset-field)
-   "The type of checksum to use for the KDC requests. Relevant only for DES
-keys")
+   "The type of checksum to use for the KDC requests.  Relevant only for DES
+keys.")
 
   (noaddresses?
    (boolean/unset unset-field)
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:04 GMT) (full text, mbox, link).


Message #20 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 6/8] services: krb5-configuration: Add dns-lookup-realm? field.
Date: Thu, 13 Mar 2025 23:19:49 +0100
* gnu/services/kerberos.scm (krb5-configuration): Add dns-lookup-realm? field.

Change-Id: Ibb92da1d4330b62225bdd9fd2a8573035f15f590
---
 gnu/services/kerberos.scm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index f2f2adda88..b423534ec2 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -298,6 +298,10 @@ (define-configuration krb5-configuration
    "Whether name lookups will be used to canonicalize host names for use in
 service principal names.")
 
+  (dns-lookup-realm?
+   (boolean/unset unset-field)
+   "Should the Kerberos realm of a host be determined by DNS TXT records?")
+
   (dns-lookup-kdc?
    (boolean/unset unset-field)
    "Should DNS SRV records should be used to locate the KDCs and other servers
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:04 GMT) (full text, mbox, link).


Message #23 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 7/8] services: kerberos: Fix order of definitions.
Date: Thu, 13 Mar 2025 23:19:50 +0100
Generating the configuration file would error out with error stating:

    Wrong type to apply: #<syntax-transformer krb5-realm?>

Moving the procedures below the respective define-configuration fixes that.

* gnu/services/kerberos.scm (realm-list?, serialize-realm-list): Move below
define-configuration for krb5-realm.

Change-Id: I6a520a92cdc3c42d3916cdf33d427dadc531e7d1
---
 gnu/services/kerberos.scm | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index b423534ec2..1e826a1455 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -169,23 +169,6 @@ (define (serialize-free-form-fields field-name val)
 
 (define non-negative-integer/unset? (predicate/unset non-negative-integer?))
 
-(define (realm-list? val)
-  (and (list? val)
-       (and-map (lambda (x) (krb5-realm? x)) val)))
-
-(define (serialize-realm-list field-name val)
-  (format #t "\n[~a]\n" field-name)
-  (for-each (lambda (realm)
-              (format #t "\n~a = {\n" (krb5-realm-name realm))
-              (for-each (lambda (field)
-                          (unless (eq? 'name (configuration-field-name field))
-                            ((configuration-field-serializer field)
-                             (configuration-field-name field)
-                             ((configuration-field-getter field)
-                              realm)))) krb5-realm-fields)
-
-              (format #t "}\n")) val))
-
 
 
 ;; For a more detailed explanation of these fields see man 5 krb5.conf
@@ -245,6 +228,23 @@ (define-configuration krb5-realm
    "Used when the V4 realm name and the V5 realm name are not the same, but
 still share the same principal names and passwords."))
 
+(define (realm-list? val)
+  (and (list? val)
+       (and-map (lambda (x) (krb5-realm? x)) val)))
+
+(define (serialize-realm-list field-name val)
+  (format #t "\n[~a]\n" field-name)
+  (for-each (lambda (realm)
+              (format #t "\n~a = {\n" (krb5-realm-name realm))
+              (for-each (lambda (field)
+                          (unless (eq? 'name (configuration-field-name field))
+                            ((configuration-field-serializer field)
+                             (configuration-field-name field)
+                             ((configuration-field-getter field)
+                              realm)))) krb5-realm-fields)
+
+              (format #t "}\n")) val))
+
 
 
 ;; For a more detailed explanation of these fields see man 5 krb5.conf
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:05 GMT) (full text, mbox, link).


Message #26 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 4/8] services: krb5-configuration: Fix indentation.
Date: Thu, 13 Mar 2025 23:19:47 +0100
* gnu/services/kerberos.scm (krb5-configuration): Adjust indentation and word
wrapping.

Change-Id: I629c106867e1d4d935b4bc33ae3489f4b0ee0bf5
---
 gnu/services/kerberos.scm | 53 ++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index 61d3a323fb..8d08a27365 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -295,19 +295,19 @@ (define-configuration krb5-configuration
 
   (dns-canonicalize-hostname?
    (boolean/unset  unset-field)
-   "Whether name lookups will be used to canonicalize host names for use in 
+   "Whether name lookups will be used to canonicalize host names for use in
 service principal names.")
 
   (dns-lookup-kdc?
    (boolean/unset unset-field)
- "Should DNS SRV records should be used to locate the KDCs and other servers 
+   "Should DNS SRV records should be used to locate the KDCs and other servers
 not appearing in the realm specification")
 
   (err-fmt
    (string/unset unset-field)
-   "Custom error message formatting. If not #f error messages will be formatted 
-by substituting a normal error message for %M and an error code for %C in the 
-value.")
+   "Custom error message formatting. If not #f error messages will be
+formatted by substituting a normal error message for %M and an error code for
+%C in the value.")
 
   (forwardable?
    (boolean/unset unset-field)
@@ -315,9 +315,9 @@ (define-configuration krb5-configuration
 
   (ignore-acceptor-hostname?
    (boolean/unset unset-field)
-   "When accepting GSSAPI or krb5 security contexts for host-based service 
-principals, ignore any hostname passed by the calling application, and allow 
-clients to authenticate to any service principal in the keytab matching the 
+   "When accepting GSSAPI or krb5 security contexts for host-based service
+principals, ignore any hostname passed by the calling application, and allow
+clients to authenticate to any service principal in the keytab matching the
 service name and realm name.")
 
   (k5login-authoritative?
@@ -327,23 +327,23 @@ (define-configuration krb5-configuration
 
   (k5login-directory
    (string/unset unset-field)
-   "If not #f, the library will look for a local user's @file{k5login} file 
-within the named directory (instead of the user's home directory), with a 
-file name corresponding to the local user name.")
+   "If not #f, the library will look for a local user's @file{k5login} file
+within the named directory (instead of the user's home directory), with a file
+name corresponding to the local user name.")
 
   (kcm-mach-service
    (string/unset unset-field)
-   "The name of the bootstrap service used to contact the KCM daemon for the 
+   "The name of the bootstrap service used to contact the KCM daemon for the
 KCM credential cache type.")
 
   (kcm-socket
    (file-name unset-field)
- "Path to the Unix domain socket used to access the KCM daemon for the KCM 
+   "Path to the Unix domain socket used to access the KCM daemon for the KCM
 credential cache type.")
 
   (kdc-default-options
    (non-negative-integer/unset unset-field)
-   "Default KDC options (logored for multiple values) when requesting initial 
+   "Default KDC options (logored for multiple values) when requesting initial
 tickets.")
 
   (kdc-timesync
@@ -352,17 +352,18 @@ (define-configuration krb5-configuration
 
   (kdc-req-checksum-type
    (non-negative-integer/unset unset-field)
-   "The type of checksum to use for the KDC requests. Relevant only for DES 
+   "The type of checksum to use for the KDC requests. Relevant only for DES
 keys")
 
   (noaddresses?
    (boolean/unset unset-field)
-   "If true, initial ticket requests will not be made with address restrictions.
-This enables their use across NATs.")
+   "If true, initial ticket requests will not be made with address
+restrictions.  This enables their use across NATs.")
 
   (permitted-enctypes
    (space-separated-string-list/unset unset-field)
-   "All encryption types that are permitted for use in session key encryption.")
+   "All encryption types that are permitted for use in session key
+encryption.")
 
   (plugin-base-dir
    (file-name unset-field)
@@ -370,8 +371,8 @@ (define-configuration krb5-configuration
 
   (preferred-preauth-types
    (comma-separated-integer-list/unset unset-field)
-   "The preferred pre-authentication types which the client will attempt before 
-others.")
+   "The preferred pre-authentication types which the client will attempt
+before others.")
 
   (proxiable?
    (boolean/unset unset-field)
@@ -379,12 +380,12 @@ (define-configuration krb5-configuration
 
   (rdns?
    (boolean/unset unset-field)
-   "Should reverse DNS lookup be used in addition to forward name lookup to 
+   "Should reverse DNS lookup be used in addition to forward name lookup to
 canonicalize host names for use in service principal names.")
 
   (realm-try-domains
    (integer/unset unset-field)
-   "Should a host's domain components should be used to determine the Kerberos 
+   "Should a host's domain components should be used to determine the Kerberos
 realm of the host.")
 
   (renew-lifetime
@@ -401,13 +402,13 @@ (define-configuration krb5-configuration
 
   (udp-preference-limit
    (non-negative-integer/unset unset-field)
-   "When sending messages to the KDC, the library will try using TCP
-before UDP if the size of the message greater than this limit.")
+   "When sending messages to the KDC, the library will try using TCP before
+UDP if the size of the message greater than this limit.")
 
   (verify-ap-rereq-nofail?
    (boolean/unset unset-field)
- "If true, then attempts to verify initial credentials will fail if the client
-machine does not have a keytab.")
+   "If true, then attempts to verify initial credentials will fail if the
+client machine does not have a keytab.")
 
   (realms
    (realm-list '())
-- 
2.48.1





Information forwarded to ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 13 Mar 2025 22:21:05 GMT) (full text, mbox, link).


Message #29 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH 8/8] services: krb5-service-type: Support launching KDC daemon.
Date: Thu, 13 Mar 2025 23:19:51 +0100
* gnu/services/kerberos.scm (krb5-configuration): Add krb5,
kdc-shepherd-service? fields.
(krb5-activation, krb5-shepherd-services): New procedures.
(krb5-service-type): Use them.

Change-Id: I091ae2a6ef25f5ce95123c29588749483954c2ac
---
 doc/guix.texi             | 12 ++++++-----
 gnu/services/kerberos.scm | 43 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index 05c855c5ea..a58cf40b63 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32125,11 +32125,13 @@ Kerberos Services
 
 @subsubheading Krb5 Service
 
-Programs using a Kerberos client library normally
-expect a configuration file in @file{/etc/krb5.conf}.
-This service generates such a file from a definition provided in the
-operating system declaration.
-It does not cause any daemon to be started.
+Programs using a Kerberos client library normally expect a configuration
+file in @file{/etc/krb5.conf}.  This service generates such a file from
+a definition provided in the operating system declaration.
+
+When @code{kdc-shepherd-service?} is set to @code{#t}, a shepherd
+service for @acronym{KDC, Key Distribution Center} is created.
+Otherwise no daemons are started.
 
 No ``keytab'' files are provided by this service---you must explicitly create them.
 This service is known to work with the MIT client library, @code{mit-krb5}.
diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index 1e826a1455..3d1ab01cb8 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -17,10 +17,13 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu services kerberos)
+  #:use-module (gnu packages kerberos)
   #:use-module (gnu services)
   #:use-module (gnu services configuration)
+  #:use-module (gnu services shepherd)
   #:use-module (gnu system pam)
   #:use-module (guix gexp)
+  #:use-module (guix packages)
   #:use-module (guix records)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-34)
@@ -416,7 +419,16 @@ (define-configuration krb5-configuration
 
   (realms
    (realm-list '())
-   "The list of realms which clients may access."))
+   "The list of realms which clients may access.")
+
+  (krb5
+   (package mit-krb5)
+   "The package to use for @command{krb5kdc}.")
+
+  (kdc-shepherd-service?
+   (boolean #f)
+   "Whether to generate a shepherd service for the @acronym{KDC, Key
+Distribution Center} daemon."  empty-serializer))
 
 
 (define (krb5-configuration-file config)
@@ -431,15 +443,40 @@ (define (krb5-configuration-file config)
 (define (krb5-etc-service config)
   (list `("krb5.conf" ,(krb5-configuration-file config))))
 
+(define (krb5-activation config)
+  (if (krb5-configuration-kdc-shepherd-service? config)
+      #~(begin
+          (use-modules (guix build utils))
+          (mkdir-p "/var/krb5kdc"))
+      #~#t))
+
+(define (krb5-shepherd-services config)
+  (match-record config <krb5-configuration>
+                (krb5 kdc-shepherd-service?)
+    (if kdc-shepherd-service?
+        (list
+         (shepherd-service
+          (documentation "Run a krb5kdc daemon.")
+          (provision '(krb5kdc))
+          (requirement '(user-processes))
+          (start #~(make-forkexec-constructor
+                    '(#$(file-append krb5 "/sbin/krb5kdc") "-n")))
+          (stop #~(make-kill-destructor))))
+        '())))
+
 
 (define krb5-service-type
   (service-type (name 'krb5)
                 (extensions
                  (list (service-extension etc-service-type
-                                          krb5-etc-service)))
+                                          krb5-etc-service)
+                       (service-extension activation-service-type
+                                          krb5-activation)
+                       (service-extension shepherd-root-service-type
+                                          krb5-shepherd-services)))
                 (description "Programs using a Kerberos client library
 normally expect a configuration file in @file{/etc/krb5.conf}.  This service
-generates such a file.  It does not cause any daemon to be started.")))
+generates such a file and (optionally) a shepherd service to run a daemon.")))
 
 
 
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:26:05 GMT) (full text, mbox, link).


Message #32 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 2/8] services: krb5-realm: Unify style of documentation strings.
Date: Wed, 19 Mar 2025 17:24:28 +0100
* gnu/services/kerberos.scm (krb5-realm): Add trailing periods where missing.
Remove double space.

Change-Id: I5dc47326c598548075f13a5ec48c24a0886a9a69
---
 gnu/services/kerberos.scm | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index e93f4bc648..ee0deec2e4 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -215,7 +215,7 @@ (define-configuration krb5-realm
   (default-domain
     (string/unset unset-field)
     "The domain used to expand host names when translating Kerberos 4 service
-principals to Kerberos 5 principals")
+principals to Kerberos 5 principals.")
 
   (v4-instance-convert
    (free-form-fields '())
@@ -223,8 +223,8 @@ (define-configuration krb5-realm
 
   (v4-realm
    (string/unset unset-field)
-   "Used  when the V4 realm name and the V5 realm name are not the same, but
-still share the same principal names and passwords"))
+   "Used when the V4 realm name and the V5 realm name are not the same, but
+still share the same principal names and passwords."))
 
 
 
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:26:06 GMT) (full text, mbox, link).


Message #35 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 3/8] services: krb5-realm: Add default-principal-flags field.
Date: Wed, 19 Mar 2025 17:24:29 +0100
* gnu/services/kerberos.scm (krb5-realm): Add default-principal-flags field.
(serialize-comma-separated-string-list/unset, comma-separated-string-list?)
(comma-separated-string-list/unset?): New procedures.

Change-Id: Ie5f787ca0745dd6234ea4577b39a58d71e4fa6d2
---
 gnu/services/kerberos.scm | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index ee0deec2e4..1a7cc5774a 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -107,6 +107,19 @@ (define (space-separated-string-list? val)
 (define space-separated-string-list/unset?
   (predicate/unset space-separated-string-list?))
 
+(define (serialize-comma-separated-string-list/unset field-name val)
+  (unless (eq? val unset-field)
+      (serialize-field* field-name (string-join val ","))))
+
+(define (comma-separated-string-list? val)
+  (and (list? val)
+       (and-map (lambda (x)
+                  (and (string? x) (not (string-index x #\,))))
+                val)))
+
+(define comma-separated-string-list/unset?
+  (predicate/unset comma-separated-string-list?))
+
 (define comma-separated-integer-list/unset?
   (predicate/unset (lambda (val)
                      (and (list? val)
@@ -199,6 +212,13 @@ (define-configuration krb5-realm
    (string/unset unset-field)
    "The server where password changes are performed.")
 
+  (default-principal-flags
+   (comma-separated-string-list/unset unset-field)
+   "Specifies the default attributes of principals created in this realm.  The
+format for this string is a list of strings, with '+' before each flag that
+should be enabled and '-' before each flag that should be disabled.  See the
+manual page for details on available flags.")
+
   (auth-to-local
    (free-form-fields '())
    "Rules to map between principals and local users.")
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:26:07 GMT) (full text, mbox, link).


Message #38 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 5/8] services: krb5-configuration: Unify style of documentation strings.
Date: Wed, 19 Mar 2025 17:24:31 +0100
* gnu/services/kerberos.scm (krb5-configuration): Add trailing periods where
missing.  Add double space.  Add @file.

Change-Id: Id2d985df1e55566cb62f7355c2e4f0ca7d9924f2
---
 gnu/services/kerberos.scm | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index 8ebcec3291..5ac3cd1830 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -302,11 +302,11 @@ (define-configuration krb5-configuration
   (dns-lookup-kdc?
    (boolean/unset unset-field)
    "Should DNS SRV records should be used to locate the KDCs and other servers
-not appearing in the realm specification")
+not appearing in the realm specification.")
 
   (err-fmt
    (string/unset unset-field)
-   "Custom error message formatting. If not #f error messages will be
+   "Custom error message formatting.  If not #f error messages will be
 formatted by substituting a normal error message for %M and an error code for
 %C in the value.")
 
@@ -324,7 +324,7 @@ (define-configuration krb5-configuration
   (k5login-authoritative?
    (boolean/unset unset-field)
    "If this flag is true, principals must be listed in a local user's k5login
-file to be granted login access, if a ~/.k5login file exists.")
+file to be granted login access, if a @file{~/.k5login} file exists.")
 
   (k5login-directory
    (string/unset unset-field)
@@ -353,8 +353,8 @@ (define-configuration krb5-configuration
 
   (kdc-req-checksum-type
    (non-negative-integer/unset unset-field)
-   "The type of checksum to use for the KDC requests. Relevant only for DES
-keys")
+   "The type of checksum to use for the KDC requests.  Relevant only for DES
+keys.")
 
   (noaddresses?
    (boolean/unset unset-field)
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:26:07 GMT) (full text, mbox, link).


Message #41 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 1/8] services: krb5-realm: Delete trailing whitespace.
Date: Wed, 19 Mar 2025 17:24:27 +0100
* gnu/services/kerberos.scm (krb5-realm): Delete trailing whitespace.

Change-Id: I3e92d53b0910660aeed318015841ec0ca8892430
---
v2: Add copyright.

 gnu/services/kerberos.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index a6f540a9b6..e93f4bc648 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -1,5 +1,6 @@
 ;;; GNU Guix --- Functional package management for GNU
 ;;; Copyright © 2016 John Darrington <jmd@gnu.org>
+;;; Copyright © 2025 Tomas Volf <~@wolfsden.cz>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -191,7 +192,7 @@ (define-configuration krb5-realm

   (master-kdc
    (string/unset unset-field)
-   "If an attempt to get credentials fails because of an invalid password,
+   "If an attempt to get credentials fails because of an invalid password,
 the client software will attempt to contact the master KDC.")

   (kpasswd-server
--
2.48.1




Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:26:08 GMT) (full text, mbox, link).


Message #44 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 6/8] services: krb5-configuration: Add dns-lookup-realm? field.
Date: Wed, 19 Mar 2025 17:24:32 +0100
* gnu/services/kerberos.scm (krb5-configuration): Add dns-lookup-realm? field.

Change-Id: Ibb92da1d4330b62225bdd9fd2a8573035f15f590
---
 gnu/services/kerberos.scm | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index 5ac3cd1830..de85b43223 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -299,6 +299,10 @@ (define-configuration krb5-configuration
    "Whether name lookups will be used to canonicalize host names for use in
 service principal names.")
 
+  (dns-lookup-realm?
+   (boolean/unset unset-field)
+   "Should the Kerberos realm of a host be determined by DNS TXT records?")
+
   (dns-lookup-kdc?
    (boolean/unset unset-field)
    "Should DNS SRV records should be used to locate the KDCs and other servers
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:26:09 GMT) (full text, mbox, link).


Message #47 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 7/8] services: kerberos: Fix order of definitions.
Date: Wed, 19 Mar 2025 17:24:33 +0100
Generating the configuration file would error out with error stating:

    Wrong type to apply: #<syntax-transformer krb5-realm?>

Moving the procedures below the respective define-configuration fixes that.

* gnu/services/kerberos.scm (realm-list?, serialize-realm-list): Move below
define-configuration for krb5-realm.

Change-Id: I6a520a92cdc3c42d3916cdf33d427dadc531e7d1
---
 gnu/services/kerberos.scm | 34 +++++++++++++++++-----------------
 1 file changed, 17 insertions(+), 17 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index de85b43223..fcb0ac1ab4 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -170,23 +170,6 @@ (define (serialize-free-form-fields field-name val)
 
 (define non-negative-integer/unset? (predicate/unset non-negative-integer?))
 
-(define (realm-list? val)
-  (and (list? val)
-       (and-map (lambda (x) (krb5-realm? x)) val)))
-
-(define (serialize-realm-list field-name val)
-  (format #t "\n[~a]\n" field-name)
-  (for-each (lambda (realm)
-              (format #t "\n~a = {\n" (krb5-realm-name realm))
-              (for-each (lambda (field)
-                          (unless (eq? 'name (configuration-field-name field))
-                            ((configuration-field-serializer field)
-                             (configuration-field-name field)
-                             ((configuration-field-getter field)
-                              realm)))) krb5-realm-fields)
-
-              (format #t "}\n")) val))
-
 
 
 ;; For a more detailed explanation of these fields see man 5 krb5.conf
@@ -246,6 +229,23 @@ (define-configuration krb5-realm
    "Used when the V4 realm name and the V5 realm name are not the same, but
 still share the same principal names and passwords."))
 
+(define (realm-list? val)
+  (and (list? val)
+       (and-map (lambda (x) (krb5-realm? x)) val)))
+
+(define (serialize-realm-list field-name val)
+  (format #t "\n[~a]\n" field-name)
+  (for-each (lambda (realm)
+              (format #t "\n~a = {\n" (krb5-realm-name realm))
+              (for-each (lambda (field)
+                          (unless (eq? 'name (configuration-field-name field))
+                            ((configuration-field-serializer field)
+                             (configuration-field-name field)
+                             ((configuration-field-getter field)
+                              realm)))) krb5-realm-fields)
+
+              (format #t "}\n")) val))
+
 
 
 ;; For a more detailed explanation of these fields see man 5 krb5.conf
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:27:03 GMT) (full text, mbox, link).


Message #50 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 4/8] services: krb5-configuration: Fix indentation.
Date: Wed, 19 Mar 2025 17:24:30 +0100
* gnu/services/kerberos.scm (krb5-configuration): Adjust indentation and word
wrapping.

Change-Id: I629c106867e1d4d935b4bc33ae3489f4b0ee0bf5
---
 gnu/services/kerberos.scm | 53 ++++++++++++++++++++-------------------
 1 file changed, 27 insertions(+), 26 deletions(-)

diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index 1a7cc5774a..8ebcec3291 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -296,19 +296,19 @@ (define-configuration krb5-configuration
 
   (dns-canonicalize-hostname?
    (boolean/unset  unset-field)
-   "Whether name lookups will be used to canonicalize host names for use in 
+   "Whether name lookups will be used to canonicalize host names for use in
 service principal names.")
 
   (dns-lookup-kdc?
    (boolean/unset unset-field)
- "Should DNS SRV records should be used to locate the KDCs and other servers 
+   "Should DNS SRV records should be used to locate the KDCs and other servers
 not appearing in the realm specification")
 
   (err-fmt
    (string/unset unset-field)
-   "Custom error message formatting. If not #f error messages will be formatted 
-by substituting a normal error message for %M and an error code for %C in the 
-value.")
+   "Custom error message formatting. If not #f error messages will be
+formatted by substituting a normal error message for %M and an error code for
+%C in the value.")
 
   (forwardable?
    (boolean/unset unset-field)
@@ -316,9 +316,9 @@ (define-configuration krb5-configuration
 
   (ignore-acceptor-hostname?
    (boolean/unset unset-field)
-   "When accepting GSSAPI or krb5 security contexts for host-based service 
-principals, ignore any hostname passed by the calling application, and allow 
-clients to authenticate to any service principal in the keytab matching the 
+   "When accepting GSSAPI or krb5 security contexts for host-based service
+principals, ignore any hostname passed by the calling application, and allow
+clients to authenticate to any service principal in the keytab matching the
 service name and realm name.")
 
   (k5login-authoritative?
@@ -328,23 +328,23 @@ (define-configuration krb5-configuration
 
   (k5login-directory
    (string/unset unset-field)
-   "If not #f, the library will look for a local user's @file{k5login} file 
-within the named directory (instead of the user's home directory), with a 
-file name corresponding to the local user name.")
+   "If not #f, the library will look for a local user's @file{k5login} file
+within the named directory (instead of the user's home directory), with a file
+name corresponding to the local user name.")
 
   (kcm-mach-service
    (string/unset unset-field)
-   "The name of the bootstrap service used to contact the KCM daemon for the 
+   "The name of the bootstrap service used to contact the KCM daemon for the
 KCM credential cache type.")
 
   (kcm-socket
    (file-name unset-field)
- "Path to the Unix domain socket used to access the KCM daemon for the KCM 
+   "Path to the Unix domain socket used to access the KCM daemon for the KCM
 credential cache type.")
 
   (kdc-default-options
    (non-negative-integer/unset unset-field)
-   "Default KDC options (logored for multiple values) when requesting initial 
+   "Default KDC options (logored for multiple values) when requesting initial
 tickets.")
 
   (kdc-timesync
@@ -353,17 +353,18 @@ (define-configuration krb5-configuration
 
   (kdc-req-checksum-type
    (non-negative-integer/unset unset-field)
-   "The type of checksum to use for the KDC requests. Relevant only for DES 
+   "The type of checksum to use for the KDC requests. Relevant only for DES
 keys")
 
   (noaddresses?
    (boolean/unset unset-field)
-   "If true, initial ticket requests will not be made with address restrictions.
-This enables their use across NATs.")
+   "If true, initial ticket requests will not be made with address
+restrictions.  This enables their use across NATs.")
 
   (permitted-enctypes
    (space-separated-string-list/unset unset-field)
-   "All encryption types that are permitted for use in session key encryption.")
+   "All encryption types that are permitted for use in session key
+encryption.")
 
   (plugin-base-dir
    (file-name unset-field)
@@ -371,8 +372,8 @@ (define-configuration krb5-configuration
 
   (preferred-preauth-types
    (comma-separated-integer-list/unset unset-field)
-   "The preferred pre-authentication types which the client will attempt before 
-others.")
+   "The preferred pre-authentication types which the client will attempt
+before others.")
 
   (proxiable?
    (boolean/unset unset-field)
@@ -380,12 +381,12 @@ (define-configuration krb5-configuration
 
   (rdns?
    (boolean/unset unset-field)
-   "Should reverse DNS lookup be used in addition to forward name lookup to 
+   "Should reverse DNS lookup be used in addition to forward name lookup to
 canonicalize host names for use in service principal names.")
 
   (realm-try-domains
    (integer/unset unset-field)
-   "Should a host's domain components should be used to determine the Kerberos 
+   "Should a host's domain components should be used to determine the Kerberos
 realm of the host.")
 
   (renew-lifetime
@@ -402,13 +403,13 @@ (define-configuration krb5-configuration
 
   (udp-preference-limit
    (non-negative-integer/unset unset-field)
-   "When sending messages to the KDC, the library will try using TCP
-before UDP if the size of the message greater than this limit.")
+   "When sending messages to the KDC, the library will try using TCP before
+UDP if the size of the message greater than this limit.")
 
   (verify-ap-rereq-nofail?
    (boolean/unset unset-field)
- "If true, then attempts to verify initial credentials will fail if the client
-machine does not have a keytab.")
+   "If true, then attempts to verify initial credentials will fail if the
+client machine does not have a keytab.")
 
   (realms
    (realm-list '())
-- 
2.48.1





Information forwarded to ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org:
bug#77001; Package guix-patches. (Wed, 19 Mar 2025 16:27:04 GMT) (full text, mbox, link).


Message #53 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Tomas Volf <~@wolfsden.cz>
To: 77001@debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>
Subject: [PATCH v2 8/8] services: krb5-service-type: Support launching KDC daemon.
Date: Wed, 19 Mar 2025 17:24:34 +0100
* gnu/services/kerberos.scm (krb5-configuration): Add krb5,
kdc-shepherd-service? fields.
(krb5-activation, krb5-shepherd-services): New procedures.
(krb5-service-type): Use them.

Change-Id: I091ae2a6ef25f5ce95123c29588749483954c2ac
---
 doc/guix.texi             | 12 ++++++-----
 gnu/services/kerberos.scm | 43 ++++++++++++++++++++++++++++++++++++---
 2 files changed, 47 insertions(+), 8 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index fe43ed2504..939683277b 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -32135,11 +32135,13 @@ Kerberos Services
 
 @subsubheading Krb5 Service
 
-Programs using a Kerberos client library normally
-expect a configuration file in @file{/etc/krb5.conf}.
-This service generates such a file from a definition provided in the
-operating system declaration.
-It does not cause any daemon to be started.
+Programs using a Kerberos client library normally expect a configuration
+file in @file{/etc/krb5.conf}.  This service generates such a file from
+a definition provided in the operating system declaration.
+
+When @code{kdc-shepherd-service?} is set to @code{#t}, a shepherd
+service for @acronym{KDC, Key Distribution Center} is created.
+Otherwise no daemons are started.
 
 No ``keytab'' files are provided by this service---you must explicitly create them.
 This service is known to work with the MIT client library, @code{mit-krb5}.
diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
index fcb0ac1ab4..a721cf3be5 100644
--- a/gnu/services/kerberos.scm
+++ b/gnu/services/kerberos.scm
@@ -18,10 +18,13 @@
 ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
 
 (define-module (gnu services kerberos)
+  #:use-module (gnu packages kerberos)
   #:use-module (gnu services)
   #:use-module (gnu services configuration)
+  #:use-module (gnu services shepherd)
   #:use-module (gnu system pam)
   #:use-module (guix gexp)
+  #:use-module (guix packages)
   #:use-module (guix records)
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-34)
@@ -417,7 +420,16 @@ (define-configuration krb5-configuration
 
   (realms
    (realm-list '())
-   "The list of realms which clients may access."))
+   "The list of realms which clients may access.")
+
+  (krb5
+   (package mit-krb5)
+   "The package to use for @command{krb5kdc}.")
+
+  (kdc-shepherd-service?
+   (boolean #f)
+   "Whether to generate a shepherd service for the @acronym{KDC, Key
+Distribution Center} daemon."  empty-serializer))
 
 
 (define (krb5-configuration-file config)
@@ -432,15 +444,40 @@ (define (krb5-configuration-file config)
 (define (krb5-etc-service config)
   (list `("krb5.conf" ,(krb5-configuration-file config))))
 
+(define (krb5-activation config)
+  (if (krb5-configuration-kdc-shepherd-service? config)
+      #~(begin
+          (use-modules (guix build utils))
+          (mkdir-p "/var/krb5kdc"))
+      #~#t))
+
+(define (krb5-shepherd-services config)
+  (match-record config <krb5-configuration>
+                (krb5 kdc-shepherd-service?)
+    (if kdc-shepherd-service?
+        (list
+         (shepherd-service
+          (documentation "Run a krb5kdc daemon.")
+          (provision '(krb5kdc))
+          (requirement '(user-processes))
+          (start #~(make-forkexec-constructor
+                    '(#$(file-append krb5 "/sbin/krb5kdc") "-n")))
+          (stop #~(make-kill-destructor))))
+        '())))
+
 
 (define krb5-service-type
   (service-type (name 'krb5)
                 (extensions
                  (list (service-extension etc-service-type
-                                          krb5-etc-service)))
+                                          krb5-etc-service)
+                       (service-extension activation-service-type
+                                          krb5-activation)
+                       (service-extension shepherd-root-service-type
+                                          krb5-shepherd-services)))
                 (description "Programs using a Kerberos client library
 normally expect a configuration file in @file{/etc/krb5.conf}.  This service
-generates such a file.  It does not cause any daemon to be started.")))
+generates such a file and (optionally) a shepherd service to run a daemon.")))
 
 
 
-- 
2.48.1





Information forwarded to guix-patches@gnu.org:
bug#77001; Package guix-patches. (Thu, 20 Mar 2025 06:28:02 GMT) (full text, mbox, link).


Message #56 received at 77001@debbugs.gnu.org (full text, mbox, reply):

From: Maxim Cournoyer <maxim.cournoyer@gmail.com>
To: Tomas Volf <~@wolfsden.cz>
Cc: 77001@debbugs.gnu.org, Ludovic Courtès <ludo@gnu.org>
Subject: Re: [bug#77001] [PATCH v2 8/8] services: krb5-service-type: Support launching KDC daemon.
Date: Thu, 20 Mar 2025 15:27:00 +0900
Hi,

I'm reviewing mostly just the doc part, which is the team I'm subscribed
to.

Tomas Volf <~@wolfsden.cz> writes:

[...]

> +++ b/doc/guix.texi
> @@ -32135,11 +32135,13 @@ Kerberos Services
>  
>  @subsubheading Krb5 Service
>  
> -Programs using a Kerberos client library normally
> -expect a configuration file in @file{/etc/krb5.conf}.
> -This service generates such a file from a definition provided in the
> -operating system declaration.
> -It does not cause any daemon to be started.
> +Programs using a Kerberos client library normally expect a configuration
> +file in @file{/etc/krb5.conf}.  This service generates such a file from
> +a definition provided in the operating system declaration.
> +
> +When @code{kdc-shepherd-service?} is set to @code{#t}, a shepherd
> +service for @acronym{KDC, Key Distribution Center} is created.
> +Otherwise no daemons are started.

I'd reword to more simply: "Whether a Shepherd service for @acronym{KDC,
Key Distribution Center} should be created."  I'd find it also more
useful if the option was named: 'key-distribution-center?'.  That it is
implemented as a service is an abstraction detail that is less important
for the user than the feature provided, in my opinion.

>  No ``keytab'' files are provided by this service---you must explicitly create them.
>  This service is known to work with the MIT client library, @code{mit-krb5}.
> diff --git a/gnu/services/kerberos.scm b/gnu/services/kerberos.scm
> index fcb0ac1ab4..a721cf3be5 100644
> --- a/gnu/services/kerberos.scm
> +++ b/gnu/services/kerberos.scm
> @@ -18,10 +18,13 @@
>  ;;; along with GNU Guix.  If not, see <http://www.gnu.org/licenses/>.
>  
>  (define-module (gnu services kerberos)
> +  #:use-module (gnu packages kerberos)
>    #:use-module (gnu services)
>    #:use-module (gnu services configuration)
> +  #:use-module (gnu services shepherd)
>    #:use-module (gnu system pam)
>    #:use-module (guix gexp)
> +  #:use-module (guix packages)
>    #:use-module (guix records)
>    #:use-module (srfi srfi-1)
>    #:use-module (srfi srfi-34)
> @@ -417,7 +420,16 @@ (define-configuration krb5-configuration
>  
>    (realms
>     (realm-list '())
> -   "The list of realms which clients may access."))
> +   "The list of realms which clients may access.")
> +
> +  (krb5
> +   (package mit-krb5)
> +   "The package to use for @command{krb5kdc}.")

Maybe, "The package providing the @command{krb5kdc} command."

> +
> +  (kdc-shepherd-service?
> +   (boolean #f)
> +   "Whether to generate a shepherd service for the @acronym{KDC, Key
> +Distribution Center} daemon."  empty-serializer))
>  
>  
>  (define (krb5-configuration-file config)
> @@ -432,15 +444,40 @@ (define (krb5-configuration-file config)
>  (define (krb5-etc-service config)
>    (list `("krb5.conf" ,(krb5-configuration-file config))))
>  
> +(define (krb5-activation config)
> +  (if (krb5-configuration-kdc-shepherd-service? config)
> +      #~(begin
> +          (use-modules (guix build utils))
> +          (mkdir-p "/var/krb5kdc"))
> +      #~#t))
> +
> +(define (krb5-shepherd-services config)
> +  (match-record config <krb5-configuration>
> +                (krb5 kdc-shepherd-service?)
> +    (if kdc-shepherd-service?
> +        (list
> +         (shepherd-service
> +          (documentation "Run a krb5kdc daemon.")
> +          (provision '(krb5kdc))
> +          (requirement '(user-processes))
> +          (start #~(make-forkexec-constructor
> +                    '(#$(file-append krb5 "/sbin/krb5kdc") "-n")))
> +          (stop #~(make-kill-destructor))))
> +        '())))
> +
>  
>  (define krb5-service-type
>    (service-type (name 'krb5)
>                  (extensions
>                   (list (service-extension etc-service-type
> -                                          krb5-etc-service)))
> +                                          krb5-etc-service)
> +                       (service-extension activation-service-type
> +                                          krb5-activation)
> +                       (service-extension shepherd-root-service-type
> +                                          krb5-shepherd-services)))
>                  (description "Programs using a Kerberos client library
>  normally expect a configuration file in @file{/etc/krb5.conf}.  This service
> -generates such a file.  It does not cause any daemon to be started.")))
> +generates such a file and (optionally) a shepherd service to run a daemon.")))

s/shepherd/Shepherd/

Otherwise, LGTM for this 8/8 commit only.

Reviewed-by: Maxim Cournoyer <maxim.cournoyer@gmail.com>

--
Thanks,
Maxim




Send a report that this bug log contains spam.


debbugs.gnu.org maintainers <help-debbugs@gnu.org>. Last modified: Wed Apr 16 03:55:37 2025; Machine Name: wallace-server

GNU bug tracking system

Debbugs is free software and licensed under the terms of the GNU Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.