def createManholeListener(): sshRealm = TerminalRealm() sshRealm.chainedProtocolFactory.protocolFactory = lambda _: Manhole( namespace) if settings.MANHOLE_PUBLIC_KEY == 'None': credChecker = checkers.InMemoryUsernamePasswordDatabaseDontUse() credChecker.addUser(settings.MANHOLE_USER.encode('utf-8'), ''.encode('utf-8')) else: userKeys = { settings.MANHOLE_USER.encode('utf-8'): settings.MANHOLE_PUBLIC_KEY.encode('utf-8'), } credChecker = PublicKeyChecker(userKeys) sshPortal = portal.Portal(sshRealm) sshPortal.registerChecker(credChecker) sessionFactory = ConchFactory(sshPortal) # set ssh host keys if settings.MANHOLE_HOST_KEY_DIR == "": raise CarbonConfigException("MANHOLE_HOST_KEY_DIR not defined") openSSHFactory = OpenSSHFactory() openSSHFactory.dataRoot = settings.MANHOLE_HOST_KEY_DIR sessionFactory.publicKeys = openSSHFactory.getPublicKeys() sessionFactory.privateKeys = openSSHFactory.getPrivateKeys() return sessionFactory
def connectionMade(self): TerminalProtocol.connectionMade(self) self.terminal.eraseDisplay() self.terminal.resetPrivateModes([privateModes.CURSOR_MODE]) self.window = TopWindow(self._draw, self._schedule) vbox = VBox() self.logWidget = OutputWidget() vbox.addChild(self.logWidget) logHandler = logging.StreamHandler(OutputLogStream(self.logWidget)) #make it use the default formatter logHandler.setFormatter(logging.Formatter(logging.BASIC_FORMAT)) logging.getLogger().addHandler(logHandler) vbox.addChild(SeperatorWidget()) #TODO: factory stuff self.manhole = Manhole() self.manholeView = TerminalProtocolWidget(self.manhole) #set the namespace directly so it's mutable if self.manholeNamespace is not None: self.manhole.interpreter.locals = self.manholeNamespace vbox.addChild(self.manholeView) self.window.addChild(vbox)
def createManholeListener(): sshRealm = TerminalRealm() sshRealm.chainedProtocolFactory.protocolFactory = lambda _: Manhole( namespace) # You can uncomment this if you're lazy and want insecure authentication instead # of setting up keys. #credChecker = checkers.InMemoryUsernamePasswordDatabaseDontUse(carbon='') userKeys = { settings.MANHOLE_USER: settings.MANHOLE_PUBLIC_KEY, } credChecker = PublicKeyChecker(userKeys) sshPortal = portal.Portal(sshRealm) sshPortal.registerChecker(credChecker) sessionFactory = ConchFactory(sshPortal) return sessionFactory
def createManholeListener(): sshRealm = TerminalRealm() sshRealm.chainedProtocolFactory.protocolFactory = lambda _: Manhole(namespace) if settings.MANHOLE_PUBLIC_KEY == 'None': credChecker = checkers.InMemoryUsernamePasswordDatabaseDontUse() credChecker.addUser(settings.MANHOLE_USER, '') else: userKeys = { settings.MANHOLE_USER : settings.MANHOLE_PUBLIC_KEY, } credChecker = PublicKeyChecker(userKeys) sshPortal = portal.Portal(sshRealm) sshPortal.registerChecker(credChecker) sessionFactory = ConchFactory(sshPortal) return sessionFactory
def connectionMade(self): Manhole.connectionMade(self) self.interpreter = BravoInterpreter(self, self.f)
def __init__(self, factory, *args, **kwargs): Manhole.__init__(self, *args, **kwargs) self.f = factory
def getManhole(_): manhole = Manhole(globals()) ps1 = 'fluidinfo-api [%d] > ' % servicePort ps2 = '... '.rjust(len(ps1)) manhole.ps = (ps1, ps2) return manhole
def connectionMade(self): Manhole.connectionMade(self) self.interpreter = MonteInterpreter(self)