From c4667331118807df4adb47de8ff87bdae7cbff43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Floure?= Date: Fri, 7 Jan 2022 11:42:13 +0100 Subject: [PATCH] __matrix_synapse: add --enable-3pid-lookups flag, normalize indentation --- .../__matrix_synapse/files/homeserver.yaml.sh | 2 +- type/__matrix_synapse/man.rst | 3 + type/__matrix_synapse/manifest | 68 ++++++++++--------- type/__matrix_synapse/parameter/boolean | 1 + 4 files changed, 42 insertions(+), 32 deletions(-) diff --git a/type/__matrix_synapse/files/homeserver.yaml.sh b/type/__matrix_synapse/files/homeserver.yaml.sh index f0df206..6437f1b 100755 --- a/type/__matrix_synapse/files/homeserver.yaml.sh +++ b/type/__matrix_synapse/files/homeserver.yaml.sh @@ -1334,7 +1334,7 @@ fi cat << EOF # Enable 3PIDs lookup requests to identity servers from this server. # -#enable_3pid_lookup: true +enable_3pid_lookup: ${ENABLE_3PID_LOOKUPS:?} # If set, allows registration of standard or admin accounts by anyone who # has the shared secret, even if registration is otherwise disabled. diff --git a/type/__matrix_synapse/man.rst b/type/__matrix_synapse/man.rst index 125a9ac..dbcc993 100644 --- a/type/__matrix_synapse/man.rst +++ b/type/__matrix_synapse/man.rst @@ -239,6 +239,9 @@ allow-public-rooms-without-auth enable-server-notices Enable the server notices room. +enable-3pid-lookups + Enable 3PIDs lookup requests to identity servers from this server. + allow-guest-access Allows users to register as guests without a password/email/etc, and participate in rooms hosted on this server which have been made accessible diff --git a/type/__matrix_synapse/manifest b/type/__matrix_synapse/manifest index 078d395..70232a8 100755 --- a/type/__matrix_synapse/manifest +++ b/type/__matrix_synapse/manifest @@ -37,7 +37,7 @@ case "$os" in --uri https://packages.matrix.org/debian/ \ --component main package_req="__apt_source/matrix-org" - ;; + ;; alpine) synapse_user=synapse synapse_pkg=synapse @@ -96,7 +96,7 @@ export SERVER_NAME BASE_URL REPORT_STATS MAX_UPLOAD_SIZE EXPOSE_METRICS \ WEB_CLIENT_URL ROOM_ENCRYPTION_POLICY BIND_ADDRESSES if [ -f "$__object/parameter/enable-server-notices" ]; then - export ENABLE_SERVER_NOTICES=1 + export ENABLE_SERVER_NOTICES=1 fi # TLS. @@ -178,51 +178,57 @@ if [ -f "$__object/parameter/registration-shared-secret" ]; then fi if [ -f "$__object/parameter/registration-requires-email" ]; then - export REGISTRATION_REQUIRES_EMAIL=1 + export REGISTRATION_REQUIRES_EMAIL=1 fi if [ -f "$__object/parameter/auto-join-room" ]; then - AUTO_JOIN_ROOMS="$(cat "$__object/parameter/auto-join-room")" - export AUTO_JOIN_ROOMS + AUTO_JOIN_ROOMS="$(cat "$__object/parameter/auto-join-room")" + export AUTO_JOIN_ROOMS fi if [ -f "$__object/parameter/registration-allows-email-pattern" ]; then - RESGISTRATION_ALLOWS_EMAIL_PATTERN=$(cat "$__object/parameter/registration-allows-email-pattern") - export RESGISTRATION_ALLOWS_EMAIL_PATTERN + RESGISTRATION_ALLOWS_EMAIL_PATTERN=$(cat "$__object/parameter/registration-allows-email-pattern") + export RESGISTRATION_ALLOWS_EMAIL_PATTERN fi if [ -f "$__object/parameter/saml2-idp-metadata-url" ]; then - # Synapse fails to start while trying to parse IDP metadata if this package - # is not installed. - __package xmlsec1 + # Synapse fails to start while trying to parse IDP metadata if this package + # is not installed. + __package xmlsec1 - SAML2_IDP_METADATA_URL=$(cat "$__object/parameter/saml2-idp-metadata-url") - export SAML2_IDP_METADATA_URL + SAML2_IDP_METADATA_URL=$(cat "$__object/parameter/saml2-idp-metadata-url") + export SAML2_IDP_METADATA_URL fi if [ -f "$__object/parameter/saml2-sp-key" ]; then - SAML2_SP_KEY=$(cat "$__object/parameter/saml2-sp-key") - export SAML2_SP_KEY + SAML2_SP_KEY=$(cat "$__object/parameter/saml2-sp-key") + export SAML2_SP_KEY fi if [ -f "$__object/parameter/saml2-sp-cert" ]; then - SAML2_SP_CERT=$(cat "$__object/parameter/saml2-sp-cert") - export SAML2_SP_CERT + SAML2_SP_CERT=$(cat "$__object/parameter/saml2-sp-cert") + export SAML2_SP_CERT fi if [ -n "$SAML2_SP_KEY" ] && [ -z "$SAML2_SP_CERT" ]; then - echo "--saml2-sp-cert must be set if --saml2-sp-key is provided." >&2 - exit 1 + echo "--saml2-sp-cert must be set if --saml2-sp-key is provided." >&2 + exit 1 elif [ -n "$SAML2_SP_CERT" ] && [ -z "$SAML2_SP_KEY" ]; then - echo "--saml2-sp-key must be set if --saml2-sp-cert is provided." >&2 - exit 1 + echo "--saml2-sp-key must be set if --saml2-sp-cert is provided." >&2 + exit 1 fi if [ -f "$__object/parameter/default-identity-server" ]; then - DEFAULT_IDENTITY_SERVER=$(cat "$__object/parameter/default-identity-server") - export DEFAULT_IDENTITY_SERVER + DEFAULT_IDENTITY_SERVER=$(cat "$__object/parameter/default-identity-server") + export DEFAULT_IDENTITY_SERVER fi +ENABLE_3PID_LOOKUPS='false' +if [ -f "$__object/parameter/enable-3pid-lookup" ]; then + ENABLE_3PID_LOOKUPS='true' +fi +export ENABLE_3PID_LOOKUPS + # Federation. ALLOW_PUBLIC_ROOMS_OVER_FEDERATION=$(get_boolean_for 'allow-public-room-over-federation') ALLOW_PUBLIC_ROOMS_WITHOUT_AUTH=$(get_boolean_for 'allow-public-rooms-without-auth') @@ -321,16 +327,16 @@ export ENABLE_REPLICATION ENABLE_REDIS_SUPPORT WORKER_REPLICATION_SECRET \ case "$DATABASE_ENGINE" in sqlite3) : - ;; + ;; psycopg2) when='database engine is psycopg2' is_required_when "$DATABASE_HOST" '--database-host' "$when" is_required_when "$DATABASE_USER" '--database-user' "$when" - ;; + ;; *) echo "Invalid database engine: $DATABASE_ENGINE." >&2 exit 1 - ;; + ;; esac @@ -348,13 +354,13 @@ mkdir -p "$__object/files" "$__type/files/log.config.sh" > "$__object/files/log.config" require="$synapse_req" __file "$synapse_conf_dir/homeserver.yaml" \ - --owner $synapse_user \ - --mode 600 \ - --source "$__object/files/homeserver.yaml" + --owner $synapse_user \ + --mode 600 \ + --source "$__object/files/homeserver.yaml" require="$synapse_req" __file "$LOG_CONFIG_PATH" \ - --owner $synapse_user \ - --mode 600 \ - --source "$__object/files/log.config" + --owner $synapse_user \ + --mode 600 \ + --source "$__object/files/log.config" for directory in $DATA_DIR $LOG_DIR; do require="$synapse_req" __directory $directory \ diff --git a/type/__matrix_synapse/parameter/boolean b/type/__matrix_synapse/parameter/boolean index 7ff48de..ac87271 100644 --- a/type/__matrix_synapse/parameter/boolean +++ b/type/__matrix_synapse/parameter/boolean @@ -17,3 +17,4 @@ user-directory-search-all-users enable-message-retention-policy worker-mode enable-url-preview +enable-3pid-lookups