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.
This commit is contained in:
Martin Kosek
2013-03-28 14:36:36 +01:00
parent d27878ce9d
commit 57d5042d28

View File

@@ -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()