def get_dn(cert_file): nimbus_home = get_nimbus_home() webdir = os.path.join(nimbus_home, "web/") if not os.path.exists(webdir): raise CLIError("ENIMBUSHOME", "web dir doesn't exist. is this a valid Nimbus install? (%s)" % webdir) log = logging.getLogger() dn = autoca.getCertDN(cert_file, webdir, log) return dn
def get_dn(cert_file): nimbus_home = get_nimbus_home() webdir = os.path.join(nimbus_home, 'web/') if not os.path.exists(webdir): raise CLIError('ENIMBUSHOME', "web dir doesn't exist. is this a valid Nimbus install? (%s)" % webdir) log = logging.getLogger() dn = autoca.getCertDN(cert_file, webdir, log) return dn
def get_cert_dn(self, cert): """ Determines the DN of a provided certificate. """ (cert_fd, cert_path) = tempfile.mkstemp(dir=self.tmpdir) try: cert_file = os.fdopen(cert_fd, 'wb') cert_file.write(cert) cert_file.close() # make sure write is buffered out return autoca.getCertDN(cert_path, self.webdir, self.log) finally: try: os.close(cert_fd) except: pass # FD may have been never opened-- or closed above os.remove(cert_path)