1 import ./make-test-python.nix ({ pkgs, ... }: {
5 services.coturn.enable = true;
8 boot.postBootCommands = ''
9 echo "some-very-secret-string" > /run/coturn-secret
13 static-auth-secret-file = "/run/coturn-secret";
22 with subtest("by default works without configuration"):
23 default.wait_for_unit("coturn.service")
25 with subtest("works with static-auth-secret-file"):
26 secretsfile.wait_for_unit("coturn.service")
27 secretsfile.wait_for_open_port(3478)
28 secretsfile.succeed("grep 'some-very-secret-string' /run/coturn/turnserver.cfg")
29 # Forbidden IP, fails:
30 secretsfile.fail("${pkgs.coturn}/bin/turnutils_uclient -W some-very-secret-string 127.0.0.1 -DgX -e 127.0.0.1 -n 1 -c -y")
31 # allowed-peer-ip, should succeed:
32 secretsfile.succeed("${pkgs.coturn}/bin/turnutils_uclient -W some-very-secret-string 192.168.1.2 -DgX -e 192.168.1.2 -n 1 -c -y")
34 default.log(default.execute("systemd-analyze security coturn.service | grep -v '✓'")[1])