diff --git a/konnect/wrapper.sh b/konnect/wrapper.sh index feec739..937bcb6 100755 --- a/konnect/wrapper.sh +++ b/konnect/wrapper.sh @@ -19,12 +19,15 @@ if [ ! -s "$eckey" ]; then openssl ec -in "$ecparam" -out "$eckey" >/dev/null 2>&1 fi -konnectd utils jwk-from-pem --use sig "$eckey" > /tmp/jwk-meet.json -CONFIG_JSON=/etc/kopano/konnectd-identifier-registration.yaml -#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 -# TODO this last bit can likely go -yq -y . $CONFIG_JSON | sponge /kopano/ssl/konnectd-identifier-registration.yaml +if [ "${allow_client_guests:-}" = "yes" ]; then + echo "Patching identifier registration for use of the Meet guest mode" + konnectd utils jwk-from-pem --use sig "$eckey" > /tmp/jwk-meet.json + CONFIG_JSON=/etc/kopano/konnectd-identifier-registration.yaml + #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 + # TODO this last bit can likely go + yq -y . $CONFIG_JSON | sponge /kopano/ssl/konnectd-identifier-registration.yaml +fi # source additional configuration from Konnect cfg (potentially overwrites env vars) if [ -e /etc/kopano/konnectd.cfg ]; then