Skip to content

Commit 350847b

Browse files
committed
Documentation for Zero Touch Deployment
1 parent 5650265 commit 350847b

4 files changed

Lines changed: 75 additions & 11 deletions

File tree

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

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!--
2+
SPDX-FileCopyRightText: 2024,2026 Catalan Lover <catalanlover@protonmail.com>
23
SPDX-FileCopyrightText: 2024 - 2025 Suguru Hirahara
34
SPDX-FileCopyrightText: 2024 MDAD project contributors
45
@@ -25,21 +26,43 @@ Draupnir for all does not support external tooling like [MRU](https://mru.rory.g
2526

2627
## Prerequisites
2728

28-
### Create a main management room
29+
### Prerequisites for Zero Touch Deployment
2930

30-
The playbook does not create a management room for your Main Draupnir. You **need to create the room manually** before setting up the bot.
31+
Zero Touch Deployment of Draupnir Appservice Mode (Draupnir for all) requires as of Draupnir 3.1.0 that you supply Draupnir the following:
32+
33+
- MXID of the the first person who gets invited to the admin room the bot creates for you.
34+
35+
That is all. The appservice manages everything on its own after you provide it a MXID to invite.
36+
37+
If proceeding with Zero Touch Deployment proceed to [Adjusting the playbook configuration](#adjusting-the-playbook-configuration)
38+
39+
### Create a admin room (Optional)
40+
41+
The playbook does not create a admin room for your Admin Draupnir. You **need to create the room manually** before setting up the bot.
3142

3243
Note that the room must be unencrypted.
3344

34-
The management room has to be given an alias, and your bot has to be invited to the room.
45+
The admin room has to be given an alias, and your bot has to be invited to the room.
3546

36-
This management 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 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.
3748

3849
> [!WARNING]
3950
> Anyone in this room can control the bot so it is important that you only invite trusted users to this room.
4051
4152
## Adjusting the playbook configuration
4253

54+
Add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file. Make sure to replace `INITIAL_MANAGER_MXID_HERE`.
55+
56+
```yaml
57+
matrix_appservice_draupnir_for_all_enabled: true
58+
59+
matrxi_appservice_draupnir_for_all_zero_touch_deployment: true
60+
61+
matrix_appservice_draupnir_for_all_config_initialManager: "INITIAL_MANAGER_MXID_HERE"
62+
```
63+
64+
If opting out of Zero Touch deployment use the following configuration block instead.
65+
4366
Add the following configuration to your `inventory/host_vars/matrix.example.com/vars.yml` file. Make sure to replace `MANAGEMENT_ROOM_ALIAS_HERE`.
4467

4568
```yaml
@@ -105,7 +128,9 @@ ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,start
105128

106129
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.
107130

108-
The installation of Draupnir for all in this playbook is very much Alpha quality. Usage-wise, Draupnir for all is almost identical to Draupnir bot mode.
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.
132+
133+
Draupnir for all installation via the playbook used to be alpha quality, but due to refinements it's now at production 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.
109134

110135
### Granting Users the ability to use D4A
111136

@@ -117,6 +142,10 @@ To allow users or whole homeservers you type /plain !admin allow `target` and ta
117142

118143
### How to provision a D4A once you are allowed to
119144

120-
To provision a D4A, you need to start a chat with `@draupnir-main:example.com`. The bot will reject this invite and you will shortly get invited to the Draupnir control room for your newly provisioned Draupnir. From here its just a normal Draupnir experience.
145+
Once someone is allowed to provision a bot. Simply provision them one with `!admin provision MXID`.
146+
Self Service Provisioning is disabled as a security feature due to it being bugged. Force Provisioning bypasses this disabled status.
147+
148+
Please note that the reason you should always make sure there is an allow entry matching whoever is provisioned is that when
149+
self service gets fixed the bot of anyone who is not allowed to provision a bot will refuse to start.
121150

122151
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: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<!--
2+
SPDX-FileCopyRightText: 2023 - 2026 Catalan Lover <catalanlover@protonmail.com>
23
SPDX-FileCopyrightText: 2023 - 2025 MDAD project contributors
34
SPDX-FileCopyrightText: 2023 Kim Brose
45
SPDX-FileCopyrightText: 2024 - 2025 Slavi Pantaleev
@@ -19,7 +20,17 @@ If your migrating from [Mjolnir](configuring-playbook-bot-mjolnir.md), skip to [
1920

2021
## Prerequisites
2122

22-
### Create a management room
23+
### Prerequisites for Zero Touch Deployment
24+
25+
Zero Touch Deployment of Draupnir bot mode requires as of Draupnir 3.1.0 that you supply Draupnir the following:
26+
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
30+
31+
Zero Touch Deployment is the officially preferred installation method for new deployments of Draupnir as of 3.1.0
32+
33+
### Create a management room (optional)
2334

2435
Using your own account, create a new invite only room that you will use to manage the bot. This is the room where you will see the status of the bot and where you will send commands to the bot, such as the command to ban a user from another room.
2536

@@ -28,6 +39,8 @@ Using your own account, create a new invite only room that you will use to manag
2839
2940
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)).
3041

42+
E2EE Support for the management room is mutually exclusive with Zero Touch Deployment of Draupnir.
43+
3144
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`.
3245

3346
## End-to-End Encryption support
@@ -63,7 +76,23 @@ matrix_bot_draupnir_config_accessToken: "CLEAN_ACCESS_TOKEN_HERE"
6376
6477
## Adjusting the playbook configuration
6578
66-
To enable the bot, add the following configuration to your `vars.yml` file. Make sure to replace `MANAGEMENT_ROOM_ID_HERE` with the one of the room which you have created earlier.
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.
80+
81+
82+
```yaml
83+
# Enable Draupnir
84+
matrix_bot_draupnir_enabled: true
85+
86+
matrix_bot_draupnir_zero_touch_deploy: true
87+
88+
matrix_bot_draupnir_config_initialManager: "INITIAL_MANAGER_MXID_HERE"
89+
90+
# Access token which the bot will use for logging in.
91+
# Comment out `matrix_bot_draupnir_login_native` when using this option.
92+
matrix_bot_draupnir_config_accessToken: "CLEAN_ACCESS_TOKEN_HERE"
93+
```
94+
95+
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.
6796
6897
```yaml
6998
# Enable Draupnir
@@ -90,7 +119,7 @@ This is due to the conditional restart logic not being able to reliably tell whe
90119

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

93-
### Create and invite the bot to the management room
122+
### Create and invite the bot to the management room (if using login native and not using Zero Touch Deployment)
94123

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

@@ -102,6 +131,12 @@ ansible-playbook -i inventory/hosts setup.yml --tags=setup-all,ensure-matrix-use
102131

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

134+
### Creating user account for the bot
135+
136+
Since Zero Touch Deployment is not validated with login native we will create the user account manually.
137+
138+
Refer to [registering users](registering-users.md) for documentation on how to configure the user account.
139+
105140
### Make sure the account is free from rate limiting (optional, recommended)
106141

107142
If your homeserver's implementation is Synapse, you will need to prevent it from rate limiting the bot's account. **This is a highly recommended step. If you do not configure it, Draupnir performance will be degraded.**

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 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 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
#

0 commit comments

Comments
 (0)