This repository has no description
1.2 kB
41 lines
1{ config, lib, pkgs, ... }:
2let
3 tcpports = [
4 4443 # jitsi
5 64738 # murmur
6 ];
7 udpports = [
8 10000 # jitsi
9 64738 # murmur
10 ];
11 target = "orange.r";
12in
13{
14 networking.firewall.allowedTCPPorts = tcpports;
15 networking.firewall.allowedUDPPorts = udpports;
16 services.nginx.streamConfig = ''
17 ${lib.concatMapStringsSep "\n" (port: ''
18 server {
19 listen [::]:${toString port};
20 listen ${toString port};
21 proxy_pass ${target}:${toString port};
22 }
23 '') tcpports}
24 '';
25
26 krebs.iptables.tables.nat.PREROUTING.rules = lib.flatten (map (port: [
27 { predicate = "-p udp --dport ${toString port}"; target = "DNAT --to-destination ${config.krebs.hosts.orange.nets.retiolum.ip4.addr}:${toString port}"; v6 = false; }
28 { predicate = "-p udp --dport ${toString port}"; target = "DNAT --to-destination [${config.krebs.hosts.orange.nets.retiolum.ip6.addr}]:${toString port}"; v4 = false; }
29 ]) udpports);
30
31 services.nginx.virtualHosts."jitsi.lassul.us" = {
32 enableACME = true;
33 acmeFallbackHost = "${target}";
34 addSSL = true;
35 locations."/" = {
36 recommendedProxySettings = true;
37 proxyWebsockets = true;
38 proxyPass = "https://${target}";
39 };
40 };
41}