diff options
-rw-r--r-- | src/org/euandre/queue.scm | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/src/org/euandre/queue.scm b/src/org/euandre/queue.scm index cdd789f..c1aa56d 100644 --- a/src/org/euandre/queue.scm +++ b/src/org/euandre/queue.scm @@ -746,39 +746,39 @@ keyfile ~a/private.key (use-modules (guix build utils)) (let* ((user (getpwnam #$user)) (uid (passwd:uid user)) - (gid (passwd:gid user))) + (gid (passwd:gid user)) + (private-key (string-append #$data-directory "/private.key")) + (public-key (string-append #$data-directory "/public.key"))) (format (current-error-port) "Creating DKIMproxy.out data directory: \"~a\".~%" #$data-directory) (mkdir-p/perms #$data-directory user #o755) - (let ((private-key (string-append #$data-directory "/private.key")) - (public-key (string-append #$data-directory "/public.key"))) - (unless (file-exists? private-key) - (format (current-error-port) - "The public/private keypair doesn't exist yet. Generating one...~%") - (cond - ((zero? (system* #$(file-append openssl "/bin/openssl") - "genrsa" - "-out" - private-key - (number->string #$key-size))) - (format (current-error-port) - "DKIMproxy.out private key file created: \"~a\".~%" private-key)) - (else - (format (current-error-port) - "Failed to create DKIMproxy.out private key file: \"~a\".~%" private-key)))) - (invoke #$(file-append openssl "/bin/openssl") - "rsa" - "-in" - private-key - "-pubout" - "-out" - public-key) + (unless (file-exists? private-key) (format (current-error-port) - "Setting permissions for the public/private DKIMproxy.out keypair: \"~a/{public,private}.key\".~%" #$data-directory) - (chown private-key uid gid) - (chown public-key uid gid) - (chmod private-key #o400) - (chmod public-key #o644)))))) + "The public/private keypair doesn't exist yet. Generating one...~%") + (cond + ((zero? (system* #$(file-append openssl "/bin/openssl") + "genrsa" + "-out" + private-key + (number->string #$key-size))) + (format (current-error-port) + "DKIMproxy.out private key file created: \"~a\".~%" private-key) + (invoke #$(file-append openssl "/bin/openssl") + "rsa" + "-in" + private-key + "-pubout" + "-out" + public-key) + (format (current-error-port) + "Setting permissions for the public/private DKIMproxy.out keypair: \"~a/{public,private}.key\".~%" #$data-directory) + (chown private-key uid gid) + (chown public-key uid gid) + (chmod private-key #o400) + (chmod public-key #o644)) + (else + (format (current-error-port) + "ERROR: failed to create DKIMproxy.out private key file: \"~a\".~%" private-key)))))))) (define (dkimproxyout-shepherd-service config) (match-record config <dkimproxyout-configuration> |