summary refs log tree commit diff
path: root/docs/manhole.md
diff options
context:
space:
mode:
authorRichard van der Hoff <1389908+richvdh@users.noreply.github.com>2018-05-23 16:23:05 +0100
committerGitHub <noreply@github.com>2018-05-23 16:23:05 +0100
commit96f07cebda915e999ccde8e5205020611da05056 (patch)
tree9cfd4d0b666220e36219eeb77ce8b5d0adffbbaf /docs/manhole.md
parentMerge pull request #3265 from matrix-org/erikj/limit_pagination (diff)
parentconsent_tracking.md: clarify link (diff)
downloadsynapse-96f07cebda915e999ccde8e5205020611da05056.tar.xz
Merge pull request #3268 from matrix-org/rav/privacy_policy_docs
Docs on consent bits
Diffstat (limited to 'docs/manhole.md')
-rw-r--r--docs/manhole.md43
1 files changed, 43 insertions, 0 deletions
diff --git a/docs/manhole.md b/docs/manhole.md
new file mode 100644

index 0000000000..7375f5ad46 --- /dev/null +++ b/docs/manhole.md
@@ -0,0 +1,43 @@ +Using the synapse manhole +========================= + +The "manhole" allows server administrators to access a Python shell on a running +Synapse installation. This is a very powerful mechanism for administration and +debugging. + +To enable it, first uncomment the `manhole` listener configuration in +`homeserver.yaml`: + +```yaml +listeners: + - port: 9000 + bind_addresses: ['::1', '127.0.0.1'] + type: manhole +``` + +(`bind_addresses` in the above is important: it ensures that access to the +manhole is only possible for local users). + +Note that this will give administrative access to synapse to **all users** with +shell access to the server. It should therefore **not** be enabled in +environments where untrusted users have shell access. + +Then restart synapse, and point an ssh client at port 9000 on localhost, using +the username `matrix`: + +```bash +ssh -p9000 matrix@localhost +``` + +The password is `rabbithole`. + +This gives a Python REPL in which `hs` gives access to the +`synapse.server.HomeServer` object - which in turn gives access to many other +parts of the process. + +As a simple example, retrieving an event from the database: + +``` +>>> hs.get_datastore().get_event('$1416420717069yeQaw:matrix.org') +<Deferred at 0x7ff253fc6998 current result: <FrozenEvent event_id='$1416420717069yeQaw:matrix.org', type='m.room.create', state_key=''>> +```