1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-07 16:06:14 +00:00

Merge pull request #377 from fbartels/konnect-domain-change

rework "guest already configured check"
This commit is contained in:
Felix Bartels 2020-04-01 11:54:36 +02:00 committed by GitHub
commit bf8a545e3e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 8 deletions

2
.gitignore vendored
View File

@ -9,3 +9,5 @@ dive.log
docker-compose.override.yml docker-compose.override.yml
build.tags build.tags
calendar/kopano-calendar-*/ calendar/kopano-calendar-*/
*.pem
apt_auth.conf

View File

@ -48,11 +48,11 @@ fi
# Create working copy by merging packaged example in /etc/kopano with passed registration conf # Create working copy by merging packaged example in /etc/kopano with passed registration conf
CONFIG_JSON=/tmp/konnectd-identifier-registration.yaml CONFIG_JSON=/tmp/konnectd-identifier-registration.yaml
yq -s '.[0] + .[1]' /etc/kopano/konnectd-identifier-registration.yaml "${identifier_registration_conf:?}" | sponge "$CONFIG_JSON" yq -y -s '.[0] + .[1]' /etc/kopano/konnectd-identifier-registration.yaml "${identifier_registration_conf:?}" | sponge "$CONFIG_JSON"
if [ "${allow_client_guests:-}" = "yes" ]; then if [ "${allow_client_guests:-}" = "yes" ]; then
# only modify identifier registration if it does not already contain the right settings # only modify identifier registration if it does not already contain the right settings
if ! grep -q "konnect/guestok" "$CONFIG_JSON"; then if ! yq .clients[].id /kopano/ssl/konnectd-identifier-registration.yaml | grep -q "kpop-https://${FQDN%/*}/meet/"; then
# TODO this could be simplified so that ecparam and eckey are only required if there is no jwk-meet.json yet # TODO this could be simplified so that ecparam and eckey are only required if there is no jwk-meet.json yet
ecparam=${ecparam:-/etc/kopano/ecparam.pem} ecparam=${ecparam:-/etc/kopano/ecparam.pem}
@ -82,12 +82,11 @@ if [ "${allow_client_guests:-}" = "yes" ]; then
openssl ec -in "$ecparam" -out "$eckey" >/dev/null 2>&1 openssl ec -in "$ecparam" -out "$eckey" >/dev/null 2>&1
fi fi
echo "Patching identifier registration for use of the Meet guest mode" echo "Entrypoint: Patching identifier registration for use of the Meet guest mode"
/usr/local/bin/konnectd utils jwk-from-pem --use sig "$eckey" > /tmp/jwk-meet.json /usr/local/bin/konnectd utils jwk-from-pem --use sig "$eckey" > /tmp/jwk-meet.json
#yq -y ".clients += [{\"id\": \"grapi-explorer.js\", \"name\": \"Grapi Explorer\", \"application_type\": \"web\", \"trusted\": true, \"insecure\": true, \"redirect_uris\": [\"http://$FQDNCLEANED:3000/\"]}]" $CONFIG_JSON | sponge $CONFIG_JSON #yq -y ".clients += [{\"id\": \"grapi-explorer.js\", \"name\": \"Grapi Explorer\", \"application_type\": \"web\", \"trusted\": true, \"insecure\": true, \"redirect_uris\": [\"http://$FQDNCLEANED:3000/\"]}]" $CONFIG_JSON | sponge $CONFIG_JSON
yq -y ".clients += [{\"id\": \"kpop-https://${FQDN%/*}/meet/\", \"name\": \"Kopano Meet\", \"application_type\": \"web\", \"trusted\": true, \"redirect_uris\": [\"https://${FQDN%/*}/meet/\"], \"trusted_scopes\": [\"konnect/guestok\", \"kopano/kwm\"], \"jwks\": {\"keys\": [{\"kty\": $(jq .kty /tmp/jwk-meet.json), \"use\": $(jq .use /tmp/jwk-meet.json), \"crv\": $(jq .crv /tmp/jwk-meet.json), \"d\": $(jq .d /tmp/jwk-meet.json), \"kid\": $(jq .kid /tmp/jwk-meet.json), \"x\": $(jq .x /tmp/jwk-meet.json), \"y\": $(jq .y /tmp/jwk-meet.json)}]},\"request_object_signing_alg\": \"ES256\"}]" $CONFIG_JSON | sponge $CONFIG_JSON yq -y ".clients += [{\"id\": \"kpop-https://${FQDN%/*}/meet/\", \"name\": \"Kopano Meet\", \"application_type\": \"web\", \"trusted\": true, \"redirect_uris\": [\"https://${FQDN%/*}/meet/\"], \"trusted_scopes\": [\"konnect/guestok\", \"kopano/kwm\"], \"jwks\": {\"keys\": [{\"kty\": $(jq .kty /tmp/jwk-meet.json), \"use\": $(jq .use /tmp/jwk-meet.json), \"crv\": $(jq .crv /tmp/jwk-meet.json), \"d\": $(jq .d /tmp/jwk-meet.json), \"kid\": $(jq .kid /tmp/jwk-meet.json), \"x\": $(jq .x /tmp/jwk-meet.json), \"y\": $(jq .y /tmp/jwk-meet.json)}]},\"request_object_signing_alg\": \"ES256\"}]" $CONFIG_JSON >> /tmp/guest-mode.yml
# TODO this last bit can likely go (but then we must default to a registry stored below /etc/kopano) yq -y -s '.[0] + .[1]' $CONFIG_JSON /tmp/guest-mode.yml | sponge "$identifier_registration_conf"
yq -y . $CONFIG_JSON | sponge "$identifier_registration_conf"
else else
echo "Entrypoint: Skipping guest mode configuration, as it is already configured." echo "Entrypoint: Skipping guest mode configuration, as it is already configured."
fi fi
@ -95,8 +94,8 @@ fi
if [ "${external_oidc_provider:-}" = "yes" ]; then if [ "${external_oidc_provider:-}" = "yes" ]; then
echo "Patching identifier registration for external OIDC provider" echo "Patching identifier registration for external OIDC provider"
echo "authorities: [{name: ${external_oidc_name:-}, default: yes, iss: ${external_oidc_url:-}, client_id: kopano-meet, client_secret: ${external_oidc_clientsecret:-}, authority_type: oidc, response_type: id_token, scopes: [openid, profile, email]}]" >> /tmp/authority.json echo "authorities: [{name: ${external_oidc_name:-}, default: yes, iss: ${external_oidc_url:-}, client_id: kopano-meet, client_secret: ${external_oidc_clientsecret:-}, authority_type: oidc, response_type: id_token, scopes: [openid, profile, email]}]" >> /tmp/authority.yml
yq -s '.[0] + .[1]' $CONFIG_JSON /tmp/authority.json | sponge "$identifier_registration_conf" yq -y -s '.[0] + .[1]' $CONFIG_JSON /tmp/authority.yml | sponge "$identifier_registration_conf"
fi fi
# source additional configuration from Konnect cfg (potentially overwrites env vars) # source additional configuration from Konnect cfg (potentially overwrites env vars)