forked from ome/devspace
-
Notifications
You must be signed in to change notification settings - Fork 1
/
sslcert
executable file
·24 lines (15 loc) · 690 Bytes
/
sslcert
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env bash
# SSL certificate dir
SSL_DIR=${1:-"jenkins/sslcert"}
HOST_OR_IP=${2:-"localhost"}
mkdir -p "$SSL_DIR"
echo "Generating certificate for $HOST_OR_IP..."
# Certificate subject
NGINX_SSL_CERTIFICATE_SUBJECT="/C=UK/ST=Scotland/L=Dundee/O=OME/CN=$HOST_OR_IP"
# Certificate validity (days)
NGINX_SSL_CERTIFICATE_DAYS=365
# Server path to SSL certificate
NGINX_SSL_CERTIFICATE="$SSL_DIR/server.crt"
# Server path to SSL certificate key
NGINX_SSL_CERTIFICATE_KEY="$SSL_DIR/server.key"
openssl req -new -nodes -x509 -subj "$NGINX_SSL_CERTIFICATE_SUBJECT" -days $NGINX_SSL_CERTIFICATE_DAYS -keyout $NGINX_SSL_CERTIFICATE_KEY -out $NGINX_SSL_CERTIFICATE -extensions v3_ca