Skip to content

Commit

Permalink
tls: Add PEM file update script and config
Browse files Browse the repository at this point in the history
Documentation so we can avoid researching this in the future. The
new PEM files have 3560 day expirations.
  • Loading branch information
13rac1 committed Dec 28, 2017
1 parent 6804b54 commit 0b889fa
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 0 deletions.
7 changes: 7 additions & 0 deletions kubernetes/tls/ssl-extensions-x509.cnf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[v3_ca]
keyUsage = critical, digitalSignature, keyEncipherment
extendedKeyUsage = serverAuth, clientAuth
basicConstraints = critical, CA:FALSE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid,issuer
subjectAltName = IP:127.0.0.1, DNS: localhost, DNS: *.example.com
42 changes: 42 additions & 0 deletions kubernetes/tls/update-tls.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/bin/sh
set -e

openssl genrsa \
-out ca-key.pem 2048

openssl req \
-x509 \
-new \
-nodes \
-key ca-key.pem \
-days 3560 \
-extensions v3_ca \
-out ca.pem \
-subj "/O=Kubernetes"

openssl x509 -in ca.pem -text

openssl genrsa \
-out key.pem 2048

openssl req \
-new \
-key key.pem \
-out csr.pem \
-subj "/O=Kubernetes/CN=*.example.com"

openssl x509 \
-req \
-in csr.pem \
-CA ca.pem \
-CAkey ca-key.pem \
-CAcreateserial \
-out cert.pem \
-extensions v3_ca \
-extfile ssl-extensions-x509.cnf \
-days 3560

openssl x509 -in cert.pem -text

rm ca.srl
rm csr.pem

0 comments on commit 0b889fa

Please sign in to comment.