Created
June 17, 2016 11:15
-
-
Save chodorowicz/0c49e17fe445129fb31ab1dad3aa066e to your computer and use it in GitHub Desktop.
create ssh certificate
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# ./make-ssl-keys.sh hello.dev | |
# | |
# https://gist.github.com/jed/6147872 | |
# https://gist.github.com/jimothyGator/5436538 | |
# | |
# put hello.dev.crt and hello.dev.key in etc/nginx | |
# add to nginx server conf for hello.dev 443 | |
# ssl on; | |
# ssl_certificate hello.dev.crt; | |
# ssl_certificate_key hello.dev.key; | |
# ssl_protocols SSLv2 SSLv3 TLSv1.2 TLSv1.1 TLSv1; | |
# ssl_ciphers ECDHE-RSA-AES256-SHA384:RC4:AES256-SHA256:HIGH:!CAMELLIA:!MD5:!aNULL:!EDH:!AESGCM; | |
# ssl_prefer_server_ciphers on; | |
# | |
# the ssl_protocols and ssl_ciphers maybe wrong? | |
# | |
# Open Keychain Access | |
# drag & drop hello.dev.crt to Certificates | |
# double clik it and set trust to always trust | |
# | |
cat > $1.conf <<-__END__ | |
[req] | |
distinguished_name = req_distinguished_name | |
x509_extensions = v3_req | |
prompt = no | |
[req_distinguished_name] | |
CN = *.$1 | |
[v3_req] | |
keyUsage = keyEncipherment, dataEncipherment | |
extendedKeyUsage = serverAuth | |
subjectAltName = @alt_names | |
[alt_names] | |
DNS.1 = *.$1 | |
DNS.2 = $1 | |
__END__ | |
openssl req \ | |
-new \ | |
-newkey rsa:2048 \ | |
-sha1 \ | |
-days 3650 \ | |
-nodes \ | |
-x509 \ | |
-keyout $1.key \ | |
-out $1.crt \ | |
-config $1.conf | |
rm $1.conf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment