Fixing nginx issues and tightening ips

coturn
Lyes Saadi 2026-09-29 14:26:44 +02:00
parent d365a99715
commit 96a72ce22d
No known key found for this signature in database
GPG Key ID: 55A1D803917CF39A
4 changed files with 46 additions and 6 deletions

View File

@ -28,6 +28,28 @@
verbose verbose
# ban private IP ranges # ban private IP ranges
no-multicast-peers no-multicast-peers
denied-peer-ip=0.0.0.0-0.255.255.255
denied-peer-ip=10.0.0.0-10.255.255.255
denied-peer-ip=100.64.0.0-100.127.255.255
denied-peer-ip=127.0.0.0-127.255.255.255
denied-peer-ip=169.254.0.0-169.254.255.255
denied-peer-ip=172.16.0.0-172.31.255.255
denied-peer-ip=192.0.0.0-192.0.0.255
denied-peer-ip=192.0.2.0-192.0.2.255
denied-peer-ip=192.88.99.0-192.88.99.255
denied-peer-ip=192.168.0.0-192.168.255.255
denied-peer-ip=198.18.0.0-198.19.255.255
denied-peer-ip=198.51.100.0-198.51.100.255
denied-peer-ip=203.0.113.0-203.0.113.255
denied-peer-ip=240.0.0.0-255.255.255.255
denied-peer-ip=::1
denied-peer-ip=64:ff9b::-64:ff9b::ffff:ffff
denied-peer-ip=::ffff:0.0.0.0-::ffff:255.255.255.255
denied-peer-ip=100::-100::ffff:ffff:ffff:ffff
denied-peer-ip=2001::-2001:1ff:ffff:ffff:ffff:ffff:ffff:ffff
denied-peer-ip=2002::-2002:ffff:ffff:ffff:ffff:ffff:ffff:ffff
denied-peer-ip=fc00::-fdff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
denied-peer-ip=fe80::-febf:ffff:ffff:ffff:ffff:ffff:ffff:ffff
''; '';
}; };
@ -39,6 +61,7 @@
}; };
in in
{ {
enable = true;
allowedUDPPortRanges = range; allowedUDPPortRanges = range;
allowedUDPPorts = [ 3478 5349 ]; allowedUDPPorts = [ 3478 5349 ];
allowedTCPPortRanges = range; allowedTCPPortRanges = range;

View File

@ -59,9 +59,9 @@ in
in in
{ {
allowedUDPPortRanges = range; allowedUDPPortRanges = range;
allowedUDPPorts = [ 8100 8101 8102 ]; allowedUDPPorts = [ 80 443 8100 8101 8102 ];
allowedTCPPortRanges = range; allowedTCPPortRanges = range;
allowedTCPPorts = [ 8100 8101 8102 ]; allowedTCPPorts = [ 80 443 8100 8101 8102 ];
}; };
users.users.livekit.extraGroups = [ "turnserver" ]; users.users.livekit.extraGroups = [ "turnserver" ];
@ -105,6 +105,14 @@ in
locations."~ /(get_token|healthz|sfu/get)" = { locations."~ /(get_token|healthz|sfu/get)" = {
proxyPass = "http://localhost:${toString config.services.lk-jwt-service.port}"; proxyPass = "http://localhost:${toString config.services.lk-jwt-service.port}";
# TODO : Restrict CORS or study issues
extraConfig = ''
add_header 'Access-Control-Allow-Methods' 'GET' always;
add_header 'Access-Control-Allow-Methods' 'OPTIONS' always;
add_header 'Access-Control-Allow-Credentials' 'false' always;
add_header 'Vary' 'Origin' always;
'';
}; };
locations."/" = { locations."/" = {

View File

@ -11,7 +11,7 @@ let
format = pkgs.formats.json { }; format = pkgs.formats.json { };
settings = lib.filterAttrsRecursive (_: v: v != null) cfg.settings; settings = lib.filterAttrsRecursive (_: v: v != null) cfg.settings;
isLocallyDistributed = config.services.livekit.ingress.enable; isLocallyDistributed = cfg.ingress.enable;
in in
{ {
options.services.livekit' = { options.services.livekit' = {

View File

@ -330,9 +330,18 @@ in
services.nginx.virtualHosts = { services.nginx.virtualHosts = {
"www-alias-crans.org".default = true; "www-alias-crans.org".default = true;
"_crans-org".locations = { "_crans-org" = {
"/_matrix/".proxyPass = "https://matrix.crans.org/_matrix/"; locations = {
"/_synapse/".proxyPass = "https://matrix.crans.org/_synapse/"; "/_matrix/".proxyPass = "https://matrix.crans.org/_matrix/";
"/_synapse/".proxyPass = "https://matrix.crans.org/_synapse/";
"/.well-known/matrix/".extraConfig = ''
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET' always;
add_header 'Access-Control-Allow-Credentials' 'false' always;
add_header 'Vary' 'Origin' always;
'';
};
}; };
}; };
} }