Commit 9ffea497 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Add some simple syslog stuff so we can see who is using the XMLRPC

interface, and for what.
parent 25075cb9
...@@ -48,6 +48,10 @@ import urllib ...@@ -48,6 +48,10 @@ import urllib
import popen2 import popen2
import rfc822 import rfc822
import xmlrpclib import xmlrpclib
import syslog
# XXX This should come from configure.
LOG_TESTBED = syslog.LOG_LOCAL5;
## ##
# Base class for exceptions in this module. # Base class for exceptions in this module.
...@@ -292,6 +296,15 @@ class SSHServerWrapper: ...@@ -292,6 +296,15 @@ class SSHServerWrapper:
def __init__(self, object): def __init__(self, object):
self.ssh_connection = os.environ['SSH_CONNECTION'].split() self.ssh_connection = os.environ['SSH_CONNECTION'].split()
self.myObject = object self.myObject = object
#
# Init syslog
#
syslog.openlog("sshxmlrpc", syslog.LOG_PID, LOG_TESTBED);
syslog.syslog(syslog.LOG_INFO,
"Connect by " + os.environ['USER'] + " from " +
self.ssh_connection[0]);
return return
## ##
...@@ -308,6 +321,7 @@ class SSHServerWrapper: ...@@ -308,6 +321,7 @@ class SSHServerWrapper:
hdrs = SSHMessage(connection, False) hdrs = SSHMessage(connection, False)
length = int(hdrs['content-length']) length = int(hdrs['content-length'])
params, method = xmlrpclib.loads(connection.read(length)) params, method = xmlrpclib.loads(connection.read(length))
syslog.syslog(syslog.LOG_INFO, "Calling method '" + method + "'");
try: try:
# ... find the corresponding method in the wrapped object, # ... find the corresponding method in the wrapped object,
meth = getattr(self.myObject, method) meth = getattr(self.myObject, method)
...@@ -371,6 +385,8 @@ class SSHServerWrapper: ...@@ -371,6 +385,8 @@ class SSHServerWrapper:
pass pass
finally: finally:
connection.close() connection.close()
syslog.syslog(syslog.LOG_INFO, "Connection closed");
syslog.closelog()
pass pass
return return
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment