mirror of
https://github.com/kernelkit/infix.git
synced 2026-08-05 23:23:02 +02:00
- Add x509-public-key-format identity to crypto-types - Add certificate node to web services container - Use certificate from ietf-keystore as web cert Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
36 lines
797 B
Bash
Executable File
36 lines
797 B
Bash
Executable File
#!/bin/sh
|
|
# Generate a self-signed TLS certificate. Called from confd keystore
|
|
# on first boot (or factory reset) when the gencert entry has empty
|
|
# keys. Output is written to a temporary directory that confd reads
|
|
# and then removes after importing into the keystore.
|
|
|
|
TMPDIR=/tmp/ssl
|
|
KEY=$TMPDIR/self-signed.key
|
|
CRT=$TMPDIR/self-signed.crt
|
|
|
|
country=US
|
|
state=California
|
|
city=Berkeley
|
|
org="Acme, Inc."
|
|
unit=Second
|
|
|
|
if [ -f /etc/mkcert.conf ]; then
|
|
. /etc/mkcert.conf
|
|
fi
|
|
|
|
if [ -z "$cn" ]; then
|
|
cn=$1
|
|
if [ -z "$cn" ]; then
|
|
cn=$(hostname).local
|
|
fi
|
|
fi
|
|
|
|
mkdir -p "$TMPDIR"
|
|
chmod 700 "$TMPDIR"
|
|
|
|
gencert --country "$country" --state "$state" --city "$city" --organisation "$org" \
|
|
--organisation-unit "$unit" --common-name "$cn" \
|
|
--out-certificate "$CRT" --out-key "$KEY"
|
|
|
|
exit $?
|