Skip to content

Commit 5408e9e

Browse files
authored
Merge pull request jitsi#122 from jitsi/token-parameter-additions
prosody: new variables for prosody
2 parents 33a45ec + 412bc4b commit 5408e9e

File tree

5 files changed

+37
-5
lines changed

5 files changed

+37
-5
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,6 +185,10 @@ Variable | Description | Example
185185
`JWT_APP_SECRET` | Application secret known only to your token | my_jitsi_app_secret
186186
`JWT_ACCEPTED_ISSUERS` | (Optional) Set asap_accepted_issuers as a comma separated list | my_web_client,my_app_client
187187
`JWT_ACCEPTED_AUDIENCES` | (Optional) Set asap_accepted_audiences as a comma separated list | my_server1,my_server2
188+
`JWT_ASAP_KEYSERVER` | (Optional) Set asap_keyserver to a url where public keys can be found | https://example.com/asap
189+
`JWT_ALLOW_EMPTY` | (Optional) Allow anonymous users with no JWT while validating JWTs when provided | 0
190+
`JWT_AUTH_TYPE` | (Optional) Controls which module is used for processing incoming JWTs | token
191+
`JWT_TOKEN_AUTH_MODULE` | (Optional) Controls which module is used for validating JWTs | token_verification
188192

189193
This can be tested using the [jwt.io] debugger. Use the following samople payload:
190194

@@ -242,6 +246,8 @@ Variable | Description | Default value
242246
`XMPP_MODULES` | Custom Prosody modules for XMPP_DOMAIN (comma separated) | mod_info,mod_alert
243247
`XMPP_MUC_MODULES` | Custom Prosody modules for MUC component (comma separated) | mod_info,mod_alert
244248
`XMPP_INTERNAL_MUC_MODULES` | Custom Prosody modules for internal MUC component (comma separated) | mod_info,mod_alert
249+
`GLOBAL_MODULES` | Custom prosodule modules to load in global configuration (comma separated) | mod_statistics,mod_alert
250+
`GLOBAL_CONFIG` | Custom configuration string with escaped newlines | foo = bar;\nkey = val;
245251
`JICOFO_COMPONENT_SECRET` | XMPP component password for Jicofo | s3cr37
246252
`JICOFO_AUTH_USER` | XMPP user for Jicofo client connections | focus
247253
`JICOFO_AUTH_PASSWORD` | XMPP password for Jicofo client connections | passw0rd
@@ -267,6 +273,7 @@ Variable | Description | Default value
267273
`JIGASI_TRANSCRIBER_ADVERTISE_URL` | Jigasi post to the chat an url with transcription file | true
268274
`DISABLE_HTTPS` | Disable HTTPS, this can be useful if TLS connections are going to be handled outside of this setup | 1
269275
`ENABLE_HTTP_REDIRECT` | Redirects HTTP traffic to HTTPS | 1
276+
`LOG_LEVEL` | Controls which logs are output from prosody and associated modules | info
270277

271278
### Running behind NAT or on a LAN environment
272279

docker-compose.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ services:
4545
- AUTH_TYPE
4646
- ENABLE_AUTH
4747
- ENABLE_GUESTS
48+
- GLOBAL_MODULES
49+
- GLOBAL_CONFIG
4850
- LDAP_URL
4951
- LDAP_BASE
5052
- LDAP_BINDDN
@@ -76,6 +78,11 @@ services:
7678
- JWT_APP_SECRET
7779
- JWT_ACCEPTED_ISSUERS
7880
- JWT_ACCEPTED_AUDIENCES
81+
- JWT_ASAP_KEYSERVER
82+
- JWT_ALLOW_EMPTY
83+
- JWT_AUTH_TYPE
84+
- JWT_TOKEN_AUTH_MODULE
85+
- LOG_LEVEL
7986
- TZ
8087
networks:
8188
meet.jitsi:

prosody/rootfs/defaults/conf.d/jitsi-meet.cfg.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ http_default_host = "{{ .Env.XMPP_DOMAIN }}"
44

