NOC online · 24/7Longview, TX · +1 323 412 0665
KinetikatechServers · Security · Websites
KO

이 심층 가이드는 영어로 제공됩니다.

English version

Self-Hosted Open Source Infrastructure

Deploying a Private Matrix Synapse Messaging Network with End-to-End Encryption and Turn Servers

Matrix provides federated, end-to-end encrypted messaging that you can run entirely on your own infrastructure. Synapse is the reference server, and a TURN server handles voice and video relay. This guide deploys a private network with federation disabled, E2EE enforced, and media stored locally.

핵심 내용

  1. Disable federation for a private network. Set federation_domain_whitelist to empty and block inbound federation traffic.
  2. Enforce end-to-end encryption. Configure the server to reject unencrypted rooms and require device verification.
  3. Deploy a TURN server. coturn relays voice and video when direct peer connections fail.
  4. Store media locally. Use the local media store with a retention policy rather than an external S3 backend for small deployments.
  5. Set up a reverse proxy. Nginx or Caddy terminates TLS and routes Matrix and TURN traffic.
  6. Configure well-known endpoints. .well-known/matrix/server and /client tell clients where to connect.
  7. Back up the database. PostgreSQL holds all messages and keys; automate dumps and test restores.
  8. Monitor federation attempts. Even with federation disabled, log and alert on any inbound federation traffic.

Architecture

Clients connect through a reverse proxy to Synapse, which stores messages and keys in PostgreSQL. Media lives on local disk. TURN handles NAT traversal for calls. With federation disabled, the network is a closed island with full control over membership and data.

Production configuration

Synapse homeserver configuration yaml
server_name: chat.example.com
listeners:
  - port: 8008
    tls: false
    bind_addresses: ['127.0.0.1']
    type: http
    resources:
      - names: [client, federation]
database:
  name: psycopg2
  args:
    user: synapse
    password: change-me
    database: synapse
    host: 127.0.0.1
federation_domain_whitelist: []
encryption_enabled_by_default_for_room_type: all
media_store_path: /var/lib/matrix-synapse/media
max_upload_size: 100M
coturn configuration ini
listening-port=3478
fingerprint
lt-cred-mech
use-auth-secret
static-auth-secret=change-me
realm=chat.example.com
total-quota=100
cert=/etc/letsencrypt/live/chat.example.com/fullchain.pem
pkey=/etc/letsencrypt/live/chat.example.com/privkey.pem
Reverse proxy for Matrix nginx
server {
  listen 443 ssl http2;
  server_name chat.example.com;
  location /_matrix/ {
    proxy_pass http://127.0.0.1:8008;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
  }
  location /.well-known/matrix/ {
    alias /var/www/matrix-well-known/;
  }
}

Edge cases from production

  • E2EE key backup must be enabled by users; server-side recovery is not possible by design.
  • Media retention policies delete files but leave database references; run the media cleanup job regularly.
  • TURN credentials expire; clients must fetch fresh credentials from Synapse before each call.
  • Federation disabled means no external users; plan membership provisioning via SSO or manual invites.

자주 묻는 질문

Can I federate later?

Yes, remove the federation block and configure DNS; existing rooms remain private unless explicitly federated.

Is Matrix E2EE by default?

Rooms can be created with encryption enabled by default, but users must verify devices for full security.

How much storage does media consume?

Depends on upload volume; set retention policies and monitor disk usage.

Can I use an external database?

Yes, Synapse supports PostgreSQL and the database can be on a separate host.

What clients work best?

Element Web and mobile apps are the reference clients with full E2EE support.

self-hosted open source infrastructure에 대한 Kinetikatech의 지원

저희는 이것을 수백 번 처리했습니다: Running sovereign collaboration, storage, and identity stacks on hardware you control. 서버 관리 및 웹사이트 유지보수와 함께하면 평가, 구현, 24시간 연중무휴 모니터링, 그리고 중요한 때에 30분 이내 대응이라는 완전한 사이클을 제공합니다.

엔지니어와 상담하기

서버 문제? 해킹된 웹사이트? 느린 페이지?

심각한 장애에 30분 이내 대응 — 24시간, 주 7일.

긴급 지원 요청 support@kinetikatech.com