From c0dc56324a47fa7aeacb4858796bb2499eaa7dfa Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Mon, 18 Mar 2019 11:18:30 +0000 Subject: [PATCH 1/3] Add config options to turnserver.conf --- .../matrix-coturn/templates/turnserver.conf.j2 | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/roles/matrix-coturn/templates/turnserver.conf.j2 b/roles/matrix-coturn/templates/turnserver.conf.j2 index a91aa5e0..2e8701fc 100644 --- a/roles/matrix-coturn/templates/turnserver.conf.j2 +++ b/roles/matrix-coturn/templates/turnserver.conf.j2 @@ -11,3 +11,20 @@ no-cli no-tls no-dtls prod +no-tcp-relay +{% if matrix_coturn_user_quota is defined %} +user-quota={{ matrix_coturn_user_quota }} +{% endif %} +{% if matrix_coturn_total_quota is defined %} +total-quota={{ matrix_coturn_total_quota }} +{% endif %} +{% if matrix_coturn_denied_peer_ips is defined %} +{% for ip_range in matrix_coturn_denied_peer_ips %} +denied-peer-ip={{ ip_range }} +{% endfor %} +{% endif %} +{% if matrix_coturn_allowed_peer_ips is defined %} +{% for ip_range in matrix_coturn_allowed_peer_ips %} +allowed-peer-ip={{ ip_range }} +{% endfor %} +{% endif %} From 9d236c5466f8ad33243e2fbde92ff4bff9cc322b Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Mon, 18 Mar 2019 11:44:40 +0000 Subject: [PATCH 2/3] Add defaults for ips --- roles/matrix-coturn/defaults/main.yml | 2 ++ roles/matrix-coturn/templates/turnserver.conf.j2 | 4 ---- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index df1cc20b..a97f04a6 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -17,3 +17,5 @@ matrix_coturn_turn_udp_min_port: 49152 matrix_coturn_turn_udp_max_port: 49172 matrix_coturn_turn_external_ip_address: "{{ ansible_host }}" +matrix_coturn_allowed_peer_ips: [] +matrix_coturn_denied_peer_ips: [] diff --git a/roles/matrix-coturn/templates/turnserver.conf.j2 b/roles/matrix-coturn/templates/turnserver.conf.j2 index 2e8701fc..9c4880fd 100644 --- a/roles/matrix-coturn/templates/turnserver.conf.j2 +++ b/roles/matrix-coturn/templates/turnserver.conf.j2 @@ -18,13 +18,9 @@ user-quota={{ matrix_coturn_user_quota }} {% if matrix_coturn_total_quota is defined %} total-quota={{ matrix_coturn_total_quota }} {% endif %} -{% if matrix_coturn_denied_peer_ips is defined %} {% for ip_range in matrix_coturn_denied_peer_ips %} denied-peer-ip={{ ip_range }} {% endfor %} -{% endif %} -{% if matrix_coturn_allowed_peer_ips is defined %} {% for ip_range in matrix_coturn_allowed_peer_ips %} allowed-peer-ip={{ ip_range }} {% endfor %} -{% endif %} From e367a2d0de39e6602cae4b91dff9a39695ec66c0 Mon Sep 17 00:00:00 2001 From: Stuart Mumford Date: Mon, 18 Mar 2019 11:58:52 +0000 Subject: [PATCH 3/3] Add nulls for quotas as well --- roles/matrix-coturn/defaults/main.yml | 2 ++ roles/matrix-coturn/templates/turnserver.conf.j2 | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/roles/matrix-coturn/defaults/main.yml b/roles/matrix-coturn/defaults/main.yml index a97f04a6..5b7dbbe9 100644 --- a/roles/matrix-coturn/defaults/main.yml +++ b/roles/matrix-coturn/defaults/main.yml @@ -19,3 +19,5 @@ matrix_coturn_turn_udp_max_port: 49172 matrix_coturn_turn_external_ip_address: "{{ ansible_host }}" matrix_coturn_allowed_peer_ips: [] matrix_coturn_denied_peer_ips: [] +matrix_coturn_user_quota: null +matrix_coturn_total_quota: null diff --git a/roles/matrix-coturn/templates/turnserver.conf.j2 b/roles/matrix-coturn/templates/turnserver.conf.j2 index 9c4880fd..a2689bc2 100644 --- a/roles/matrix-coturn/templates/turnserver.conf.j2 +++ b/roles/matrix-coturn/templates/turnserver.conf.j2 @@ -12,10 +12,10 @@ no-tls no-dtls prod no-tcp-relay -{% if matrix_coturn_user_quota is defined %} +{% if matrix_coturn_user_quota != None %} user-quota={{ matrix_coturn_user_quota }} {% endif %} -{% if matrix_coturn_total_quota is defined %} +{% if matrix_coturn_total_quota != None %} total-quota={{ matrix_coturn_total_quota }} {% endif %} {% for ip_range in matrix_coturn_denied_peer_ips %}