self.ca_cert_file = '%s/certmaster.crt' % self.cfg.cadir
self.logger = logger.Logger().logger
- self.audit_logger = logger.AuditLogger().logger
+ self.audit_logger = logger.AuditLogger()
try:
if not os.path.exists(self.cfg.cadir):
if method == 'trait_names' or method == '_getAttributeNames':
return self.handlers.keys()
-# ip = self.client_address
+# ip = self._this_request
# print ip
# self.audit_logger.log_call(ip, method, params)
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):
- def __init__(self, args):
+ def __init__(self, addr):
self.allow_reuse_address = True
- SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, args)
+ SimpleXMLRPCServer.SimpleXMLRPCServer.__init__(self, addr)
def serve(xmlrpcinstance):
Code for starting the XMLRPC service.
"""
+
server = CertmasterXMLRPCServer((xmlrpcinstance.cfg.listen_addr, CERTMASTER_LISTEN_PORT))
server.logRequests = 0 # don't print stuff to console
server.register_instance(xmlrpcinstance)
xmlrpcinstance.logger.info("certmaster started")
- xmlrpcinstance.audit_logger.info("certmaster started")
+ xmlrpcinstance.audit_logger.logger.info("certmaster started")
server.serve_forever()
self._setup_handlers(logfilepath=logfilepath)
def _setup_logging(self):
- self.logger = logging.getLogger("svc")
+ self.logger = logging.getLogger("certmaster")
def _setup_handlers(self, logfilepath="/var/log/certmaster/certmaster.log"):
handler = logging.FileHandler(logfilepath, "a")
class AuditLogger(Singleton):
_no_handlers = True
def __init__(self, logfilepath = "/var/log/certmaster/audit.log"):
+ self.logfilepath = logfilepath
self.loglevel = logging.INFO
self._setup_logging()
if self._no_handlers:
def _setup_logging(self):
- self.logger = logging.getLogger("audit")
+ self.logger = logging.getLogger("certmaster-audit")
def _setup_handlers(self, logfilepath="/var/log/certmaster/audit.log"):
handler = logging.FileHandler(logfilepath, "a")