Remove registration_shared_secret from homeserver.yaml for security; trigger restart of Synapse after admin user creation
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing

This commit is contained in:
gyurix
2025-09-02 10:27:22 +02:00
parent 1134fd915c
commit 72cb30e706

View File

@@ -116,6 +116,14 @@ register_admin_user() {
if echo "$response" | grep -q '"user_id"\|"access_token"'; then
echo "Admin user created successfully!"
# renmove registration_shared_secret from homeserver.yaml for security
yq eval '.registration_shared_secret = ""' /data/homeserver.yaml > /data/homeserver.yaml.tmp && mv /data/homeserver.yaml.tmp /data/homeserver.yaml
# trigger a restart of synapse to reload config
echo '{"NAME":"service-matrix.containers.matrixserver-app"}' | jq -r > /var/tmp/input/upgrade.json
echo "Matrix server app restart requested"
return 0
else
echo "Failed to create admin user. Response: $response"
@@ -135,7 +143,6 @@ check_admin_by_login() {
if echo "$response" | grep -q access_token; then
echo "Successfully logged in as admin user"
yq eval '.registration_shared_secret = ""' /data/homeserver.yaml > /data/homeserver.yaml.tmp && mv /data/homeserver.yaml.tmp /data/homeserver.yaml
return 0 # User exists and password is correct
fi