Merge pull request #1086 from hidraulicChicken/mjolnir_antispam
Mjolnir antispam
This commit is contained in:
commit
661bf89223
|
@ -4,8 +4,6 @@ The playbook can install and configure the [Mjolnir](https://github.com/matrix-o
|
|||
|
||||
See the project's [documentation](https://github.com/matrix-org/mjolnir) to learn what it does and why it might be useful to you.
|
||||
|
||||
Note: the playbook does not currently support the Mjolnir Synapse module. The playbook does support another antispam module, see [Setting up Synapse Simple Antispam](configuring-playbook-synapse-simple-antispam.md).
|
||||
|
||||
|
||||
## 1. Register the bot account
|
||||
|
||||
|
@ -90,8 +88,21 @@ matrix_bot_mjolnir_access_token: "ACCESS_TOKEN_FROM_STEP_2_GOES_HERE"
|
|||
matrix_bot_mjolnir_management_room: "ROOM_ID_FROM_STEP_4_GOES_HERE"
|
||||
```
|
||||
|
||||
## 6. Adding mjolnir synapse antispam module (optional)
|
||||
|
||||
## 6. Installing
|
||||
Add the following configuration to your `inventory/host_vars/matrix.DOMAIN/vars.yml` file (adapt to your needs):
|
||||
|
||||
|
||||
```yaml
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled: true
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_invites: true
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_messages: false
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames: false
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists: []
|
||||
```
|
||||
|
||||
|
||||
## 7. Installing
|
||||
|
||||
After configuring the playbook, run the [installation](installing.md) command:
|
||||
|
||||
|
|
|
@ -505,6 +505,27 @@ matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_repository_url: "htt
|
|||
matrix_synapse_ext_spam_checker_synapse_simple_antispam_git_version: "923ca5c85b08f157181721abbae50dd89c31e4b5"
|
||||
matrix_synapse_ext_spam_checker_synapse_simple_antispam_config_blocked_homeservers: []
|
||||
|
||||
# Enable this to activate the Mjolnir Antispam spam-checker module.
|
||||
# See: https://github.com/matrix-org/mjolnir#synapse-module
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled: false
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_git_repository_url: "https://github.com/matrix-org/mjolnir"
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_git_version: "70f353fbbad0af469b1001080dea194d512b2815"
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_invites: true
|
||||
# Flag messages sent by servers/users in the ban lists as spam. Currently
|
||||
# this means that spammy messages will appear as empty to users. Default
|
||||
# false.
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_messages: false
|
||||
# Remove users from the user directory search by filtering matrix IDs and
|
||||
# display names by the entries in the user ban list. Default false.
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames: false
|
||||
# The room IDs of the ban lists to honour. Unlike other parts of Mjolnir,
|
||||
# this list cannot be room aliases or permalinks. This server is expected
|
||||
# to already be joined to the room - Mjolnir will not automatically join
|
||||
# these rooms.
|
||||
# ["!roomid:example.org"]
|
||||
matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists: []
|
||||
|
||||
|
||||
matrix_s3_media_store_enabled: false
|
||||
matrix_s3_media_store_custom_endpoint_enabled: false
|
||||
matrix_s3_goofys_docker_image: "ewoutp/goofys:latest"
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_install.yml"
|
||||
when: matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled|bool
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup_uninstall.yml"
|
||||
when: "not matrix_synapse_ext_spam_checker_mjolnir_antispam_enabled|bool"
|
|
@ -0,0 +1,52 @@
|
|||
---
|
||||
|
||||
- name: Ensure git installed (RedHat)
|
||||
yum:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: no
|
||||
when: "ansible_os_family == 'RedHat'"
|
||||
|
||||
- name: Ensure git installed (Debian)
|
||||
apt:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: no
|
||||
when: "ansible_os_family == 'Debian'"
|
||||
|
||||
- name: Ensure git installed (Archlinux)
|
||||
pacman:
|
||||
name:
|
||||
- git
|
||||
state: present
|
||||
update_cache: no
|
||||
when: "ansible_distribution == 'Archlinux'"
|
||||
|
||||
- name: Clone mjolnir-antispam git repository
|
||||
git:
|
||||
repo: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_git_repository_url }}"
|
||||
version: "{{ matrix_synapse_ext_spam_checker_mjolnir_antispam_git_version }}"
|
||||
dest: "{{ matrix_synapse_ext_path }}/mjolnir"
|
||||
become: true
|
||||
become_user: "{{ matrix_user_username }}"
|
||||
|
||||
- set_fact:
|
||||
matrix_synapse_spam_checker: >
|
||||
{{ matrix_synapse_spam_checker }}
|
||||
+
|
||||
[{
|
||||
"module": "mjolnir.AntiSpam",
|
||||
"config": {
|
||||
"block_invites": {{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_invites }},
|
||||
"block_messages": {{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_messages }},
|
||||
"block_usernames": {{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_block_usernames }},
|
||||
"ban_lists": {{ matrix_synapse_ext_spam_checker_mjolnir_antispam_config_ban_lists }}
|
||||
}
|
||||
}]
|
||||
|
||||
matrix_synapse_container_extra_arguments: >
|
||||
{{ matrix_synapse_container_extra_arguments|default([]) }}
|
||||
+
|
||||
["--mount type=bind,src={{ matrix_synapse_ext_path }}/mjolnir/synapse_antispam/mjolnir,dst={{ matrix_synapse_in_container_python_packages_path }}/mjolnir,ro"]
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
|
||||
- name: Ensure mjolnir-antispam doesn't exist
|
||||
file:
|
||||
path: "{{ matrix_synapse_ext_path }}/mjolnir"
|
||||
state: absent
|
|
@ -7,3 +7,5 @@
|
|||
- import_tasks: "{{ role_path }}/tasks/ext/ldap-auth/setup.yml"
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/ext/synapse-simple-antispam/setup.yml"
|
||||
|
||||
- import_tasks: "{{ role_path }}/tasks/ext/mjolnir-antispam/setup.yml"
|
||||
|
|
Loading…
Reference in a new issue