self.handlers = {
'wait_for_cert': self.wait_for_cert,
}
+
def _dispatch(self, method, params):
if method == 'trait_names' or method == '_getAttributeNames':
return self.handlers.keys()
-
-# ip = self._this_request
-# print ip
-# self.audit_logger.log_call(ip, method, params)
if method in self.handlers.keys():
return self.handlers[method](*params)
# check for old csr on disk
# if we have it - compare the two - if they are not the same - raise a fault
+ self.logger.debug("csrfile: %s certfile: %s" % (csrfile, certfile))
+
if os.path.exists(csrfile):
oldfo = open(csrfile)
oldcsrbuf = oldfo.read()
if not newdig == olddig:
self.logger.info("A cert for %s already exists and does not match the requesting cert" % (requesting_host))
# XXX raise a proper fault
- return False, '', ''
+ return False, '', ''
+
# look for a cert:
# if we have it, then return True, etc, etc
else: # assume we got a bare csr req
csrreq = csr
- requesting_host = self._sanitize_cn(csrreq.get_subject().CN)
-
+
+
+ requesting_host = self._sanitize_cn(csrreq.get_subject().CN)
certfile = '%s/%s.cert' % (self.cfg.certroot, requesting_host)
+ self.logger.info("Signing for csr %s requested" % certfile)
thiscert = certs.create_slave_certificate(csrreq, self.cakey, self.cacert, self.cfg.cadir)
+
destfo = open(certfile, 'w')
destfo.write(crypto.dump_certificate(crypto.FILETYPE_PEM, thiscert))
destfo.close()
del destfo
+
+
+ self.logger.info("csr %s signed" % (certfile))
if csr_unlink_file and os.path.exists(csr_unlink_file):
os.unlink(csr_unlink_file)
return certfile
-# not used yet, trying to figure out a way to get the client ip addr to log -akl
-class CertmasterXMLRPCRequestHandler(SimpleXMLRPCServer.SimpleXMLRPCRequestHandler):
- def do_POST(self):
- self.server._this_request = (self.request, self.client_address)
- try:
- SimpleXMLRPCServer.SimpleXMLRPCRequestHandler.do_POST(self)
- except socket.timeout:
- pass
- except (socket.error, OpenSSL.SSL.SysCallError), e:
- print "Error (%s): socket error - '%s'" % (self.client_address, e)
class CertmasterXMLRPCServer(SimpleXMLRPCServer.SimpleXMLRPCServer):