Do not concatenate chained certs w/out line breaks

The charm was adding the CA and chain certificate without a line break
leading to an invalid certificate pem file on the client side.

Add a line break when concatenating the ca cert and the chain.

Closes-Bug: #1838709
Change-Id: I646c8419838011160a74c4c4c488c04268825efd
This commit is contained in:
David Ames 2019-08-01 17:24:09 -07:00
parent 63388ae0a5
commit 953442f0cb

View File

@ -13,6 +13,7 @@
# limitations under the License.
import base64
import os
from charmhelpers.contrib.ssl.service import ServiceCA
@ -95,7 +96,7 @@ def configure_client_ssl(relation_data):
relation_certs = get_relation_cert_data()
ca_data = relation_certs['ca']
if relation_certs.get('chain'):
ca_data = ca_data + relation_certs.get('chain')
ca_data = ca_data + os.linesep + relation_certs.get('chain')
relation_data['ssl_ca'] = b64encoded_string(ca_data)
else:
if external_ca: