webterm Package

compat Module

class opennode.oms.endpoint.webterm.compat.TerminalServer(terminal_protocol, avatar=None)[source]

Bases: twisted.web.resource.Resource, opennode.oms.endpoint.webterm.root.TerminalServerMixin

Web resource which handles web terminal sessions adhering to ShellInABox.js protocol. NOTE: This is only for backward compatibility.

render_OPTIONS(request)[source]

Return headers which allow cross domain xhr for this.

render_POST(request)[source]
class opennode.oms.endpoint.webterm.compat.WebTerminalServer(avatar=None)[source]

Bases: twisted.web.resource.Resource

ShellInABox web terminal protocol handler.

getChild(name, request)[source]

For now the only mounted terminal service is the commadnline oms management. We’ll mount here the ssh consoles to machines.

isLeaf = False
render(request)[source]

root Module

class opennode.oms.endpoint.webterm.root.ConsoleView(context)[source]

Bases: opennode.oms.endpoint.httprest.base.HttpRestView, opennode.oms.endpoint.webterm.root.TerminalServerMixin

class opennode.oms.endpoint.webterm.root.OmsShellConsoleView(context)[source]

Bases: opennode.oms.endpoint.webterm.root.ConsoleView

terminal_protocol[source]
class opennode.oms.endpoint.webterm.root.OmsShellTerminalProtocol[source]

Bases: object

Connect a OmsShellProtocol to a web terminal session.

connection_made(terminal, size)[source]
handle_key(key)[source]
logged_in(principal)[source]
terminalSize(width, height)[source]
class opennode.oms.endpoint.webterm.root.SSHClientTerminalProtocol(user, host, port=22)[source]

Bases: object

Connect a ssh client session to a web terminal session. Can be used to connect to hosts or to services and guis exposed via ssh interfaces, tunnels etc

connection_made(terminal, size)[source]
handle_key(key)[source]
logged_in(principal)[source]
set_channel(channel)[source]
terminalSize(width, height)[source]
class opennode.oms.endpoint.webterm.root.TerminalServerMixin[source]

Bases: object

Common code for view-based and twisted-resource based rendering of ShellInABox protocol.

get_terminal_protocol(request)[source]
render_POST(request)[source]
sessions = {}
class opennode.oms.endpoint.webterm.root.TerminalSession(terminal_protocol, terminal_size)[source]

Bases: object

A session for our ajax terminal emulator.

enqueue(request)[source]
handle_keys(key_stream)[source]

Send each input key the terminal.

handle_resize(size)[source]
parse_keys(key_stream)[source]

The ajax protocol encodes keystrokes as a string of hex bytes, so each char code occupies to characters in the encoded form.

process_queue()[source]
windowChanged(*args)[source]

Called back by insults on terminalSize.

write(request)[source]
class opennode.oms.endpoint.webterm.root.WebTerminal(session)[source]

Bases: twisted.conch.insults.insults.ServerProtocol

Used by TerminalProtocols (like OmsShellProtocol) to actually manipulate the terminal.

class opennode.oms.endpoint.webterm.root.WebTransport(session)[source]

Bases: object

Used by WebTerminal to actually send the data through the http transport.

loseConnection()[source]

Close the connection ensuring the the web client will properly detect this close. The name of the method was chosen to implement the twisted convention.

write(text)[source]

ssh Module

class opennode.oms.endpoint.webterm.ssh.ClientUserAuth(*args, **kwargs)[source]

Bases: twisted.conch.ssh.userauth.SSHUserAuthClient

Performs ssh connection authentication on behalf of a SSHClientTransport.

Public key authentication is designed to be performed with the OMS service key. The OMS thus takes the responsibility to authorize a given principal and then logs in on his behalf.

getPassword(prompt=None)[source]

Conch expects a deferred which will yield a password to try. Writes a prompt and redirect the terminal input to a password reader which will callback a deferred and thus yield a password to conch.

The terminal input will be automatically handled over to the ssh channel after successful authentication.

getPrivateKey()[source]
getPublicKey()[source]

Return the public key unless we already failed our previous publickey auth attempt.

class opennode.oms.endpoint.webterm.ssh.SSHClientTransport(terminal_transport, set_channel, terminal_size, user, host, command)[source]

Bases: twisted.conch.ssh.transport.SSHClientTransport

Performs a SSH connection to a server.

connectionLost(reason)[source]
connectionSecure()[source]
verifyHostKey(pubKey, fingerprint)[source]
class opennode.oms.endpoint.webterm.ssh.SSHShellConnection(terminal_transport, set_channel, terminal_size, command)[source]

Bases: twisted.conch.ssh.connection.SSHConnection

Represents a SSH client connection opening a interactive remote shell.

serviceStarted()[source]
class opennode.oms.endpoint.webterm.ssh.ShellChannel(*args, **kwargs)[source]

Bases: twisted.conch.ssh.channel.SSHChannel

This is the core of the interactive ssh shell.

channelOpen(data)[source]
closed()[source]
dataReceived(data)[source]
name = 'session'
terminalSize(width, height)[source]
opennode.oms.endpoint.webterm.ssh.ssh_connect_interactive_shell(user, host, port, transport, set_channel, size, command=None)[source]

Table Of Contents

Previous topic

cmd Package

Next topic

model Package

This Page