Skip to content

Backport #12374 to release-7.3 - #13089

Merged
spraza merged 1 commit into
apple:release-7.3from
arnav-ag:backport/sni-tls-handshake-7.3
May 1, 2026
Merged

spraza merged 1 commit into
apple:release-7.3from
arnav-ag:backport/sni-tls-handshake-7.3

Conversation

@arnav-ag

@arnav-ag arnav-ag commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

cherrypick #12374, similar to #12385 which was for release-7.4. i believe this is a bug fix that should be backported since it affects the usage of some S3-compatible blob storages, such as GCS, as can be seen in the original PR's description

  • use sni in the tls handshake

  • Ran clang-format -i

  • Remove accidental overcommit

  • drop too spamy logs

  • clang-format -style=file -i flow/Net2.actor.cpp


(cherry picked commit e810d64)

* use sni in the tls handshake

* Ran clang-format -i

* Remove accidental overcommit

* drop too spamy logs

* clang-format -style=file -i flow/Net2.actor.cpp

---------

Co-authored-by: stack <stack@duboce.com>
(cherry picked from commit 947276f)
@arnav-ag

Copy link
Copy Markdown
Contributor Author

@spraza Would it be possible to get your thoughts here on whether this is an acceptable change? Tagging you here since you reviewed the 7.4 backport and the original change!

@arnav-ag arnav-ag changed the title use sni in the tls handshake [release-7.3] backport release-7.3] Apr 28, 2026
@arnav-ag arnav-ag changed the title backport release-7.3] backport #12374 to release-7.3 Apr 28, 2026
@arnav-ag arnav-ag changed the title backport #12374 to release-7.3 Backport #12374 to release-7.3 Apr 28, 2026
@spraza

spraza commented Apr 28, 2026

Copy link
Copy Markdown
Collaborator

@spraza Would it be possible to get your thoughts here on whether this is an acceptable change? Tagging you here since you reviewed the 7.4 backport and the original change!

@arnav-ag ack, let me get back to you on this by today (in a few hours)

@spraza

spraza commented Apr 28, 2026 •

Copy link
Copy Markdown
Collaborator

@spraza Would it be possible to get your thoughts here on whether this is an acceptable change? Tagging you here since you reviewed the 7.4 backport and the original change!

@arnav-ag ack, let me get back to you on this by today (in a few hours)

@arnav-ag change lgtm at a high level. In the context of 7.3, I am still discussing with some folks. Meanwhile:

  • can you share the rollback strategy i.e. if there's a bug in the code, what would it take to mitigate it? Based on my understanding, I think we'll have to revert the commit, cut a new patch release, and then people deploy the new patch release.
  • how did you test this change? Is it the packet capture done in Sep 2025 mentioned in use sni in the tls handshake #12374?

@arnav-ag

Copy link
Copy Markdown
Contributor Author

can you share the rollback strategy i.e. if there's a bug in the code, what would it take to mitigate it? Based on my understanding, I think we'll have to revert the commit, cut a new patch release, and then people deploy the new patch release.

@spraza I think your understanding here is right, we would have to revert the commit on release-7.3, cut a new patch release, redeploy. There's no runtime knob to disable the new path.

A couple of things that bound the blast radius:

  • The change is purely additive. It introduces a new connection path that only fires when addr.isTLS() && addr.fromHostname. The existing connectExternal path is untouched, so non-TLS connections and TLS connections made by raw IP (e.g., FDB-internal traffic) are not affected.
  • The only callers that take this branch in 7.3 are the ones that go through INetworkConnections::connect(host, service, isTLS) with a hostname, which is practically S3BlobStoreEndpoint (backups/restores against an HTTPS hostname) and anything else doing hostname-resolved TLS to an external system. Cluster traffic, fdbcli, etc. are not in this path.
  • There are no persistent state changes. Nothing on disk, no protocol-version bumps, no schema changes, no metadata. A revert restores prior behavior immediately on rollout - there's nothing to migrate back.

how did you test this change?

Yep, i more or less followed the packet capture technique from the original PR, but fleshing it out here for repro if it helps:

