create-pki: a simple script demonstrating how to create a public-key infrastructure for a TLS server
The script has been tested on Ubuntu (e.g., 16.04 LTS), and requires OpenSSL be installed. To install OpenSSL on Ubuntu,
sudo apt-get install openssl
- Modify the configuration template file
openssl.confas needed. - Run
./create_pki.shto generate a TLS server certificate. Enter requested information when prompted. - To add a subjectAltName, in openssl.cnf, under the
[ v3_req]section, uncomment the lineand replace thesubjectAltName = DNS:<your_subject_alternative_name><your_subject_alternative_name>with your SAN.
Run
openssl s_server \
-CAfile TestCA/cacert.pem \
-cert TestCA/server/example.com.cert.pem \
-key TestCA/server/example.com.key
If everything is OK, expect to see
Using default temp DH parameters
Using default temp ECDH parameters
ACCEPT
In another shell, try
openssl s_client