From 7d3c1bd972c67af3f5006bd02e8ed3655f16bfc7 Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Sat, 12 Apr 2025 16:25:53 +0200 Subject: tests/email-dns: Factor out all of the secrets/acme stuff into a common dir This makes it easier to re-use this test data for various tests. --- tests/common/acme/certs/generate.client | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 tests/common/acme/certs/generate.client (limited to 'tests/common/acme/certs/generate.client') diff --git a/tests/common/acme/certs/generate.client b/tests/common/acme/certs/generate.client new file mode 100755 index 0000000..5930298 --- /dev/null +++ b/tests/common/acme/certs/generate.client @@ -0,0 +1,44 @@ +#! /usr/bin/env sh + +# Take the correct binary to create the certificates +CERTTOOL=$(command -v gnutls-certtool 2>/dev/null || command -v certtool 2>/dev/null) +if [ -z "$CERTTOOL" ]; then + echo "ERROR: No certtool found" >&2 + exit 1 +fi + +NAME=client +if [ $# -gt 0 ]; then + NAME="$1" +fi + +# Create a client key. +$CERTTOOL \ + --generate-privkey \ + --sec-param "$SEC_PARAM" \ + --key-type "$KEY_TYPE" \ + --outfile "$NAME".key.pem + +chmod 600 "$NAME".key.pem + +# Sign a client cert with the key. +cat <"$NAME".template +dns_name = "$NAME" +dns_name = "$SAN" +expiration_days = $EXPIRATION_DAYS +organization = $ORGANIZATION +encryption_key +signing_key +EOF + +$CERTTOOL \ + --generate-certificate \ + --load-privkey "$NAME".key.pem \ + --load-ca-certificate ca.cert.pem \ + --load-ca-privkey ca.key.pem \ + --template "$NAME".template \ + --outfile "$NAME".cert.pem + +chmod 600 "$NAME".cert.pem + +# vim: ft=sh -- cgit 1.4.1