Skip to content

fix(tls): run every listener on scalo ServerTls - #274

Draft
catinspace-au wants to merge 2 commits into
mainfrom
fix/tls-servertls
Draft

catinspace-au wants to merge 2 commits into
mainfrom
fix/tls-servertls

Conversation

@catinspace-au

Copy link
Copy Markdown
Contributor

scalo-rs#472 is merged but unreleased. scalo uses a git rev until ServerTls ships.

Certificate, key and client CA rotation works from files or secrets without a restart. Handshakes use the rotated values from the next handshake. Before, only a secret-backed certificate reloaded, and only on five listeners.

  • ServerTls loads the tls block for /ingest, webhook, Splunk HEC, remote write, OTLP HTTP and gRPC, Vector gRPC, syslog TLS, Fluent Forward, GELF and Lumberjack.
  • Removed both acceptor builders, the RwLock cert provider, the tonic identity loader and five handshake-with-timeout copies. Net removal: 337 lines from src.
  • The receiver takes over gRPC handshakes from tonic. It offers h2. It counts failures on receiver_tls_handshake_failures_total. It holds the connection cap before the handshake.
  • Config load rejects a cert, key or CA set as both a file and a secret. The secret previously took priority. The example config replaces "override" with "instead of".
  • refresh_interval_secs defaults to 3600. Rotation takes up to an hour unless the config sets a shorter interval.
  • The hyper loops keep the IP filter, connection cap and first-byte check before the handshake. scalo's TlsListener has no hook for these checks.

Tests: lib 963 pass. tls_reload tests rotation for each family (hyper, raw TCP, tonic) with both a file and a file: secret. It sends a gRPC and an OTLP request over the receiver's handshake. With reload off the three rotation tests fail. tls_openssl (Docker, every listener, plain and mTLS) and the vault TLS tests pass.

Release is blocked until the git rev is replaced with a scalo release that has ServerTls and allow-git is removed from deny.toml.

Closes #270

Each listener's tls block loads into scalo's ServerTls. This covers /ingest, webhook, Splunk HEC, remote write, OTLP HTTP and gRPC, Vector gRPC, syslog, Fluent Forward, GELF and Lumberjack. The next handshake uses the rotated certificate, key or client CA without a restart. Before, only a secret-backed certificate reloaded, and only on five listeners.

- The sync and async acceptor builders, the RwLock certificate provider, the tonic identity loader and five copies of the handshake-with-timeout block are gone.
- The receiver handles the handshake instead of tonic. Failed gRPC handshakes count towards receiver_tls_handshake_failures_total. The connection cap applies before the handshake.
- Config loading rejects a certificate, key or CA set as both a file and a secret. It used to prefer the secret.
- scalo is pinned to the commit that adds ServerTls until a release has it, so deny.toml allows that git source.

Closes #270
tls.refresh_interval_secs is unset by default, so ServerTls reloads on scalo's interval instead of the receiver's 3600. A value set in the config still wins. The example config, config schema and tests match this default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(tls): reload certificates on every listener and share one TLS builder

1 participant