Skip to content

Commit 88997f5

Browse files
mm28ajosMarkus Münzel
and
Markus Münzel
authored
prosody: authentication by matrix user authentication service
Added env variables and prosody plugins to authenticate prosody users by the matrix user authentication service, refer to https://github.com/matrix-org/prosody-mod-auth-matrix-user-verification Co-authored-by: Markus Münzel <[email protected]>
1 parent 7a93978 commit 88997f5

File tree

4 files changed

+45
-4
lines changed

4 files changed

+45
-4
lines changed

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ services:
170170
- JWT_ALLOW_EMPTY
171171
- JWT_AUTH_TYPE
172172
- JWT_TOKEN_AUTH_MODULE
173+
- MATRIX_UVS_URL
174+
- MATRIX_UVS_ISSUER
175+
- MATRIX_UVS_AUTH_TOKEN
176+
- MATRIX_UVS_SYNC_POWER_LEVELS
173177
- LOG_LEVEL
174178
- LDAP_AUTH_METHOD
175179
- LDAP_BASE

env.example

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ ETHERPAD_SKIN_VARIANTS="super-light-toolbar super-light-editor light-background
142142
# Enable guest access
143143
#ENABLE_GUESTS=1
144144

145-
# Select authentication type: internal, jwt or ldap
145+
# Select authentication type: internal, jwt, ldap or matrix
146146
#AUTH_TYPE=internal
147147

148148
# JWT authentication
@@ -207,6 +207,22 @@ ETHERPAD_SKIN_VARIANTS="super-light-toolbar super-light-editor light-background
207207
# LDAP_START_TLS=1
208208

209209

210+
# Matrix authentication (for more information see the documention of the "Prosody Auth Matrix User Verification" at https://github.com/matrix-org/prosody-mod-auth-matrix-user-verification)
211+
#
212+
213+
# Base URL to the matrix user verification service (without ending slash)
214+
#MATRIX_UVS_URL=https://uvs.example.com:3000
215+
216+
# (optional) The issuer of the auth token to be passed through. Must match what is being set as `iss` in the JWT. Defaut value is "issuer".
217+
#MATRIX_UVS_ISSUER=issuer
218+
219+
# (optional) user verification service auth token, if authentication enabled
220+
#MATRIX_UVS_AUTH_TOKEN=changeme
221+
222+
# (optional) Make Matrix room moderators owners of the Prosody room.
223+
#MATRIX_UVS_SYNC_POWER_LEVELS=1
224+
225+
210226
#
211227
# Advanced configuration options (you generally don't need to change these)
212228
#

prosody/Dockerfile

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ LABEL org.opencontainers.image.documentation="https://jitsi.github.io/handbook/"
2626

2727
ENV XMPP_CROSS_DOMAIN="false"
2828

29+
ARG VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN="1.7.0"
30+
2931
RUN wget -qO /etc/apt/trusted.gpg.d/prosody.gpg https://prosody.im/files/prosody-debian-packages.key && \
3032
echo "deb http://packages.prosody.im/debian bullseye main" > /etc/apt/sources.list.d/prosody.list && \
3133
apt-dpkg-wrap apt-get update && \
@@ -47,7 +49,12 @@ RUN wget -qO /etc/apt/trusted.gpg.d/prosody.gpg https://prosody.im/files/prosody
4749
mv /tmp/pkg/usr/share/jitsi-meet/prosody-plugins /prosody-plugins && \
4850
apt-cleanup && \
4951
rm -rf /tmp/pkg /var/cache/apt && \
50-
patch -d /usr/lib/prosody/modules/muc -p0 < /prosody-plugins/muc_owner_allow_kick.patch
52+
patch -d /usr/lib/prosody/modules/muc -p0 < /prosody-plugins/muc_owner_allow_kick.patch && \
53+
wget https://github.com/matrix-org/prosody-mod-auth-matrix-user-verification/archive/refs/tags/v$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN.tar.gz && \
54+
tar -xf v$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN.tar.gz && \
55+
mv prosody-mod-auth-matrix-user-verification-$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN/mod_auth_matrix_user_verification.lua $PROSODY_PLUGINS_FOLDER && \
56+
mv prosody-mod-auth-matrix-user-verification-$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN/mod_matrix_power_sync.lua $PROSODY_PLUGINS_FOLDER && \
57+
rm -rf prosody-mod-auth-matrix-user-verification-$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN v$VERSION_MATRIX_USER_VERIFICATION_SERVICE_PLUGIN.tar.gz
5158

5259
COPY rootfs/ /
5360

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

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
{{ $JWT_ASAP_KEYSERVER := .Env.JWT_ASAP_KEYSERVER | default "" }}
55
{{ $JWT_ALLOW_EMPTY := .Env.JWT_ALLOW_EMPTY | default "0" | toBool }}
66
{{ $JWT_AUTH_TYPE := .Env.JWT_AUTH_TYPE | default "token" }}
7+
{{ $MATRIX_UVS_ISSUER := .Env.MATRIX_UVS_ISSUER | default "issuer" }}
8+
{{ $MATRIX_UVS_SYNC_POWER_LEVELS := .Env.MATRIX_UVS_SYNC_POWER_LEVELS | default "0" | toBool }}
79
{{ $JWT_TOKEN_AUTH_MODULE := .Env.JWT_TOKEN_AUTH_MODULE | default "token_verification" }}
810
{{ $ENABLE_LOBBY := .Env.ENABLE_LOBBY | default "true" | toBool }}
911
{{ $ENABLE_AV_MODERATION := .Env.ENABLE_AV_MODERATION | default "true" | toBool }}
@@ -85,11 +87,20 @@ VirtualHost "{{ .Env.XMPP_DOMAIN }}"
8587
{{ if $JWT_ASAP_KEYSERVER }}
8688
asap_key_server = "{{ .Env.JWT_ASAP_KEYSERVER }}"
8789
{{ end }}
88-
89-
{{ else if eq $AUTH_TYPE "ldap" }}
90+
{{ else if eq $AUTH_TYPE "ldap" }}
9091
authentication = "cyrus"
9192
cyrus_application_name = "xmpp"
9293
allow_unencrypted_plain_auth = true
94+
{{ else if eq $AUTH_TYPE "matrix" }}
95+
authentication = "matrix_user_verification"
96+
app_id = "{{ $MATRIX_UVS_ISSUER }}"
97+
uvs_base_url = "{{ .Env.MATRIX_UVS_URL }}"
98+
{{ if .Env.MATRIX_UVS_AUTH_TOKEN }}
99+
uvs_auth_token = "{{ .Env.MATRIX_UVS_AUTH_TOKEN }}"
100+
{{ end }}
101+
{{ if $MATRIX_UVS_SYNC_POWER_LEVELS }}
102+
uvs_sync_power_levels = true
103+
{{ end }}
93104
{{ else if eq $AUTH_TYPE "internal" }}
94105
authentication = "internal_hashed"
95106
{{ end }}
@@ -198,6 +209,9 @@ Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc"
198209
{{ end -}}
199210
{{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") -}}
200211
"{{ $JWT_TOKEN_AUTH_MODULE }}";
212+
{{ end }}
213+
{{ if and $ENABLE_AUTH (eq $AUTH_TYPE "matrix") $MATRIX_UVS_SYNC_POWER_LEVELS -}}
214+
"matrix_power_sync";
201215
{{ end -}}
202216
{{ if not $DISABLE_POLLS -}}
203217
"polls";

0 commit comments

Comments
 (0)