Skip to content

Commit 7b7b6fe

Browse files
luixxiulspantaleev
andauthored
Relocate coturn to MASH project (#4906)
* Fetch ansible-role-coturn from MASH project Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Replace "matrix_coturn" with "coturn" Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Replace "custom/matrix-coturn" with "galaxy/coturn" Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Set `coturn_identifier` Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Move `coturn_base_path` to matrix_servers for the playbook Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Set `coturn_uid` and `coturn_gid` Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Set empty value to `coturn_turn_external_ip_address_auto_detection_echoip_service_url` on main.yml Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Replace `coturn_docker_image_*` Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Move `coturn_container_image_registry_prefix` to matrix_servers Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Replace "matrix-coturn" with "coturn" on matrix_servers Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Replace "matrix-coturn" with "coturn" Keep "matrix-coturn" on documentation as-is, since it is specified so with `coturn_identifier`. Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Remove roles/custom/matrix-coturn Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> * Update CHANGELOG.md Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> --------- Signed-off-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> Co-authored-by: Suguru Hirahara <did:key:z6MkvVZk1A3KBApWJXv2Ju4H14ErDfRGxh8zxdXSZ4vACDg5> Co-authored-by: Slavi Pantaleev <slavi@devture.com>
1 parent fa7b784 commit 7b7b6fe

23 files changed

Lines changed: 125 additions & 784 deletions

CHANGELOG.md

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# 2026-02-11
22

3+
## (BC Break) coturn role has been relocated and variable names need adjustments
4+
5+
The role for coturn has been relocated to the [mother-of-all-self-hosting](https://github.com/mother-of-all-self-hosting) organization.
6+
7+
Along with the relocation, the `matrix_coturn_` prefix on its variable names has been renamed to `coturn_`, so you need to adjust your `vars.yml` configuration.
8+
9+
As always, the playbook would let you know about this and point out any variables you may have missed.
10+
311
## conduwuit has been removed from the playbook
412

513
[conduwuit](./docs/configuring-playbook-conduwuit.md) has been removed from the playbook, as it has been abandoned.
@@ -324,7 +332,7 @@ In light of this new information, you have 2 options:
324332
- Consider closing the STUN/UDP port with the following configuration:
325333

326334
```yaml
327-
matrix_coturn_container_stun_plain_host_bind_port_udp: ""
335+
coturn_container_stun_plain_host_bind_port_udp: ""
328336
```
329337

330338
- Consider keeping `3478/udp` blocked in your external firewall (if you have one)
@@ -385,11 +393,11 @@ The playbook now **only exposes the Coturn STUN port (`3478`) over TCP by defaul
385393
If you'd like the Coturn STUN port to be exposed over UDP like before, you can revert to the previous behavior by using the following configuration in your `vars.yml` file:
386394

387395
```yaml
388-
matrix_coturn_container_stun_plain_host_bind_port_udp: "3478"
396+
coturn_container_stun_plain_host_bind_port_udp: "3478"
389397
```
390398

391399
> [!WARNING]
392-
> People running Coturn directly on the `host` network (using `matrix_coturn_container_network: host`) will still have the STUN port exposed over UDP, as port exposure is done directly via Coturn and not via Docker. In such cases, the playbook cannot prevent `3478/udp` port exposure and you'd need to do it in another way (separate firewall rule, etc).
400+
> People running Coturn directly on the `host` network (using `coturn_container_network: host`) will still have the STUN port exposed over UDP, as port exposure is done directly via Coturn and not via Docker. In such cases, the playbook cannot prevent `3478/udp` port exposure and you'd need to do it in another way (separate firewall rule, etc).
393401

394402

395403
# 2025-02-17
@@ -1732,12 +1740,12 @@ Other roles which aren't strictly related to Matrix are likely to follow this fa
17321740

17331741
## coturn can now use host-networking
17341742

1735-
Large coturn deployments (with a huge range of ports specified via `matrix_coturn_turn_udp_min_port` and `matrix_coturn_turn_udp_max_port`) experience a huge slowdown with how Docker publishes all these ports (setting up firewall forwarding rules), which leads to a very slow coturn service startup and shutdown.
1743+
Large coturn deployments (with a huge range of ports specified via `coturn_turn_udp_min_port` and `coturn_turn_udp_max_port`) experience a huge slowdown with how Docker publishes all these ports (setting up firewall forwarding rules), which leads to a very slow coturn service startup and shutdown.
17361744

17371745
Such deployments don't need to run coturn within a private container network anymore. coturn can now run with host-networking by using configuration like this:
17381746

17391747
```yaml
1740-
matrix_coturn_container_network: host
1748+
coturn_container_network: host
17411749
```
17421750

17431751
With such a configuration, **Docker no longer needs to configure thousands of firewall forwarding rules** each time coturn starts and stops. This, however, means that **you will need to ensure these ports are open** in your firewall yourself.
@@ -1746,11 +1754,11 @@ Thanks to us [tightening coturn security](#backward-compatibility-tightening-cot
17461754

17471755
## (Backward Compatibility) Tightening coturn security can lead to connectivity issues
17481756

1749-
**TLDR**: users who run and access their Matrix server on a private network (likely a small minority of users) may experience connectivity issues with our new default coturn blocklists. They may need to override `matrix_coturn_denied_peer_ips` and remove some IP ranges from it.
1757+
**TLDR**: users who run and access their Matrix server on a private network (likely a small minority of users) may experience connectivity issues with our new default coturn blocklists. They may need to override `coturn_denied_peer_ips` and remove some IP ranges from it.
17501758

17511759
Inspired by [this security article](https://www.rtcsec.com/article/cve-2020-26262-bypass-of-coturns-access-control-protection/), we've decided to make use of coturn's `denied-peer-ip` functionality to prevent relaying network traffic to certain private IP subnets. This ensures that your coturn server won't accidentally try to forward traffic to certain services running on your local networks. We run coturn in a container and in a private container network by default, which should prevent such access anyway, but having additional block layers in place is better.
17521760

1753-
If you access your Matrix server from a local network and need coturn to relay to private IP addresses, you may observe that relaying is now blocked due to our new default `denied-peer-ip` lists (specified in `matrix_coturn_denied_peer_ips`). If you experience such connectivity problems, consider overriding this setting in your `vars.yml` file and removing certain networks from it.
1761+
If you access your Matrix server from a local network and need coturn to relay to private IP addresses, you may observe that relaying is now blocked due to our new default `denied-peer-ip` lists (specified in `coturn_denied_peer_ips`). If you experience such connectivity problems, consider overriding this setting in your `vars.yml` file and removing certain networks from it.
17541762

17551763
We've also added `no-multicast-peers` to the default coturn configuration, but we don't expect this to cause trouble for most people.
17561764

@@ -2536,8 +2544,8 @@ To improve security, we've [removed TLSv1 and TLSv1.1 support](https://github.co
25362544
If you need to support old clients, you can re-enable both (or whichever one you need) with the following configuration:
25372545

25382546
```yaml
2539-
matrix_coturn_tls_v1_enabled: true
2540-
matrix_coturn_tls_v1_1_enabled: true
2547+
coturn_tls_v1_enabled: true
2548+
coturn_tls_v1_1_enabled: true
25412549
```
25422550

25432551

@@ -3816,7 +3824,7 @@ Because people like using the playbook's components independently (outside of th
38163824
With the new changes, **all roles are now only dependent on the minimal `matrix-base` role**. They are no longer dependent among themselves.
38173825

38183826
In addition, the following components can now be completely disabled (for those who want/need to):
3819-
- `matrix-coturn` by using `matrix_coturn_enabled: false`
3827+
- `matrix-coturn` by using `coturn_enabled: false`
38203828
- `matrix-mailer` by using `matrix_mailer_enabled: false`
38213829
- `matrix-postgres` by using `matrix_postgres_enabled: false`
38223830

@@ -4036,7 +4044,7 @@ The following playbook variables were renamed:
40364044
- from `matrix_docker_image_mautrix_telegram` to `matrix_mautrix_telegram_docker_image`
40374045
- from `matrix_docker_image_mautrix_whatsapp` to `matrix_mautrix_whatsapp_docker_image`
40384046
- from `matrix_docker_image_mailer` to `matrix_mailer_docker_image`
4039-
- from `matrix_docker_image_coturn` to `matrix_coturn_docker_image`
4047+
- from `matrix_docker_image_coturn` to `coturn_container_image`
40404048
- from `matrix_docker_image_goofys` to `matrix_s3_goofys_docker_image`
40414049
- from `matrix_docker_image_riot` to `matrix_riot_web_docker_image`
40424050
- from `matrix_docker_image_nginx` to `matrix_nginx_proxy_docker_image`

docs/configuring-playbook-turn.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,19 +26,19 @@ In the `hosts` file we explicitly ask for your server's external IP address when
2626
If you'd rather use a local IP for `ansible_host`, add the following configuration to your `vars.yml` file. Make sure to replace `YOUR_PUBLIC_IP` with the pubic IP used by the server.
2727

2828
```yaml
29-
matrix_coturn_turn_external_ip_address: "YOUR_PUBLIC_IP"
29+
coturn_turn_external_ip_address: "YOUR_PUBLIC_IP"
3030
```
3131
32-
If you'd like to rely on external IP address auto-detection (not recommended unless you need it), set an empty value to the variable. The playbook will automatically contact an [echoip](https://github.com/mpolden/echoip)-compatible service (`https://ifconfig.co/json` by default) to determine your server's IP address. This API endpoint is configurable via the `matrix_coturn_turn_external_ip_address_auto_detection_echoip_service_url` variable.
32+
If you'd like to rely on external IP address auto-detection (not recommended unless you need it), set an empty value to the variable. The playbook will automatically contact an [echoip](https://github.com/mpolden/echoip)-compatible service (`https://ifconfig.co/json` by default) to determine your server's IP address. This API endpoint is configurable via the `coturn_turn_external_ip_address_auto_detection_echoip_service_url` variable.
3333

3434
>[!NOTE]
3535
> You can self-host the echoip service by using the [Mother-of-All-Self-Hosting (MASH)](https://github.com/mother-of-all-self-hosting/mash-playbook) Ansible playbook. See [this page](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/services/echoip.md) for the instruction to install it with the playbook. If you are wondering how to use it for your Matrix server, refer to [this page](https://github.com/mother-of-all-self-hosting/mash-playbook/blob/main/docs/setting-up-services-on-mdad-server.md) for the overview.
3636

3737
If your server has multiple external IP addresses, the coturn role offers a different variable for specifying them:
3838

3939
```yaml
40-
# Note: matrix_coturn_turn_external_ip_addresses is different than matrix_coturn_turn_external_ip_address
41-
matrix_coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']
40+
# Note: coturn_turn_external_ip_addresses is different than coturn_turn_external_ip_address
41+
coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']
4242
```
4343

4444
### Change the authentication mechanism (optional)
@@ -48,7 +48,7 @@ The playbook uses the [`auth-secret` authentication method](https://github.com/c
4848
To do so, add the following configuration to your `vars.yml` file:
4949

5050
```yaml
51-
matrix_coturn_authentication_method: lt-cred-mech
51+
coturn_authentication_method: lt-cred-mech
5252
```
5353

5454
Regardless of the selected authentication method, the playbook generates secrets automatically and passes them to the homeserver and coturn.
@@ -62,7 +62,7 @@ By default, Coturn uses the same hostname as your Matrix homeserver (the value o
6262
If you'd like to use a custom subdomain for Coturn (e.g., `turn.example.com` or `t.matrix.example.com`), add the following configuration to your `vars.yml` file:
6363

6464
```yaml
65-
matrix_coturn_hostname: turn.example.com
65+
coturn_hostname: turn.example.com
6666
```
6767

6868
The playbook will automatically:
@@ -78,7 +78,7 @@ If you'd like to use another TURN server (be it coturn or some other one), add t
7878

7979
```yaml
8080
# Disable integrated coturn server
81-
matrix_coturn_enabled: false
81+
coturn_enabled: false
8282
8383
# Point Synapse to your other coturn server
8484
matrix_synapse_turn_uris:
@@ -99,30 +99,30 @@ You can put multiple host/port combinations if you'd like to.
9999

100100
### Edit the reloading schedule (optional)
101101

102-
By default the service is reloaded on 6:30 a.m. every day based on the `matrix_coturn_reload_schedule` variable so that new SSL certificates can kick in. It is defined in the format of systemd timer calendar.
102+
By default the service is reloaded on 6:30 a.m. every day based on the `coturn_reload_schedule` variable so that new SSL certificates can kick in. It is defined in the format of systemd timer calendar.
103103

104104
To edit the schedule, add the following configuration to your `vars.yml` file (adapt to your needs):
105105

106106
```yaml
107-
matrix_coturn_reload_schedule: "*-*-* 06:30:00"
107+
coturn_reload_schedule: "*-*-* 06:30:00"
108108
```
109109

110-
**Note**: the actual job may run with a delay. See `matrix_coturn_reload_schedule_randomized_delay_sec` for its default value.
110+
**Note**: the actual job may run with a delay. See `coturn_reload_schedule_randomized_delay_sec` for its default value.
111111

112112
### Extending the configuration
113113

114114
There are some additional things you may wish to configure about the TURN server.
115115

116116
Take a look at:
117117

118-
- `roles/custom/matrix-coturn/defaults/main.yml` for some variables that you can customize via your `vars.yml` file
118+
- `roles/galaxy/coturn/defaults/main.yml` for some variables that you can customize via your `vars.yml` file
119119

120120
## Disabling coturn
121121

122122
If, for some reason, you'd like for the playbook to not install coturn (or to uninstall it if it was previously installed), add the following configuration to your `vars.yml` file:
123123

124124
```yaml
125-
matrix_coturn_enabled: false
125+
coturn_enabled: false
126126
```
127127

128128
In that case, Synapse would not point to any coturn servers and audio/video call functionality may fail.

docs/faq.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ exim_relay_enabled: false
313313

314314
# You can also disable this to save more RAM,
315315
# at the expense of audio/video calls being unreliable.
316-
matrix_coturn_enabled: false
316+
coturn_enabled: false
317317

318318
# This makes Synapse not keep track of who is online/offline.
319319
#

docs/howto-srv-server-delegation.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -104,10 +104,10 @@ This should not happen again afterwards as Traefik will renew certificates well
104104

105105
```yaml
106106
# Only depend on docker.service, this removes the dependency on the certificate exporter, might imply the need to manually restart coturn on the first installation once the certificates are obtained, afterwards, the reload service should handle things
107-
matrix_coturn_systemd_required_services_list: ['docker.service']
107+
coturn_systemd_required_services_list: ['docker.service']
108108
109109
# This changes the path of the loaded certificate, while maintaining the original functionality, we're now loading the wildcard certificate.
110-
matrix_coturn_container_additional_volumes: |
110+
coturn_container_additional_volumes: |
111111
{{
112112
(
113113
[
@@ -121,7 +121,7 @@ matrix_coturn_container_additional_volumes: |
121121
'dst': '/privatekey.key',
122122
'options': 'ro',
123123
},
124-
] if matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] and traefik_certs_dumper_enabled and matrix_coturn_tls_enabled else []
124+
] if matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] and traefik_certs_dumper_enabled and coturn_tls_enabled else []
125125
)
126126
}}
127127
```
@@ -165,10 +165,10 @@ traefik_environment_variables: |
165165
LEGO_DISABLE_CNAME_SUPPORT=true
166166
167167
# Only depend on docker.service, this removes the dependency on the certificate exporter, might imply the need to manually restart coturn on the first installation once the certificates are obtained, afterwards, the reload service should handle things
168-
matrix_coturn_systemd_required_services_list: ['docker.service']
168+
coturn_systemd_required_services_list: ['docker.service']
169169

170170
# This changes the path of the loaded certificate, while maintaining the original functionality, we're now loading the wildcard certificate.
171-
matrix_coturn_container_additional_volumes: |
171+
coturn_container_additional_volumes: |
172172
{{
173173
(
174174
[
@@ -182,7 +182,7 @@ matrix_coturn_container_additional_volumes: |
182182
'dst': '/privatekey.key',
183183
'options': 'ro',
184184
},
185-
] if matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] and traefik_certs_dumper_enabled and matrix_coturn_tls_enabled else []
185+
] if matrix_playbook_reverse_proxy_type in ['playbook-managed-traefik', 'other-traefik-container'] and traefik_certs_dumper_enabled and coturn_tls_enabled else []
186186
)
187187
}}
188188
```

docs/self-building.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ Possibly outdated list of roles where self-building the Docker image is currentl
3131
- `matrix-client-hydrogen`
3232
- `cinny`
3333
- `matrix-registration`
34-
- `matrix-coturn`
34+
- `coturn`
3535
- `matrix-corporal`
3636
- `matrix-dimension`
3737
- `exim-relay`

examples/hosts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# We explicitly ask for your server's external IP address, because the same value is used for configuring coturn.
2-
# If you'd rather use a local IP here, make sure to set up `matrix_coturn_turn_external_ip_address`.
2+
# If you'd rather use a local IP here, make sure to set up `coturn_turn_external_ip_address`.
33
#
44
# To connect using a non-root user (and elevate to root with sudo later),
55
# replace `ansible_ssh_user=root` with something like this: `ansible_ssh_user=username ansible_become=true ansible_become_user=root`.

examples/vars.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@ postgres_connection_password: ''
6161
# 2. Uncomment and adjust the line below to specify an IP address manually
6262
#
6363
# By default, auto-detection will be attempted using the `https://ifconfig.co/json` API.
64-
# Default values for this are specified in `matrix_coturn_turn_external_ip_address_auto_detection_*` variables in the coturn role
65-
# (see `roles/custom/matrix-coturn/defaults/main.yml`).
64+
# Default values for this are specified in `coturn_turn_external_ip_address_auto_detection_*` variables in the coturn role
65+
# (see `roles/galaxy/coturn/defaults/main.yml`).
6666
#
6767
# If your server has multiple IP addresses, you may define them in another variable which allows a list of addresses.
68-
# Example: `matrix_coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']`
68+
# Example: `coturn_turn_external_ip_addresses: ['1.2.3.4', '4.5.6.7']`
6969
#
70-
# matrix_coturn_turn_external_ip_address: ''
70+
# coturn_turn_external_ip_address: ''

0 commit comments

Comments
 (0)