File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11#! /bin/sh
22
3+ # X.509 caps CN at 64 characters, and cloud hosts routinely have longer FQDNs
4+ CN=` hostname -f`
5+ if [ ${# CN} -gt 64 ]; then
6+ CN=` hostname`
7+ fi
8+
39# Generate self signed root CA cert
4- openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj " /C=GB/ST=London/L=Lon1/O=wolfSSL/OU=root/CN=` hostname -f ` /emailAddress=info@wolfssl.com"
10+ openssl req -nodes -x509 -newkey rsa:2048 -keyout ca.key -out ca.crt -subj " /C=GB/ST=London/L=Lon1/O=wolfSSL/OU=root/CN=$CN /emailAddress=info@wolfssl.com"
511
612
713# Generate server cert to be signed
8- openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj " /C=GB/ST=London/L=Lon1/O=wolfSSL/OU=server/CN=` hostname -f ` /emailAddress=info@wolfssl.com"
14+ openssl req -nodes -newkey rsa:2048 -keyout server.key -out server.csr -subj " /C=GB/ST=London/L=Lon1/O=wolfSSL/OU=server/CN=$CN /emailAddress=info@wolfssl.com"
915
1016# Sign the server cert
1117openssl x509 -req -in server.csr -CA ca.crt -CAkey ca.key -CAcreateserial -out server.crt
@@ -15,7 +21,7 @@ cat server.key server.crt > server.pem
1521
1622
1723# Generate client cert to be signed
18- openssl req -nodes -newkey rsa:2048 -keyout client.key -out client.csr -subj " /C=GB/ST=London/L=Lon1/O=wolfSSL/OU=client/CN=` hostname -f ` /emailAddress=info@wolfssl.com"
24+ openssl req -nodes -newkey rsa:2048 -keyout client.key -out client.csr -subj " /C=GB/ST=London/L=Lon1/O=wolfSSL/OU=client/CN=$CN /emailAddress=info@wolfssl.com"
1925
2026# Sign the client cert
2127openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAserial ca.srl -out client.crt
You can’t perform that action at this time.
0 commit comments