Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Change manhole to use ssh #473

Merged
merged 2 commits into from
Jan 7, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions synapse/app/homeserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
from synapse.server import HomeServer


from twisted.conch.manhole import ColoredManhole
from twisted.conch.insults import insults
from twisted.conch import manhole_ssh
from twisted.cred import checkers, portal


from twisted.internet import reactor, task, defer
from twisted.application import service
from twisted.enterprise import adbapi
Expand All @@ -67,7 +73,6 @@
from synapse import events

from daemonize import Daemonize
import twisted.manhole.telnet

import synapse

Expand Down Expand Up @@ -248,10 +253,21 @@ def start_listening(self):
if listener["type"] == "http":
self._listener_http(config, listener)
elif listener["type"] == "manhole":
f = twisted.manhole.telnet.ShellFactory()
f.username = "matrix"
f.password = "rabbithole"
f.namespace['hs'] = self
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(
matrix="rabbithole"
)

rlm = manhole_ssh.TerminalRealm()
rlm.chainedProtocolFactory = lambda: insults.ServerProtocol(
ColoredManhole,
{
"__name__": "__console__",
"hs": self,
}
)

f = manhole_ssh.ConchFactory(portal.Portal(rlm, [checker]))

reactor.listenTCP(
listener["port"],
f,
Expand Down
2 changes: 1 addition & 1 deletion synapse/config/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def default_config(self, server_name, **kwargs):
- names: [federation]
compress: false

# Turn on the twisted telnet manhole service on localhost on the given
# Turn on the twisted ssh manhole service on localhost on the given
# port.
# - port: 9000
# bind_address: 127.0.0.1
Expand Down