mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 02:54:52 -04:00
Add config option to use non-default manhole password and keys (#10643)
This commit is contained in:
parent
b298de780a
commit
6e895366ea
9 changed files with 161 additions and 17 deletions
|
@ -61,7 +61,7 @@ EddTrx3TNpr1D5m/f+6mnXWrc8u9y1+GNx9yz889xMjIBTBI9KqaaOs=
|
|||
-----END RSA PRIVATE KEY-----"""
|
||||
|
||||
|
||||
def manhole(username, password, globals):
|
||||
def manhole(settings, globals):
|
||||
"""Starts a ssh listener with password authentication using
|
||||
the given username and password. Clients connecting to the ssh
|
||||
listener will find themselves in a colored python shell with
|
||||
|
@ -75,6 +75,15 @@ def manhole(username, password, globals):
|
|||
Returns:
|
||||
twisted.internet.protocol.Factory: A factory to pass to ``listenTCP``
|
||||
"""
|
||||
username = settings.username
|
||||
password = settings.password
|
||||
priv_key = settings.priv_key
|
||||
if priv_key is None:
|
||||
priv_key = Key.fromString(PRIVATE_KEY)
|
||||
pub_key = settings.pub_key
|
||||
if pub_key is None:
|
||||
pub_key = Key.fromString(PUBLIC_KEY)
|
||||
|
||||
if not isinstance(password, bytes):
|
||||
password = password.encode("ascii")
|
||||
|
||||
|
@ -86,8 +95,8 @@ def manhole(username, password, globals):
|
|||
)
|
||||
|
||||
factory = manhole_ssh.ConchFactory(portal.Portal(rlm, [checker]))
|
||||
factory.publicKeys[b"ssh-rsa"] = Key.fromString(PUBLIC_KEY)
|
||||
factory.privateKeys[b"ssh-rsa"] = Key.fromString(PRIVATE_KEY)
|
||||
factory.privateKeys[b"ssh-rsa"] = priv_key
|
||||
factory.publicKeys[b"ssh-rsa"] = pub_key
|
||||
|
||||
return factory
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue