# mjolnir
A moderation tool for Matrix. Visit [#mjolnir:matrix.org](https://matrix.to/#/#mjolnir:matrix.org)
for more information.
## Features
As an all-in-one moderation tool, it can protect your server from malicious invites, spam
messages, and whatever else you don't want. In addition to server-level protection, Mjolnir
is great for communities wanting to protect their rooms without having to use their personal
accounts for moderation.
The bot by default includes support for bans, redactions, anti-spam, server ACLs, room
directory changes, room alias transfers, account deactivation, room shutdown, and more.
A Synapse module is also available to apply the same rulesets the bot uses across an entire
homeserver.
## Setting up
See the [setup documentation](docs/setup.md) for first-time setup documentation.
See the [configuration sample with documentation](config/default.yaml) for detailed information about Mjolnir's configuration.
See the [synapse module documentation](docs/synapse_module.md) for information on how to setup Mjolnir's accompanying Synapse Module.
## Quickstart guide
After your bot is up and running, you'll want to run a couple commands to get everything
set up:
1. `!mjolnir list create COC code-of-conduct-ban-list` - This will create a new ban list
with the shortcode `COC` and an alias of `#code-of-conduct-ban-list:example.org`. You
will be invited to the room it creates automatically where you can change settings such
as the visibility of the room.
2. `!mjolnir default COC` - This sets the default ban list to the list we just created to
help with the ban commands later on.
3. Review the [Moderator's Guide](https://github.com/matrix-org/mjolnir/blob/main/docs/moderators.md).
4. Review `!mjolnir help` to see what else the bot can do.
## Enabling readable abuse reports
Since version 1.2, Mjölnir offers the ability to replace the Matrix endpoint used
to report abuse and display it into a room, instead of requiring you to request
this data from an admin API.
This requires two configuration steps:
1. In your Mjölnir configuration file, typically `/etc/mjolnir/config/production.yaml`, copy and paste the `web` section from `default.yaml`, if you don't have it yet (it appears with version 1.20) and set `enabled: true` for both `web` and
`abuseReporting`.
2. Setup a reverse proxy that will redirect requests from `^/_matrix/client/(r0|v3)/rooms/([^/]*)/report/(.*)$` to `http://host:port/api/1/report/$2/$3`, where `host` is the host where you run Mjölnir, and `port` is the port you configured in `production.yaml`. For an example nginx configuration, see `test/nginx.conf`. It's the confirmation we use during runtime testing.
### Security note
This mechanism can extract some information from **unencrypted** rooms. We have
taken precautions to ensure that this cannot be abused: the only case in which
this feature will publish information from room *foo* is:
1. If it is used by a member of room *foo*; AND
2. If said member did witness the event; AND
3. If the event was unencrypted; AND
4. If the event was not redacted/removed/...
Essentially, this is a more restricted variant of the Admin APIs available on
homeservers.
However, if you are uncomfortable with this, please do not activate this feature.
Also, you should probably setup your `production.yaml` to ensure that the web
server can only receive requests from your reverse proxy (e.g. `localhost`).
## Development
TODO. It's a TypeScript project with a linter.
### Development and testing with mx-tester
WARNING: mx-tester is currently work in progress, but it can still save you some time and is better than struggling with nothing.
If you have docker installed you can quickly get setup with a development environment by using
[mx-tester](https://github.com/matrix-org/mx-tester).
To use mx-tester you will need to have rust installed. You can do that at [rustup](https://rustup.rs/) or [here](https://rust-lang.github.io/rustup/installation/other.html), you should probably also check your distro's documentation first to see if they have specific instructions for installing rust.
Once rust is installed you can install mx-tester like so.
```
$ cargo install mx-tester
```
Once you have mx-tester installed you we will want to build a synapse image with synapse_antispam from the Mjolnir project root.
```
$ mx-tester build
```
Then we can start a container that uses that image and the config in `mx-tester.yml`.
```
$ mx-tester up
```
Once you have called `mx-tester up` you can run the integration tests.
```
$ yarn test:integration
```
After calling `mx-tester up`, if we want to play with mojlnir locally we can run the following and then point a matrix client to http://localhost:9999.
You should then be able to join the management room at `#moderators:localhost:9999`.
```
yarn test:manual
```
Once we are finished developing we can stop the synapse container.
```
mx-tester down
```
### Running integration tests
The integration tests can be run with `yarn test:integration`.
The config that the tests use is in `config/harness.yaml`
and by default this is configured to work with the server specified in `mx-tester.yml`,
but you can configure it however you like to run against your own setup.
没有合适的资源?快使用搜索试试~ 我知道了~
Matrix的审核工具_TypeScript_Python_下载.zip
共131个文件
ts:98个
md:8个
py:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 72 浏览量
2023-04-13
23:32:37
上传
评论
收藏 312KB ZIP 举报
温馨提示
Matrix的审核工具_TypeScript_Python_下载.zip
资源推荐
资源详情
资源评论
收起资源包目录
Matrix的审核工具_TypeScript_Python_下载.zip (131个子文件)
nginx.conf 1KB
Dockerfile 406B
.dockerignore 50B
.gitignore 1KB
package.json 3KB
tslint.json 2KB
tsconfig.json 926B
LICENSE 11KB
yarn.lock 137KB
CONTRIBUTING.md 8KB
moderators.md 7KB
README.md 5KB
setup_docker.md 3KB
synapse_module.md 3KB
setup.md 3KB
appservice.md 2KB
setup_selfbuild.md 988B
antispam.py 7KB
ban_list.py 4KB
matching.py 3KB
list_rule.py 2KB
message_max_length.py 2KB
setup.py 317B
__init__.py 60B
mjolnir-entrypoint.sh 777B
ReportManager.ts 40KB
banListTest.ts 37KB
roomMembersTest.ts 36KB
PolicyList.ts 34KB
DetectFederationLag.ts 28KB
UnbanBanCommandTest.ts 26KB
ProtectedRoomsSet.ts 25KB
Mjolnir.ts 23KB
moderationRequestTest.ts 20KB
utils.ts 20KB
ProtectionManager.ts 18KB
abuseReportTest.ts 17KB
SinceCommand.ts 15KB
CommandHandler.ts 15KB
detectFederationLagTest.ts 14KB
RuleServer.ts 14KB
MjolnirManager.ts 12KB
AccessControlUnit.ts 12KB
config.ts 10KB
ListRule.ts 10KB
AppService.ts 10KB
WebAPIs.ts 10KB
policyConsumptionTest.ts 9KB
RoomMembers.ts 8KB
ProtectionsCommands.ts 8KB
redactCommandTest.ts 8KB
StatusCommand.ts 8KB
Api.ts 8KB
UnbanBanCommand.ts 7KB
clientHelper.ts 7KB
protectionSettingsTest.ts 7KB
standardConsequenceTest.ts 7KB
commandUtils.ts 6KB
EventRedactionQueue.ts 6KB
ProtectionSettings.ts 6KB
timelinePaginationTest.ts 6KB
ProtectedRoomsConfig.ts 6KB
ManagementRoomOutput.ts 6KB
ThrottlingQueue.ts 6KB
makedminCommandTest.ts 6KB
ReportPoller.ts 5KB
JoinWaveShortCircuit.ts 5KB
DumpRulesCommand.ts 5KB
LocalAbuseReports.ts 5KB
WordList.ts 5KB
BasicFlooding.ts 4KB
OpenMetrics.ts 4KB
ServerAcl.ts 4KB
mjolnirSetupUtils.ts 4KB
FirstMessageIsImage.ts 4KB
protectedRoomsConfigTest.ts 4KB
AliasCommands.ts 4KB
TrustedReporters.ts 3KB
ErrorCache.ts 3KB
config.ts 3KB
KickCommand.ts 3KB
datastore.ts 3KB
ProtectedRoomActivityTracker.ts 3KB
throttleQueueTest.ts 3KB
webAPITest.ts 3KB
ImportCommand.ts 3KB
SetupDecentralizedReportingCommand.ts 3KB
index.ts 3KB
AccessControl.ts 3KB
reportPollingTest.ts 2KB
provisionTest.ts 2KB
UnlistedUserRedactionQueue.ts 2KB
IProtection.ts 2KB
MatrixEmitter.ts 2KB
fixtures.ts 2KB
RedactCommand.ts 2KB
MessageIsMedia.ts 2KB
MessageIsVoice.ts 2KB
shutdownCommandTest.ts 2KB
WatchUnwatchCommand.ts 2KB
共 131 条
- 1
- 2
资源评论
快撑死的鱼
- 粉丝: 1w+
- 资源: 9156
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功