Add support for adjusting Synapse rate-limiting configuration

This commit is contained in:
Slavi Pantaleev 2019-04-01 21:40:14 +03:00
parent 77359ae867
commit 631b7cc6a6
3 changed files with 45 additions and 1 deletions

View File

@ -36,6 +36,20 @@ matrix_corporal_http_api_auth_token: "AUTH_TOKEN_HERE"
# If you need to change the reconciliator user's id from the default (matrix-corporal).. # If you need to change the reconciliator user's id from the default (matrix-corporal)..
# In any case, you need to make sure this Matrix user is created on your server. # In any case, you need to make sure this Matrix user is created on your server.
matrix_corporal_reconciliation_user_id_local_part: "matrix-corporal" matrix_corporal_reconciliation_user_id_local_part: "matrix-corporal"
# Because Corporal peridoically performs lots of user logins from the same IP,
# you may need raise Synapse's ratelimits.
# The values below are just an example. Tweak to your use-case (number of users, etc.)
matrix_synapse_rc_login:
address:
per_second: 50
burst_count: 300
account:
per_second: 0.17
burst_count: 3
failed_attempts:
per_second: 0.17
burst_count: 3
``` ```
Matrix Corporal operates with a specific Matrix user on your server. Matrix Corporal operates with a specific Matrix user on your server.

View File

@ -68,6 +68,28 @@ matrix_synapse_root_log_level: "INFO"
matrix_synapse_rc_messages_per_second: 0.2 matrix_synapse_rc_messages_per_second: 0.2
matrix_synapse_rc_message_burst_count: 10.0 matrix_synapse_rc_message_burst_count: 10.0
matrix_synapse_rc_registration:
per_second: 0.17
burst_count: 3
matrix_synapse_rc_login:
address:
per_second: 0.17
burst_count: 3
account:
per_second: 0.17
burst_count: 3
failed_attempts:
per_second: 0.17
burst_count: 3
matrix_synapse_federation_rc_window_size: 1000
matrix_synapse_federation_rc_sleep_limit: 10
matrix_synapse_federation_rc_sleep_delay: 500
matrix_synapse_federation_rc_reject_limit: 50
matrix_synapse_federation_rc_concurrent: 3
matrix_synapse_federation_rr_transactions_per_room_per_second: 50
# Controls whether the TLS federation listener is enabled (tcp/8448). # Controls whether the TLS federation listener is enabled (tcp/8448).
# Only makes sense if federation is enabled (`matrix_synapse_federation_enabled`). # Only makes sense if federation is enabled (`matrix_synapse_federation_enabled`).
# Note that federation may potentially be enabled as non-TLS on tcp/8048 as well. # Note that federation may potentially be enabled as non-TLS on tcp/8048 as well.

View File

@ -409,6 +409,7 @@ rc_message_burst_count: {{ matrix_synapse_rc_message_burst_count }}
#rc_registration: #rc_registration:
# per_second: 0.17 # per_second: 0.17
# burst_count: 3 # burst_count: 3
rc_registration: {{ matrix_synapse_rc_registration|to_json }}
# #
#rc_login: #rc_login:
# address: # address:
@ -420,30 +421,36 @@ rc_message_burst_count: {{ matrix_synapse_rc_message_burst_count }}
# failed_attempts: # failed_attempts:
# per_second: 0.17 # per_second: 0.17
# burst_count: 3 # burst_count: 3
rc_login: {{ matrix_synapse_rc_login|to_json }}
# The federation window size in milliseconds # The federation window size in milliseconds
# #
#federation_rc_window_size: 1000 #federation_rc_window_size: 1000
federation_rc_window_size: {{ matrix_synapse_federation_rc_window_size }}
# The number of federation requests from a single server in a window # The number of federation requests from a single server in a window
# before the server will delay processing the request. # before the server will delay processing the request.
# #
#federation_rc_sleep_limit: 10 #federation_rc_sleep_limit: 10
federation_rc_sleep_limit: {{ matrix_synapse_federation_rc_sleep_limit }}
# The duration in milliseconds to delay processing events from # The duration in milliseconds to delay processing events from
# remote servers by if they go over the sleep limit. # remote servers by if they go over the sleep limit.
# #
#federation_rc_sleep_delay: 500 #federation_rc_sleep_delay: 500
federation_rc_sleep_delay: {{ matrix_synapse_federation_rc_sleep_delay }}
# The maximum number of concurrent federation requests allowed # The maximum number of concurrent federation requests allowed
# from a single server # from a single server
# #
#federation_rc_reject_limit: 50 #federation_rc_reject_limit: 50
federation_rc_reject_limit: {{ matrix_synapse_federation_rc_reject_limit }}
# The number of federation requests to concurrently process from a # The number of federation requests to concurrently process from a
# single server # single server
# #
#federation_rc_concurrent: 3 #federation_rc_concurrent: 3
federation_rc_concurrent: {{ matrix_synapse_federation_rc_concurrent }}
# Target outgoing federation transaction frequency for sending read-receipts, # Target outgoing federation transaction frequency for sending read-receipts,
# per-room. # per-room.
@ -452,6 +459,7 @@ rc_message_burst_count: {{ matrix_synapse_rc_message_burst_count }}
# into fewer transactions. # into fewer transactions.
# #
#federation_rr_transactions_per_room_per_second: 50 #federation_rr_transactions_per_room_per_second: 50
federation_rr_transactions_per_room_per_second: {{ matrix_synapse_federation_rr_transactions_per_room_per_second }}