Skip to content

Instantly share code, notes, and snippets.

@debuggerboy
Created October 24, 2022 07:24
Show Gist options
  • Save debuggerboy/c8dcf1a23967914349a0babe30cc9959 to your computer and use it in GitHub Desktop.
Save debuggerboy/c8dcf1a23967914349a0babe30cc9959 to your computer and use it in GitHub Desktop.
OpenSSL CSR Generation
###################################################################################
#
# Free SSL Certificate CSR Generator
#
# OpenSSL configuration file for creating a CSR
# Modify only the FQDN and ORGNAME lines, if required and then run:
#
# openssl req -new -config ssl-config.cnf -keyout myserver.key -out myserver.csr
#
# from the CPanel SSH terminal from "/home/$USER/anish/ssl" directory
#
# BUT, always take backup of existing CSR and KEY file before running this script!
#
# # References:
# - https://www.switch.ch/pki/manage/request/csr-openssl/
# - https://www.ibm.com/docs/en/hpvs/1.2.x?topic=reference-openssl-configuration-examples
# - https://www.shellhacks.com/create-csr-openssl-without-prompt-non-interactive/
###################################################################################
FQDN = mydomain1.com
AFQDN = www.mydomain1.com
ORGNAME = My Domain 1
ALTNAMES = DNS:$FQDN , DNS:$AFQDN
# --- no modifications required below ---
[ req ]
default_bits = 4096
default_md = sha256
prompt = no
encrypt_key = no
distinguished_name = dn
req_extensions = req_ext
[ dn ]
countryName = IN
stateOrProvinceName = KL
localityName = Cochin
organizationName = $ORGNAME
organizationalUnitName = Support
CN = $FQDN
emailAddress = anish@mydomain.com
[ req_ext ]
subjectAltName = $ALTNAMES
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment