HTTPS
By default, an on-premise deployment serves content via unsecured HTTP on port 80. To enable secure connections using HTTPS (port 443), a valid TLS/SSL certificate is required that is either self-signed or from a certificate authority (CA). These are the steps needed to configure HTTPS after a valid certificate is acquired.
Managing HTTPS
To enable HTTPS, some environment variables need to be changed in the .env
file. For additional information on changing the environment for PathcoreFlow, see Configuration. The minimum configuration needed is:
- The
HTTP_ONLY
environment variable must disabled via the.env
configuration file - The certificate and key files (purchased, self-signed, or from Let's Encrypt) must be placed in the directory defined in
PCW_SSL_DIR
To configure PathcoreFlow to use HTTPS
Place the certificate and key files in the appropriate directory on the host server or VM. By default, the following path and names are used:
- Certificate directory:
/opt/pathcore/certs
- Certificate file:
fullchain.pem
- Key file:
privkey.pem
These files must be in the PEM format.- Certificate directory:
Use your preferred text editor to update the relevant environment variables in the
.env
file (the default location for this file is/opt/pathcore/compose/.env
)PCW_SSL_DIR=/opt/pathcore/certs
: the path to the directory containing the certificate and key files:PCW_HTTP_ONLY=0
: enable HTTPS(Optional)
PCW_SECURE_COOKIES=1
: only allow user sessions via HTTPS. Enable this only if all users will be connecting to the PathcoreFlow service via HTTPS
To use a different certificate or key filename
Use your preferred text editor to add the following environment variables to the
.env
file (the default location for this file is/opt/pathcore/compose/.env
)PCW_SSL_CERT_NAME=server_cert.pem
: to change the filename of the certificate filePCW_SSL_KEY_NAME=server_key.pem
: to change the filename of the key file
To update the certificate
Backup the existing certificate and key files
Place the new certificate file(s) in the appropriate directory on the host server or VM. By default, this is
/opt/pathcore/certs
These files must be in the PEM format.Restart the affected service components
It is recommended to backup the existing files before overwriting them.
Purchased Certificates
When purchasing certificates from a certificate service you must first provide them with a Certificate Signing Request (CSR). Creating a CSR is out of scope for this documentation.
Once you have received the certificate bundle you will need to create the full certificate chain to use as your certificate. This will help prevent issues with older browsers and operating systems.
The certificate issuer should provide documentation on how to create a certificate chain. In general, the certificates from the bundle need to be combined in a specific order:
- Server Certificate -> Intermediate Certificate(s) -> CA Root Certificate
Here is an example command to generate a certificate chain bundle. This command is for illustrative purposes — the actual command will vary depending on certificate issuer. Here we also assume you have all of your certificate files supplied by the issuer in one directory on a Linux server.
cat ComodoRSAAddTrustCA.crt \ExtendedvalidationSecureServerCA.crt \AddTrustExternalCARoot.crt > fullchain.pem
Self-Signed Certificates
OpenSSL can be used to generate the key and certificate files for a self-signed certificate:
openssl req -newkey rsa:2048 -new -nodes -x509 -days 365 \-keyout privkey.pem -out fullchain.pem
For more information on the openssl req
command line options, see the openssl-req manpage.
Let's Encrypt
Let's Encrypt is a free, automated, and open Certificate Authority (CA). You can read more about the services they offer and how to subscribe on their documentation page.
To use Let's Encrypt with PathcoreFlow:
- PathcoreFlow must be externally accessible via TCP ports 80 (HTTP) and 443 (HTTPS)
PCW_HOST
must be set to a valid hostname which routes to PathcoreFlow. See Configuration - Environment Variables for more details on how to set this valuecertbot
must be installed on the host server or VM
To configure PathcoreFlow to use Let's Encrypt
Enable HTTPS via the environment variables described above
Use your preferred text editor to update the relevant environment variables in the
.env
file (the default location for this file is/opt/pathcore/compose/.env
)PCW_ENABLE_CERTBOT=1
: enable thecertbot
automationPCW_CERTBOT_EMAIL=your@email.address
: an email address to receive communications from Let's Encrypt
Request the initial certificate by running the
certbot.sh
script manually:/opt/pathcore/compose/scripts/certbot.sh
To renew a Let's Encrypt certificate
If the pathcoreflow-maintenance.timer
systemd unit is installed and enabled, then the certificate should be automatically renewed 30 days before it expires.