Rename nixos-coturn to coturn and finish config

This commit is contained in:
yuri 2023-08-07 22:12:36 +02:00
parent fc2c69dbb7
commit 909a2ac6c1
8 changed files with 49 additions and 21 deletions

View file

@ -51,7 +51,7 @@ in
hostNixpkgs = nixpkgs-unstable; hostNixpkgs = nixpkgs-unstable;
site = "vs"; site = "vs";
}; };
nixos-coturn = { coturn = {
site = "vs"; site = "vs";
}; };
tor-relay = { tor-relay = {

10
hosts/coturn/acme.nix Normal file
View file

@ -0,0 +1,10 @@
{ ... }:
{
security.acme.certs = {
"turn.nekover.se" = {
listenHTTP = ":80";
group = "turnserver";
reloadServices = [ "coturn.service" ];
};
};
}

View file

@ -0,0 +1,22 @@
{ config, ... }:
{
boot.loader.grub = {
enable = true;
device = "/dev/vda";
};
networking = {
hostName = "coturn";
firewall = {
enable = true;
allowedTCPPorts = [ 80 3478 5349 ];
allowedUDPPorts = [ 3478 5349 ];
allowedUDPPortRanges = [{
from = config.services.coturn.min-port;
to = config.services.coturn.max-port;
}];
};
};
system.stateVersion = "23.05";
}

View file

@ -1,17 +1,17 @@
{ ... }: { config, ... }:
{ {
services.coturn = { services.coturn = {
enable = true; enable = true;
min-port = 49200; min-port = 49200;
max-port = 49500; max-port = 49500;
use-auth-secret = true; use-auth-secret = true;
static-auth-secret-file = "/secrets/static-auth-secret.secret"; static-auth-secret-file = "/secrets/static-auth-secret.secret";
realm = "turn.nekover.se"; realm = "turn.nekover.se";
cert = "/certs/turn.nekover.se/fullchain.pem"; cert = "${config.security.acme.certs."turn.nekover.se".directory}/fullchain.pem";
pkey = "/certs/turn.nekover.se/key.pem"; pkey = "${config.security.acme.certs."turn.nekover.se".directory}/key.pem";
no-tcp-relay = true; no-tcp-relay = true;
extraConfig = " no-cli = true;
extraConfig = ''
external-ip=170.133.2.81/10.202.41.118 external-ip=170.133.2.81/10.202.41.118
prometheus prometheus
syslog syslog
@ -40,6 +40,6 @@
user-quota=12 user-quota=12
total-quota=1200 total-quota=1200
"; '';
}; };
} }

View file

@ -2,6 +2,7 @@
{ {
imports = [ imports = [
./configuration.nix ./configuration.nix
./acme.nix
./coturn.nix ./coturn.nix
]; ];
} }

View file

@ -1,14 +0,0 @@
{ ... }:
{
boot.loader.grub = {
enable = true;
device = "/dev/vda";
};
networking = {
hostName = "coturn";
firewall.enable = false;
};
system.stateVersion = "23.05";
}

View file

@ -27,4 +27,13 @@
proxyPass = "http://metrics.vs.grzb.de:80"; proxyPass = "http://metrics.vs.grzb.de:80";
}; };
}; };
services.nginx.virtualHosts."turn.nekover.se" = {
listen = [{
addr = "0.0.0.0";
port = 80;
}];
locations."^~ /.well-known/acme-challenge/" = {
proxyPass = "http://coturn.vs.grzb.de:80";
};
};
} }