2022-11-23 17:12:55 +01:00
|
|
|
(define-module (glicid services authentication)
|
2022-11-23 17:12:10 +01:00
|
|
|
#:use-module (gnu services)
|
|
|
|
#:use-module (gnu services shepherd)
|
|
|
|
#:use-module (guix)
|
|
|
|
#:use-module (guix records)
|
|
|
|
#:use-module (ice-9 match)
|
|
|
|
#:use-module (gnu packages sssd)
|
|
|
|
#:use-module (glicid system file-systems)
|
|
|
|
#:export (
|
|
|
|
sssd-configuration
|
|
|
|
sssd-configuration?
|
|
|
|
sssd-service
|
|
|
|
sssd-service-type
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(define-record-type* <sssd-configuration>
|
|
|
|
sssd-configuration make-sssd-configuration sssd-configuration?
|
|
|
|
(sssd-pkg sssd-pkg
|
|
|
|
(default sssd)
|
|
|
|
)
|
|
|
|
(sssd-conf sssd-conf
|
|
|
|
(default (file-append sssd-pkg "/lib/sssd/conf/sssd.conf"))
|
|
|
|
)
|
|
|
|
(sssd-logger sssd-logger
|
|
|
|
(default "stderr")
|
|
|
|
)
|
|
|
|
(sssd-debug-level sssd-debug-level
|
2022-11-23 18:05:57 +01:00
|
|
|
(default #f)
|
2022-11-23 17:12:10 +01:00
|
|
|
)
|
|
|
|
(log-file log-file
|
|
|
|
(default "/var/log/sssd/sssd.log")
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(define sssd-service
|
|
|
|
(match-lambda
|
|
|
|
(($ <sssd-configuration> sssd-pkg sssd-conf sssd-logger sssd-debug-level log-file)
|
|
|
|
(list
|
|
|
|
(shepherd-service
|
|
|
|
(provision '(sssd) )
|
|
|
|
(documentation "Run sssd.")
|
|
|
|
(requirement '(
|
|
|
|
user-processes
|
|
|
|
))
|
|
|
|
(respawn? #t)
|
|
|
|
(start #~(make-forkexec-constructor
|
|
|
|
(list
|
|
|
|
#$(file-append sssd-pkg "/sbin/sssd")
|
2022-11-23 17:37:00 +01:00
|
|
|
; "--interactive"
|
2022-11-23 18:05:57 +01:00
|
|
|
(string-append "--config=" sssd-conf)
|
|
|
|
(string-append "--logger=" sssd-logger)
|
2022-11-23 17:12:10 +01:00
|
|
|
#$@(if sssd-debug-level
|
2022-11-23 18:05:57 +01:00
|
|
|
list (string-append "--debug-level=" sssd-debug-level)
|
2022-11-23 17:12:10 +01:00
|
|
|
'()
|
|
|
|
)
|
|
|
|
)
|
|
|
|
#:log-file #$log-file
|
|
|
|
))
|
|
|
|
(stop #~(make-kill-destructor))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(define %sssd-activation
|
|
|
|
(with-imported-modules '((guix build utils))
|
|
|
|
#~(begin
|
|
|
|
(use-modules (guix build utils))
|
|
|
|
(define (touch file-name)
|
|
|
|
(call-with-output-file file-name (const #t))
|
|
|
|
)
|
|
|
|
(mkdir-p "/var/log/sssd")
|
|
|
|
(mkdir-p "/var/lib/sssd")
|
|
|
|
#t
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
|
|
|
(define sssd-service-type
|
|
|
|
(service-type (name 'sssd)
|
|
|
|
(extensions
|
|
|
|
(list
|
|
|
|
(service-extension shepherd-root-service-type sssd-service)
|
|
|
|
(service-extension activation-service-type (const %sssd-activation))
|
|
|
|
)
|
|
|
|
)
|
|
|
|
(description "Run sssd")
|
|
|
|
)
|
|
|
|
)
|