diff options
author | Seth Forshee <seth.forshee@canonical.com> | 2017-10-22 22:52:43 -0500 |
---|---|---|
committer | Seth Forshee <seth.forshee@canonical.com> | 2017-12-23 21:20:07 -0600 |
commit | 2ae78adb6ee17e07cbbfc30c5fcf7cd55da450e6 (patch) | |
tree | ffc13a4dfaa62b641933693d0773042b833e07d7 | |
parent | a0a7716a67a40cc6ef3e4b0989a1ae8bbd75613d (diff) | |
download | wireless-regdb-2ae78adb6ee17e07cbbfc30c5fcf7cd55da450e6.tar.gz |
wireless-regdb: Better support for generating public certificates
The current makefile rule for the public certificate calls for an
openssl config file which is not provided. Let's put the pubcert
generation into a script named gen-pubcert.sh and embed the
openssl configuration file there.
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
-rw-r--r-- | Makefile | 4 | ||||
-rwxr-xr-x | gen-pubcert.sh | 18 |
2 files changed, 19 insertions, 3 deletions
@@ -79,9 +79,7 @@ $(REGDB_PUBKEY): $(REGDB_PRIVKEY) $(REGDB_PUBCERT): $(REGDB_PRIVKEY) @echo "Generating certificate for $(REGDB_AUTHOR)..." - @openssl req -config regulatory.openssl.conf \ - -key $(REGDB_PRIVKEY) -days 36500 -utf8 -nodes -batch \ - -x509 -outform PEM -out $(REGDB_PUBCERT) + ./gen-pubcert.sh $(REGDB_PRIVKEY) $(REGDB_PUBCERT) @echo $(REGDB_PUBKEY) > .custom diff --git a/gen-pubcert.sh b/gen-pubcert.sh new file mode 100755 index 0000000..1a4d579 --- /dev/null +++ b/gen-pubcert.sh @@ -0,0 +1,18 @@ +#!/bin/bash + +if [[ $# -ne 2 ]]; then + echo "Usage: $0 priv-key out-file" + exit 1 +fi + +openssl req -new -key "$1" -days 36500 -utf8 -nodes -batch \ + -x509 -outform PEM -out "$2" \ + -config <(cat <<-EOF + [ req ] + distinguished_name = req_distinguished_name + string_mask = utf8only + prompt = no + [ req_distinguished_name ] + commonName = sforshee + EOF + ) |