From 57d5042d28b107bbee757e825c077c5501face02 Mon Sep 17 00:00:00 2001 From: Martin Kosek Date: Thu, 28 Mar 2013 14:36:36 +0100 Subject: Normalize RA agent certificate Certificate parsed out of sslget request to pki-ca was not always properly formatted and it may still contain DOS line ending. Make sure that the certificate is printed with correct line ending. --- ipaserver/install/cainstance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipaserver/install/cainstance.py') diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py index deb9a613..6bf22dbf 100644 --- a/ipaserver/install/cainstance.py +++ b/ipaserver/install/cainstance.py @@ -1004,8 +1004,11 @@ class CAInstance(service.Service): outputList = get_outputList(data) self.ra_cert = outputList['b64_cert'] - self.ra_cert = self.ra_cert.replace('\\n','') + + # Strip certificate headers and convert it to proper line ending self.ra_cert = x509.strip_header(self.ra_cert) + self.ra_cert = "\n".join(line.strip() for line + in self.ra_cert.splitlines() if line.strip()) # Add the new RA cert to the database in /etc/httpd/alias (agent_fd, agent_name) = tempfile.mkstemp() -- cgit