Skip to content

Commit 2291626

Browse files
committed
Polish Draupnir 3.1.0 ZTD docs and fix variable name typo
- Fix `matrxi_appservice_draupnir_for_all_zero_touch_deployment` typo in the appservice doc example so the variable actually matches the role default (`matrix_appservice_draupnir_for_all_zero_touch_deploy`). - Drop a garbled sentence in the appservice usage section. - Restructure the bot-mode "Adjusting the playbook configuration" section into clearly labeled ZTD vs. native-login subsections so the access-token vs. native-login choice is unambiguous. - Restore an example block under the (now uncommented) `pollReports` paragraph in the bot-mode doc. - Reorder the orphaned "automatically done if Ketesa is enabled" sentence so it precedes the code block it qualifies. - Fix `SPDX-FileCopyRightText` casing and normalize `2024,2026` / `2024, 2026` to the project's `YYYY - YYYY` convention. - Fix variable name references in role default comments (`matrix_*_initialManager` -> `matrix_*_config_initialManager`). - Misc grammar/spelling fixes ("the the", "a admin", "mittigated", "recommendationare", "News memory", "re creation", "an Synapse"). - Drop a stray double blank line in the appservice template.
1 parent d14937c commit 2291626

7 files changed

Lines changed: 57 additions & 54 deletions

File tree

