mirror of https://gitlab.crans.org/nounous/nixos
Merge branch 'coturn' into 'main'
Coturn & Livekit : Appels matrix See merge request nounous/nixos!79iso
commit
fd125e0fd8
|
|
@ -0,0 +1,83 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
{
|
||||
age.secrets = {
|
||||
coturn_auth_secret = {
|
||||
file = ../../../secrets/common/coturn_auth_secret.age;
|
||||
mode = "440";
|
||||
owner = "turnserver";
|
||||
group = "turnserver";
|
||||
};
|
||||
};
|
||||
|
||||
# Taken from https://wiki.nixos.org/wiki/Matrix#Coturn_with_Synapse
|
||||
services.coturn = rec {
|
||||
enable = true;
|
||||
no-cli = true;
|
||||
no-tcp-relay = true;
|
||||
min-port = 48000;
|
||||
max-port = 50000;
|
||||
use-auth-secret = true;
|
||||
static-auth-secret-file = config.age.secrets.coturn_auth_secret.path;
|
||||
secure-stun = true;
|
||||
realm = "coturn.crans.org";
|
||||
cert = "${config.security.acme.certs.${realm}.directory}/full.pem";
|
||||
pkey = "${config.security.acme.certs.${realm}.directory}/key.pem";
|
||||
extraConfig = ''
|
||||
# for debugging
|
||||
verbose
|
||||
# ban private IP ranges
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall =
|
||||
let
|
||||
range = with config.services.coturn; lib.singleton {
|
||||
from = min-port;
|
||||
to = max-port;
|
||||
};
|
||||
in
|
||||
{
|
||||
enable = true;
|
||||
allowedUDPPortRanges = range;
|
||||
allowedUDPPorts = [ 3478 5349 ];
|
||||
allowedTCPPortRanges = range;
|
||||
allowedTCPPorts = [ 3478 5349 ];
|
||||
};
|
||||
|
||||
users.users.turnserver.extraGroups = [ "nginx" ];
|
||||
|
||||
security.acme.certs.${config.services.coturn.realm} = {
|
||||
postRun = "systemctl restart coturn.service";
|
||||
};
|
||||
|
||||
services.nginx.virtualHosts = {
|
||||
${config.services.coturn.realm} = {
|
||||
forceSSL = true;
|
||||
enableACME = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
{ ... }:
|
||||
|
||||
{
|
||||
imports = [
|
||||
./coturn.nix
|
||||
./service.nix
|
||||
./livekit.nix
|
||||
./hardware-configuration.nix
|
||||
];
|
||||
|
||||
networking.hostName = "coturn";
|
||||
boot.loader.grub.devices = [ "/dev/sda" ];
|
||||
|
||||
services.nginx.enable = true;
|
||||
|
||||
system.stateVersion = "26.05";
|
||||
}
|
||||
|
|
@ -0,0 +1,45 @@
|
|||
# Do not modify this file! It was generated by ‘nixos-generate-config’
|
||||
# and may be overwritten by future invocations. Please make changes
|
||||
# to /etc/nixos/configuration.nix instead.
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
modulesPath,
|
||||
...
|
||||
}:
|
||||
|
||||
{
|
||||
imports = [
|
||||
(modulesPath + "/profiles/qemu-guest.nix")
|
||||
];
|
||||
|
||||
boot.initrd.availableKernelModules = [
|
||||
"ata_piix"
|
||||
"uhci_hcd"
|
||||
"virtio_pci"
|
||||
"virtio_scsi"
|
||||
"sd_mod"
|
||||
"sr_mod"
|
||||
];
|
||||
boot.initrd.kernelModules = [ ];
|
||||
boot.kernelModules = [ ];
|
||||
boot.extraModulePackages = [ ];
|
||||
|
||||
fileSystems."/" = {
|
||||
device = "/dev/disk/by-uuid/e2406ee7-b3ca-4fe0-8b4b-e4a38a1149ca";
|
||||
fsType = "ext4";
|
||||
};
|
||||
|
||||
swapDevices = [ ];
|
||||
|
||||
# Enables DHCP on each ethernet and wireless interface. In case of scripted networking
|
||||
# (the default) this is the recommended approach. When using systemd-networkd it's
|
||||
# still possible to use this option, but it's recommended to use it in conjunction
|
||||
# with explicit per-interface declarations with `networking.interfaces.<interface>.useDHCP`.
|
||||
networking.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ens18.useDHCP = lib.mkDefault true;
|
||||
# networking.interfaces.ens19.useDHCP = lib.mkDefault true;
|
||||
|
||||
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
|
||||
}
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
name = "coturn";
|
||||
description = "Serveur Web RTC pour les appels du Crans";
|
||||
id = 119;
|
||||
|
||||
enable = true;
|
||||
|
||||
networking = {
|
||||
adm.enable = true;
|
||||
srv = {
|
||||
enable = true;
|
||||
ipv4 = "185.230.79.19";
|
||||
};
|
||||
};
|
||||
|
||||
resticClient.when = "06:07";
|
||||
|
||||
services = {
|
||||
acme.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,130 @@
|
|||
#
|
||||
# livekit' est un clone du module livekit mais qui permet de spécifier
|
||||
# les secrets pour la connexion aux serveurs turn par un fichier sur le disque,
|
||||
# ce qui nous permet d'utiliser agenix pour cela et de ne pas exposer les
|
||||
# secrets de turn.
|
||||
#
|
||||
|
||||
{ config, pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
keyFile = "/run/livekit.key";
|
||||
domain = "livekit.crans.org";
|
||||
in
|
||||
{
|
||||
services.livekit' = {
|
||||
enable = true;
|
||||
|
||||
openFirewall = true;
|
||||
|
||||
settings = {
|
||||
port = 8100;
|
||||
|
||||
room.auto_create = true;
|
||||
|
||||
rtc = {
|
||||
use_external_ip = false;
|
||||
node_ip = config.crans.networking.srv.ipv4;
|
||||
tcp_port = 8101;
|
||||
port_range_start = 50000;
|
||||
port_range_end = 52000;
|
||||
enable_loopback_candidate = false;
|
||||
turn_servers = [
|
||||
{
|
||||
host = config.services.coturn.realm;
|
||||
port = 3478;
|
||||
protocol = "tcp";
|
||||
secretFile = config.age.secrets.coturn_auth_secret.path;
|
||||
}
|
||||
{
|
||||
host = config.services.coturn.realm;
|
||||
port = 3478;
|
||||
protocol = "udp";
|
||||
secretFile = config.age.secrets.coturn_auth_secret.path;
|
||||
}
|
||||
{
|
||||
host = config.services.coturn.realm;
|
||||
port = 5349;
|
||||
protocol = "tls";
|
||||
secretFile = config.age.secrets.coturn_auth_secret.path;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
turn.enabled = false;
|
||||
};
|
||||
|
||||
inherit keyFile;
|
||||
};
|
||||
|
||||
networking.firewall =
|
||||
let
|
||||
range = with config.services.livekit'.settings.rtc; lib.singleton {
|
||||
from = port_range_start;
|
||||
to = port_range_end;
|
||||
};
|
||||
in
|
||||
{
|
||||
allowedUDPPortRanges = range;
|
||||
allowedUDPPorts = [ 80 443 8100 8101 8102 ];
|
||||
allowedTCPPortRanges = range;
|
||||
allowedTCPPorts = [ 80 443 8100 8101 8102 ];
|
||||
};
|
||||
|
||||
users.users.livekit.extraGroups = [ "turnserver" ];
|
||||
|
||||
services.lk-jwt-service = {
|
||||
enable = true;
|
||||
port = 8102;
|
||||
|
||||
livekitUrl = "wss://${domain}";
|
||||
|
||||
inherit keyFile;
|
||||
};
|
||||
|
||||
systemd.services.livekit-key = {
|
||||
before = [
|
||||
"lk-jwt-service.service"
|
||||
"livekit.service"
|
||||
];
|
||||
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
||||
path = with pkgs; [
|
||||
livekit
|
||||
coreutils
|
||||
gawk
|
||||
];
|
||||
|
||||
script = ''
|
||||
echo "Key missing, generating key"
|
||||
echo "lk-jwt-service: $(livekit-server generate-keys | tail -1 | awk '{print $3}')" > "${keyFile}"
|
||||
'';
|
||||
serviceConfig.Type = "oneshot";
|
||||
unitConfig.ConditionPathExists = "!${keyFile}";
|
||||
};
|
||||
|
||||
systemd.services.lk-jwt-service.environment.LIVEKIT_FULL_ACCESS_HOMESERVERS = "crans.org";
|
||||
|
||||
services.nginx.virtualHosts."${domain}" = {
|
||||
enableACME = true;
|
||||
forceSSL = true;
|
||||
|
||||
locations."~ /(get_token|healthz|sfu/get)" = {
|
||||
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."/" = {
|
||||
proxyPass = "http://localhost:${toString config.services.livekit'.settings.port}";
|
||||
proxyWebsockets = true;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -0,0 +1,253 @@
|
|||
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
pkgs,
|
||||
utils,
|
||||
...
|
||||
}:
|
||||
let
|
||||
cfg = config.services.livekit';
|
||||
format = pkgs.formats.json { };
|
||||
settings = lib.filterAttrsRecursive (_: v: v != null) cfg.settings;
|
||||
|
||||
isLocallyDistributed = config.services.livekit.ingress.enable;
|
||||
in
|
||||
{
|
||||
options.services.livekit' = {
|
||||
enable = lib.mkEnableOption "the livekit server";
|
||||
package = lib.mkPackageOption pkgs "livekit" { };
|
||||
|
||||
keyFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
LiveKit key file holding one or multiple application secrets. Use `livekit-server generate-keys` to generate a random key name and secret.
|
||||
|
||||
The file should have the format `<keyname>: <secret>`.
|
||||
Example:
|
||||
`lk-jwt-service: f6lQGaHtM5HfgZjIcec3cOCRfiDqIine4CpZZnqdT5cE`
|
||||
|
||||
Individual key/secret pairs need to be passed to clients to connect to this instance.
|
||||
'';
|
||||
};
|
||||
|
||||
openFirewall = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = "Opens port range for LiveKit on the firewall.";
|
||||
};
|
||||
|
||||
redis = {
|
||||
createLocally = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = isLocallyDistributed;
|
||||
defaultText = "true if any other Livekit component is enabled locally else false";
|
||||
description = "Whether to set up a local redis instance.";
|
||||
};
|
||||
|
||||
host = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = if cfg.redis.createLocally then "127.0.0.1" else null;
|
||||
defaultText = "127.0.0.1 if config.services.livekit.redis.createLocally else null";
|
||||
description = ''
|
||||
Address to bind local redis instance to.
|
||||
'';
|
||||
};
|
||||
|
||||
port = lib.mkOption {
|
||||
type = with lib.types; nullOr port;
|
||||
default = null;
|
||||
description = ''
|
||||
Port to bind local redis instance to.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
settings = lib.mkOption {
|
||||
type = lib.types.submodule {
|
||||
freeformType = format.type;
|
||||
options = {
|
||||
port = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 7880;
|
||||
description = "Main TCP port for RoomService and RTC endpoint.";
|
||||
};
|
||||
|
||||
redis = {
|
||||
address = lib.mkOption {
|
||||
type = with lib.types; nullOr str;
|
||||
default = if isLocallyDistributed then "${cfg.redis.host}:${toString cfg.redis.port}" else null;
|
||||
defaultText = lib.literalExpression "Local Redis host/port when a local ingress component is enabled else null";
|
||||
example = "redis.example.com:6379";
|
||||
description = "Host and port used to connect to a redis instance.";
|
||||
};
|
||||
};
|
||||
|
||||
rtc = {
|
||||
port_range_start = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 50000;
|
||||
description = "Start of UDP port range for WebRTC";
|
||||
};
|
||||
|
||||
port_range_end = lib.mkOption {
|
||||
type = lib.types.port;
|
||||
default = 51000;
|
||||
description = "End of UDP port range for WebRTC";
|
||||
};
|
||||
|
||||
use_external_ip = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = false;
|
||||
description = ''
|
||||
When set to true, attempts to discover the host's public IP via STUN.
|
||||
This is useful for cloud environments such as AWS & Google where hosts have an internal IP that maps to an external one.
|
||||
'';
|
||||
};
|
||||
|
||||
turn_servers = lib.mkOption {
|
||||
type = lib.types.listOf (lib.types.submodule {
|
||||
freeformType = format.type;
|
||||
options = {
|
||||
secretFile = lib.mkOption {
|
||||
type = lib.types.path;
|
||||
description = ''
|
||||
Path to a file containing the shared secret of a coturn server.
|
||||
'';
|
||||
};
|
||||
};
|
||||
});
|
||||
default = [];
|
||||
example = [
|
||||
{
|
||||
host = "coturn.example.com";
|
||||
port = 443;
|
||||
protocol = "tls";
|
||||
secretFile = "/run/turn_secret";
|
||||
}
|
||||
];
|
||||
description = ''
|
||||
An attribute set of turn servers.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
default = { };
|
||||
description = ''
|
||||
LiveKit configuration file expressed in nix.
|
||||
|
||||
For an example configuration, see <https://docs.livekit.io/home/self-hosting/deployment/#configuration>.
|
||||
For all possible values, see <https://github.com/livekit/livekit/blob/master/config-sample.yaml>.
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
config = lib.mkIf cfg.enable {
|
||||
assertions = [
|
||||
{
|
||||
assertion = cfg.redis.createLocally -> cfg.redis.port != null;
|
||||
message = ''
|
||||
When `services.livekit.redis.createLocally` is enabled `services.livekit.redis.port` must be configured.
|
||||
'';
|
||||
}
|
||||
];
|
||||
|
||||
networking.firewall = lib.mkIf cfg.openFirewall {
|
||||
allowedTCPPorts = [
|
||||
cfg.settings.port
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = cfg.settings.rtc.port_range_start;
|
||||
to = cfg.settings.rtc.port_range_end;
|
||||
}
|
||||
];
|
||||
};
|
||||
|
||||
# Provision a redis instance, when livekit-ingress (or later livekit-egress) are enabled on the same host
|
||||
services.redis.servers.livekit = lib.mkIf cfg.redis.createLocally {
|
||||
enable = true;
|
||||
bind = cfg.redis.host;
|
||||
port = cfg.redis.port;
|
||||
};
|
||||
|
||||
systemd = {
|
||||
tmpfiles.settings.livekit = {
|
||||
"/run/livekit-config.json"."f" = {
|
||||
mode = "600";
|
||||
user = "livekit";
|
||||
group = "livekit";
|
||||
};
|
||||
};
|
||||
|
||||
services.livekit = {
|
||||
description = "LiveKit SFU server";
|
||||
documentation = [ "https://docs.livekit.io" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
wants = [ "network-online.target" ];
|
||||
after = [ "network-online.target" ];
|
||||
|
||||
preStart =
|
||||
let
|
||||
file = "/run/livekit-config.json";
|
||||
in
|
||||
''
|
||||
cat ${format.generate "livekit.json" settings} > ${file}
|
||||
while $(cat ${file} | ${pkgs.jq}/bin/jq -e 'first((.rtc.turn_servers[]) | select(.secretFile != null)).secretFile != null')
|
||||
do
|
||||
secretFile=$(cat ${file} | ${pkgs.jq}/bin/jq -r 'first((.rtc.turn_servers[]) | select(.secretFile != null)).secretFile')
|
||||
cat ${file} | ${pkgs.jq}/bin/jq "first((.rtc.turn_servers[]) | select(.secretFile != null)).secret = \"$(cat $secretFile)\" | del(first((.rtc.turn_servers[]) | select(.secretFile != null)).secretFile)" > ${file}
|
||||
done
|
||||
'';
|
||||
|
||||
serviceConfig = {
|
||||
User = "livekit";
|
||||
Group = "livekit";
|
||||
LoadCredential = [ "livekit-secrets:${cfg.keyFile}" ];
|
||||
ExecStart = utils.escapeSystemdExecArgs [
|
||||
(lib.getExe cfg.package)
|
||||
"--config=/run/livekit-config.json"
|
||||
"--key-file=/run/credentials/livekit.service/livekit-secrets"
|
||||
];
|
||||
LockPersonality = true;
|
||||
MemoryDenyWriteExecute = true;
|
||||
ProtectClock = true;
|
||||
ProtectControlGroups = true;
|
||||
ProtectHostname = true;
|
||||
ProtectKernelLogs = true;
|
||||
ProtectKernelModules = true;
|
||||
ProtectKernelTunables = true;
|
||||
PrivateDevices = true;
|
||||
PrivateMounts = true;
|
||||
PrivateUsers = true;
|
||||
RestrictAddressFamilies = [
|
||||
"AF_INET"
|
||||
"AF_INET6"
|
||||
"AF_NETLINK"
|
||||
];
|
||||
RestrictNamespaces = true;
|
||||
RestrictRealtime = true;
|
||||
ProtectHome = true;
|
||||
SystemCallArchitectures = "native";
|
||||
SystemCallFilter = [
|
||||
"@system-service"
|
||||
"~@privileged"
|
||||
"~@resources"
|
||||
];
|
||||
Restart = "on-failure";
|
||||
RestartSec = 5;
|
||||
UMask = "077";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
users = {
|
||||
users.livekit = {
|
||||
isSystemUser = true;
|
||||
group = "livekit";
|
||||
};
|
||||
groups.livekit = { };
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -16,6 +16,5 @@
|
|||
|
||||
services = {
|
||||
acme.enable = true;
|
||||
coturn.enable = true;
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
{ config, ... }:
|
||||
|
||||
let
|
||||
turn_server = "coturn.crans.org";
|
||||
in
|
||||
{
|
||||
age.secrets = {
|
||||
ldap_synapse_password = {
|
||||
|
|
@ -19,11 +22,12 @@
|
|||
|
||||
appservice_irc_db_env = {
|
||||
file = ../../../secrets/neo/appservice_irc_db_env.age;
|
||||
owner = "matrix-synapse";
|
||||
};
|
||||
|
||||
coturn_auth_secret = {
|
||||
file = ../../../secrets/neo/coturn_auth_secret.age;
|
||||
owner = "turnserver";
|
||||
file = ../../../secrets/common/coturn_auth_secret.age;
|
||||
owner = "matrix-synapse";
|
||||
};
|
||||
};
|
||||
|
||||
|
|
@ -124,12 +128,18 @@
|
|||
];
|
||||
|
||||
turn_uris = [
|
||||
"turn:${config.services.coturn.realm}:3478?transport=udp"
|
||||
"turn:${config.services.coturn.realm}:3478?transport=tcp"
|
||||
"turn:${turn_server}:3478?transport=udp"
|
||||
"turn:${turn_server}:3478?transport=tcp"
|
||||
"turn:${turn_server}:5349?transport=tls"
|
||||
];
|
||||
turn_shared_secret = config.age.secrets.coturn_auth_secret.path;
|
||||
turn_user_lifetime = "1h";
|
||||
|
||||
matrix_rtc.transports = [{
|
||||
type = "livekit";
|
||||
livekit_service_url = "https://livekit.crans.org";
|
||||
}];
|
||||
|
||||
app_service_config_files = [
|
||||
"/var/lib/matrix-appservice-irc/registration.yml"
|
||||
];
|
||||
|
|
@ -151,6 +161,11 @@
|
|||
room_topic = "Salon utilisé par les administrateurs du serveur pour vous envoyer des informations importantes";
|
||||
auto_join = true;
|
||||
};
|
||||
|
||||
experimental_features = {
|
||||
# MatrixRTC
|
||||
msc4143_enabled = true;
|
||||
};
|
||||
};
|
||||
|
||||
extraConfigFiles = [
|
||||
|
|
|
|||
|
|
@ -323,9 +323,19 @@ in
|
|||
services.nginx.virtualHosts = {
|
||||
"www-alias-crans.org".default = true;
|
||||
|
||||
"_crans-org".locations = {
|
||||
"/_matrix/".proxyPass = "https://matrix.crans.org/_matrix/";
|
||||
"/_synapse/".proxyPass = "https://matrix.crans.org/_synapse/";
|
||||
"_crans-org" = {
|
||||
locations = {
|
||||
"/_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-Methods' 'OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Credentials' 'false' always;
|
||||
add_header 'Vary' 'Origin' always;
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,100 +0,0 @@
|
|||
{ config, lib, ... }:
|
||||
|
||||
let
|
||||
cfg = config.crans.services.coturn;
|
||||
|
||||
inherit (lib)
|
||||
mkEnableOption
|
||||
mkOption
|
||||
mkIf
|
||||
types
|
||||
;
|
||||
in
|
||||
|
||||
{
|
||||
options.crans.services.coturn = {
|
||||
enable = mkEnableOption "Coturn, un serveur TURN open-source.";
|
||||
|
||||
secretFile = mkOption {
|
||||
type = types.path;
|
||||
default = config.age.secrets.coturn_auth_secret.path;
|
||||
description = "Fichier contenant le secret de configuration du serveur.";
|
||||
};
|
||||
|
||||
fqdn = mkOption {
|
||||
type = types.str;
|
||||
default = "crans.org";
|
||||
description = "Domaine pour lequel le serveur coturn est configuré.";
|
||||
};
|
||||
|
||||
certFile = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/acme/${cfg.fqdn}/full.pem";
|
||||
description = "Fichier contenant le certificat associé au FQDN.";
|
||||
};
|
||||
|
||||
keyFile = mkOption {
|
||||
type = types.path;
|
||||
default = "/var/lib/acme/${cfg.fqdn}/key.pem";
|
||||
description = "Fichier contenant la clef associé au FQDN.";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.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-file = cfg.secretFile;
|
||||
realm = cfg.fqdn;
|
||||
cert = cfg.certFile;
|
||||
pkey = cfg.keyFile;
|
||||
extraConfig = ''
|
||||
verbose
|
||||
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
|
||||
'';
|
||||
};
|
||||
|
||||
networking.firewall = {
|
||||
allowedTCPPorts = [
|
||||
3478
|
||||
5349
|
||||
];
|
||||
allowedUDPPorts = [
|
||||
3478
|
||||
5349
|
||||
];
|
||||
allowedUDPPortRanges = [
|
||||
{
|
||||
from = config.services.coturn.min-port;
|
||||
to = config.services.coturn.max-port;
|
||||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
{
|
||||
imports = [
|
||||
./acme.nix
|
||||
./coturn.nix
|
||||
./nginx.nix
|
||||
./restic.nix
|
||||
./reverseproxy.nix
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ let
|
|||
apprentix = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDCJV6jqQWEYuwi+OJ9r/4TbBN/cK9NvYWNiJhpFzcc7 root@apprentix";
|
||||
cephiroth = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIOsBGkhiu6l3jeo15cQHMu3dPyL025zXPV2ZH02EDYEt root@nixos";
|
||||
collabora = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFa2D9fREtO2r2oIx6q9JAKFUHtxGbgEPMjkx09DQSU8 root@collabora";
|
||||
coturn = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIGoR66An5huQucZlueQCcB/vwd085wrS2mUIz39e8QLt root@nixos";
|
||||
jitsi = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIB6jVMIZ5y2oXX9HOkw7r5UUjw95MlFaFuu7FnEC0Q8z root@jitsi";
|
||||
livre = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIEVfKNokHG6ig32hhQxTep+fKFmKahlDClPrX/dP4/gb root@livre";
|
||||
mediakiwi = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFfcKtim7Aj+strHdg847D7KCCdoOAuasxx/2yi2TY1n root@mediakiwi";
|
||||
|
|
@ -56,6 +57,7 @@ let
|
|||
all = attrsets.mapAttrsToList (_: key: key) hosts;
|
||||
|
||||
acme = [
|
||||
hosts.coturn
|
||||
hosts.jitsi
|
||||
hosts.neo
|
||||
hosts.reverseproxy
|
||||
|
|
|
|||
|
|
@ -0,0 +1,58 @@
|
|||
age-encryption.org/v1
|
||||
-> ssh-ed25519 2k5NOg bM1vQnYz2d/XtvIAqgZWaV9h00EhoP8ELGJIjjHucUo
|
||||
jzRAdtv4x4LcV5RcfOImAm4kN3iWvwj5uVk00J04ub4
|
||||
-> ssh-ed25519 IJtQuw GOYphd63hgVN5RZRFFaJrnOMhx/ynHxhJrVU+sCuRXA
|
||||
6c4s9xnszULcAF5rpBz6cUpWu4a+6q4tYlh+6nNhCUc
|
||||
-> ssh-ed25519 7aCZxQ ejy6VrxzDsTO1MnGg1gzlfscHts0GayBWq6EnjH0/34
|
||||
DbQs4OYhZfQmSf5gckw7u4vQ5IXZyj08seaPHyE7anA
|
||||
-> ssh-ed25519 iTd7eA hGqPTtCwxU+jFXkqSw+ksPohKEV48IGUjObELjXdwkM
|
||||
S8ame9JvfBtcWSelu19oNv3B9iZ39WwEnuYtQLjPhtw
|
||||
-> ssh-ed25519 h5sWQA bjWx1tmXabuoM0b+JlvA7Vj5gxxKebqllgkHHx4M5lI
|
||||
9vMPxodcKbyWHyFpGG8uM7rCK3JaSANs6jweGeUDvB0
|
||||
-> ssh-ed25519 /Gpyew Av26H06LGF3pz7R+BtFrfI/bAVBcHhv6oyavN5hd2BU
|
||||
BObGU1+wF3m6+poaY8/0g7UgvnMwTh0juuk5k+wPDNg
|
||||
-> ssh-ed25519 APVFfA J/wJz2McMEGTkDNUFMvgTnBM0LLGtqzYB2fTjdnpK1k
|
||||
+Ka77arqbiThP0aD6BdxLGeLk9K+BgP3IO5oL5dQKXI
|
||||
-> ssh-ed25519 FtI9pg sPSjKdtIeXbWQiXPuoyPdBb1Plm18gcYcTmIaw+8cEE
|
||||
KNV+/GDFK3LlubxmBwOuoPR9XHkZ658HxMYEbNq/LR8
|
||||
-> ssh-ed25519 hTlmJA F+5JWR7iZEY0UEt6W2taeFPGRGp1onB6cTGRZUWVgBI
|
||||
OIgCe4fx7ExwsKOG7pF+TlrjzwF0eWUWAk4KZnGYtSc
|
||||
-> ssh-ed25519 GCcVXA 1SO1SXQb2cMg7id8XVy1jOQ2PpYyGzapUHiDCLSbUm4
|
||||
PbXeWdiqdbH98KgV6e/ZBkO+zS81D/O6jB+ZvoqrI9U
|
||||
-> ssh-ed25519 LAIH1A T+3hL9Vullh4GArLrBNJOYRyGEERUBUxR1ruTcurGR4
|
||||
noUgWh+ItZGjQWLyjOP7Pz7XyN81c9gbH/DqY9o//RE
|
||||
-> ssh-ed25519 qeMkwQ GhNieAL2vzkpU9aNEpAhFXWm1tUMn8MgwVWOmDDTYHE
|
||||
f6XxFZwd0dU9Qc5OkRnEz7yqnWSZpnK1d9eN+w+fJNw
|
||||
-> ssh-ed25519 TqxOLw 9J1A/crYBc0s5WRHB8GkhruM2yjEhrxAkmLiU4W8S2c
|
||||
WpXbWEQ8FX2c3iMmm4oKMAN3+dAZoEkmBD6WfCIto+Y
|
||||
-> piv-p256 ewCc3w A5BS2YEOzA1Vw4y8sMP+KbLwnVr0nZ6SUlbzw9Boj5AM
|
||||
YyC6vUYwGGp/rihZM84VCMGxvLvNY/L5bdfNnZO55us
|
||||
-> piv-p256 6CL/Pw AhycO/+3f7qLq7BMatIroL+sT61P8GqZXFSaiGlWNAyX
|
||||
q+hcsEz8Bfvx6zRr+13gxL9MkzHsYIanMeBD44Xt97c
|
||||
-> ssh-ed25519 eOAUSg DPIRJYzX16SYuAGKW6dF1ctewe5dZhmEerCkdVegi34
|
||||
8G0iRsTMISXVrp78naecWhEHSd144mFYWG4zXRXQxSc
|
||||
-> ssh-rsa REaZBA
|
||||
O8xHVa338tm/NDJzMdIpKpJDqe3JQ1z+9GQveEtEu/TYCjPb508zOhS1UlWpHPxn
|
||||
t9KHRxddIZcN6ESI1TPkt2SJ0Z9+PRCDJsVj7LXE+2bevc6QjFwZAZVp6LlJnanz
|
||||
tBLx1ji+P1vV1YFi/IA76ZbqABprf/RRfrEStVgcqhweTzwkyD6XSb7veA8Mk6Vw
|
||||
whDvNky2qKzscKLD7/t62KEKWIcOUs4o6ZRvSIH0nloQGo65pVgIrkUcWaxZsFea
|
||||
usZ/YYOm9+qfKlVIsz+7OjIvdb1oD3uE+EVIda7cohfn+xDIwFJOoPcQ33dhi/VP
|
||||
BnBcWKbgQsBMcDI/95ytSuvN/60sZk6HICQ1Aro2CrnHiUUfGcyLEh4vkpjtb0Ou
|
||||
NqEtkqOag85lYWrN/92jBb53Tb2yTfAlaMEEmHqLKQ35JGD56MuhE4tJ2p45UrEF
|
||||
74647+ig7Tgn04a0VPFSnMxsHGH1Y2wT5i6PPfVY9/J76daHfCl261cfbFjxEqgA
|
||||
|
||||
-> ssh-ed25519 J/iReg P0Y3DW1XcetX8AyxAouSW0JeA3JN/h9foBKnxuLCnz0
|
||||
vJ4Lce1NUiSDok2dRgC/dpw3dzwybR/+ms3/Ba6ZrJ4
|
||||
-> ssh-ed25519 GNhSGw RIbzUU4B1WcMRP61Vu5aZYuxPAsAn9X0Ww3Yet3FZnE
|
||||
XWJ6OwovuHHNuDWZfvoOxVqLvlZ5vAfgrm8A8QWDCpk
|
||||
-> ssh-ed25519 eXMAtA 9ZWrqLVOve5+rNtttTLPmrYkqKW1fAYgYDrc32AYtDI
|
||||
yWXkEfL3mJKhHyAT7yFTOL9ddLf7EG4KZUE2md4b2WA
|
||||
-> ssh-ed25519 5hXocQ fgO6tvKi57imBReNoQMNP3Wc7ygcF4zCDH6JKcn0NlQ
|
||||
9siPUHvHfvBXuTz4fwc5oJo5JHWmmgOQCzTKURPOng4
|
||||
-> ssh-ed25519 bRHVVA IciRYvXwFnK6ezVuVWYVqBTk/j+p5NMjMJXE3FS4NEY
|
||||
DnS4GQStNj4iDWI7fgtxRuoE5vtQCIBy9aO6USOFqWA
|
||||
-> ssh-ed25519 HgW9eA fvD/14o+aCPlX3vpmU2lxPGB42mFxZsVEFE36VMjNmQ
|
||||
S1B7wBp9fRDmMMv+ak4J7pB4kQG9zU35CMLKtJOfNow
|
||||
--- GJiv475BRLP6dSijqycUi/5y2mCWQhOAh6+eYZioyZ4
|
||||
oΣイX懦]7ラ,VvPNO b'゙セ2%)H。媛Ik<1A>_p<5F>pUtlI3y
|
||||
+ナ_!Yqtマ<74>ス剋L4ィシn崧Px}ミOASr<EFBCB3><%xX銈簔<E98A88>}ユ凄K5チゥJ<EFBDA9>)ン撤サモ<0C>」サァヲ<EFBDA7>槫扛毫鵝<15><0B>/<2F>Gス、ニE7ゥ餒゚粃ゥ;
|
||||
|
|
@ -1,33 +0,0 @@
|
|||
age-encryption.org/v1
|
||||
-> ssh-ed25519 /Gpyew gwwmM3XDedFdxIFd92REcgLv0CIb83f2wo81BTcmuVs
|
||||
7CLQlsrbdcC2I+TFop1iSB6YjH6E5MGrDbxPnePe3JU
|
||||
-> piv-p256 ewCc3w AgITAOii4K9+Xbq5ycDiVQycSmfdcQVASFlaKfTVpyYR
|
||||
UOThjo/BQF2tU2JMe+5rgNySiwfcZeCy0UHYxJICXDM
|
||||
-> piv-p256 6CL/Pw A5bw0Y8IFThwuoI7/8eOEkJEc1tLoGpMgHqKEvZq9kKH
|
||||
+LHipQ7p+tUkMmxfy5eDRuRP3+H3Iv5QCV4asfb2mdA
|
||||
-> ssh-ed25519 eOAUSg qk+sku6sjw2oIMwu/1nH+gUaHAoGD6/GnjlrXz07JQQ
|
||||
hC/LQEyaESI0UhJ5nW0vYHSUZuLhUCPpfUcCFM044Cc
|
||||
-> ssh-rsa REaZBA
|
||||
EFF327bjCoY1QnXjquMc53I1PEO7br6yY31wm54Tutqzl4oKRoVg7ztxOc1qleXX
|
||||
EHBOpf+/30o9SITi9U7B4L68WgsJh+B08+Wrok27BHpjzcHHZiT8VZJjQGhpFaN9
|
||||
TMehN/eH/C2A0PnBzdd7cHdlCJ3cXEMoZF/aTqMNe4+Jiyn122voxpV9Rt7eM72K
|
||||
Y0Mfsvwt+vJx+T+9dqcF187kQ8hc/83h0kxbqO7O/mrLfQpFLpF7wD52TAAX8vlX
|
||||
1DZukblDSSltRRt/2XI4SwtR8ioneJ3LKWq8PUNwvJ6rfjMo8KqwWsZqO7ar8YW3
|
||||
/H6ACGUphXZpWc3JuN3wZEodO+gwcYnx6AUgXuZ2DKLanmpmflTg43mRE8BZzDO5
|
||||
HWo/LOoErHRBPkiqXYDxyXP+Y3zhp7O7JTzIyA3dt4bjb3ksAKd7Hw4vy1Kqch2j
|
||||
XE4d5v0uDTMBV6PwJ58JcmqKkmWHLslA0+6GMIwvKqpFWorDa2WGhtKsWeV2eWqZ
|
||||
|
||||
-> ssh-ed25519 J/iReg FMq71dEMAtay7dBPc9qaZsw9qvXwE6EQznZn6xfRGHc
|
||||
910ePcO921m+dJA3MdOmkRYolUntUqpoksRm9CeEEpU
|
||||
-> ssh-ed25519 GNhSGw uIQ0FkYLMke1pRAJx2YnUEj7Bzy11JYDMtpw590Hj2o
|
||||
62iHQoKl/ysrWgpkmJLs/PUSsuRFNKd/QqvyoQ9tnU0
|
||||
-> ssh-ed25519 eXMAtA WCsV2/+iJq9PxXlgYKZG4cE7i5MzFB6Xs89JfCCPMzI
|
||||
zErA0D90CU3L7NRXTTmI9YzHSIdOiaBf2EGONw/XBOk
|
||||
-> ssh-ed25519 5hXocQ zmmtRrPesAFQYYZ6JpefonCBB2dNlCYxlS769OLoe3w
|
||||
/b7+nMn62LHvSyJ2u6nw6yh87aK4EPVK5uXGNpok/c4
|
||||
-> ssh-ed25519 bRHVVA hUUrPRVry1Ff1nZEztndLSEyUrTOhlfbrJCUvatnRyQ
|
||||
Y0TAB1jpR03VbdrAnDnWSeNTJX+srMfqaRCp106bgss
|
||||
-> ssh-ed25519 HgW9eA 5wiFunotVB/3vLxxiFPlNNYxdeffD2Efgi8dikTKl1o
|
||||
e1MvuQOP+1g832x9Kk9mJaFiPLYH4ngJlUh+rBZav7M
|
||||
--- CemGwNRUonRtuSx6BTHw2M9JHOuY4mZKoEqfGJgyjxE
|
||||
¢Ç-kžÃ|59CzàÁK‘¿û/S^h:¸ÉÖ”€Dú<44>H˜»¤Ab‡Z?Om-[¿¶JæbìïB°XVu<56>_Æ`‘FN²<4E>œÚ‹ÀtRD"O}ª<>ß <20>QøQú5<03>ìÝuaV>ZJ!‚;±ïÜØóOÀ&+b;¼˜y¹þb\îª-¥Ý5U
|
||||
Binary file not shown.
|
|
@ -0,0 +1,33 @@
|
|||
age-encryption.org/v1
|
||||
-> ssh-ed25519 7aCZxQ o+/sq+5iIPsEn79U2d6XmxkgOyhmg/L7GmeBrFR1EVg
|
||||
HQ7Z7jGJCTrhhPIIN52SYTw7nE0gtEQpOxfV3sPy82c
|
||||
-> piv-p256 ewCc3w AktaHGX3TyRxRTWJTQjhuhG0urtEQpxZOUBEO2rpGmKR
|
||||
o5PzBrc41FJ+YQTAe/an60wdG3o+PR/r4rriy2XlcD0
|
||||
-> piv-p256 6CL/Pw A5yJ8glRXvh782sazxZ4T7tjLvzIdaZXhAMyrB0ddrUN
|
||||
HlNA/DmAWyxUJ8RkFiGQqAxArpk8n7bl4EoKjsAAKus
|
||||
-> ssh-ed25519 eOAUSg ZuvrYCATYw3BT2nq8GaDMPJAebXlYBBMHvqqWULlvWE
|
||||
6KA+t715lLSOuIn4nLG8ex3klzq/Fmu7r4AAgSFdF+g
|
||||
-> ssh-rsa REaZBA
|
||||
J0UUcr4xZ8lG+y9et0TQjAtWbcN1vkiwPiuoyiOL8+1easGI+WCcw7UviO52Xktr
|
||||
wL9ndvSOw43tFW1EzOLaeij/dcq1mjHWkSUiGKyOQD4y6k14u7ad9Be/V3qLRs3m
|
||||
jrW5Nc4c77RvWbnhdAicG3lQmcvektxEJiL7EbykimmKIupsRDc+JAyQ3ewoWuzB
|
||||
Owk9XhmtSm47rHBRxn45rAsJw9GRCN0eozvFjmL6xR3eyoSr6qzh4Wp++BjFeQrF
|
||||
m2efJsuHUB4GpwSBy4kzOx7ETTXSwJJzGZjQbn7yUC/N+nl0Hu7jkcZfR1D/CByc
|
||||
HYW1hZTRhd/9DlqqKICBdKkLkj1FI6cKwIkcsAZz1q/1kZEyqAfDYrA0rypK0zqL
|
||||
8yUPFM16FudeiE4I87WDFPou0hoS8Zdl1pzyRScXFJESqT7y8AXeU7/g6e0mw7oi
|
||||
xIBBoS42vcFHxy/uf+Hth3PWOplWpaEGV/MegE13mBtgR8BYCEkBTDHyM1fqqSM8
|
||||
|
||||
-> ssh-ed25519 J/iReg T9B90cgLaH19+YM16JFPzxXWk/jOfJgL1S7ChuuVoRg
|
||||
5aAYeuoqS8MFvrvmuHGjWp402DiVO3MmzWxpkWePJZo
|
||||
-> ssh-ed25519 GNhSGw AvvAANHxtcDFohHO0o1GERDoukNEnzxr3MttqKZesE0
|
||||
xm0X3BzfmBDAsSIS6xZ8RXLUARqWOH0OItutgXTa4xc
|
||||
-> ssh-ed25519 eXMAtA dV+wfpM2TmMcz3HFHP92NbJG8GPEMbftbt1mOuNW7T4
|
||||
O8Mb+a6g9KzSmiQTsXjdkB6gMaDGkXcoAPxZVljMDOE
|
||||
-> ssh-ed25519 5hXocQ E91gcLfT9x5mioC24Djeu+KS0CIP5Rn+pzsrd1WctRQ
|
||||
Ou7s3JDkGikOKdJ9aOzzQOhKtrxj52ccuWCWnmCEoO4
|
||||
-> ssh-ed25519 bRHVVA 90J6z+GTk6TGV8pp1yfFf5uLklzS0k4T+AT61wUPAlw
|
||||
u3Jm6knl5366qhQSFbpjocdjuoouxj3y9fQ+D+bjMGw
|
||||
-> ssh-ed25519 HgW9eA eKu3G+e3gTp29WTcP4sdvTYC/dMgmzNL8IuCveLkjXs
|
||||
PNIpx90DHxb551Kslci0gxkXxtmSLu4Y6kk81ApXmis
|
||||
--- AQfRyPbRD5utbB9BIlfo78Hj8hYHA8MtZscv2yfYSDI
|
||||
A…ð<>}À¹Ü€‘˜U¬I‡X{aPƒ÷‘þ¨c©¥´ô)‰ø«Ú¦ò¸`Z&iñSHƒ¾…qƒí»=£u,6¼$µuíE¿Nh4Ê?RÄΘÌ<CB9C>Pd‹<64>fÀ#´B¹)Fަ¬zÛøô•½òb‡5QÀ>t`ؾ۩iH u1ÊêaÏ£6üÎ
|
||||
Loading…
Reference in New Issue