aboutsummaryrefslogtreecommitdiff
path: root/src/org/euandre/queue.scm
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2023-03-17 11:34:59 -0300
committerEuAndreh <eu@euandre.org>2023-03-17 11:34:59 -0300
commit08b4494470c37654f789c578a255c7937f8bdc3b (patch)
tree3c741cce26985cce0c15e51f97bb3507e15e4a08 /src/org/euandre/queue.scm
parentqueue.scm: Remove FIXME markers from output file contents (diff)
downloadpackage-repository-08b4494470c37654f789c578a255c7937f8bdc3b.tar.gz
package-repository-08b4494470c37654f789c578a255c7937f8bdc3b.tar.xz
queue.scm: Better error handling of dkimproxyout-activation
Diffstat (limited to 'src/org/euandre/queue.scm')
-rw-r--r--src/org/euandre/queue.scm58
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>