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