docs/configuring-playbook-appservice-draupnir-for-all.md

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
SPDX-FileCopyRightText: 2024,2026 Catalan Lover <catalanlover@protonmail.com>
2+
SPDX-FileCopyrightText: 2024 - 2026 Catalan Lover <catalanlover@protonmail.com>
33
SPDX-FileCopyrightText: 2024 - 2025 Suguru Hirahara
44
SPDX-FileCopyrightText: 2024 MDAD project contributors
55
@@ -26,44 +26,42 @@ Draupnir for all only has limited support for external tooling like [MRU](https:
2626

2727
## Prerequisites
2828

29-
### Prerequisites for Zero Touch Deployment (Recommended)
29+
### Prerequisites for Zero Touch Deployment (recommended)
3030

31-
Zero Touch Deployment of Draupnir Appservice Mode (Draupnir for all) requires as of Draupnir 3.1.0 that you supply Draupnir the following:
31+
As of Draupnir 3.1.0, Zero Touch Deployment of Draupnir Appservice Mode (Draupnir for all) requires you to supply the following:
3232

33-
- MXID of the the first person who gets invited to the admin room the bot creates for you.
33+
- MXID of the first person who gets invited to the admin room that the bot creates for you.
3434

35-
That is all. The appservice manages everything on its own after you provide it a MXID to invite.
35+
That is all. The appservice manages everything on its own after you provide it with an MXID to invite.
3636

37-
If proceeding with Zero Touch Deployment proceed to [Adjusting the playbook configuration](#adjusting-the-playbook-configuration)
37+
If proceeding with Zero Touch Deployment, skip ahead to [Adjusting the playbook configuration](#adjusting-the-playbook-configuration).
3838

39-
### Create a admin room (Optional)
39+
### Create an admin room (optional)
4040

41-
The playbook does not create a admin room for your Admin Draupnir but the appservice it self can do this. You **can create room manually** before setting up the bot.
41+
The playbook does not create an admin room for your Draupnir, but the appservice itself can do this for you. Alternatively, you **can create the room manually** before setting up the bot.
4242

4343
Note that the room must be unencrypted.
4444

4545
The admin room has to be given an alias, and your bot has to be invited to the room.
4646

47-
This admin room is used to control who has access to your D4A deployment. The room stores this data inside of the control room state so your bot must have sufficient powerlevel to send custom state events. This is default 50 or moderator as Element clients call this powerlevel.
47+
This admin room is used to control who has access to your D4A deployment. The room stores this data in the control room state, so your bot must have sufficient power level to send custom state events. This is `50` by default (moderator, as Element clients call this power level).
4848

4949
> [!WARNING]
5050
> Anyone in this room can control the bot so it is important that you only invite trusted users to this room.
5151
5252
## Adjusting the playbook configuration
5353

54-
Add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file. Make sure to replace `INITIAL_MANAGER_MXID_HERE`.
54+
When using Zero Touch Deployment, add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file. Make sure to replace `INITIAL_MANAGER_MXID_HERE` with the MXID of the user who should be invited to the admin room first.
5555

5656
```yaml
5757
matrix_appservice_draupnir_for_all_enabled: true
5858

59-
matrxi_appservice_draupnir_for_all_zero_touch_deployment: true
59+
matrix_appservice_draupnir_for_all_zero_touch_deploy: true
6060

6161
matrix_appservice_draupnir_for_all_config_initialManager: "INITIAL_MANAGER_MXID_HERE"
6262
```
6363
64-
If opting out of Zero Touch deployment use the following configuration block instead.
65-
66-
Add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file. Make sure to replace `MANAGEMENT_ROOM_ALIAS_HERE`.
64+
If opting out of Zero Touch Deployment, use the following configuration block instead. Make sure to replace `MANAGEMENT_ROOM_ALIAS_HERE` with the alias of the admin room you have created earlier.
6765

6866
```yaml
6967
matrix_appservice_draupnir_for_all_enabled: true
@@ -126,28 +124,26 @@ ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
126124

127125
## Usage
128126

129-
If you made it through all the steps above and your main control room was joined by a user called `@draupnir-main:example.com` you have successfully installed Draupnir for All and can now start using it.
130-
131-
If using Zero Touch Deployment the flow will be reversed and the success signal is the initial manager account being invited to the admin room.
127+
If you made it through all the steps above and your main control room was joined by a user called `@draupnir-main:example.com`, you have successfully installed Draupnir for All and can now start using it.
132128

133-
The installation of Draupnir for all in Usage-wise, Draupnir for all is almost identical to Draupnir bot mode.
129+
If using Zero Touch Deployment, the flow is reversed and the success signal is the initial manager account being invited to the admin room.
134130

135131
Draupnir for all installation via this playbook is very much Alpha quality. Usage-wise, Draupnir for all is almost identical to Draupnir bot mode, except that protections requiring homeserver admin access are not available, and the config file is shared between all bots so legacy protections like wordlist share a single global config.
136132

137133
### Granting Users the ability to use D4A
138134

139135
Draupnir for all includes several security measures like that it only allows users that are on its allow list to ask for a bot. To add a user to this list we have 2 primary options. Using the chat to tell Draupnir to do this for us or if you want to automatically do it by sending `m.policy.rule.user` events that target the subject you want to allow provisioning for with the `org.matrix.mjolnir.allow` recommendation. Using the chat is recommended.
140136

141-
The bot requires a powerlevel of 50 in the management room to control who is allowed to use the bot. The bot does currently not say anything if this is true or false. (This is considered a bug and is documented in issue [#297](https://github.com/the-draupnir-project/Draupnir/issues/297)) This issue is mittigated in large part by Zero Touch Deployment workflows that got introduced in Draupnir 3.1.0
137+
The bot requires a power level of 50 in the management room to control who is allowed to use the bot. The bot does currently not say anything if this is true or false. (This is considered a bug and is documented in issue [#297](https://github.com/the-draupnir-project/Draupnir/issues/297).) This issue is largely mitigated by the Zero Touch Deployment workflows introduced in Draupnir 3.1.0.
142138

143139
To allow users or whole homeservers you type /plain !admin allow `target` and target can be either a MXID or a wildcard like `@*:example.com` to allow all users on example.com to provision a bot. We use /plain to force the client to not attempt to mess with this command as it can break Wildcard commands especially.
144140

145141
### How to provision a D4A once you are allowed to
146142

147-
Once someone is allowed to provision a bot. Simply provision them one with `!admin provision MXID`.
148-
Self Service Provisioning is disabled as a security feature due to it being bugged. Force Provisioning bypasses this disabled status.
143+
Once someone is allowed to provision a bot, simply provision them one with `!admin provision MXID`.
144+
145+
Self-service provisioning is disabled as a security measure because it is currently bugged. Force-provisioning (with `!admin provision`) bypasses this disabled status.
149146

150-
Please note that the reason you should always make sure there is an allow entry matching whoever is provisioned is that when
151-
self service gets fixed the bot of anyone who is not allowed to provision a bot will refuse to start.
147+
Note that you should always make sure there is an allow entry matching whoever is provisioned, because once self-service is fixed, the bot of anyone who is not allowed to provision a bot will refuse to start.
152148

153-
Congratulations if you made it all the way here because you now have a fully working Draupnir for all deployment.
149+
Congratulations if you made it all the way here, because you now have a fully working Draupnir for all deployment.

docs/configuring-playbook-bot-draupnir.md

Lines changed: 25 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
SPDX-FileCopyRightText: 2023 - 2026 Catalan Lover <catalanlover@protonmail.com>
2+
SPDX-FileCopyrightText: 2023 - 2026 Catalan Lover <catalanlover@protonmail.com>
33
SPDX-FileCopyrightText: 2023 - 2025 MDAD project contributors
44
SPDX-FileCopyrightText: 2023 Kim Brose
55
SPDX-FileCopyrightText: 2024 - 2025 Slavi Pantaleev
@@ -20,15 +20,15 @@ If your migrating from [Mjolnir](configuring-playbook-bot-mjolnir.md), skip to [
2020

2121
## Prerequisites
2222

23-
### Prerequisites for Zero Touch Deployment (Recommended)
23+
### Prerequisites for Zero Touch Deployment (recommended)
2424

25-
Zero Touch Deployment of Draupnir bot mode requires as of Draupnir 3.1.0 that you supply Draupnir the following:
25+
As of Draupnir 3.1.0, Zero Touch Deployment of Draupnir bot mode requires you to supply the following:
2626

27-
- MXID of the the first person who gets invited to the management room the bot creates for you.
28-
- Permanent access token for authentication. Instructions for obtaining one can be found at [obtain an access token via curl](obtaining-access-tokens.md#obtain-an-access-token-via-curl)
29-
- User account for Draupnir
27+
- MXID of the first person who gets invited to the management room that the bot creates for you.
28+
- A permanent access token for authentication. Instructions for obtaining one can be found at [obtain an access token via curl](obtaining-access-tokens.md#obtain-an-access-token-via-curl).
29+
- A user account for Draupnir.
3030

31-
Zero Touch Deployment is the officially preferred installation method for new deployments of Draupnir as of 3.1.0
31+
Zero Touch Deployment is the officially preferred installation method for new deployments of Draupnir as of 3.1.0.
3232

3333
### Create a management room (optional)
3434

@@ -39,7 +39,7 @@ Using your own account, create a new invite only room that you will use to manag
3939
4040
It is possible to make the management room encrypted (E2EE). If doing so, then you need to enable the native E2EE support (see [below](#native-e2ee-support)).
4141

42-
E2EE Support for the management room is mutually exclusive with Zero Touch Deployment of Draupnir.
42+
E2EE support for the management room is mutually exclusive with Zero Touch Deployment of Draupnir.
4343

4444
Once you have created the room you need to copy the room ID so you can specify it on your `inventory/host_vars/matrix.example.com/vars.yml` file. In Element Web you can check the ID by going to the room's settings and clicking "Advanced". The room ID will look something like `!qporfwt:example.com`.
4545

@@ -76,7 +76,9 @@ matrix_bot_draupnir_config_accessToken: "CLEAN_ACCESS_TOKEN_HERE"
7676
7777
## Adjusting the playbook configuration
7878
79-
To enable the bot, add the following configuration to your `vars.yml` file. Make sure to replace `INITIAL_MANAGER_MXID_HERE` with the MXID for whoever is to be invited to the management room first.
79+
### Configuration for Zero Touch Deployment (recommended)
80+
81+
To enable the bot using Zero Touch Deployment, add the following configuration to your `vars.yml` file. Make sure to replace `INITIAL_MANAGER_MXID_HERE` with the MXID of the user who should be invited to the management room first, and `CLEAN_ACCESS_TOKEN_HERE` with the access token you obtained.
8082

8183
```yaml
8284
# Enable Draupnir
@@ -87,11 +89,12 @@ matrix_bot_draupnir_zero_touch_deploy: true
8789
matrix_bot_draupnir_config_initialManager: "INITIAL_MANAGER_MXID_HERE"
8890
8991
# Access token which the bot will use for logging in.
90-
# Comment out `matrix_bot_draupnir_login_native` when using this option.
9192
matrix_bot_draupnir_config_accessToken: "CLEAN_ACCESS_TOKEN_HERE"
9293
```
9394

94-
If wanting to have the bot manage its own login at the cost of having to create a management room you can use login native and the config block below.
95+
### Configuration without Zero Touch Deployment
96+
97+
If you'd prefer to have the bot manage its own login at the cost of having to create the management room manually, you can use native login with the configuration block below. Make sure to replace `MANAGEMENT_ROOM_ID_HERE` with the ID of the management room you have created earlier.
9598

9699
```yaml
97100
# Enable Draupnir
@@ -118,7 +121,7 @@ This is due to the conditional restart logic not being able to reliably tell whe
118121

119122
Conditional restarts work correctly for all tags when running only one of these two operating modes.
120123

121-
### Create and invite the bot to the management room (if using login native and not using Zero Touch Deployment)
124+
### Create and invite the bot to the management room (only when using native login without Zero Touch Deployment)
122125

123126
Before proceeding to the next step, run the playbook with the following command to create the bot user.
124127

@@ -130,9 +133,9 @@ ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,ensure-matrix-use
130133

131134
Then, invite the bot (`@bot.draupnir:example.com`) to its management room which you have created earlier.
132135

133-
### Creating user account for the bot
136+
### Creating a user account for the bot (when using Zero Touch Deployment)
134137

135-
Since Zero Touch Deployment is not validated with login native we will create the user account manually.
138+
Since Zero Touch Deployment is not validated with native login, you will need to create the user account manually.
136139

137140
Refer to [registering users](registering-users.md) for documentation on how to configure the user account.
138141

@@ -148,8 +151,7 @@ The APIs can also be accessed via [Ketesa](https://github.com/etkecc/ketesa), a
148151

149152
#### Add the configuration
150153

151-
To expose the APIs publicly, add the following configuration to your `vars.yml` file:
152-
This is automatically done if Ketesa is enabled.
154+
This is automatically done if Ketesa is enabled. Otherwise, to expose the APIs publicly, add the following configuration to your `vars.yml` file:
153155

154156
```yaml
155157
matrix_synapse_container_labels_public_client_synapse_admin_api_enabled: true
@@ -201,9 +203,14 @@ matrix_bot_draupnir_config_web_synapseHTTPAntispam_enabled: true
201203
matrix_bot_draupnir_admin_api_enabled: true
202204
```
203205

204-
These protections need to be manually activated and consulting the [enabling protections](#enabling-built-in-protections) guide can be helpful or consulting upstream documentation.
206+
These protections need to be manually activated. Consulting the [enabling protections](#enabling-built-in-protections) guide and/or upstream documentation can be helpful.
207+
208+
The other method polls a Synapse Admin API endpoint, hence it is available only if using Synapse and if the Draupnir user is an admin. To enable it, set `pollReports: true` in your `vars.yml` file as below:
205209

206-
The other method polls an Synapse Admin API endpoint, hence it is available only if using Synapse and if the Draupnir user is an admin (see [above](#register-the-bot-account)). To enable it, set `pollReports: true` on `vars.yml` file as below.
210+
```yaml
211+
matrix_bot_draupnir_configuration_extension_yaml: |
212+
pollReports: true
213+
```
207214

208215
### Extending the configuration
209216

roles/custom/matrix-appservice-draupnir-for-all/defaults/main.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -63,25 +63,26 @@ matrix_appservice_draupnir_for_all_force_restart: "{{
6363
# the configuration values Draupnir expects for this mode.
6464
# This prevents invalid manual combinations from being passed through, since
6565
# Draupnir requires `matrix_appservice_draupnir_for_all_config_adminRoom` to be
66-
# unset and `matrix_appservice_draupnir_for_all_initialManager` to be a valid
67-
# user ID.
66+
# unset and `matrix_appservice_draupnir_for_all_config_initialManager` to be a
67+
# valid user ID.
6868
# Zero Touch Deployment is recommended for all new deployments.
69-
# New deployments that are exempt from this recommendationare assumed to be advanced users.
70-
# Who know what they are doing and have specific needs that require the flexibility of non-zero-touch-deployment mode.
69+
# Deployments that are exempt from this recommendation are assumed to be
70+
# advanced setups with specific needs that require the flexibility of
71+
# non-zero-touch-deployment mode.
7172
# Note that enabling this on an existing deployment will cause the bot to recreate the admin room.
72-
# Manual policy migration has to be done in that case as to not break when access controls return to working order.
73+
# Manual policy migration has to be done in that case so as not to break when access controls return to working order.
7374
matrix_appservice_draupnir_for_all_zero_touch_deploy: false
7475

7576
# The room ID where people can use the bot. The bot has no access controls, so
7677
# anyone in this room can use the bot - secure your room!
7778
# This should be a room alias - not a matrix.to URL.
78-
# Appservice mode unlike bot mode is not verbose in the admin room.
79+
# Appservice mode, unlike bot mode, is not verbose in the admin room.
7980
# This room is different for Appservice Mode compared to normal mode.
8081
# In Appservice mode it provides functions like user management.
8182
matrix_appservice_draupnir_for_all_config_adminRoom: "" # noqa var-naming
8283

83-
# This controls the mxid of who is invited to the admin room on its creation when using Zero Touch Deployment.
84-
# The this value is mutually exclusive with matrix_appservice_draupnir_for_all_config_adminRoom
84+
# This controls the MXID of who is invited to the admin room on its creation when using Zero Touch Deployment.
85+
# This value is mutually exclusive with matrix_appservice_draupnir_for_all_config_adminRoom
8586
# and the bot will crash if you attempt to set both at the same time.
8687
matrix_appservice_draupnir_for_all_config_initialManager: "" # noqa var-naming
8788

roles/custom/matrix-appservice-draupnir-for-all/tasks/setup_install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-FileCopyrightText: 2024 David Mehren
22
# SPDX-FileCopyrightText: 2024 MDAD project contributors
3-
# SPDX-FileCopyrightText: 2024, 2026 Catalan Lover <catalanlover@protonmail.com>
3+
# SPDX-FileCopyrightText: 2024 - 2026 Catalan Lover <catalanlover@protonmail.com>
44
# SPDX-FileCopyrightText: 2024 Slavi Pantaleev
55
# SPDX-FileCopyrightText: 2024 Suguru Hirahara
66
#

roles/custom/matrix-appservice-draupnir-for-all/tasks/validate_config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# SPDX-FileCopyrightText: 2024 MDAD project contributors
2-
# SPDX-FileCopyrightText: 2024, 2026 Catalan Lover <catalanlover@protonmail.com>
2+
# SPDX-FileCopyrightText: 2024 - 2026 Catalan Lover <catalanlover@protonmail.com>
33
# SPDX-FileCopyrightText: 2024 Slavi Pantaleev
44
# SPDX-FileCopyrightText: 2025 Suguru Hirahara
55
#

roles/custom/matrix-appservice-draupnir-for-all/templates/production-appservice.yaml.j2

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ adminRoom: {{ matrix_appservice_draupnir_for_all_config_adminRoom | to_json }}
2828
initialManager: {{ matrix_appservice_draupnir_for_all_config_initialManager | to_json }}
2929
{% endif %}
3030

31-
3231
# This is a web api that the widget connects to in order to interact with the appservice.
3332
webAPI:
3433
port: 9000

roles/custom/matrix-bot-draupnir/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ matrix_bot_draupnir_login_native: false
127127
# Note that enabling this on an existing deployment will cause the bot to
128128
# recreate the management room.
129129
# Recreating the management room will cause all protections to reset their settings to defaults
130-
# and cause the re creation of secondary rooms like notification rooms. News memory will also be wiped.
130+
# and cause the recreation of secondary rooms like notification rooms. All bot memory will also be wiped.
131131
matrix_bot_draupnir_zero_touch_deploy: false
132132

133133
# The management room used for administration when Zero Touch

0 commit comments

Comments
 (0)