Skip to content

Commit 4483350

Browse files
committed
Raise the generate_ssl.sh common name length limit
1 parent 88d5659 commit 4483350

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

can-bus/generate_ssl.sh

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
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
1117
openssl 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
2127
openssl x509 -req -in client.csr -CA ca.crt -CAkey ca.key -CAserial ca.srl -out client.crt

0 commit comments

Comments
 (0)