- Go 99.3%
- Dockerfile 0.7%
| .forgejo/workflows | ||
| cmd/matrix-invite-logger | ||
| doc | ||
| pkg | ||
| .dockerignore | ||
| .gitignore | ||
| Dockerfile | ||
| example-config.yaml | ||
| go.mod | ||
| go.sum | ||
| LICENSE | ||
| README.md | ||
Matrix Invite Logger
Warning
Due to a sudden and rapid increase in scope, matrix-invite-logger is currently undergoing a major rewrite on the v2 branch. I am not currently accepting new issues regarding the current code (there are many problems, I know), however PRs are welcome.
A permissionless (does not require server admin) daemon that listens to a collection of accounts for invites, logs them, and optionally rejects ones that violate ban policies.
Tip
You may also like: MatrixAntiDmSpam.git (similar tool written in C#)
If you're like me, you may have a few Matrix accounts spread across different homeservers. Maybe your main account, a backup account, a testing account, and a bot account. Whatever the case, they will likely eventually get spam invites, especially if you are in some public rooms.
This invite logger is a simple solution that will log all invites and their associated metadata to a room, and if available, will check the invite user, room, and user homeserver against a set of policy lists.
If you have access to a Meowlnir API, you can delegate policy checking to a Meowlnir instance. This is not required!
Installing
With the go command
go install codeberg.org/nexy7574/matrix-invite-logger/cmd/matrix-invite-logger@dev
Building from source
git clone https://codeberg.org/nexy7574/matrix-invite-logger.git
cd matrix-invite-logger
go build -o matrix-invite-logger ./cmd/matrix-invite-logger
Using the Docker image
docker pull codeberg.org/nexy7574/matrix-invite-logger:latest
docker run \
-v /path/to/config.yaml:/app/config.yaml:rw \
--name matrix-invite-logger \
codeberg.org/nexy7574/matrix-invite-logger:latest
Usage
First, you will want to generate the example config.
matrix-invite-logger -generate-config
This will create a new config file at ./config.yaml. You can then edit this file to your liking.
If you don't want to edit the YAML yourself, you can use the -cli flag to engage the configuration wizard.
$ matrix-invite-logger -cli
Welcome to the Matrix Invite Logger configuration wizard.
Changes are saved as they are made.
1. Add account
2. Remove account
3. List accounts
4. Subscribe to policy list room
5. Unsubscribe from policy list room
6. Set log room
7. Exit
Enter your choice:
From there, you can add accounts, remove accounts, and set the log room. If you aren't using Meowlnir, it is also recommended to set some policy lists, such as #cme-bl:neko.dev.
See example-config.yaml for an example of all the available configuration options, or view the repo wiki for detailed information.
FAQ
I don't have Meowlnir!
Well, that's not a question, but I'll answer anyway.
You do not need Meowlnir to be able to use policy-based auto-rejecting! matrix-invite-logger has a built-in (albeit less-efficient) policy evaluator that can fill the role of Meowlnir.
The downside of this is that every account will try to join the policy rooms, however only one is required to be in the room in order to check policies. Furthermore, the built-in policy list evaluator is not as mature as Meowlnir/Draupnir/Mjolnir, and is very much designed to be used in a "no other option" situation. It works, in the same way that burnt toast is still toast.
Invites are rejecting, but there's sometimes no reason attached?
Due to a bug in conduwuit (and possibly other Conduit forks), when a leave event is federated, the reason is dropped from the membership event. This does not happen on Synapse or Dendrite.
Nothing can be done without patching the server.
If you are invited to a room already known to your homeserver, this issue is irrelevant as a federated leave is not performed.
The accounts are logging weird messages about tombstones
The tombstone handler is a bit weird at figuring out room names sometimes. Rest assured, it follows them fine, this is purely a cosmetic problem.