diff options
author | Rob Crittenden <rcritten@redhat.com> | 2010-05-03 17:38:39 -0400 |
---|---|---|
committer | Jason Gerard DeRose <jderose@redhat.com> | 2010-05-03 17:58:08 -0600 |
commit | 3ea044fb59bf6ada2c0e9b507c1d6c4dfd8aaa23 (patch) | |
tree | f10938893f3b22361e46fd7ad16c8ea9df4e91ae /ipaserver | |
parent | 3698dca8e350febf21f830d61630e12d40d51392 (diff) | |
download | freeipa-3ea044fb59bf6ada2c0e9b507c1d6c4dfd8aaa23.tar.gz freeipa-3ea044fb59bf6ada2c0e9b507c1d6c4dfd8aaa23.tar.xz freeipa-3ea044fb59bf6ada2c0e9b507c1d6c4dfd8aaa23.zip |
Handle CSRs whether they have NEW in the header or not
Also consolidate some duplicate code
Diffstat (limited to 'ipaserver')
-rw-r--r-- | ipaserver/install/cainstance.py | 5 | ||||
-rw-r--r-- | ipaserver/install/certs.py | 15 |
2 files changed, 5 insertions, 15 deletions
diff --git a/ipaserver/install/cainstance.py b/ipaserver/install/cainstance.py index 9e55333db..375676ae7 100644 --- a/ipaserver/install/cainstance.py +++ b/ipaserver/install/cainstance.py @@ -36,6 +36,7 @@ import urllib import xml.dom.minidom import stat from ipapython import dogtag +from ipalib import pkcs10 import subprocess from nss.error import NSPRError @@ -911,9 +912,7 @@ class CAInstance(service.Service): finally: os.remove(noise_name) - csr = stdout.find("-----BEGIN NEW CERTIFICATE REQUEST-----") - if csr >= 0: - csr = stdout[csr:] + csr = pkcs10.strip_header(stdout) # Send the request to the CA conn = httplib.HTTPConnection(self.host_name, 9180) diff --git a/ipaserver/install/certs.py b/ipaserver/install/certs.py index 05c9213bb..6fb012919 100644 --- a/ipaserver/install/certs.py +++ b/ipaserver/install/certs.py @@ -32,6 +32,7 @@ from ipapython import nsslib from ipapython import dogtag from ipapython import sysrestore from ipapython import ipautil +from ipalib import pkcs10 from ConfigParser import RawConfigParser from nss.error import NSPRError @@ -552,12 +553,7 @@ class CertDB(object): csr = "".join(csr) # We just want the CSR bits, make sure there is nothing else - s = csr.find("-----BEGIN NEW CERTIFICATE REQUEST-----") - e = csr.find("-----END NEW CERTIFICATE REQUEST-----") - if e > 0: - e = e + 37 - if s >= 0: - csr = csr[s:] + csr = pkcs10.strip_header(csr) params = {'profileId': 'caRAserverCert', 'cert_request_type': 'pkcs10', @@ -639,12 +635,7 @@ class CertDB(object): csr = "".join(csr) # We just want the CSR bits, make sure there is no thing else - s = csr.find("-----BEGIN NEW CERTIFICATE REQUEST-----") - e = csr.find("-----END NEW CERTIFICATE REQUEST-----") - if e > 0: - e = e + 37 - if s >= 0: - csr = csr[s:] + csr = pkcs10.strip_header(csr) params = {'profileId': 'caJarSigningCert', 'cert_request_type': 'pkcs10', |