diff options
author | Vivien Kraus <vivien@planete-kraus.eu> | 2021-09-26 00:02:44 +0200 |
---|---|---|
committer | Vivien Kraus <vivien@planete-kraus.eu> | 2021-09-26 00:02:44 +0200 |
commit | 2508079864766afc3b6d3b670547b827c7a84ef7 (patch) | |
tree | f492a57db656d0678c9aa30dc13586b581e4a624 /vkraus/systems | |
parent | 654b70c84a608c43d07f089c17e71a7d9307a4c0 (diff) |
Update package
Diffstat (limited to 'vkraus/systems')
-rw-r--r-- | vkraus/systems/test.scm | 141 |
1 files changed, 63 insertions, 78 deletions
diff --git a/vkraus/systems/test.scm b/vkraus/systems/test.scm index c742db9..1bfc2b8 100644 --- a/vkraus/systems/test.scm +++ b/vkraus/systems/test.scm @@ -19,85 +19,70 @@ #:use-module (guix gexp) #:use-module (gnu packages certs) #:use-module (vkraus packages disfluid) - #:use-module (vkraus services disfluid) - #:use-module (ice-9 match) - #:use-module (ice-9 optargs) - #:use-module (oop goops)) - -(define-class <test-server-configuration> (<disfluid-full-server-configuration>) - (user #:init-keyword #:user #:getter user)) - -(define-method (initialize (cfg <test-server-configuration>) initargs) - (let-keywords - initargs #t - ((port #f)) - (let replace-#:user ((args initargs) - (replaced '()) - (replaced? #f)) - (match args - (() - (if replaced? - ;; last explicit call to initialize - (initialize cfg (reverse replaced)) - ;; #:user not found - (next-method))) - ((#:user username args ...) - (let ((added-args - `(#:complete-corresponding-source "https://disfluid.planete-kraus.eu/complete-corresponding-source.tar.gz" - #:server-name ,(format #f "http://localhost:~a" port) - #:subject ,(format #f "http://localhost:~a/~a#me" port username) - #:encrypted-password-file - ,(computed-file (format #f "~a-password" username) - #~(let ((salt "$6$not.secured.salt.") - (password username)) - (call-with-output-file #$output - (lambda (port) - (format port "~a\n" - (crypt password salt)))))) - #:key-file ,(format #f "/var/lib/disfluid/~a/key.jwk" username) - #:jwks-uri ,(format #f "http://localhost:~a/keys" port) - #:authorization-endpoint-uri - ,(format #f "http://localhost:~a/authorize" port) - #:token-endpoint-uri - ,(format #f "http://localhost:~a/token" port)))) - (replace-#:user args (append (reverse added-args) replaced) #t))) - (((? keyword? key) value args ...) - (replace-#:user args `(,value ,key ,@replaced) replaced?)))))) + #:use-module (vkraus services disfluid)) (operating-system - (host-name "disfluid-test-system") - (hosts-file - (plain-file "hosts" - "127.0.0.1 localhost + (host-name "disfluid-test-system") + (hosts-file + (plain-file "hosts" + "127.0.0.1 localhost ::1 localhost ")) - (users %base-user-accounts) - (packages - `(,disfluid - ,nss-certs - ,@%base-packages)) - (services - (append - (list - (service disfluid-service-type - `(("alice" - . ,(make <test-server-configuration> - #:user "alice" - #:port 8081)) - ("bob" - . ,(make <test-server-configuration> - #:user "bob" - #:port 8082))))) - %base-services)) - (timezone "Europe/Paris") - (bootloader - (bootloader-configuration - (bootloader grub-efi-bootloader) - (target "/boot/efi"))) - (mapped-devices '()) - (file-systems - `(,(file-system - (mount-point "/") - (device "/dev/sda") - (type "ext4")) - ,@%base-file-systems))) + (users %base-user-accounts) + (packages + `(,disfluid + ,nss-certs + ,@%base-packages)) + (services + (append + (list + (service disfluid-service-type + `(("alice" + . ,(disfluid-server-configuration + (complete-corresponding-source "https://webid-oidc.planete-kraus.eu/complete-corresponding-source.tar.gz") + (server-name "http://localhost:8081") + (subject "http://localhost:8081/alice#me") + (encrypted-password-file + (computed-file "alice-password" + #~(let ((salt "$6$.salt.for.Alice.") + (password "alice")) + (call-with-output-file #$output + (lambda (port) + (format port "~a\n" + (crypt password salt))))))) + (key-file "/var/lib/disfluid/alice/key.jwk") + (jwks-uri "http://localhost:8081/keys") + (authorization-endpoint-uri "http://localhost:8081/authorize") + (token-endpoint-uri "http://localhost:8081/token") + (port 8081))) + ("bob" + . ,(disfluid-server-configuration + (complete-corresponding-source "https://webid-oidc.planete-kraus.eu/complete-corresponding-source.tar.gz") + (server-name "http://localhost:8082") + (subject "http://localhost:8082/bob#me") + (encrypted-password-file + (computed-file "bob-password" + #~(let ((salt "$6$And.salt.for.Bob") + (password "bob")) + (call-with-output-file #$output + (lambda (port) + (format port "~a\n" + (crypt password salt))))))) + (key-file "/var/lib/disfluid/bob/key.jwk") + (jwks-uri "http://localhost:8082/keys") + (authorization-endpoint-uri "http://localhost:8082/authorize") + (token-endpoint-uri "http://localhost:8082/token") + (port 8082)))))) + %base-services)) + (timezone "Europe/Paris") + (bootloader + (bootloader-configuration + (bootloader grub-efi-bootloader) + (target "/boot/efi"))) + (mapped-devices '()) + (file-systems + `(,(file-system + (mount-point "/") + (device "/dev/sda") + (type "ext4")) + ,@%base-file-systems))) |