Harden Dockerfile and integrate worker orchestration#4
Merged
jevonearth merged 2 commits intomainfrom Feb 26, 2026
Merged
Conversation
- Replace pysodium with PyNaCl (already in base Synapse image), removing the need for gcc, libsodium-dev, and pip install entirely. - Narrow signature verification exception catch from bare Exception to nacl.exceptions.BadSignatureError. - Target sed PDU size patch at ^MAX_PDU_SIZE = 65536$ to prevent accidental replacement of unrelated constants. - Fix missing execute permissions on entrypoint scripts. - Bump crypto_auth_provider to v0.3.
06697bd to
959c4a6
Compare
Replace static worker configs with the upstream configure_workers_and_start.py that dynamically generates nginx, supervisord, redis, and per-worker configs from SYNAPSE_WORKER_TYPES. Entrypoint switches between single-process mode (direct exec) and worker mode (supervisord) based on SYNAPSE_WORKERS env var. Adds nginx-light, redis-server, supervisor to image. Removes shared_config.yaml and workers/ directory. Preserves all hardening from previous commit (SSRF protection, PyNaCl, logfmt logging, Beacon modules).
959c4a6 to
0a9729a
Compare
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--no-install-recommendsconfigure_workers_and_start.py(supervisord + nginx + redis, all in-container) replacing our static 4-worker config. Workers are dynamically generated fromSYNAPSE_WORKER_TYPESenv varsynctl), worker mode execsconfigure_workers_and_start.py. Listener port/bind set automatically per modeinstance_map,redis, and replication listener blocks (generated dynamically in worker mode). Added${SYNAPSE_HTTP_PORT}/${SYNAPSE_HTTP_BIND}template varsAll security hardening is preserved: SSRF
federation_ip_range_blacklist,crypto_auth_provider.pyv0.3,beacon_monitor_module.py, logfmt logging,password_config: false.Usage
What's new in the image
nginx-lightredis-serversupervisorPrometheus service discovery at
:9469/metrics/service_discoverywhenSYNAPSE_ENABLE_METRICS=1.