Handle '\n' line breaks in PEM-encoded SSL/TLS certificates

For example Podman, handling OCI containers, does not seem to have
a way to pass multi-line strings via env files (and Docker seems to
have the same issue at least outside of docker-compose). Thus this
change allows 'LDAP_CA_CERT' to handle a string with '\n', because
currently only 0x0A aka LF might work. An example for additionally
supported format:

LDAP_CA_CERT=-----BEGIN CERTIFICATE-----\n...\n...\n...\n-----END CERTIFICATE-----

See also: https://github.com/wekan/wekan/issues/3484
This commit is contained in:
Robert Scheck 2021-01-25 23:46:48 +01:00
parent 1189b66748
commit 927d15f2d8

View file

@ -100,7 +100,7 @@ export default class LDAP {
if (this.options.ca_cert && this.options.ca_cert !== '') {
// Split CA cert into array of strings
const chainLines = this.constructor.settings_get('LDAP_CA_CERT').split('\n');
const chainLines = this.constructor.settings_get('LDAP_CA_CERT').replace(/\\n/g,'\n').split('\n');
let cert = [];
const ca = [];
chainLines.forEach((line) => {