-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3599 from mercedes-benz/feature-3596-web-ui-ssl-k…
…eystore Feature 3596 web UI ssl keystore
- Loading branch information
Showing
6 changed files
with
87 additions
and
17 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,50 @@ | ||
#!/bin/sh | ||
# SPDX-License-Identifier: MIT | ||
set -e | ||
|
||
debug () { | ||
while true | ||
do | ||
echo "Press [CTRL+C] to stop.." | ||
sleep 120 | ||
done | ||
while true ; do | ||
echo "Press [CTRL+C] to stop.." | ||
sleep 120 | ||
done | ||
} | ||
|
||
if [ "$LOADBALANCER_START_MODE" != "server" ] | ||
then | ||
debug | ||
install_ssl_certs () { | ||
echo "### Installing SSL certs \"$WEB_UI_SSL_KEYSTORE_ALIAS\"" | ||
K8S_SSL_SECRETS="/sechub-web-ui/secrets/secret-ssl" | ||
|
||
cd "$CERTIFICATE_DIRECTORY" | ||
|
||
echo "# Extraxting private key" | ||
openssl pkcs12 -in "$K8S_SSL_SECRETS/keystore_file" -nocerts -out key.pem -nodes -legacy -password file:"$K8S_SSL_SECRETS/keystore_password" | ||
|
||
echo "# Extracting certificate(s)" | ||
openssl pkcs12 -in "$K8S_SSL_SECRETS/keystore_file" -nokeys -out cert.pem -nodes -legacy -password file:"$K8S_SSL_SECRETS/keystore_password" | ||
|
||
echo "# Verifying name (keystore alias)" | ||
grep "friendlyName: $WEB_UI_SSL_KEYSTORE_ALIAS" key.pem | ||
grep "friendlyName: $WEB_UI_SSL_KEYSTORE_ALIAS" cert.pem | ||
|
||
echo "# Replacing certificates" | ||
cat key.pem | sed -ne '/-BEGIN PRIVATE KEY-/,/-END PRIVATE KEY-/p' > sechub-web-ui.key | ||
cat cert.pem | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > sechub-web-ui.cert | ||
|
||
# cleanup temporary files | ||
rm -f key.pem cert.pem | ||
} | ||
|
||
############### | ||
# main | ||
if [ "$WEB_UI_SSL_KEYSTORE_ALIAS" != "undefined" ] ; then | ||
install_ssl_certs | ||
fi | ||
|
||
if [ "$LOADBALANCER_START_MODE" != "server" ] ; then | ||
debug | ||
fi | ||
|
||
echo "Check configuration file" | ||
echo "### Checking configuration file" | ||
nginx -t | ||
|
||
echo "Start Nginx" | ||
nginx -g 'daemon off;' | ||
echo "### Starting Nginx" | ||
nginx -g 'daemon off;' |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,43 @@ | ||
<!-- SPDX-License-Identifier: MIT ---> | ||
# SecHub Web UI | ||
|
||
This Helm chart is used to deploy the SecHub Web UI to a Kubernetes cluster. | ||
This Helm chart is used to deploy the SecHub Web UI to a Kubernetes cluster. | ||
|
||
## SSL certificates and keys | ||
|
||
### Default SSL setup | ||
The web-ui container image is shipped with initially created self-signed certificates. | ||
|
||
### User-provided SSL keystore | ||
If you want to provide your own officially signed certificates, | ||
you need to create a pkcs12 keystore with a "-name" attribute (e.g. `sechub-web-ui.example.com`). | ||
|
||
#### How to create the .p12 keystore | ||
Create a private key (`sechub-web-ui.key`), create a certificate signed by a CA of your trust (`sechub-web-ui.cert`). | ||
```bash | ||
NAME="sechub-web-ui.example.com" | ||
openssl pkcs12 -export -in sechub.corpinter.net-full-chain.crt -inkey sechub.corpinter.net_server.key -out ${NAME}.p12 -name ${NAME} | ||
# Enter pass phrase for private key file | ||
# Enter Export Password for .p12 keystore | ||
``` | ||
|
||
#### Set .p12 and its password as Kubernetes secrets | ||
A Kubernetes secret `secret-web-ui-ssl` must be defined containing | ||
- `keystore_file` - Your .p12 keystore file created in the previous step<br> | ||
Inside the .p12 keystore, an alias with ${NAME} is expected pointing to the ssl certificate to use | ||
- `keystore_password` - Export Password for .p12 keystore from above step | ||
|
||
#### Update your values.yaml | ||
Declare ${NAME} as your keystore alias in your Helm values.yaml file. | ||
|
||
Example: | ||
```yaml | ||
web_ui: | ||
ssl: | ||
keystoreAlias: "sechub-web-ui.example.com" | ||
``` | ||
#### Deploy | ||
Now you can deploy using your values.yaml file from above. | ||
Then the SecHub web-ui will use your certificates and key for https encryption. |
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
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