Repository navigation
Conversation
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2089 +/- ##
==========================================
+ Coverage 65.29% 67.17% +1.87%
==========================================
Files 103 102 -1
Lines 30789 32985 +2196
==========================================
+ Hits 20105 22157 +2052
- Misses 10684 10828 +144
🚀 New features to boost your workflow:
|
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>
|
gaius-qi@ LunaWhispers@ small follow up of #1859 to make the mTSL setup work. |
CooooolFrog
left a comment
There was a problem hiding this comment.
The implementation looks good to me. Could you add a TLS handshake regression test using a server certificate with DNS SANs only, while connecting by IP?
Please cover:
No serverName override: verification fails.
Matching serverName: the handshake succeeds.
Non-matching serverName: verification still fails.
The existing tests only check that the server name ends up in the ClientTlsConfig. They do not prove that it fixes verification of a certificate that carries DNS SANs only when the client dials by IP. Start a gRPC server on 127.0.0.1 with a certificate whose only SAN is a DNS name, and dial it by IP with the scheduler and upload client TLS configs. Without a server name, and with a non-matching one, the handshake fails certificate verification; with a matching server name, the handshake and a health check succeed. Signed-off-by: Simone Primarosa <simone.primarosa@gmail.com>
|
Added a handshake test in 6e0fcc4: server cert with a DNS SAN only, dialed by IP. No |
Description
Add an optional
serverNamefield to the scheduler TLS config (scheduler) and the peer TLS config (upload.client). When set,load_client_tls_configuses 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
serverNamefor both configs and thatload_client_tls_configprefers 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. SettingserverNameto a name in the certificate lets DNS-only certificates verify, for example one shared peer certificate for every dfdaemon.