mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-10-01 08:25:44 -04:00
Merge pull request #473 from matrix-org/erikj/ssh_manhole
Change manhole to use ssh
This commit is contained in:
commit
5727922106
@ -42,6 +42,12 @@ from synapse.storage.prepare_database import UpgradeDatabaseException
|
|||||||
from synapse.server import HomeServer
|
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.internet import reactor, task, defer
|
||||||
from twisted.application import service
|
from twisted.application import service
|
||||||
from twisted.enterprise import adbapi
|
from twisted.enterprise import adbapi
|
||||||
@ -67,7 +73,6 @@ from synapse.metrics.resource import MetricsResource, METRICS_PREFIX
|
|||||||
from synapse import events
|
from synapse import events
|
||||||
|
|
||||||
from daemonize import Daemonize
|
from daemonize import Daemonize
|
||||||
import twisted.manhole.telnet
|
|
||||||
|
|
||||||
import synapse
|
import synapse
|
||||||
|
|
||||||
@ -249,10 +254,21 @@ class SynapseHomeServer(HomeServer):
|
|||||||
if listener["type"] == "http":
|
if listener["type"] == "http":
|
||||||
self._listener_http(config, listener)
|
self._listener_http(config, listener)
|
||||||
elif listener["type"] == "manhole":
|
elif listener["type"] == "manhole":
|
||||||
f = twisted.manhole.telnet.ShellFactory()
|
checker = checkers.InMemoryUsernamePasswordDatabaseDontUse(
|
||||||
f.username = "matrix"
|
matrix="rabbithole"
|
||||||
f.password = "rabbithole"
|
)
|
||||||
f.namespace['hs'] = self
|
|
||||||
|
rlm = manhole_ssh.TerminalRealm()
|
||||||
|
rlm.chainedProtocolFactory = lambda: insults.ServerProtocol(
|
||||||
|
ColoredManhole,
|
||||||
|
{
|
||||||
|
"__name__": "__console__",
|
||||||
|
"hs": self,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
f = manhole_ssh.ConchFactory(portal.Portal(rlm, [checker]))
|
||||||
|
|
||||||
reactor.listenTCP(
|
reactor.listenTCP(
|
||||||
listener["port"],
|
listener["port"],
|
||||||
f,
|
f,
|
||||||
|
@ -200,7 +200,7 @@ class ServerConfig(Config):
|
|||||||
- names: [federation]
|
- names: [federation]
|
||||||
compress: false
|
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.
|
||||||
# - port: 9000
|
# - port: 9000
|
||||||
# bind_address: 127.0.0.1
|
# bind_address: 127.0.0.1
|
||||||
|
Loading…
Reference in New Issue
Block a user