def check_auth_publickey(self, username, key): hex_fingerprint = utils.hex_key(key) logger.info('Auth attempt with key: %s' % hex_fingerprint) if hook.check_username(username) and hook.check_store_key(key): self.key = key return paramiko.AUTH_SUCCESSFUL return paramiko.AUTH_FAILED
def check_auth_publickey(self, username, key): hex_fingerprint = utils.hex_key(key) logger.info('Auth attempt with key: %s' % hex_fingerprint) if not self.interface.check_user(username) \ or not self.interface.check_key(key): return paramiko.AUTH_FAILED return paramiko.AUTH_SUCCESSFUL
def main(): parser = argparse.ArgumentParser() populate_argument_parser(parser) args = parser.parse_args() config.parser(args) init_log() if args.mode == 'ssh': config.worker = load_class('maria.gssh.GSSHServer') config.host_key = paramiko.RSAKey(filename=os.path.realpath(config.host_key)) logger.info('Host Key %s' % hex_key(config.host_key)) interface = args.interface or 'maria.gssh.GSSHInterface' server = StreamServer((args.host, args.port), handle) elif args.mode == 'http': config.worker = load_class('maria.ghttp.GHTTPServer') interface = args.interface or 'maria.ghttp.GHTTPInterface' server = WSGIServer((args.host, args.port), GHTTPServer()) else: print 'Not support %s yet, system shutdown!' % args.mode sys.exit(-1) config.interface = load_class(interface) try: logger.info('Maria System Start at %s:%d' % (config.host, config.port)) server.serve_forever() except KeyboardInterrupt: logger.info('Maria System Stopped')
def run(host="0.0.0.0", port=2200, worker="maria.gssh.GSSHServer", interface=""): config.host = host config.port = port config.worker = worker config.worker = load_class(worker) if worker == "maria.gssh.GSSHServer": if interface: config.gssh_interface = interface config.gssh_interface = load_class(config.gssh_interface) config.host_key = paramiko.RSAKey(filename=config.host_key) logger.info('Host Key %s' % hex_key(config.host_key)) server = StreamServer((config.host, config.port), handle) else: if interface: config.ghttp_interface = interface config.ghttp_interface = load_class(config.ghttp_interface) server = WSGIServer((config.host, config.port), GHTTPServer()) try: logger.info('Maria System Start at %s:%d' % (config.host, config.port)) server.serve_forever() except KeyboardInterrupt: logger.info('Maria System Stopped')
def main(): parser = argparse.ArgumentParser() populate_argument_parser(parser) args = parser.parse_args() config.parser(args) init_log() # init hook file from maria import hook config.host_key = paramiko.RSAKey(filename=config.host_key) config.worker = load_class(config.worker) server = StreamServer((args.host, args.port), handle) try: logger.info('Maria System Start at %s:%d' % (config.host, config.port)) logger.info('Host Key %s' % hex_key(config.host_key)) server.serve_forever() except KeyboardInterrupt: logger.info('Maria System Stopped')
def main(): parser = argparse.ArgumentParser() populate_argument_parser(parser) args = parser.parse_args() config.parser(args) init_log() if config.worker == "maria.gssh.GSSHServer": config.host_key = paramiko.RSAKey(filename=config.host_key) logger.info('Host Key %s' % hex_key(config.host_key)) server = StreamServer((args.host, args.port), handle) else: server = WSGIServer((args.host, args.port), GHTTPServer()) config.worker = load_class(config.worker) config.gssh_interface = load_class(config.gssh_interface) config.ghttp_interface = load_class(config.ghttp_interface) try: logger.info('Maria System Start at %s:%d' % (config.host, config.port)) server.serve_forever() except KeyboardInterrupt: logger.info('Maria System Stopped')