3 Commits

Author SHA1 Message Date
cortex 4e1fb4b194 mas fix 2026-05-24 11:36:12 +01:00
cortex f872b9e8f5 . 2026-05-24 11:26:17 +01:00
cortex ae5154ee51 Upstream config fix 2026-05-24 11:10:16 +01:00
2 changed files with 18 additions and 2 deletions
+17 -2
View File
@@ -98,13 +98,17 @@ fix_ownership "${VOLUME_PATH}/mas"
log_info "Linking Synapse and MAS via OIDC..."
CLIENT_ID="synapse-client"
CLIENT_ID="0000000000000000000SYNAPSE"
CLIENT_SECRET=$(openssl rand -hex 32)
ADMIN_SECRET=$(openssl rand -hex 32)
MATRIX_SECRET=$(openssl rand -hex 32)
MATRIX_ENDPOINT="http://synapse:8008"
EXISTING_CLIENT=$(yq '.clients[] | select(.client_id == "'"${CLIENT_ID}"'")' "$MAS_CFG" 2>/dev/null || echo "")
if [[ -z "$EXISTING_CLIENT" ]]; then
CLIENT_OBJ="{
\"client_id\": \"${CLIENT_ID}\",
\"client_auth_method\": \"client_secret_basic\",
\"client_secret\": \"${CLIENT_SECRET}\",
\"redirect_uris\": [\"https://${HOMESERVER_FQDN}/_synapse/client/oidc/callback\"],
\"grant_types\": [\"authorization_code\", \"refresh_token\"],
@@ -112,12 +116,22 @@ if [[ -z "$EXISTING_CLIENT" ]]; then
\"scopes\": [\"openid\", \"profile\", \"email\"],
\"application_type\": \"web\"
}"
yq -y -i ".clients += [$CLIENT_OBJ]" "$SYNAPSE_CFG" || { log_error "Failed to register Synapse client in MAS"; exit 1; }
yq -y -i ".clients += [$CLIENT_OBJ]" "$MAS_CFG" || { log_error "Failed to register Synapse client in MAS"; exit 1; }
log_info " -> Registered Synapse as OIDC client in MAS"
else
log_info " -> Synapse client already registered in MAS, skipping"
fi
# Ensure the matrix section exists
if ! yq '.matrix' "$MAS_CFG" > /dev/null 2>&1; then
yq -y -i '.matrix = {}' "$MAS_CFG"
fi
yq -y -i ".matrix.homeserver = \"${HOMESERVER_FQDN}\"" "$MAS_CFG"
yq -y -i ".matrix.secret = \"${MATRIX_SECRET}\"" "$MAS_CFG"
yq -y -i ".matrix.endpoint = \"${MATRIX_ENDPOINT}\"" "$MAS_CFG"
ISSUER_URL="https://${MAS_FQDN}"
fix_ownership "$SYNAPSE_CFG"
@@ -129,6 +143,7 @@ if ! yq '.oidc_providers' "$SYNAPSE_CFG" 2>/dev/null | grep -q "idp_id"; then
\"issuer\": \"${ISSUER_URL}\",
\"client_id\": \"${CLIENT_ID}\",
\"client_secret\": \"${CLIENT_SECRET}\",
\"shared_secret\": \"${MATRIX_SECRET}\",
\"scopes\": [\"openid\", \"profile\"],
\"skip_verification\": false
}]" "$SYNAPSE_CFG" || { log_error "Failed to inject OIDC config"; exit 1; }
+1
View File
@@ -234,6 +234,7 @@ services:
- "--entrypoints.web.address=:80"
- "--entrypoints.websecure.address=:443"
- "--certificatesresolvers.myresolver.acme.tlschallenge=true"
- "--certificatesresolvers.myresolver.acme.caserver=https://acme-staging-v02.api.letsencrypt.org/directory"
- "--certificatesresolvers.myresolver.acme.email=${PG_USER}@${DOMAIN}"
- "--certificatesresolvers.myresolver.acme.storage=/etc/traefik/acme.json"
networks: