Skip to content

TLS

Each listener can terminate TLS for its clients. Configuration is consistent across Postgres and MongoDB modes. TestListenerConfig_EffectivePostgresTLSMode_Default internal/config/config_test.go:339 TestListenerConfig_EffectivePostgresTLSMode_CaseInsensitive internal/config/config_test.go:346

[[listeners]]
name = "pg-main"
mode = "postgres"
tls_mode = "optional" # off | optional | require
use_tailscale_tls = true
# cert_file = "/etc/waypoint/server.crt"
# key_file = "/etc/waypoint/server.key"
ValueBehavior
offReject TLS upgrade requests; serve plaintext only.
optionalUpgrade to TLS when the client requests it TestReadStartupMessage_TLSOptionalAcceptsSSL internal/pgwire/startup_test.go:197 ; otherwise plaintext TestReadStartupMessage_TLSOptionalAllowsPlaintext internal/pgwire/startup_test.go:264 . Default.
requireReject plaintext connections. Postgres clients must send SSLRequest TestReadStartupMessage_TLSRequireRejectsPlaintext internal/pgwire/startup_test.go:247 TestIntegration_Proxy_TLSRequiredRejectsPlaintext internal/proxy/proxy_integration_test.go:385 ; MongoDB clients must connect over TLS. TestMongoAcceptClientTLSRequireCapturesSNI internal/proxy/mongodb_tls_test.go:19

For Postgres, optional matches the historical default: if the client opens with SSLRequest, Waypoint upgrades; otherwise it proceeds in cleartext.

Waypoint picks a certificate by server name, in this order:

  1. cert_file / key_file — admin-provided cert, used when the SNI matches TestBuildPostgresClientTLSConfig_UsesAdminCertForMatchingSNI internal/server/server_test.go:26 (or when no SNI is sent and a file cert is configured TestBuildPostgresClientTLSConfig_NoSNIFallsBackToAdminCert internal/server/server_test.go:65 ). Use this for custom domains like waypoint.redo.run.
  2. Tailscale-managed cert — fetched via the Tailscale local API for *.ts.net names, when use_tailscale_tls = true TestListenerConfig_EffectiveUseTailscaleTLS_Default internal/config/config_test.go:353 and HTTPS certificates are enabled in the tailnet. Used when the SNI is a non-admin name TestBuildPostgresClientTLSConfig_UsesTailscaleCertForDifferentSNI internal/server/server_test.go:46 or unknown. TestBuildPostgresClientTLSConfig_UnknownSNIFallsBackToTailscale internal/server/server_test.go:98

Setting use_tailscale_tls = false disables the second source — useful when you want to be sure clients only ever see your file-based cert. TestBuildPostgresClientTLSConfig_AdminOnlyIgnoresTailscale internal/server/server_test.go:85 TestListenerConfig_EffectiveUseTailscaleTLS_False internal/config/config_test.go:360

For MongoDB listeners, tls = true enables TLS from Waypoint to each backend member. This is independent of tls_mode (which governs the client side):

[[listeners]]
mode = "mongodb"
tls = true # Waypoint → MongoDB
tls_mode = "require" # client → Waypoint

When clients connect over TLS with SNI, Waypoint rewrites the hostnames in MongoDB topology responses (isMaster, hello) to the SNI hostname, while preserving the advertised listener/member ports. TestMongoTopologySNIRewritesAdvertiseHostAndPreservesPorts internal/proxy/mongodb_tls_test.go:131 This keeps drivers pinned to the proxy and prevents direct connections to backend members.