1
0
mirror of https://github.com/zokradonh/kopano-docker synced 2025-06-07 16:06:14 +00:00
kopano-docker/konnect/wrapper.sh
Felix Bartels 87b844b10e
Add grapi-explorer (#215)
* grapi explorer is located in its own (optional) file
* update readme
* optimize eclint check
2019-08-20 21:58:54 +02:00

43 lines
2.0 KiB
Bash
Executable File

#!/bin/sh
set -e
# TODO since this file is only used here, also generate it here.
dockerize \
-wait file:///kopano/ssl/meet-kwmserver.pem \
-timeout 360s
cd /kopano/ssl/
konnectd utils jwk-from-pem --use sig /kopano/ssl/meet-kwmserver.pem > /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
yq -y . $CONFIG_JSON | sponge /kopano/ssl/konnectd-identifier-registration.yaml
# shellcheck disable=SC2154
if [ -n "$log_level" ]; then
set -- "$@" --log-level="$log_level"
fi
# shellcheck disable=SC2154
if [ "$allow_client_guests" = "yes" ]; then
set -- "$@" "--allow-client-guests"
fi
# shellcheck disable=SC2154
if [ "$allow_dynamic_client_registration" = "yes" ]; then
set -- "$@" "--allow-dynamic-client-registration"
fi
dockerize \
-wait file:///kopano/ssl/konnectd-tokens-signing-key.pem \
-wait file:///kopano/ssl/konnectd-encryption.key \
-timeout 360s
exec konnectd serve \
--signing-private-key=/kopano/ssl/konnectd-tokens-signing-key.pem \
--encryption-secret=/kopano/ssl/konnectd-encryption.key \
--iss=https://"$FQDN" \
--identifier-registration-conf /kopano/ssl/konnectd-identifier-registration.yaml \
--identifier-scopes-conf /etc/kopano/konnectd-identifier-scopes.yaml \
"$@" kc