2025-01-01 02:02:00 -05:00
|
|
|
{ config, lib, ... }:
|
2024-10-09 03:36:08 -04:00
|
|
|
{
|
2024-11-04 22:41:38 -05:00
|
|
|
imports = [ ./nginx ];
|
2024-10-15 17:46:44 -04:00
|
|
|
|
2025-01-01 02:02:00 -05:00
|
|
|
config = lib.mkIf config.services.matrix-synapse.enable {
|
|
|
|
services = {
|
|
|
|
coturn = {
|
|
|
|
enable = true;
|
|
|
|
no-cli = true;
|
|
|
|
no-tcp-relay = true;
|
|
|
|
min-port = 49000;
|
|
|
|
max-port = 50000;
|
|
|
|
use-auth-secret = true;
|
|
|
|
static-auth-secret = config.secrets.coturnSecret;
|
|
|
|
realm = "turn.${config.domains.p1}";
|
|
|
|
cert = "/var/lib/acme/turn.${config.domains.p1}.com/fullchain.pem";
|
|
|
|
pkey = "/var/lib/acme/turn.${config.domains.p1}.com/key.pem";
|
|
|
|
};
|
|
|
|
|
|
|
|
# Enable coturn on Synapse
|
|
|
|
matrix-synapse.settings = {
|
|
|
|
turn_uris = [
|
|
|
|
"turn:turn.${config.domains.p1}:3478?transport=udp"
|
|
|
|
"turn:turn.${config.domains.p1}:3478?transport=tcp"
|
|
|
|
];
|
|
|
|
turn_shared_secret = config.secrets.coturnSecret;
|
|
|
|
turn_user_lifetime = "1h";
|
|
|
|
};
|
2025-01-19 15:31:02 -05:00
|
|
|
|
|
|
|
# Sync the IP to Cloudflare
|
|
|
|
ddclient.domains = [ "git.${config.domains.p2}" ];
|
2024-09-10 15:07:31 -04:00
|
|
|
};
|
|
|
|
|
2025-01-01 02:02:00 -05:00
|
|
|
# Open coturn ports
|
|
|
|
networking.firewall = {
|
|
|
|
allowedUDPPorts = [
|
|
|
|
3478
|
|
|
|
5349
|
2024-09-10 15:10:58 -04:00
|
|
|
];
|
2025-01-01 02:02:00 -05:00
|
|
|
allowedUDPPortRanges = [{
|
|
|
|
from = config.services.coturn.min-port;
|
|
|
|
to = config.services.coturn.max-port;
|
|
|
|
}];
|
2024-09-10 15:10:58 -04:00
|
|
|
};
|
2024-09-10 15:07:31 -04:00
|
|
|
};
|
|
|
|
}
|