summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Likins <alikins@grimlock.devel.redhat.com>2008-03-17 18:16:19 -0400
committerAdrian Likins <alikins@grimlock.devel.redhat.com>2008-03-17 18:16:19 -0400
commitc3e4dd36b5723f95202d0446e96a9d0b00246eac (patch)
tree6b377164719cc8971d7027eff56aeccb0b9ccd33
parentaf4f09f155f4a4f1c5a9e3e29b4c8736f892dce4 (diff)
downloadcertmaster-c3e4dd36b5723f95202d0446e96a9d0b00246eac.zip
certmaster-c3e4dd36b5723f95202d0446e96a9d0b00246eac.tar.gz
certmaster-c3e4dd36b5723f95202d0446e96a9d0b00246eac.tar.xz
certmaster logging cleanups
- use unique name for the certmaster logs - some not quite working code for passing down client info so we can log
-rw-r--r--certmaster.spec2
-rwxr-xr-xcertmaster/certmaster.py23
-rwxr-xr-xcertmaster/logger.py5
3 files changed, 22 insertions, 8 deletions
diff --git a/certmaster.spec b/certmaster.spec
index 3a04a72..bb252cc 100644
--- a/certmaster.spec
+++ b/certmaster.spec
@@ -99,7 +99,7 @@ fi
%changelog
-* Mon March 17 2008 Adrian Likins <alikins@redhat.com> - 0.1-2
+* Mon Mar 17 2008 Adrian Likins <alikins@redhat.com> - 0.1-2
- removed unused minion/ and overlord/ dirs
* Mon Feb 25 2008 Adrian Likins <alikins@redhat.com> - 0.1-1
diff --git a/certmaster/certmaster.py b/certmaster/certmaster.py
index 88ea265..18c02d4 100755
--- a/certmaster/certmaster.py
+++ b/certmaster/certmaster.py
@@ -48,7 +48,7 @@ class CertMaster(object):
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):
@@ -77,7 +77,7 @@ class CertMaster(object):
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)
@@ -229,10 +229,22 @@ class CertMaster(object):
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):
@@ -241,11 +253,12 @@ 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()
diff --git a/certmaster/logger.py b/certmaster/logger.py
index 3a7e0ad..3ff9d42 100755
--- a/certmaster/logger.py
+++ b/certmaster/logger.py
@@ -40,7 +40,7 @@ class Logger(Singleton):
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")
@@ -54,6 +54,7 @@ class Logger(Singleton):
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:
@@ -65,7 +66,7 @@ class AuditLogger(Singleton):
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")