2020-05-04 15:00:58 +00:00
|
|
|
{ config, lib, pkgs, ... }:
|
|
|
|
|
|
|
|
with lib;
|
|
|
|
|
|
|
|
let
|
|
|
|
cfg = config.services.jicofo;
|
|
|
|
in
|
|
|
|
{
|
|
|
|
options.services.jicofo = with types; {
|
2022-08-28 19:18:44 +00:00
|
|
|
enable = mkEnableOption (lib.mdDoc "Jitsi Conference Focus - component of Jitsi Meet");
|
2020-05-04 15:00:58 +00:00
|
|
|
|
|
|
|
xmppHost = mkOption {
|
|
|
|
type = str;
|
|
|
|
example = "localhost";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-05-04 15:00:58 +00:00
|
|
|
Hostname of the XMPP server to connect to.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
xmppDomain = mkOption {
|
|
|
|
type = nullOr str;
|
|
|
|
example = "meet.example.org";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-05-04 15:00:58 +00:00
|
|
|
Domain name of the XMMP server to which to connect as a component.
|
|
|
|
|
2022-07-28 21:19:15 +00:00
|
|
|
If null, {option}`xmppHost` is used.
|
2020-05-04 15:00:58 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
componentPasswordFile = mkOption {
|
|
|
|
type = str;
|
|
|
|
example = "/run/keys/jicofo-component";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-05-04 15:00:58 +00:00
|
|
|
Path to file containing component secret.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
userName = mkOption {
|
|
|
|
type = str;
|
|
|
|
default = "focus";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-05-04 15:00:58 +00:00
|
|
|
User part of the JID for XMPP user connection.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
userDomain = mkOption {
|
|
|
|
type = str;
|
|
|
|
example = "auth.meet.example.org";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-05-04 15:00:58 +00:00
|
|
|
Domain part of the JID for XMPP user connection.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
userPasswordFile = mkOption {
|
|
|
|
type = str;
|
|
|
|
example = "/run/keys/jicofo-user";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-05-04 15:00:58 +00:00
|
|
|
Path to file containing password for XMPP user connection.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
bridgeMuc = mkOption {
|
|
|
|
type = str;
|
|
|
|
example = "jvbbrewery@internal.meet.example.org";
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
2020-05-04 15:00:58 +00:00
|
|
|
JID of the internal MUC used to communicate with Videobridges.
|
|
|
|
'';
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkOption {
|
|
|
|
type = attrsOf str;
|
|
|
|
default = { };
|
2021-10-03 16:06:03 +00:00
|
|
|
example = literalExpression ''
|
2020-05-04 15:00:58 +00:00
|
|
|
{
|
|
|
|
"org.jitsi.jicofo.auth.URL" = "XMPP:jitsi-meet.example.com";
|
|
|
|
}
|
|
|
|
'';
|
2022-07-28 21:19:15 +00:00
|
|
|
description = lib.mdDoc ''
|
|
|
|
Contents of the {file}`sip-communicator.properties` configuration file for jicofo.
|
2020-05-04 15:00:58 +00:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
services.jicofo.config = mapAttrs (_: v: mkDefault v) {
|
|
|
|
"org.jitsi.jicofo.BRIDGE_MUC" = cfg.bridgeMuc;
|
|
|
|
};
|
|
|
|
|
|
|
|
users.groups.jitsi-meet = {};
|
|
|
|
|
|
|
|
systemd.services.jicofo = let
|
|
|
|
jicofoProps = {
|
|
|
|
"-Dnet.java.sip.communicator.SC_HOME_DIR_LOCATION" = "/etc/jitsi";
|
|
|
|
"-Dnet.java.sip.communicator.SC_HOME_DIR_NAME" = "jicofo";
|
|
|
|
"-Djava.util.logging.config.file" = "/etc/jitsi/jicofo/logging.properties";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
{
|
|
|
|
description = "JItsi COnference FOcus";
|
|
|
|
wantedBy = [ "multi-user.target" ];
|
|
|
|
after = [ "network.target" ];
|
|
|
|
|
|
|
|
restartTriggers = [
|
|
|
|
config.environment.etc."jitsi/jicofo/sip-communicator.properties".source
|
|
|
|
];
|
|
|
|
environment.JAVA_SYS_PROPS = concatStringsSep " " (mapAttrsToList (k: v: "${k}=${toString v}") jicofoProps);
|
|
|
|
|
2020-07-15 19:41:29 +00:00
|
|
|
script = ''
|
|
|
|
${pkgs.jicofo}/bin/jicofo \
|
|
|
|
--host=${cfg.xmppHost} \
|
|
|
|
--domain=${if cfg.xmppDomain == null then cfg.xmppHost else cfg.xmppDomain} \
|
|
|
|
--secret=$(cat ${cfg.componentPasswordFile}) \
|
|
|
|
--user_name=${cfg.userName} \
|
|
|
|
--user_domain=${cfg.userDomain} \
|
|
|
|
--user_password=$(cat ${cfg.userPasswordFile})
|
|
|
|
'';
|
|
|
|
|
2020-05-04 15:00:58 +00:00
|
|
|
serviceConfig = {
|
|
|
|
Type = "exec";
|
|
|
|
|
|
|
|
DynamicUser = true;
|
|
|
|
User = "jicofo";
|
|
|
|
Group = "jitsi-meet";
|
|
|
|
|
|
|
|
CapabilityBoundingSet = "";
|
|
|
|
NoNewPrivileges = true;
|
|
|
|
ProtectSystem = "strict";
|
|
|
|
ProtectHome = true;
|
|
|
|
PrivateTmp = true;
|
|
|
|
PrivateDevices = true;
|
|
|
|
ProtectHostname = true;
|
|
|
|
ProtectKernelTunables = true;
|
|
|
|
ProtectKernelModules = true;
|
|
|
|
ProtectControlGroups = true;
|
|
|
|
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_UNIX" ];
|
|
|
|
RestrictNamespaces = true;
|
|
|
|
LockPersonality = true;
|
|
|
|
RestrictRealtime = true;
|
|
|
|
RestrictSUIDSGID = true;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
environment.etc."jitsi/jicofo/sip-communicator.properties".source =
|
|
|
|
pkgs.writeText "sip-communicator.properties" (
|
2020-07-08 21:47:37 +00:00
|
|
|
generators.toKeyValue {} cfg.config
|
2020-05-04 15:00:58 +00:00
|
|
|
);
|
|
|
|
environment.etc."jitsi/jicofo/logging.properties".source =
|
|
|
|
mkDefault "${pkgs.jicofo}/etc/jitsi/jicofo/logging.properties-journal";
|
|
|
|
};
|
|
|
|
|
2020-08-04 19:46:14 +00:00
|
|
|
meta.maintainers = lib.teams.jitsi.members;
|
2020-05-04 15:00:58 +00:00
|
|
|
}
|