xmpp: add jwt authentication support
This commit is contained in:
committed by
Saúl Ibarra Corretgé
parent
a235af06d0
commit
df36d71542
@@ -1,11 +1,25 @@
|
||||
FROM jitsi/base
|
||||
|
||||
ADD https://raw.githubusercontent.com/jitsi/jitsi-meet/fc129d9849ca5e26245d54df6451931b6c179987/resources/prosody-plugins/token/util.lib.lua /prosody-plugins/token/util.lib.lua
|
||||
ADD https://raw.githubusercontent.com/jitsi/jitsi-meet/fc129d9849ca5e26245d54df6451931b6c179987/resources/prosody-plugins/mod_token_verification.lua /prosody-plugins/mod_token_verification.lua
|
||||
ADD https://raw.githubusercontent.com/jitsi/jitsi-meet/fc129d9849ca5e26245d54df6451931b6c179987/resources/prosody-plugins/mod_auth_token.lua /prosody-plugins/mod_auth_token.lua
|
||||
|
||||
RUN sed -i s/hook/hook_global/g /prosody-plugins/mod_auth_token.lua
|
||||
|
||||
RUN \
|
||||
apt-dpkg-wrap apt-get update && \
|
||||
apt-dpkg-wrap apt-get install -y lua5.2 liblua5.2-dev libssl1.0-dev lua-basexx luarocks gcc git && \
|
||||
apt-dpkg-wrap apt-get install -t stretch-backports -y prosody && \
|
||||
apt-cleanup && \
|
||||
rm -rf /etc/prosody
|
||||
|
||||
RUN \
|
||||
luarocks install lua-cjson 2.1.0-1 && \
|
||||
luarocks install luajwtjitsi
|
||||
|
||||
RUN \
|
||||
apt-dpkg-wrap apt-get remove -y liblua5.2-dev libssl1.0-dev gcc git && \
|
||||
apt-cleanup
|
||||
|
||||
COPY rootfs/ /
|
||||
|
||||
EXPOSE 5222 5269 5347 5280
|
||||
|
||||
@@ -1,13 +1,28 @@
|
||||
admins = { "{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}" }
|
||||
plugin_paths = { "/prosody-plugins-custom" }
|
||||
plugin_paths = { "/prosody-plugins/", "/prosody-plugins-custom" }
|
||||
http_default_host = "{{ .Env.XMPP_DOMAIN }}"
|
||||
|
||||
{{ if and (.Env.ENABLE_AUTH | default "0" | toBool) (.Env.JWT_ENABLE_TOKEN_AUTH | default "0" | toBool) .Env.JWT_ACCEPTED_ISSUERS }}
|
||||
asap_accepted_issuers = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_ISSUERS) }}" }
|
||||
{{ end }}
|
||||
|
||||
{{ if and (.Env.ENABLE_AUTH | default "0" | toBool) (.Env.JWT_ENABLE_TOKEN_AUTH | default "0" | toBool) .Env.JWT_ACCEPTED_AUDIENCES }}
|
||||
asap_accepted_audiences = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_AUDIENCES) }}" }
|
||||
{{ end }}
|
||||
|
||||
VirtualHost "{{ .Env.XMPP_DOMAIN }}"
|
||||
{{ if .Env.ENABLE_AUTH | default "0" | toBool }}
|
||||
authentication = "internal_plain"
|
||||
{{ if .Env.ENABLE_AUTH | default "0" | toBool }}
|
||||
{{ if .Env.JWT_ENABLE_TOKEN_AUTH | default "0" | toBool }}
|
||||
authentication = "token"
|
||||
app_id = "{{ .Env.JWT_APP_ID }}"
|
||||
app_secret = "{{ .Env.JWT_APP_SECRET }}"
|
||||
allow_empty_token = false
|
||||
{{ else }}
|
||||
authentication = "anonymous"
|
||||
authentication = "internal_plain"
|
||||
{{ end }}
|
||||
{{ else }}
|
||||
authentication = "anonymous"
|
||||
{{ end }}
|
||||
ssl = {
|
||||
key = "/config/certs/{{ .Env.XMPP_DOMAIN }}.key";
|
||||
certificate = "/config/certs/{{ .Env.XMPP_DOMAIN }}.crt";
|
||||
@@ -52,8 +67,10 @@ Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc"
|
||||
{{ if .Env.XMPP_MUC_MODULES }}
|
||||
"{{ join "\";\n\"" (splitList "," .Env.XMPP_MUC_MODULES) }}";
|
||||
{{ end }}
|
||||
{{ if .Env.JWT_ENABLE_TOKEN_AUTH | default "0" | toBool }}
|
||||
"token_verification";
|
||||
{{ end }}
|
||||
}
|
||||
|
||||
Component "focus.{{ .Env.XMPP_DOMAIN }}"
|
||||
component_secret = "{{ .Env.JICOFO_COMPONENT_SECRET }}"
|
||||
|
||||
|
||||
@@ -10,6 +10,14 @@ if [[ "$(stat -c %U /config)" != "prosody" ]]; then
|
||||
chown -R prosody /config
|
||||
fi
|
||||
|
||||
if [[ "$(stat -c %U /prosody-plugins)" != "prosody" ]]; then
|
||||
chown -R prosody /prosody-plugins
|
||||
fi
|
||||
|
||||
if [[ "$(stat -c %U /prosody-plugins-custom)" != "prosody" ]]; then
|
||||
chown -R prosody /prosody-plugins-custom
|
||||
fi
|
||||
|
||||
if [[ ! -f $PROSODY_CFG ]]; then
|
||||
cp -r /defaults/* /config
|
||||
tpl /defaults/conf.d/jitsi-meet.cfg.lua > /config/conf.d/jitsi-meet.cfg.lua
|
||||
|
||||
Reference in New Issue
Block a user