1. Setup

  • Self-signed cert + openssl s_server listening on 127.0.0.1:14444
  • sudo tcpdump -i lo0 -w /tmp/sni-test/capture.pcap 'port 14444' capturing loopback

2. Trigger

fdbbackup describe -d 'blobstore://AKIA_dummy:dummy_secret@localhost:14444/test-bucket?bucket=test-bucket&secure_connection=1&region=us-east-1' \
    --log --logdir=/tmp/sni-test/logs

Using localhost as the hostname makes FDB go through INetworkConnections::connect(host, service, isTLS=true) → addr.fromHostname=true && addr.isTLS()=true → the new branch.

3. Observations

Trace log (FDB's own logging):

$ grep "SSLSetSNIResult" /tmp/sni-test/logs/trace.*.xml
Type="SSLSetSNIResult" Hostname="localhost" Result="1" Addr="127.0.0.1:14444:tls(fromHostname)"

SSLSetSNIResult is a TraceEvent the patch itself added, so we can be sure that the new code path ran. Result=1 is the return value of SSL_set_tlsext_host_name() = success. And Addr="...:tls(fromHostname)" confirms the new conditional in flow/network.cpp:377 fired (TLS + hostname-derived address) and routed through connectExternalWithHostname instead of plain connectExternal.

Wire capture (tshark dissecting the pcap):

$ tshark -r /tmp/sni-test/capture.pcap -Y 'tls.handshake.type == 1' \
    -T fields -e frame.number -e tls.handshake.extensions_server_name
5     localhost
26    localhost
$ tshark -r /tmp/sni-test/capture.pcap -Y 'tls.handshake.type == 1' -V | grep -A 6 server_name
Extension: server_name (len=14) name=localhost
    Server Name Indication extension
        Server Name Type: host_name (0)
        Server Name: localhost

The pcap has the SNI extension on the wire, 2/2 Client Hellos carry server_name = localhost. Without the patch, there's no SSL_set_tlsext_host_name() call and the extension wouldn't be in the bytes.

Perhaps most importantly, we have been already running this patch backported on the 7.3 branch internally for the past few months with GCS backups and can attest that it works.

@ploxiln

ploxiln commented Apr 30, 2026

Copy link
Copy Markdown
Collaborator

closing and re-opening to trigger PR checks

@ploxiln ploxiln closed this Apr 30, 2026
@ploxiln ploxiln reopened this Apr 30, 2026
@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-73 on Linux RHEL 9

  • Commit ID: d79bd72
  • Duration 0:47:23
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-73 on Linux RHEL 9

  • Commit ID: d79bd72
  • Duration 0:51:38
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-cluster-tests-73 on Linux RHEL 9

  • Commit ID: d79bd72
  • Duration 1:08:45
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@ploxiln

ploxiln commented May 1, 2026

Copy link
Copy Markdown
Collaborator

just testing the codebuild thing a bit ...

/codebuild_run(d79bd72)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-macos-m1 on macOS Ventura 13.x

  • Commit ID: d79bd72
  • Duration 0:58:08
  • Result: ✅ SUCCEEDED
  • Error: N/A
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@spraza
spraza requested a review from gxglass May 1, 2026 07:54
@arnav-ag

arnav-ag commented May 1, 2026 •

Copy link
Copy Markdown
Contributor Author

@ploxiln @gxglass do I need to do anything here to trigger the checks/merge the PR in afterwards?

@spraza

spraza commented May 1, 2026

Copy link
Copy Markdown
Collaborator

@ploxiln @gxglass do I need to do anything here to trigger the checks/merge the PR in afterwards?

I'll merge it @arnav-ag

@spraza
spraza merged commit db6b268 into apple:release-7.3 May 1, 2026
neethuhaneesha pushed a commit to neethuhaneesha/foundationdb that referenced this pull request Jun 11, 2026
* use sni in the tls handshake

* Ran clang-format -i

* Remove accidental overcommit

* drop too spamy logs

* clang-format -style=file -i flow/Net2.actor.cpp

---------


(cherry picked from commit 947276f)

Co-authored-by: Evgeny <evgeny.kuzin@outlook.com>
Co-authored-by: stack <stack@duboce.com>
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.

6 participants