Skip to content

Instantly share code, notes, and snippets.

@hpherzog
Last active December 14, 2015 04:48
Show Gist options
  • Save hpherzog/5030369 to your computer and use it in GitHub Desktop.
Save hpherzog/5030369 to your computer and use it in GitHub Desktop.
Create a self or ca signed ssl certificate with openssl on debian wheezy
#!/bin/sh
#####################################################
# #
# Create a ca signed ssl certificate with CA.pl #
# #
#####################################################
# http://www.debian-administration.org/article/618/Certificate_Authority_CA_with_OpenSSL
/usr/lib/ssl/misc/CA.pl -newca
/usr/lib/ssl/misc/CA.pl -newreq
/usr/lib/ssl/misc/CA.pl -sign
openssl rsa -in newkey.pem -out newkey.nopass.pem
#!/bin/sh
#######################################################
# #
# Create a self signed ssl certificate with openssl #
# #
#######################################################
DOMAIN_NAME=$1
KEY_NAME="$DOMAIN_NAME.key"
KEY_ORI_NAME="$DOMAIN_NAME.key.ori"
CSR_NAME="$DOMAIN_NAME.csr"
CRT_NAME="$DOMAIN_NAME.crt"
# Create private key
openssl genrsa -des3 -out $KEY_NAME 2048
# Create CSR
openssl req -new -key $KEY_NAME -out $CSR_NAME
openssl req -text -noout -in $CSR_NAME
# Remove passphrase from key
cp $KEY_NAME $KEY_ORI_NAME
openssl rsa -in $KEY_ORI_NAME -out $KEY_NAME
# Create a self signed certificate
openssl x509 -req -days 365 -in $CSR_NAME -signkey $KEY_NAME -out $CRT_NAME
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment