From 81f81beb106a49651d2765cf37c623e48b22e688 Mon Sep 17 00:00:00 2001 From: Samuel Trégouët Date: Wed, 28 Apr 2021 15:43:34 +0000 Subject: Jibri installation et configuration --- .../templates/chrome-extension-background.js.j2 | 41 ++++++ roles/jibri-install/templates/jibri.conf | 152 +++++++++++++++++++++ 2 files changed, 193 insertions(+) create mode 100644 roles/jibri-install/templates/chrome-extension-background.js.j2 create mode 100644 roles/jibri-install/templates/jibri.conf (limited to 'roles/jibri-install/templates') diff --git a/roles/jibri-install/templates/chrome-extension-background.js.j2 b/roles/jibri-install/templates/chrome-extension-background.js.j2 new file mode 100644 index 0000000..10eb1ed --- /dev/null +++ b/roles/jibri-install/templates/chrome-extension-background.js.j2 @@ -0,0 +1,41 @@ + +chrome.runtime.onInstalled.addListener(function() { + chrome.storage.managed.get("forcedCookies", managedItems => { + if (!managedItems.hasOwnProperty('forcedCookies')) { + return; + } + for (const item of managedItems.forcedCookies) { + chrome.cookies.set({ + url: `https://${item.domain}/`, + domain: item.domain, + name: item.name, + value: item.value + }); + } + }) + + // temp hack because loading config from managed policies seems too slow + const forcedCookies = [ + { + domain: "{{ jitsi_server_host }}", + name: "rgpd", + value: "nothing" + }, + {% for host in cookies_dns|default([]) %} + { + domain: "{{ host }}", + name: "rgpd", + value: "nothing" + }, + {% endfor %} + ]; + for (const item of forcedCookies) { + chrome.cookies.set({ + url: `https://${item.domain}/`, + domain: item.domain, + name: item.name, + value: item.value + }); + } + +}); diff --git a/roles/jibri-install/templates/jibri.conf b/roles/jibri-install/templates/jibri.conf new file mode 100644 index 0000000..eb9b4ce --- /dev/null +++ b/roles/jibri-install/templates/jibri.conf @@ -0,0 +1,152 @@ +jibri { + // A unique identifier for this Jibri + // TODO: eventually this will be required with no default + id = "{{ inventory_hostname }}" + // Whether or not Jibri should return to idle state after handling + // (successfully or unsuccessfully) a request. A value of 'true' + // here means that a Jibri will NOT return back to the IDLE state + // and will need to be restarted in order to be used again. + single-use-mode = false + api { + http { + external-api-port = 2222 + internal-api-port = 3333 + } + xmpp { + // See example_xmpp_envs.conf for an example of what is expected here + environments = [ + { + // A user-friendly name for this environment + name = "prod env" + + // A list of XMPP server hosts to which we'll connect + xmpp-server-hosts = [ + "{{ jitsi_server_host }}", + ] + + // The base XMPP domain + xmpp-domain = "{{ jitsi_server_host }}" + + // The MUC we'll join to announce our presence for + // recording and streaming services + control-muc { + domain = "internal.auth.{{ jitsi_server_host }}" + room-name = "JibriBrewery" + nickname = "{{ inventory_hostname }}-nickname" + } + + // The login information for the control MUC + control-login { + domain = "auth.{{ jitsi_server_host }}" + // Optional port, defaults to 5222. + // port = 6222 + username = "{{ jibri_user }}" + password = "{{ jibri_password }}" + } + + // An (optional) MUC configuration where we'll + // join to announce SIP gateway services + # sip-control-muc { + # domain = "domain" + # room-name = "room-name" + # nickname = "nickname" + # } + + // The login information the selenium web client will use + call-login { + domain = "recorder.{{ jitsi_server_host }}" + username = "{{ jibri_user }}-record" + password = "{{ jibri_password }}" + } + + // The value we'll strip from the room JID domain to derive + // the call URL + strip-from-room-domain = "conference." + + // How long Jibri sessions will be allowed to last before + // they are stopped. A value of 0 allows them to go on + // indefinitely + usage-timeout = 1 hour + + // Whether or not we'll automatically trust any cert on + // this XMPP domain + trust-all-xmpp-certs = true + } + ] + } + } + recording { + recordings-directory = "/tmp/recordings" + # TODO: make this an optional param and remove the default + # finalize-script = "/path/to/finalize" + } + streaming { + // A list of regex patterns for allowed RTMP URLs. The RTMP URL used + // when starting a stream must match at least one of the patterns in + // this list. + rtmp-allow-list = [ + // By default, all services are allowed + ".*" + ] + } + ffmpeg { + resolution = "1280x720" + // The audio source that will be used to capture audio on Linux + audio-source = "alsa" + // The audio device that will be used to capture audio on Linux + audio-device = "plug:bsnoop" + } + chrome { + // The flags which will be passed to chromium when launching + flags = [ + {% if jitsi_cookie_enabled | default(false) %} + "--load-extension=/opt/chrome-extension-cookie", + {% endif %} + "--use-fake-ui-for-media-stream", + "--start-maximized", + "--kiosk", + "--enabled", + "--disable-infobars", + "--autoplay-policy=no-user-gesture-required" + ] + } + stats { + enable-stats-d = true + } + webhook { + // A list of subscribers interested in receiving webhook events + subscribers = [] + } + jwt-info { + // The path to a .pem file which will be used to sign JWT tokens used in webhook + // requests. If not set, no JWT will be added to webhook requests. + # signing-key-path = "/path/to/key.pem" + + // The kid to use as part of the JWT + # kid = "key-id" + + // The issuer of the JWT + # issuer = "issuer" + + // The audience of the JWT + # audience = "audience" + + // The TTL of each generated JWT. Can't be less than 10 minutes. + # ttl = 1 hour + } + call-status-checks { + // If all clients have their audio and video muted and if Jibri does not + // detect any data stream (audio or video) comming in, it will stop + // recording after NO_MEDIA_TIMEOUT expires. + no-media-timeout = 30 seconds + + // If all clients have their audio and video muted, Jibri consideres this + // as an empty call and stops the recording after ALL_MUTED_TIMEOUT expires. + all-muted-timeout = 10 minutes + + // When detecting if a call is empty, Jibri takes into consideration for how + // long the call has been empty already. If it has been empty for more than + // DEFAULT_CALL_EMPTY_TIMEOUT, it will consider it empty and stop the recording. + default-call-empty-timeout = 30 seconds + } +} \ No newline at end of file -- cgit v1.2.3