Skip to content

feat(config): support TLS server name override for scheduler and peer clients - #2089

Open
simonepri wants to merge 2 commits into
dragonflyoss:mainfrom
simonepri:feat/scheduler-tls-server-name
Open

simonepri wants to merge 2 commits into
dragonflyoss:mainfrom
simonepri:feat/scheduler-tls-server-name

Conversation

@simonepri

@simonepri simonepri commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Description

Add an optional serverName field to the scheduler TLS config (scheduler) and the peer TLS config (upload.client). When set, load_client_tls_config uses it as the TLS domain name for verifying the scheduler, peer or seed peer certificate. When unset, behavior is unchanged: the host of the dial URL is used.

Unit tests cover deserializing serverName for both configs and that load_client_tls_config prefers it over the dial host.

Related Issue

Fixes #2088

Follow-up to #1859, which made dfdaemon dial schedulers over https when TLS is configured. With that fix in place, the handshake now reaches certificate verification, which fails against DNS-only scheduler certificates.

Motivation and Context

dfdaemon dials schedulers, peers and seed peers by IP, so it verifies their certificates against that IP. On Kubernetes, these certificates usually carry DNS SANs only, because pod and node IPs change. With mTLS on, every connection then fails with tls: bad certificate. Setting serverName to a name in the certificate lets DNS-only certificates verify, for example one shared peer certificate for every dfdaemon.

When dfdaemon connects to schedulers with TLS enabled, Scheduler::load_client_tls_config sets ClientTlsConfig::domain_name to the host of the dial URL, which is always the scheduler IP address. If the scheduler TLS certificate contains only DNS Subject Alternative Names (SANs) rather than IP SANs, TLS verification fails during handshake.

Add an optional server_name field to Scheduler config (serde serverName). When set, Scheduler::load_client_tls_config uses this value as the TLS domain name for certificate verification, falling back to the dial host IP when unset. Add unit tests for configuration deserialization and TLS domain name resolution.

Signed-off-by: Simone Primarosa <simone.primarosa@gmail.com>
@codecov

codecov Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.37%. Comparing base (3904607) to head (d1cd00d).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2089      +/-   ##
==========================================
+ Coverage   65.29%   65.37%   +0.07%     
==========================================
  Files         103      103              
  Lines       30789    30860      +71     
==========================================
+ Hits        20105    20176      +71     
  Misses      10684    10684              
Files with missing lines Coverage Δ
dragonfly-client-config/src/dfdaemon.rs 98.09% <100.00%> (+0.09%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

dfdaemon dials peers and seed peers by IP, so UploadClient::load_client_tls_config
verifies their certificates against the peer IP. Peer certificates with DNS
SANs only fail the handshake, the same way scheduler certificates did.

Add an optional server_name field to UploadClient config (serde serverName).
When set, it is used as the TLS domain name for verifying peer certificates,
falling back to the dial host when unset.

Signed-off-by: Simone Primarosa <simone.primarosa@gmail.com>
@simonepri simonepri changed the title feat(config): support TLS server name override for scheduler client feat(config): support TLS server name override for scheduler and peer clients Oct 8, 2026
@simonepri

Copy link
Copy Markdown
Contributor Author

gaius-qi@ LunaWhispers@ small follow up of #1859 to make the mTSL setup work.

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.

Scheduler and peer mTLS fail when certificates have DNS SANs only

1 participant