Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Matrix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Operate
Environments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Matrix
Commits
5ad1149f
Commit
5ad1149f
authored
6 years ago
by
Richard van der Hoff
Browse files
Options
Downloads
Patches
Plain Diff
Notes on the manhole
parent
563606b8
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
docs/manhole.md
+43
-0
43 additions, 0 deletions
docs/manhole.md
with
43 additions
and
0 deletions
docs/manhole.md
0 → 100644
+
43
−
0
View file @
5ad1149f
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=''>>
```
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment