How to Create a Self-Signed SSL Certificate: A Step-by-Step Guide

umask 077 && touch {FQDN}.key {FQDN}.cert {FQDN}.pem

openssl genrsa 2048 > {FQDN}.key

openssl req -new -sha256 -key {FQDN}.key -out {FQDN}.csr

openssl req -new -x509 -nodes -sha1 -days 3650 -key {FQDN}.key > {FQDN}.cert

cat {FQDN}.cert {FQDN}.key > {FQDN}.pem

openssl pkcs12 -export -out {FQDN}.pfx -inkey {FQDN}.key -in {FQDN}.cert

chmod 400 {FQDN}.key {FQDN}.pem
SSL CHECKS
Check CSR
openssl req -text -noout -verify -in {FQDN}.csr
Check KEY
openssl rsa -in {FQDN}.key -check
Check CERT
openssl x509 -in {FQDN}.cert -text -noout
Check PKCS12
openssl pkcs12 -info -in {FQDN}.pfx

Leave a Reply