Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/etkecc/synapse-user-autoerase
A simple tool to automatically erase users and their media using Synapse Admin API
https://github.com/etkecc/synapse-user-autoerase
admin-api cli synapse
Last synced: about 2 months ago
JSON representation
A simple tool to automatically erase users and their media using Synapse Admin API
- Host: GitHub
- URL: https://github.com/etkecc/synapse-user-autoerase
- Owner: etkecc
- License: agpl-3.0
- Created: 2024-08-08T06:33:14.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-11-07T10:48:00.000Z (2 months ago)
- Last Synced: 2024-11-07T11:35:28.362Z (2 months ago)
- Topics: admin-api, cli, synapse
- Language: Go
- Homepage:
- Size: 67.4 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE.md
Awesome Lists containing this project
README
# Synapse User Auto Eraser
This is a simple script that will erase users, their media, and redact all their events from a Synapse server based on specific criteria:
- not an admin
- not a guest
- not deactivated
- not contain a specific string in their MXID
- not older than a specific threshold in daysIt was developed for the [etke.cc demo server](https://etke.cc/demo/) for the purpose of cleaning up the user database.
Another purpose of this repo is to be a test stand for migrating our [gitlab repos](https://gitlab.com/etke.cc) to [github](https://github.com/etkecc)
Don't expect this to be a full-featured tool, it's just a simple script that does one thing.
## Configuration
Configuration is done via environment variables (`.env` file is supported as well). The following variables are supported:
- `SUAE_HOST` - Synapse server host, e.g. `https://matrix.example.com` (without trailing slash)
- `SUAE_TOKEN` - Synapse homeserver admin token
- `SUAE_PREFIXES` - Space-separated list of additional MXID prefixes that should be excluded from deletion
- `SUAE_TTL` - Maximum age of the user in days, users younger than this value will not be deleted
- `SUAE_DRYRUN` - If set to `true`, the script will only print the list of users that would be deleted. You **WANT** to run it in dry-run mode first to make sure you're not deleting the wrong users.Check `.env.example` for an example configuration.
## Usage
```bash
# if you want to run it with docker, do this
$ docker run --rm --env-file .env ghcr.io/etkecc/synapse-user-autoerase
# if you have binary, run it like this
$ synapse-user-auto-erase
# if you want to run from source
$ just run
```