A set of bash scripts for generating self-signed SSL/TLS certificates for development and testing purposes. These scripts create a certificate authority (CA) and domain-specific certificates using OpenSSL.
- OpenSSL must be installed and available in your PATH
- Bash shell environment
- Execute permissions on all script files:
chmod +x *.shorchmod +x *in this directory
Creates a 2048-bit RSA private key and a self-signed root CA certificate valid for 1024 days.
./create-root-cert-and-keyFiles Generated:
rootCA.key- CA private key (keep secure!)rootCA.pem- CA certificate in PEM format
Renews the existing CA certificate for another 5 years (1830 days). Backs up current CA files before renewal.
./renew-root-certBackup Location:
_backups/YYYY-MM-DD_HH.MM/- Timestamped backup directory containing:rootCA.pemrootCA.pfxrootCA.keyrootCA.srlcacert.pem
Files Updated:
rootCA.pem- Renewed CA certificaterootCA.pfx- Updated PFX for IIS import
Generates site-specific certificates signed by the root CA for development domains.
./create-certificate-for-domain [domain-name]Examples:
./create-certificate-for-domain example.local
./create-certificate-for-domain dev.myapp.comCertificate Details:
- 2048-bit RSA key
- Valid for 365 days (browsers limit validity periods for security)
- Subject:
//C=CA/ST=None/L=NB/O=None/CN=[domain-name] - Extensions: Basic constraints, key usage, DNS subject alternative name
Directory Structure Created:
certs/[domain-name]/
├── [domain-name].crt # Certificate file
├── [domain-name].csr # Certificate signing request
└── device.key # Private key
Additional Files Generated:
[domain-name].pfx- PKCS12 format for Windows/IIS import (no password)
PFX files are automatically generated for both CA and domain certificates. For IIS web server usage:
- CA Certificate Import: Import
rootCA.pfxinto Windows Certificate Store as Trusted Root Certification Authority - Site Certificate: Import the domain's
.pfxfile into IIS for the respective website binding
The scripts output completion messages with IIS-specific import reminders.
The v3.ext file contains X.509 v3 certificate extensions applied to domain certificates:
- Authority Key Identifier
- Basic Constraints (CA:FALSE)
- Key Usage: Digital Signature, Non-Repudiation, Key Encipherment, Data Encipherment
- Subject Alternative Name with DNS entry for the domain
This file is automatically processed during certificate generation.
The .gitignore file excludes generated keys and certificates from version control:
/device.key/rootCA.*
The certs/ directory contains generated domain certificates and may also be ignored depending on your security policies.
"command not found: openssl"
- Install OpenSSL:
apt install openssl(Debian/Ubuntu) orbrew install openssl(macOS)
Certificate verification fails
- Ensure the root CA certificate was generated first
- Check file permissions on
.keyfiles (should be readable only by owner)
IIS PFX import issues
- PFX files are generated without passwords
- For CA import, use the Certificate Import Wizard in MMC with "Trusted Root Certification Authorities" store
Certificate validity issues
- Domain certificates expire after 365 days
- CA certificates expire after 1024 days or can be renewed with
renew-root-cert