Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions scripts/tls/cert-gen
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,21 @@ set -e
rm -f ca.key ca.crt server.key server.csr server.crt client.key client.csr client.crt index.* serial*
rm -rf certs crl newcerts

if [ -z $SAN ]
then echo "Set SAN with a DNS or IP for matchbox (e.g. export SAN=DNS.1:matchbox.example.com,IP.1:172.17.0.2)."
exit 1
if [ -z "$SAN" ]; then
echo "Configure matchbox certificate:"
echo -n "FQDN: "
read -r FQDN
echo -n "IP: "
read -r IP

if [ -z "$FQDN" ] || [ -z "$IP" ]; then
echo "Error: Both FQDN and IP are required"
exit 1
fi

SAN="DNS.1:${FQDN},IP.1:${IP}"
export SAN
echo "Using SAN: $SAN"
fi

echo "Creating example CA, server cert/key, and client cert/key..."
Expand Down