Skip to content

Synapse Configuration

Synapse is configured via a YAML file. Copy config.example.yaml to config.yaml and customize.

Complete Reference

yaml
# ── Server ───────────────────────────────────────────────
server:
  listen: "0.0.0.0:6190"     # Proxy listener address
  workers: 0                   # Worker threads (0 = auto-detect CPU count)

shutdown_timeout_secs: 30      # Graceful shutdown drain timeout
waf_threshold: 70              # Global risk threshold (0-100)
waf_enabled: true              # Master WAF enable/disable
log_level: "info"              # trace, debug, info, warn, error
waf_regex_timeout_ms: 100      # ReDoS protection (max 500ms)
# admin_api_key: "..."         # Optional; random key generated if unset

# ── Upstreams ────────────────────────────────────────────
upstreams:
  - host: "127.0.0.1"
    port: 8080
  # - host: "127.0.0.1"
  #   port: 8081              # Add more for round-robin load balancing

# ── Rate Limiting ────────────────────────────────────────
rate_limit:
  rps: 10000                   # Requests per second per client IP
  enabled: true

# ── Logging ──────────────────────────────────────────────
logging:
  level: "info"                # trace, debug, info, warn, error
  format: "text"               # text or json
  access_log: true             # Log every proxied request

# ── Detection ────────────────────────────────────────────
detection:
  sqli: true                   # SQL injection detection
  xss: true                    # Cross-site scripting detection
  path_traversal: true         # Path traversal detection
  command_injection: true      # Command injection detection
  action: "block"              # block, log, or challenge
  block_status: 403            # HTTP status for blocked requests

# ── TLS ──────────────────────────────────────────────────
tls:
  enabled: false
  # cert_path: "/etc/synapse/certs/default.pem"
  # key_path: "/etc/synapse/keys/default.key"
  min_version: "1.2"           # "1.2" or "1.3"
  # per_domain_certs:
  #   - domain: "api.example.com"
  #     cert_path: "/etc/synapse/certs/api.pem"
  #     key_path: "/etc/synapse/keys/api.key"

# ── DLP (Data Loss Prevention) ───────────────────────────
dlp:
  enabled: false
  max_body_size_bytes: 1048576        # 1 MB hard limit
  max_body_inspection_bytes: 8192     # 8 KB inspection cap
  scan_text_only: true                # Skip binary content types
  action: "mask"                      # mask, hash, block, or log
  patterns:
    - name: "credit_card"
      pattern: "\\b\\d{4}[- ]?\\d{4}[- ]?\\d{4}[- ]?\\d{4}\\b"
      action: "mask"
    - name: "ssn"
      pattern: "\\b\\d{3}-\\d{2}-\\d{4}\\b"
      action: "block"

# ── Telemetry (Horizon Integration) ─────────────────────
# telemetry:
#   enabled: true
#   horizon_url: "wss://horizon.example.com/ws/sensors"
#   sensor_id: "sensor-abc123"
#   token: "sensor-token-xyz789"
#   batch_size: 50
#   flush_interval_ms: 5000

Section Details

Server

FieldTypeDefaultDescription
server.listenstring"0.0.0.0:6190"Proxy listener host:port
server.workersinteger0Worker threads. 0 = auto-detect CPU count
shutdown_timeout_secsinteger30Seconds to drain connections on shutdown
waf_thresholdinteger70Risk score threshold for blocking (0–100)
waf_enabledbooleantrueMaster switch for WAF detection
waf_regex_timeout_msinteger100Per-regex timeout for ReDoS protection (max 500)
admin_api_keystring(random)Admin API authentication key

Detection

FieldTypeDefaultDescription
detection.sqlibooleantrueSQL injection detection
detection.xssbooleantrueCross-site scripting detection
detection.path_traversalbooleantruePath traversal detection
detection.command_injectionbooleantrueCommand injection detection
detection.actionstring"block"block, log, or challenge
detection.block_statusinteger403HTTP status for blocked requests

DLP

FieldTypeDefaultDescription
dlp.enabledbooleanfalseEnable DLP body scanning
dlp.max_body_size_bytesinteger1048576Hard limit — reject bodies larger than this
dlp.max_body_inspection_bytesinteger8192Inspection cap — truncate (not reject) at this size
dlp.scan_text_onlybooleantrueSkip binary content types automatically
dlp.actionstring"mask"Default action: mask, hash, block, or log
dlp.patterns[].namestringPattern identifier
dlp.patterns[].patternstringRegex pattern
dlp.patterns[].actionstringPer-pattern action override

DLP performance tuning

  • High-security: Set max_body_inspection_bytes to 32768+ for deeper inspection
  • High-throughput APIs: Keep the default 8 KB cap for sub-100 μs scan times
  • Binary content types (images, video, archives) are always skipped automatically

TLS

FieldTypeDefaultDescription
tls.enabledbooleanfalseEnable TLS termination
tls.cert_pathstringPath to default certificate PEM file
tls.key_pathstringPath to default private key file
tls.min_versionstring"1.2"Minimum TLS version ("1.2" or "1.3")
tls.per_domain_certsarrayPer-domain SNI certificate overrides

Hot-Reload

Reload configuration without restarting:

sh
curl -X POST http://localhost:6191/reload -H "X-Admin-Key: $ADMIN_KEY"

Takes ~240 μs via atomic RwLock swap. In-flight requests are unaffected.

Licensed under AGPL-3.0 · atlascrew.dev