UNPKG

768 Bapplication/x-shView Raw
1#!/bin/bash
2set -e
3
4DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
5SSL_DIR="$DIR/../certs"
6CERT_NAME="server"
7
8# Set the wildcarded domain we want to use
9DOMAIN="gulp-connect"
10
11# A blank passphrase
12PASSPHRASE="gulp"
13
14# Set our CSR variables
15SUBJ="
16C=US
17ST=MN
18O=
19localityName=
20commonName=$DOMAIN
21organizationalUnitName=
22emailAddress=
23"
24
25# Generate our Private Key, CSR and Certificate
26openssl genrsa -out "$SSL_DIR/$CERT_NAME.key" 2048
27openssl req -new -subj "$(echo -n "$SUBJ" | tr "\n" "/")" -key "$SSL_DIR/$CERT_NAME.key" -out "$SSL_DIR/$CERT_NAME.csr" -passin pass:$PASSPHRASE
28openssl x509 -req -days 1461 -in "$SSL_DIR/$CERT_NAME.csr" -signkey "$SSL_DIR/$CERT_NAME.key" -out "$SSL_DIR/$CERT_NAME.crt"
29
30# Not needed anymore
31rm -rf "$SSL_DIR/$CERT_NAME.csr"
\No newline at end of file