mirror of
https://gitlab.univ-nantes.fr/glicid-public/guix-glicid.git
synced 2025-04-29 21:58:36 +02:00
correcting merge request
This commit is contained in:
commit
f035827204
3 changed files with 251 additions and 106 deletions
135
glicid/packages/nginx.scm
Normal file
135
glicid/packages/nginx.scm
Normal file
|
@ -0,0 +1,135 @@
|
|||
(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)
|
||||
#:use-module (gnu 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")
|
||||
,@(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_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)
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
; )
|
||||
;)
|
|
@ -1,12 +1,10 @@
|
|||
(define-module (glicid packages openldap)
|
||||
;; #:use-module (guix)
|
||||
#: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 base)
|
||||
#:use-module (gnu packages autotools)
|
||||
#:use-module (gnu packages check)
|
||||
#:use-module (gnu packages compression)
|
||||
|
@ -37,9 +35,9 @@
|
|||
#:use-module (gnu packages password-utils)
|
||||
)
|
||||
|
||||
(define-public glicid-openldap
|
||||
(define-public openldap
|
||||
(package
|
||||
(name "glicid-openldap")
|
||||
(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.")
|
||||
|
@ -99,71 +97,3 @@
|
|||
))
|
||||
)
|
||||
)
|
||||
;;YD;; ; (define-record-type* <openldap-configuration>
|
||||
;;YD;; ; openldap-configuration make-openldap-configuration
|
||||
;;YD;; openldap-configuration?
|
||||
;;YD;; (openldap openldap-configuration-openldap ;<package>
|
||||
;;YD;; (default openldap-glicid)
|
||||
;;YD;; )
|
||||
;;YD;; (arguments openldap-configuration-arguments ;list of strings
|
||||
;;YD;; (default '())
|
||||
;;YD;; )
|
||||
;;YD;; (logflags openldap-configuration-logflags ;number
|
||||
;;YD;; (default "0")
|
||||
;;YD;; )
|
||||
;;YD;; (log-file openldap-configuration-log-file ; string
|
||||
;;YD;; (default "/var/log/slapd.log")
|
||||
;;YD;; )
|
||||
;;YD;; (pid-file openldap-configuration-pid-file ; string
|
||||
;;YD;; (default "/var/run/openldap/slapd.pid")
|
||||
;;YD;; )
|
||||
;;YD;; (config-file openldap-configuration-config-file ; string
|
||||
;;YD;; (default %default-slapd.conf)
|
||||
;;YD;; )
|
||||
;;YD;; (schema-dir openldap-configuration-schema-dir ; string
|
||||
;;YD;; (default '())
|
||||
;;YD;; )
|
||||
;;YD;; )
|
||||
;;YD;; (define %default-slapd.conf
|
||||
;;YD;; (plain-file "slapd.conf" "
|
||||
;;YD;; # Empty file for test
|
||||
;;YD;; "))
|
||||
;;YD;; (define schema_dir (local-file "ldap_schema" #:recursive? #t))
|
||||
;;YD;; (define openldap-shepherd-service
|
||||
;;YD;; (match-lambda
|
||||
;;YD;; (($ <openldap-configuration> openldap arguments logflags log-file pid-file config-file schema-dir)
|
||||
;;YD;; (list
|
||||
;;YD;; (shepherd-service
|
||||
;;YD;; (provision '(slapd) )
|
||||
;;YD;; (documentation "Run openldap.")
|
||||
;;YD;; (requirement '(user-processes))
|
||||
;;YD;; (respawn? #f)
|
||||
;;YD;; (start #~(make-forkexec-constructor
|
||||
;;YD;; (list
|
||||
;;YD;; #$(file-append openldap-glicid "/libexec/slapd")
|
||||
;;YD;; "-h 'ldap:;;YD;;/ ldaps:;;YD;;/'"
|
||||
;;YD;; "-d" #$logflags
|
||||
;;YD;; "-f" #$config-file
|
||||
;;YD;; )
|
||||
;;YD;; #:pid-file #$pid-file
|
||||
;;YD;; ))
|
||||
;;YD;; (stop #~(make-kill-destructor))
|
||||
;;YD;; )
|
||||
;;YD;; )
|
||||
;;YD;; )
|
||||
;;YD;; )
|
||||
;;YD;; )
|
||||
;;YD;; (define openldap-service-type
|
||||
;;YD;; (service-type (name 'slapd)
|
||||
;;YD;; (extensions
|
||||
;;YD;; (list (
|
||||
;;YD;; service-extension
|
||||
;;YD;; shepherd-root-service-type
|
||||
;;YD;; openldap-shepherd-service
|
||||
;;YD;; ))
|
||||
;;YD;; )
|
||||
;;YD;; (description "Run @uref{https:;;YD;;www.openldap.org, Openldap} community developped LDAP software.")
|
||||
;;YD;; )
|
||||
;;YD;; )
|
||||
;;YD;; )
|
||||
|
||||
|
|
80
glicid/services/openldap.scm
Normal file
80
glicid/services/openldap.scm
Normal file
|
@ -0,0 +1,80 @@
|
|||
(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?
|
||||
%default-slapd.conf
|
||||
)
|
||||
)
|
||||
|
||||
(define-record-type* <openldap-configuration>
|
||||
openldap-configuration make-openldap-configuration
|
||||
openldap-configuration?
|
||||
(openldap openldap-configuration-openldap ;<package>
|
||||
(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-configuration> 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.")
|
||||
)
|
||||
)
|
Loading…
Add table
Reference in a new issue