diff options
author | Narayan Desai <desai@mcs.anl.gov> | 2009-05-06 01:26:40 +0000 |
---|---|---|
committer | Narayan Desai <desai@mcs.anl.gov> | 2009-05-06 01:26:40 +0000 |
commit | 13f6d1554dd24d08d44662906fa9f3f008a23058 (patch) | |
tree | f2d22d669bc2c304f14eeda0a5103c973c5349a9 /src/sbin | |
parent | 13a817e07aeb3890972a62fa4905eb73e9f4cb99 (diff) | |
download | bcfg2-13f6d1554dd24d08d44662906fa9f3f008a23058.tar.gz bcfg2-13f6d1554dd24d08d44662906fa9f3f008a23058.tar.bz2 bcfg2-13f6d1554dd24d08d44662906fa9f3f008a23058.zip |
bcfg2 client: remove agent support
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5186 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/sbin')
-rwxr-xr-x | src/sbin/bcfg2 | 98 |
1 files changed, 0 insertions, 98 deletions
diff --git a/src/sbin/bcfg2 b/src/sbin/bcfg2 index 36ef6d63c..a7e420b52 100755 --- a/src/sbin/bcfg2 +++ b/src/sbin/bcfg2 @@ -17,8 +17,6 @@ import Bcfg2.Client.XML import Bcfg2.Client.Frame import Bcfg2.Client.Tools import Bcfg2.Daemon -from Bcfg2.Component import SimpleXMLRPCServer, ComponentInitError, ComponentKeyError, CobaltXMLRPCRequestHandler, TLSServer -from Bcfg2.tlslite.errors import TLSNoAuthenticationError, TLSFingerprintError import Bcfg2.Proxy import Bcfg2.Logger @@ -295,102 +293,6 @@ class Client: self.logger.error("Failed to upload configuration statistics") raise SystemExit(2) -class FingerCheck(object): - def __init__(self, fprints): - self.fingerprints = fprints - self.logger = logging.getLogger('checker') - - def __call__(self, connection): - if connection._client: - chain = connection.session.serverCertChain - else: - chain = connection.session.clientCertChain - - if chain == None: - self.logger.error("Fingerprint authentication error") - raise TLSNoAuthenticationError() - if chain.getFingerprint() not in self.fingerprints: - self.logger.error("Got connection with bad fingerprint %s" \ - % (chain.getFingerprint())) - raise TLSFingerprintError(\ - "X.509 fingerprint mismatch: %s, %s" % \ - (chain.getFingerprint(), self.fingerprints)) - -class Agent(Bcfg2.Component.Component): - """The Bcfg2 Agent component providing XML-RPC access to 'run'""" - __name__ = 'bcfg2-agent' - __implementation__ = 'bcfg2-agent' - - def __init__(self, client): - # need to get addr - self.setup = client.setup - self.shut = False - signal.signal(signal.SIGINT, self.start_shutdown) - signal.signal(signal.SIGTERM, self.start_shutdown) - self.logger = logging.getLogger('Agent') - - self.static = True - - if self.setup["agent-port"]: - port = int(self.setup["agent-port"]) - elif self.setup["server"]: - port = int(self.setup["server"].split(':')[1]) - else: - print("port or server URL not specified") - raise SystemExit(1) - - location = (socket.gethostname(), port) - - keyfile = self.setup["key"] - self.password = self.setup["password"] - - try: - TLSServer.__init__(self, - location, - keyfile, - CobaltXMLRPCRequestHandler, - FingerCheck(self.setup["fingerprint"]), - reqCert=True) - except socket.error: - self.logger.error("Failed to bind to socket") - raise ComponentInitError - except ComponentKeyError: - self.logger.error("Failed to parse key" % (keyfile)) - raise ComponentInitError - except: - self.logger.error("Failed to load ssl key %s" % (keyfile), exc_info=1) - raise ComponentInitError - try: - SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self) - except TypeError: - SimpleXMLRPCServer.SimpleXMLRPCDispatcher.__init__(self, False, None) - self.logRequests = 0 - self.port = self.socket.getsockname()[1] - self.url = "https://%s:%s" % (socket.gethostname(), self.port) - self.logger.info("Bound to port %s" % self.port) - self.funcs.update({'system.listMethods':self.addr_system_listMethods}) - self.atime = 0 - self.client = client - self.funcs.update({ - "run": self.run, - }) - - def run(self, address): - try: - os.waitpid(-1, os.WNOHANG) - except: - pass - self.logger.info("Got run request from %s" % (address[0])) - if os.fork(): - return True - else: - try: - self.client.run() - except SystemExit: - self.logger.error("Client failed to execute") - self.shut = True - return False - if __name__ == '__main__': signal.signal(signal.SIGINT, cb_sigint_handler) client = Client() |