diff --git a/README.md b/README.md index b1a4dd497736b54d0b114bb1eaf347d4cc7c0c51..b26eb1d9849abfb6ae16fa5a0917270f564cfd04 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,22 @@ Below is a description of the config file's properties: * `janusBitrate`: The default bitrate with which a camera feed is transmitted by Janus. Defaults to `128000`. +* `janusAdminKey`: Admin key for the Janus API, which is required to create new rooms. + It is recommended to use this feature becuase it reduces attack possibilities. + Defaults to an empty string. + + **Important**: This key needs to match the admin key in the config file for the + Janus videoroom plugin. In the used development environment it is located at + `/opt/janus/etc/janus/janus.plugin.videoroom.jcfg`. The admin key can be set + in the `general: { ... }` block of the janus config using the `admin_key` directive. + + Example: + ``` + general: { + admin_key = "MySafeAdminKey" + } + ``` + ## Stdin-Interface The camera server is controlled by PULT via its stdin. One could also implement the interface in any other program to manage the CVH-Camera. diff --git a/camera-server/example-config.json b/camera-server/example-config.json index 5bfb42bce5f938379ad68adc5df1435202d065c0..c16619dcf6d82a8e704cfb09de053a6c8a43dab9 100644 --- a/camera-server/example-config.json +++ b/camera-server/example-config.json @@ -6,5 +6,6 @@ "janusRoom": 1000, "janusRoomSecret": "changeit", "janusRoomPin": "abc123", - "janusBitrate": 128000 + "janusBitrate": 128000, + "janusAdminKey": "changeit" } diff --git a/camera-server/src/config/config.ts b/camera-server/src/config/config.ts index f74834ae6aadcc96838ce1c97d2575a43c8a6820..c14023ffa61f658d8bbac86c425203e96cc0f9a7 100644 --- a/camera-server/src/config/config.ts +++ b/camera-server/src/config/config.ts @@ -10,6 +10,7 @@ interface Config { janusRoomSecret: string; janusRoomPin: string; janusBitrate: number; + janusAdminKey: string; } // Required to access config with config[key] @@ -44,7 +45,8 @@ const indexableConfig: IndexableConfig = { janusRoom: 1000, janusRoomSecret: 'default', janusRoomPin: '', - janusBitrate: 128000 + janusBitrate: 128000, + janusAdminKey: '' }; if (fileContent) { diff --git a/camera-server/src/janus/janus-api.ts b/camera-server/src/janus/janus-api.ts index fb0df2a093e461402adb3ce542fd296c8f1b5644..73282777c4fefdb595120ee01206f75a4c1a75d9 100644 --- a/camera-server/src/janus/janus-api.ts +++ b/camera-server/src/janus/janus-api.ts @@ -14,6 +14,7 @@ interface RoomConfig { secret?: string; pin?: string; description?: string; + admin_key?: string; } export const api = axios.create({ diff --git a/camera-server/src/janus/janus-room.ts b/camera-server/src/janus/janus-room.ts index cb21b585c1caa9e8b9cf10887486919a6d20373d..8836ebafad2c155350e8b00416e7968985925a86 100644 --- a/camera-server/src/janus/janus-room.ts +++ b/camera-server/src/janus/janus-room.ts @@ -128,7 +128,8 @@ class JanusRoom { bitrate: config.janusBitrate, publishers: config.cameraSlots, pin: config.janusRoomPin, - secret: config.janusRoomSecret + secret: config.janusRoomSecret, + admin_key: config.janusAdminKey } );