55
{{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "0" | toBool }}
66
{{ $AUTH_TYPE := .Env.AUTH_TYPE | default "internal" }}
7+
{{ $JWT_ASAP_KEYSERVER := .Env.JWT_ASAP_KEYSERVER | default "" }}
8+
{{ $JWT_ALLOW_EMPTY := .Env.JWT_ALLOW_EMPTY | default "0" | toBool }}
9+
{{ $JWT_AUTH_TYPE := .Env.JWT_AUTH_TYPE | default "token" }}
10+
{{ $JWT_TOKEN_AUTH_MODULE := .Env.JWT_TOKEN_AUTH_MODULE | default "token_verification" }}
711

812
{{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") .Env.JWT_ACCEPTED_ISSUERS }}
913
asap_accepted_issuers = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_ISSUERS) }}" }
@@ -16,11 +20,15 @@ asap_accepted_audiences = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_AU
1620
VirtualHost "{{ .Env.XMPP_DOMAIN }}"
1721
{{ if $ENABLE_AUTH }}
1822
{{ if eq $AUTH_TYPE "jwt" }}
19-
authentication = "token"
23+
authentication = "{{ $JWT_AUTH_TYPE }}"
2024
app_id = "{{ .Env.JWT_APP_ID }}"
2125
app_secret = "{{ .Env.JWT_APP_SECRET }}"
22-
allow_empty_token = false
23-
{{ else if eq $AUTH_TYPE "ldap" }}
26+
allow_empty_token = {{ if $JWT_ALLOW_EMPTY }}true{{ else }}false{{ end }}
27+
{{ if $JWT_ASAP_KEYSERVER }}
28+
asap_key_server = "{{ .Env.JWT_ASAP_KEYSERVER }}"
29+
{{ end }}
30+
31+
{{ else if eq $AUTH_TYPE "ldap" }}
2432
authentication = "cyrus"
2533
cyrus_application_name = "xmpp"
2634
allow_unencrypted_plain_auth = true
@@ -78,7 +86,7 @@ Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc"
7886
"{{ join "\";\n\"" (splitList "," .Env.XMPP_MUC_MODULES) }}";
7987
{{ end }}
8088
{{ if eq $AUTH_TYPE "jwt" }}
81-
"token_verification";
89+
"{{ $JWT_TOKEN_AUTH_MODULE }}";
8290
{{ end }}
8391
}
8492

prosody/rootfs/defaults/prosody.cfg.lua

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
{{ $LOG_LEVEL := .Env.LOG_LEVEL | default "info" }}
2+
13
-- Prosody Example Configuration File
24
--
35
-- Information on configuring Prosody can be found on our
@@ -70,6 +72,9 @@ modules_enabled = {
7072
--"watchregistrations"; -- Alert admins of registrations
7173
--"motd"; -- Send a message to users when they log in
7274
--"legacyauth"; -- Legacy authentication. Only used by some old clients and bots.
75+
{{ if .Env.GLOBAL_MODULES }}
76+
"{{ join "\";\n\"" (splitList "," .Env.GLOBAL_MODULES) }}";
77+
{{ end }}
7378
};
7479

7580
https_ports = { }
@@ -143,9 +148,13 @@ authentication = "internal_plain"
143148
-- Logs info and higher to /var/log
144149
-- Logs errors to syslog also
145150
log = {
146-
{ levels = {min = "info"}, to = "console"};
151+
{ levels = {min = "{{ $LOG_LEVEL }}"}, to = "console"};
147152
}
148153

154+
{{ if .Env.GLOBAL_CONFIG }}
155+
{{ join "\n" (splitList "\\n" .Env.GLOBAL_CONFIG) }}
156+
{{ end }}
157+
149158
component_interface = { "*" }
150159

151160
data_path = "/config/data"

prosody/rootfs/etc/cont-init.d/10-config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ fi
3131

3232
if [[ ! -f $PROSODY_CFG ]]; then
3333
cp -r /defaults/* /config
34+
tpl /defaults/prosody.cfg.lua > $PROSODY_CFG
3435
tpl /defaults/conf.d/jitsi-meet.cfg.lua > /config/conf.d/jitsi-meet.cfg.lua
3536

3637
prosodyctl --config $PROSODY_CFG register $JICOFO_AUTH_USER $XMPP_AUTH_DOMAIN $JICOFO_AUTH_PASSWORD

0 commit comments

Comments
 (0)