Add script to generate certificate for plugins
This patch adds a script that generates a certificate signed by the StackLight authority. The PEM file generated can be used to configure plugins with HTTPs support. Change-Id: I6ad092fa197d5d61a03f721304c8d9fe6d0a3ee1
This commit is contained in:
parent
04ab26bd20
commit
1aadb186aa
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
- **rootCA.key** is the key used to self-signed rootCA.pem
|
- **rootCA.key** is the key used to self-signed rootCA.pem
|
||||||
- **rootCA.pem** is the certificate that will act as the **StackLight Root Authority**
|
- **rootCA.pem** is the certificate that will act as the **StackLight Root Authority**
|
||||||
|
- **md5.txt** that contains the checksum of the two previous files
|
||||||
|
|
||||||
|
The **rootCA.pem** is the one that you need to add to your client to
|
||||||
|
authenticate certificates that will be signed by this certificate.
|
||||||
|
|
||||||
The certificate has the following information:
|
The certificate has the following information:
|
||||||
```
|
```
|
||||||
@ -29,8 +33,34 @@ the client by using the correct option.
|
|||||||
|
|
||||||
# Create a certificate
|
# Create a certificate
|
||||||
|
|
||||||
Follow these steps to generate a new certificate that can be used to enable
|
To create a certificate you just need to run the script
|
||||||
HTTPS for the StackLight plugins.
|
**create_certificate.sh** provided in this directory. You must pass the common
|
||||||
|
name that will be used in the certificate by your plugin. For example if you
|
||||||
|
need a certificate for the *Elasticsearch-Kibana* plugin and if you will
|
||||||
|
access to server using the FQDN *kibana.fuel.local* you will generate the
|
||||||
|
certificate by running:
|
||||||
|
```
|
||||||
|
create_certificate.sh kibana.fuel.local
|
||||||
|
```
|
||||||
|
|
||||||
|
It will create four files:
|
||||||
|
- kibana.key: the private key
|
||||||
|
- kibana.csr: the certificate singing request. The script will create a
|
||||||
|
certificate with the following parameters:
|
||||||
|
- Common Name: *kibana.fuel.local* (that parameter you gave to the script)
|
||||||
|
- Organization: *Mirantis*
|
||||||
|
- Organizational Unit: *Fuel plugins*
|
||||||
|
- City: *Grenoble*
|
||||||
|
- State: *Rhone-Alpes*
|
||||||
|
- Country: *FR*
|
||||||
|
- kibana.crt: The certificate signed by the StackLight authority
|
||||||
|
- kibana.pem: The concatenation of the CRT certificate and the private key
|
||||||
|
|
||||||
|
Only **kibana.pem** is needed for configuring the Fuel plugin. Currently you
|
||||||
|
can only pass the common name as a parameter.
|
||||||
|
|
||||||
|
If you don't want to use the script and prefer to do it manually, follow these
|
||||||
|
steps:
|
||||||
|
|
||||||
- Generate the key for the plugin _my-plugin_.
|
- Generate the key for the plugin _my-plugin_.
|
||||||
```
|
```
|
||||||
|
191
fixtures/https/create_certificate.sh
Executable file
191
fixtures/https/create_certificate.sh
Executable file
@ -0,0 +1,191 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ "$#" -lt 1 ]; then
|
||||||
|
echo "Usage: $0 <CN>"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
CN="$1"
|
||||||
|
BASE=$(echo "$CN" | awk -F'.' '{print $1}')
|
||||||
|
SUBJECT="/C=FR/ST=Rhone-Alpes/L=Grenoble/O=Mirantis/OU=Fuel plugins/CN=$CN"
|
||||||
|
|
||||||
|
# We only check that openssl is available
|
||||||
|
OPENSSL=$(which openssl)
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "openssl: command not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# First we create the private key
|
||||||
|
$OPENSSL genrsa -out "$BASE.key" 2048
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Failed to create $BASE.key"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Creation of $BASE.key done"
|
||||||
|
|
||||||
|
# Then we create the certificate signing request for BASE
|
||||||
|
$OPENSSL req -new -key "$BASE.key" -out "$BASE.csr" -subj "$SUBJECT"
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Failed to create the CSR $BASE.csr"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Creation of $BASE.csr done"
|
||||||
|
|
||||||
|
# Sign it with the CA root key
|
||||||
|
ROOT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
ROOTKEYFILE=$(mktemp -t rootCA-XXX.key)
|
||||||
|
ROOTPEMFILE=$(mktemp -t rootCA-XXX.pem)
|
||||||
|
|
||||||
|
echo "$ROOTKEY" | $OPENSSL base64 -d -out "$ROOTKEYFILE"
|
||||||
|
echo "$ROOTPEM" | $OPENSSL base64 -d -out "$ROOTPEMFILE"
|
||||||
|
|
||||||
|
# Verify the checksum
|
||||||
|
MD5FILE=$(mktemp -t md5-XXX)
|
||||||
|
echo "8e3c74e6a6f143c902540968fce833d2 $ROOTKEYFILE
|
||||||
|
9f9813ac87039b621d50a47d20cc3568 $ROOTPEMFILE" > "$MD5FILE"
|
||||||
|
|
||||||
|
md5sum -c "$MD5FILE"
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Failed to validate checksum for $ROOTKEYFILE/$ROOTPEMFILE"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
$OPENSSL x509 -req -in "$BASE.csr" \
|
||||||
|
-CAkey "$ROOTKEYFILE" \
|
||||||
|
-CA "$ROOTPEMFILE" \
|
||||||
|
-CAcreateserial -out "$BASE.crt" -days 500 -sha256
|
||||||
|
if [ "$?" -ne 0 ]; then
|
||||||
|
echo "Failed to create the signed certificate $BASE.crt"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Creation of $BASE.crt done"
|
||||||
|
|
||||||
|
# Concatenate file
|
||||||
|
cat "$BASE.crt" "$BASE.key" > "$BASE.pem"
|
||||||
|
echo "Creation of $BASE.pem done"
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
rm -f "$BASE.key" "$BASE.csr" "$BASE.crt"
|
||||||
|
rm -f "$ROOTKEYFILE" "$ROOTPEMFILE" "$MD5FILE"
|
2
fixtures/https/md5.txt
Normal file
2
fixtures/https/md5.txt
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
8e3c74e6a6f143c902540968fce833d2 rootCA.key
|
||||||
|
9f9813ac87039b621d50a47d20cc3568 rootCA.pem
|
Loading…
Reference in New Issue
Block a user