In this how-to, we will use X.509 certificates to secure ingress communication using SSL/TLS. We will store a TLS private key using environment variable or file and enable it in Pyron with its corresponding certificate.
In order to configure Pyron, set related environment variables in envs
file.
NOTE
Read about private key and certificate format.
Read how to configure mutual SSL/TLS.
- You have a valid TLS private key and certificate.
- Set
HTTP_SERVER_SSL
totrue
. - Set
HTTP_SERVER_SNI
totrue
(optional, enables Server Name Indication).
Set HTTP_SERVER_PEM_KEY_CERT_OPTIONS__KEY_VALUE
with Base64-encoded private key PEM block:
HTTP_SERVER_PEM_KEY_CERT_OPTIONS__KEY_VALUE=LS0tLS1CRUdJTiB...
or set path to private key file:
HTTP_SERVER_PEM_KEY_CERT_OPTIONS__KEY_PATH=/mykey.pem
NOTE
Storing private key in environment variable is not secure. Use Vault instead.
Set HTTP_SERVER_PEM_KEY_CERT_OPTIONS__CERT_VALUE
with a Base64-encoded certificate PEM block:
HTTP_SERVER_PEM_KEY_CERT_OPTIONS__CERT_VALUE=IC0tLS0tQkVHSU4g...
or set path to certificate file:
HTTP_SERVER_PEM_KEY_CERT_OPTIONS__CERT_PATH=/mycert.pem