From 84c60730d112013c63ca9741de9b5784ae63cefb Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Oct 2021 16:57:53 +0200 Subject: [PATCH 1/6] splitting openldap --- glicid/packages/glicid-openldap.scm | 166 ---------------------------- glicid/packages/openldap.scm | 99 +++++++++++++++++ glicid/services/openldap.scm | 75 +++++++++++++ 3 files changed, 174 insertions(+), 166 deletions(-) delete mode 100644 glicid/packages/glicid-openldap.scm create mode 100644 glicid/packages/openldap.scm create mode 100644 glicid/services/openldap.scm diff --git a/glicid/packages/glicid-openldap.scm b/glicid/packages/glicid-openldap.scm deleted file mode 100644 index 9fffdab..0000000 --- a/glicid/packages/glicid-openldap.scm +++ /dev/null @@ -1,166 +0,0 @@ -(use-modules (guix) - (guix build-system gnu) - ((guix licenses) #:select (openldap2.8 lgpl2.1+ gpl3+ psfl expat)) - (guix packages) - (guix utils) - (guix download) - (guix build-system gnu) - (gnu packages base) - (gnu packages autotools) - (gnu packages check) - (gnu packages compression) - (gnu packages cyrus-sasl) - (gnu packages dbm) - (gnu packages documentation) - (gnu packages gettext) - (gnu packages gnupg) - (gnu packages groff) - (gnu packages icu4c) - (gnu packages kerberos) - (gnu packages libevent) - (gnu packages linux) - (gnu packages networking) - (gnu packages nss) - (gnu packages password-utils) - (gnu packages pcre) - (gnu packages perl) - (gnu packages pkg-config) - (gnu packages python) - (gnu packages python-xyz) - (gnu packages rsync) - (gnu packages selinux) - (gnu packages time) - (gnu packages tls) - (gnu packages web) - (gnu packages databases) - (gnu packages password-utils) -) - -(define-public openldap-glicid - (package - (name "openldap-glicid") - (version "2.5.7") - (synopsis "Implementation of the Lightweight Directory Access Protocol") - (description "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.") - (license openldap2.8) - (home-page "https://www.openldap.org/") - (source (origin - (method url-fetch) - (uri (list - (string-append "https://www.openldap.org/software/download/OpenLDAP/" "openldap-release/openldap-" version ".tgz") - (string-append "http://gpl.savoirfairelinux.net/pub/mirrors/openldap/" "openldap-release/openldap-" version ".tgz") - (string-append "http://repository.linagora.org/OpenLDAP/" "openldap-release/openldap-" version ".tgz") - (string-append "ftp://ftp.ntua.gr/mirror/OpenLDAP/" "openldap-release/openldap-" version ".tgz") - (string-append "https://mirror-hk.koddos.net/OpenLDAP/" "openldap-release/openldap-" version ".tgz") - (string-append "ftp://ftp.dti.ad.jp/pub/net/OpenLDAP/" "openldap-release/openldap-" version ".tgz") - (string-append "https://mirror.koddos.net/OpenLDAP/" "openldap-release/openldap-" version ".tgz") - (string-append "https://mirror.lyrahosting.com/OpenLDAP/" "openldap-release/openldap-" version ".tgz") - )) - (sha256 ( base32 "1ayr76sa5hjwldqzis5v71sbp88hd3hysc00gw1raqn33c05g5za" )) - ) - ) - (build-system gnu-build-system) - (inputs `( - ("bdb", bdb) - ("cyrus-sasl", cyrus-sasl) - ("gnutls", gnutls) - ("libgcrypt", libgcrypt) - ("zlib", zlib) - ("libltdl", libltdl) - ("pkg-config", pkg-config) - ("libevent", libevent) - ("libtool", libtool) - ("groff", groff) - ("openssl", openssl) - ("argon2", argon2) - ("wiredtiger", wiredtiger) - ("snappy", snappy) - ("lz4", lz4) - )) - (arguments '( - ; this is needed because the make check does not work inside guix - #:tests? #f - #:configure-flags '( - "--enable-debug" "--enable-dynamic" "--enable-syslog" "--enable-ipv6" "--enable-local" "--enable-slapd" "--enable-dynacl" - "--enable-aci" "--enable-cleartext" "--enable-crypt" "--enable-spasswd" "--enable-modules" "--enable-rlookups" "--enable-slapi" - "--enable-backends=mod" "--enable-overlays=mod" "--enable-argon2" "--enable-balancer" "--disable-static" - "--enable-shared" "--with-tls=openssl" - ) - ; Disable install stripping as it breaks cross-compiling. - #:make-flags '("STRIP=") - #:phases (modify-phases %standard-phases - (add-before 'build 'make-depend - (lambda* (#:key input #:allow-other-keys) - (invoke "make" "depend") - ) - ) - ) - )) - ) - (define-record-type* - openldap-configuration make-openldap-configuration - openldap-configuration? - (openldap openldap-configuration-openldap ; - (default openldap-glicid) - ) - (arguments openldap-configuration-arguments ;list of strings - (default '()) - ) - (logflags openldap-configuration-logflags ;number - (default "0") - ) - (log-file openldap-configuration-log-file ; string - (default "/var/log/slapd.log") - ) - (pid-file openldap-configuration-pid-file ; string - (default "/var/run/openldap/slapd.pid") - ) - (config-file openldap-configuration-config-file ; string - (default %default-slapd.conf) - ) - (schema-dir openldap-configuration-schema-dir ; string - (default '()) - ) - ) - (define %default-slapd.conf - (plain-file "slapd.conf" " - # Empty file for test - ")) - (define schema_dir (local-file "ldap_schema" #:recursive? #t)) - (define openldap-shepherd-service - (match-lambda - (($ openldap arguments logflags log-file pid-file config-file schema-dir) - (list - (shepherd-service - (provision '(slapd) ) - (documentation "Run openldap.") - (requirement '(user-processes)) - (respawn? #f) - (start #~(make-forkexec-constructor - (list - #$(file-append openldap-glicid "/libexec/slapd") - "-h 'ldap:/// ldaps:///'" - "-d" #$logflags - "-f" #$config-file - ) - #:pid-file #$pid-file - )) - (stop #~(make-kill-destructor)) - ) - ) - ) - ) - ) - (define openldap-service-type - (service-type (name 'slapd) - (extensions - (list ( - service-extension - shepherd-root-service-type - openldap-shepherd-service - )) - ) - (description "Run @uref{https://www.openldap.org, Openldap} community developped LDAP software.") - ) - ) -) diff --git a/glicid/packages/openldap.scm b/glicid/packages/openldap.scm new file mode 100644 index 0000000..035f3f7 --- /dev/null +++ b/glicid/packages/openldap.scm @@ -0,0 +1,99 @@ +(define-module (glicid packages openldap) + #:use-module (guix build-system gnu) + #:use-module ((guix licenses) #:select (openldap2.8 lgpl2.1+ gpl3+ psfl expat)) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix download) + #:use-module (guix build-system gnu) + #:use-module (gnu packages autotools) + #:use-module (gnu packages check) + #:use-module (gnu packages compression) + #:use-module (gnu packages cyrus-sasl) + #:use-module (gnu packages dbm) + #:use-module (gnu packages documentation) + #:use-module (gnu packages gettext) + #:use-module (gnu packages gnupg) + #:use-module (gnu packages groff) + #:use-module (gnu packages icu4c) + #:use-module (gnu packages kerberos) + #:use-module (gnu packages libevent) + #:use-module (gnu packages linux) + #:use-module (gnu packages networking) + #:use-module (gnu packages nss) + #:use-module (gnu packages password-utils) + #:use-module (gnu packages pcre) + #:use-module (gnu packages perl) + #:use-module (gnu packages pkg-config) + #:use-module (gnu packages python) + #:use-module (gnu packages python-xyz) + #:use-module (gnu packages rsync) + #:use-module (gnu packages selinux) + #:use-module (gnu packages time) + #:use-module (gnu packages tls) + #:use-module (gnu packages web) + #:use-module (gnu packages databases) + #:use-module (gnu packages password-utils) +) + +(define-public openldap-glicid + (package + (name "openldap-glicid") + (version "2.5.7") + (synopsis "Implementation of the Lightweight Directory Access Protocol") + (description "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.") + (license openldap2.8) + (home-page "https://www.openldap.org/") + (source (origin + (method url-fetch) + (uri (list + (string-append "https://www.openldap.org/software/download/OpenLDAP/" "openldap-release/openldap-" version ".tgz") + (string-append "http://gpl.savoirfairelinux.net/pub/mirrors/openldap/" "openldap-release/openldap-" version ".tgz") + (string-append "http://repository.linagora.org/OpenLDAP/" "openldap-release/openldap-" version ".tgz") + (string-append "ftp://ftp.ntua.gr/mirror/OpenLDAP/" "openldap-release/openldap-" version ".tgz") + (string-append "https://mirror-hk.koddos.net/OpenLDAP/" "openldap-release/openldap-" version ".tgz") + (string-append "ftp://ftp.dti.ad.jp/pub/net/OpenLDAP/" "openldap-release/openldap-" version ".tgz") + (string-append "https://mirror.koddos.net/OpenLDAP/" "openldap-release/openldap-" version ".tgz") + (string-append "https://mirror.lyrahosting.com/OpenLDAP/" "openldap-release/openldap-" version ".tgz") + )) + (sha256 ( base32 "1ayr76sa5hjwldqzis5v71sbp88hd3hysc00gw1raqn33c05g5za" )) + ) + ) + (build-system gnu-build-system) + (inputs `( + ("bdb", bdb) + ("cyrus-sasl", cyrus-sasl) + ("gnutls", gnutls) + ("libgcrypt", libgcrypt) + ("zlib", zlib) + ("libltdl", libltdl) + ("pkg-config", pkg-config) + ("libevent", libevent) + ("libtool", libtool) + ("groff", groff) + ("openssl", openssl) + ("argon2", argon2) + ("wiredtiger", wiredtiger) + ("snappy", snappy) + ("lz4", lz4) + )) + (arguments '( + ; this is needed because the make check does not work inside guix + #:tests? #f + #:configure-flags '( + "--enable-debug" "--enable-dynamic" "--enable-syslog" "--enable-ipv6" "--enable-local" "--enable-slapd" "--enable-dynacl" + "--enable-aci" "--enable-cleartext" "--enable-crypt" "--enable-spasswd" "--enable-modules" "--enable-rlookups" "--enable-slapi" + "--enable-backends=mod" "--enable-overlays=mod" "--enable-argon2" "--enable-balancer" "--disable-static" + "--enable-shared" "--with-tls=openssl" + ) + ; Disable install stripping as it breaks cross-compiling. + #:make-flags '("STRIP=") + #:phases (modify-phases %standard-phases + (add-before 'build 'make-depend + (lambda* (#:key input #:allow-other-keys) + (invoke "make" "depend") + ) + ) + ) + )) + ) +) diff --git a/glicid/services/openldap.scm b/glicid/services/openldap.scm new file mode 100644 index 0000000..4ee36fd --- /dev/null +++ b/glicid/services/openldap.scm @@ -0,0 +1,75 @@ +(define-module (glicid services openldap) + #:use-module (glicid packages openldap) + #: export ( + openldap-configuration + openldap-configuration? + %default-slapd.conf + ) +) + + (define-record-type* + openldap-configuration make-openldap-configuration + openldap-configuration? + (openldap openldap-configuration-openldap ; + (default openldap-glicid) + ) + (arguments openldap-configuration-arguments ;list of strings + (default '()) + ) + (logflags openldap-configuration-logflags ;number + (default "0") + ) + (log-file openldap-configuration-log-file ; string + (default "/var/log/slapd.log") + ) + (pid-file openldap-configuration-pid-file ; string + (default "/var/run/openldap/slapd.pid") + ) + (config-file openldap-configuration-config-file ; string + (default %default-slapd.conf) + ) + (schema-dir openldap-configuration-schema-dir ; string + (default '()) + ) + ) + (define %default-slapd.conf + (plain-file "slapd.conf" " + # Empty file for test + ")) + (define schema_dir (local-file "ldap_schema" #:recursive? #t)) + (define openldap-shepherd-service + (match-lambda + (($ openldap arguments logflags log-file pid-file config-file schema-dir) + (list + (shepherd-service + (provision '(slapd) ) + (documentation "Run openldap.") + (requirement '(user-processes)) + (respawn? #f) + (start #~(make-forkexec-constructor + (list + #$(file-append openldap-glicid "/libexec/slapd") + "-h 'ldap:/// ldaps:///'" + "-d" #$logflags + "-f" #$config-file + ) + #:pid-file #$pid-file + )) + (stop #~(make-kill-destructor)) + ) + ) + ) + ) + ) + (define openldap-service-type + (service-type (name 'slapd) + (extensions + (list ( + service-extension + shepherd-root-service-type + openldap-shepherd-service + )) + ) + (description "Run @uref{https://www.openldap.org, Openldap} community developped LDAP software.") + ) + ) From 63a8c1c048487316a80079246f66c6e4b05ad655 Mon Sep 17 00:00:00 2001 From: root Date: Wed, 27 Oct 2021 17:03:07 +0200 Subject: [PATCH 2/6] splitting openldap --- glicid/packages/openldap.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glicid/packages/openldap.scm b/glicid/packages/openldap.scm index 035f3f7..23304d6 100644 --- a/glicid/packages/openldap.scm +++ b/glicid/packages/openldap.scm @@ -35,9 +35,9 @@ #:use-module (gnu packages password-utils) ) -(define-public openldap-glicid +(define-public openldap (package - (name "openldap-glicid") + (name "openldap") (version "2.5.7") (synopsis "Implementation of the Lightweight Directory Access Protocol") (description "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.") From b99a3730b5698600efd653272cfbb97f77f9ec5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20GUILLAUME?= Date: Wed, 27 Oct 2021 17:04:10 +0200 Subject: [PATCH 3/6] splitting openldap --- glicid/packages/openldap.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glicid/packages/openldap.scm b/glicid/packages/openldap.scm index 035f3f7..23304d6 100644 --- a/glicid/packages/openldap.scm +++ b/glicid/packages/openldap.scm @@ -35,9 +35,9 @@ #:use-module (gnu packages password-utils) ) -(define-public openldap-glicid +(define-public openldap (package - (name "openldap-glicid") + (name "openldap") (version "2.5.7") (synopsis "Implementation of the Lightweight Directory Access Protocol") (description "OpenLDAP is a free implementation of the Lightweight Directory Access Protocol.") From addd01d341ce9068fbd585a9f1026889fd351322 Mon Sep 17 00:00:00 2001 From: JEAN-FRANCOIS GUILLAUME Date: Fri, 29 Oct 2021 12:24:33 +0200 Subject: [PATCH 4/6] adding nginx-ldap-auth --- glicid/packages/nginx.scm | 74 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 glicid/packages/nginx.scm diff --git a/glicid/packages/nginx.scm b/glicid/packages/nginx.scm new file mode 100644 index 0000000..8467c67 --- /dev/null +++ b/glicid/packages/nginx.scm @@ -0,0 +1,74 @@ +(define-module (glicid packages nginx) + #:use-module (guix packages) + #:use-module (guix utils) + #:use-module (guix download) + #:use-module (guix git-download) + #:use-module (guix build-system gnu) + #:use-module (gnu packages web) + #:use-module (glicid packages openldap) +) + +(define-public nginx-ldap-auth-module + (package + (inherit nginx) + (name "nginx-ldap-auth-module") + (version "83c059b73566c2ee9cbda920d91b66657cf120b7") + (source + (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/kvspb/nginx-auth-ldap") + (commit version) + ) + ) + (file-name (git-file-name "nginx-ldap-auth-module" version)) + (sha256 (base32 "023zmdir7w92dnb508ggskkc7kmd7k71hc597sb7i4xfgpwxzq1s" )) + ) + ) + (synopsis "LDAP Authentication module for nginx") + (description "LDAP module for nginx which supports authentication against multiple LDAP servers.") + (build-system gnu-build-system) + (inputs + `(("nginx-sources" ,(package-source nginx)) + ("openldap", openldap) + ,@(package-inputs nginx))) + (arguments + (substitute-keyword-arguments + `(#:configure-flags '("--add-dynamic-module=.") + #:make-flags '("modules") +; #:modules ((guix build utils) +; (guix build gnu-build-system) +; (ice-9 popen) +; (ice-9 regex) +; (ice-9 textual-ports)) + ,@(package-arguments nginx)) + ((#:phases phases) + `(modify-phases ,phases + (add-after 'unpack 'unpack-nginx-sources + (lambda* (#:key inputs native-inputs #:allow-other-keys) + (begin + ;; The nginx source code is part of the module’s source. + (format #t "decompressing nginx source code~%") + (let ((tar (assoc-ref inputs "tar")) + (nginx-srcs (assoc-ref inputs "nginx-sources"))) + (invoke (string-append tar "/bin/tar") + "xvf" nginx-srcs "--strip-components=1")) + #t))) +; (replace 'install +; (lambda* (#:key outputs #:allow-other-keys) +; (let ((modules-dir (string-append (assoc-ref outputs "out") +; "/etc/nginx/modules"))) +; (install-file "objs/ngx_http_lua_module.so" modules-dir) +; #t))) +; (delete 'fix-root-dirs) +; (delete 'install-man-page) +)))))) + + + +nginx-ldap-auth-module + +;(define-public nginx-mod_security +; (package +; ) +;) From 5c1dfeb662d36a6fce2f75f9b29610dee1403be5 Mon Sep 17 00:00:00 2001 From: JEAN-FRANCOIS GUILLAUME Date: Fri, 29 Oct 2021 13:56:59 +0200 Subject: [PATCH 5/6] nginx-ldap-auth --- glicid/packages/nginx.scm | 121 ++++++++++++++++++++++++++++---------- 1 file changed, 91 insertions(+), 30 deletions(-) diff --git a/glicid/packages/nginx.scm b/glicid/packages/nginx.scm index 8467c67..b349b60 100644 --- a/glicid/packages/nginx.scm +++ b/glicid/packages/nginx.scm @@ -5,7 +5,8 @@ #:use-module (guix git-download) #:use-module (guix build-system gnu) #:use-module (gnu packages web) - #:use-module (glicid packages openldap) +; #:use-module (glicid packages openldap) + #:use-module (gnu packages openldap) ) (define-public nginx-ldap-auth-module @@ -33,42 +34,102 @@ ("openldap", openldap) ,@(package-inputs nginx))) (arguments - (substitute-keyword-arguments - `(#:configure-flags '("--add-dynamic-module=.") + (substitute-keyword-arguments + `(#:configure-flags '("--add-dynamic-module=.") #:make-flags '("modules") -; #:modules ((guix build utils) -; (guix build gnu-build-system) -; (ice-9 popen) -; (ice-9 regex) -; (ice-9 textual-ports)) - ,@(package-arguments nginx)) - ((#:phases phases) - `(modify-phases ,phases + ,@(package-arguments nginx) + ) + ((#:phases phases) + `(modify-phases ,phases (add-after 'unpack 'unpack-nginx-sources (lambda* (#:key inputs native-inputs #:allow-other-keys) (begin ;; The nginx source code is part of the module’s source. (format #t "decompressing nginx source code~%") - (let ((tar (assoc-ref inputs "tar")) - (nginx-srcs (assoc-ref inputs "nginx-sources"))) - (invoke (string-append tar "/bin/tar") - "xvf" nginx-srcs "--strip-components=1")) - #t))) -; (replace 'install -; (lambda* (#:key outputs #:allow-other-keys) -; (let ((modules-dir (string-append (assoc-ref outputs "out") -; "/etc/nginx/modules"))) -; (install-file "objs/ngx_http_lua_module.so" modules-dir) -; #t))) + (let ((tar (assoc-ref inputs "tar")) (nginx-srcs (assoc-ref inputs "nginx-sources"))) + (invoke (string-append tar "/bin/tar") "xvf" nginx-srcs "--strip-components=1") + ) + #t + ) + ) + ) + (replace 'install + (lambda* (#:key outputs #:allow-other-keys) + (let ((modules-dir (string-append (assoc-ref outputs "out") "/etc/nginx/modules"))) + (install-file "objs/ngx_http_auth_ldap_module.so" modules-dir) + #t + ) + ) + ) + (delete 'fix-root-dirs) + (delete 'install-man-page) + ) + ) + ) + ) + ) +) + +;(define-public nginx-modsecurity +; (package +; (inherit nginx) +; (name "nginx-modsecurity") +; (version "3.0.5") +; (source +; (origin +; (method url-fetch) +; (uri (list +; (string-append "https://github.com/SpiderLabs/ModSecurity/releases/download/v3.0.5/modsecurity-v" version ".tar.gz") +; ) +; ) +; (sha256 (base32 "1sarp7bjvkkdlpky5j9axfi0qmb177vw2vn2s10c8fcdg9dgj6vm" )) +; ) +; ) +; (synopsis "modsecurity module for nginx") +; (description "modsecurity module for nginx.") +; (build-system gnu-build-system) +; (inputs +; `(("nginx-sources" ,(package-source nginx)) +; ("openldap", openldap) +; ,@(package-inputs nginx))) +; (arguments +; (substitute-keyword-arguments +; `(#:configure-flags '("--add-dynamic-module=.") +; #:make-flags '("modules") +; ,@(package-arguments nginx) +; ) +; ((#:phases phases) +; `(modify-phases ,phases +; (replace 'configure +; (lambda* (#:key output #:allow-other-keys) +; (invoke "./configure" "--enable-standalone-module" "make" ) +; ) +; ) +;; (add-after 'configure 'unpack-nginx-sources +;; (lambda* (#:key inputs native-inputs #:allow-other-keys) +;; (begin +;; ;; The nginx source code is part of the module’s source. +;; (format #t "decompressing nginx source code~%") +;; (let ((tar (assoc-ref inputs "tar")) (nginx-srcs (assoc-ref inputs "nginx-sources"))) +;; (invoke (string-append tar "/bin/tar") "xvf" nginx-srcs "--strip-components=1") +;; ) +;; #t +;; ) +;; ) +;; ) +;; (replace 'install +;; (lambda* (#:key outputs #:allow-other-keys) +;; (let ((modules-dir (string-append (assoc-ref outputs "out") "/etc/nginx/modules"))) +;; (install-file "objs/ngx_http_auth_ldap_module.so" modules-dir) +;; #t +;; ) +;; ) +;; ) ; (delete 'fix-root-dirs) ; (delete 'install-man-page) -)))))) - - - -nginx-ldap-auth-module - -;(define-public nginx-mod_security -; (package +; ) +; ) +; ) +; ) ; ) ;) From 9ade8e1e6d8fa080637bd772b0cdefd1b87caf96 Mon Sep 17 00:00:00 2001 From: JEAN-FRANCOIS GUILLAUME Date: Tue, 2 Nov 2021 09:07:30 +0100 Subject: [PATCH 6/6] wip --- glicid/services/openldap.scm | 123 ++++++++++++++++++----------------- 1 file changed, 64 insertions(+), 59 deletions(-) diff --git a/glicid/services/openldap.scm b/glicid/services/openldap.scm index 4ee36fd..b0d50a7 100644 --- a/glicid/services/openldap.scm +++ b/glicid/services/openldap.scm @@ -1,5 +1,10 @@ (define-module (glicid services openldap) #:use-module (glicid packages openldap) + #:use-module (gnu services) + #:use-module (gnu services shepherd) + #:use-module (guix) + #:use-module (guix records) + #:use-module (ice-9 match) #: export ( openldap-configuration openldap-configuration? @@ -7,69 +12,69 @@ ) ) - (define-record-type* - openldap-configuration make-openldap-configuration - openldap-configuration? - (openldap openldap-configuration-openldap ; - (default openldap-glicid) - ) - (arguments openldap-configuration-arguments ;list of strings - (default '()) - ) - (logflags openldap-configuration-logflags ;number - (default "0") - ) - (log-file openldap-configuration-log-file ; string - (default "/var/log/slapd.log") - ) - (pid-file openldap-configuration-pid-file ; string - (default "/var/run/openldap/slapd.pid") - ) - (config-file openldap-configuration-config-file ; string - (default %default-slapd.conf) - ) - (schema-dir openldap-configuration-schema-dir ; string - (default '()) - ) +(define-record-type* + openldap-configuration make-openldap-configuration + openldap-configuration? + (openldap openldap-configuration-openldap ; + (default openldap-glicid) ) - (define %default-slapd.conf - (plain-file "slapd.conf" " - # Empty file for test - ")) - (define schema_dir (local-file "ldap_schema" #:recursive? #t)) - (define openldap-shepherd-service - (match-lambda - (($ openldap arguments logflags log-file pid-file config-file schema-dir) - (list - (shepherd-service - (provision '(slapd) ) - (documentation "Run openldap.") - (requirement '(user-processes)) - (respawn? #f) - (start #~(make-forkexec-constructor - (list - #$(file-append openldap-glicid "/libexec/slapd") - "-h 'ldap:/// ldaps:///'" - "-d" #$logflags - "-f" #$config-file - ) - #:pid-file #$pid-file - )) - (stop #~(make-kill-destructor)) - ) + (arguments openldap-configuration-arguments ;list of strings + (default '()) + ) + (logflags openldap-configuration-logflags ;number + (default "0") + ) + (log-file openldap-configuration-log-file ; string + (default "/var/log/slapd.log") + ) + (pid-file openldap-configuration-pid-file ; string + (default "/var/run/openldap/slapd.pid") + ) + (config-file openldap-configuration-config-file ; string + (default %default-slapd.conf) + ) + (schema-dir openldap-configuration-schema-dir ; string + (default '()) + ) +) +(define %default-slapd.conf + (plain-file "slapd.conf" " + # Empty file for test +")) +(define schema_dir (local-file "ldap_schema" #:recursive? #t)) +(define openldap-shepherd-service + (match-lambda + (($ openldap arguments logflags log-file pid-file config-file schema-dir) + (list + (shepherd-service + (provision '(slapd) ) + (documentation "Run openldap.") + (requirement '(user-processes)) + (respawn? #f) + (start #~(make-forkexec-constructor + (list + #$(file-append openldap-glicid "/libexec/slapd") + "-h 'ldap:/// ldaps:///'" + "-d" #$logflags + "-f" #$config-file + ) + #:pid-file #$pid-file + )) + (stop #~(make-kill-destructor)) ) ) ) ) - (define openldap-service-type - (service-type (name 'slapd) - (extensions - (list ( - service-extension - shepherd-root-service-type - openldap-shepherd-service - )) - ) - (description "Run @uref{https://www.openldap.org, Openldap} community developped LDAP software.") +) +(define openldap-service-type + (service-type (name 'slapd) + (extensions + (list ( + service-extension + shepherd-root-service-type + openldap-shepherd-service + )) ) + (description "Run @uref{https://www.openldap.org, Openldap} community developped LDAP software.") ) +)