Verified against source code and enhanced with Docusaurus markdown features: Documentation Accuracy Fixes: - Fixed acme.md: Added "letsencrypt" as valid AUTOCONFIG value (was incorrectly shown as "-") - Added reference to ACME docs from environment-variable.md - Verified all features against actual implementation in /src Docusaurus Enhancements Added: - Admonitions (:::note, :::tip, :::warning, :::danger, :::info) for important callouts - Code block titles for all bash/yaml examples (e.g., title="Install EasyHAProxy") - Better structured warnings and notes for limitations - Improved formatting and readability throughout Files Enhanced: - kubernetes.md: Added info boxes, warnings, code titles - docker.md: Added limitation warnings, code titles - swarm.md: Added advantage tips, limitation warnings - acme.md: Fixed Let's Encrypt autoconfig, enhanced requirements with admonitions - ssl.md: Added code block titles for all examples - static.md: Added live reload tip, SSL certificate note - container-labels.md: Added definition explanation, code titles - limitations.md: Restructured with clear warnings and explanations - helm.md: Added warnings, code titles - microk8s.md: Added ingress controller warning, code titles - volumes.md: Added info box about volume purposes - other.md: Added code block titles - environment-variable.md: Added ACME reference note All changes verified against actual Python source code implementation.
84 lines
2.2 KiB
Markdown
84 lines
2.2 KiB
Markdown
---
|
|
sidebar_position: 9
|
|
---
|
|
|
|
# Setup custom certificates
|
|
|
|
You can use your own certificates with EasyHAProxy. You just need to let EasyHAProxy know that certificate.
|
|
|
|
There are two ways to do that.
|
|
|
|
- [Setup certificate as a label definition in docker container](#setup-certificate-as-a-label-definition-in-docker-container)
|
|
- [Map the certificate as a docker volume](#map-the-certificate-as-a-docker-volume)
|
|
|
|
## Setup certificate as a label definition in docker container
|
|
|
|
1. Create a single PEM from the certificate and key.
|
|
|
|
```bash title="Combine certificate and key"
|
|
cat example.com.crt example.com.key > single.pem
|
|
|
|
cat single.pem
|
|
|
|
-----BEGIN CERTIFICATE-----
|
|
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5ZheHqmBnEJP+
|
|
U9r1gxYWKLzdqrMrcxtQN6M1hIH9n0peuJeIrybdcV7sMbStMXI=
|
|
-----END CERTIFICATE-----
|
|
|
|
-----BEGIN PRIVATE KEY-----
|
|
MIIEojCCA4qgAwIBAgIUegW2BimwuL4RzRZ2WYkHA6U5nkAwDQYJKoZIhvcNAQEL
|
|
3j4wz8/I5fdsk090j4s5KA==
|
|
-----END PRIVATE KEY-----
|
|
```
|
|
|
|
2. Convert the `single.pem` to BASE64 in a single line:
|
|
|
|
```bash title="Convert to BASE64"
|
|
cat single.pem | base64 -w0
|
|
```
|
|
|
|
3. Define a label in yout container
|
|
|
|
Add the Base64 string you generated before to the label `easyhaproxy.[definition].sslcert`
|
|
|
|
## Map the certificate as a docker volume
|
|
|
|
EasyHAProxy stores the certificates inside the container folder `/certs/haproxy`.
|
|
|
|
1. Run EasyHAProxy with the volume for the certificates:
|
|
|
|
```bash title="Create and mount certificate volume"
|
|
docker volume create certs_haproxy
|
|
|
|
docker run \
|
|
/* other parameters */
|
|
-v certs_haproxy:/certs/haproxy \
|
|
-d byjg/easy-haproxy
|
|
```
|
|
|
|
2. Create a single PEM from the certificate and the key.
|
|
|
|
```bash title="Combine certificate and key"
|
|
cat example.com.crt example.com.key > single.pem
|
|
|
|
cat single.pem
|
|
|
|
-----BEGIN CERTIFICATE-----
|
|
MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQC5ZheHqmBnEJP+
|
|
U9r1gxYWKLzdqrMrcxtQN6M1hIH9n0peuJeIrybdcV7sMbStMXI=
|
|
-----END CERTIFICATE-----
|
|
|
|
-----BEGIN PRIVATE KEY-----
|
|
MIIEojCCA4qgAwIBAgIUegW2BimwuL4RzRZ2WYkHA6U5nkAwDQYJKoZIhvcNAQEL
|
|
3j4wz8/I5fdsk090j4s5KA==
|
|
-----END PRIVATE KEY-----
|
|
```
|
|
|
|
3. Copy this certificate to EasyHAProxy volume:
|
|
|
|
```bash title="Copy certificate to container"
|
|
docker cp single.pem easyhaproxy:/certs/haproxy
|
|
```
|
|
|
|
----
|
|
[Open source ByJG](http://opensource.byjg.com)
|