Skip to content

use sni in the tls handshake - #12374

Merged
jzhou77 merged 5 commits into
apple:mainfrom
evkuzin:sni_fix_main
Sep 18, 2025
Merged

jzhou77 merged 5 commits into
apple:mainfrom
evkuzin:sni_fix_main

Conversation

@evkuzin

@evkuzin evkuzin commented Sep 16, 2025 •

Copy link
Copy Markdown
Contributor

Original PR is in #12366

Problem
FoundationDB's network layer was not properly setting Server Name Indication (SNI) when making TLS connections to hostnames that require SNI for proper certificate selection. This caused failures when connecting to services like Google Cloud Storage, which returns a dummy self-signed certificate when SNI is not provided.

Symptoms:

Backup agent fails with "VerifyError": "self signed certificate" when connecting to storage.googleapis.com
TLS handshake errors: "certificate verify failed"
Network captures showed TLS Client Hello without SNI extension

Root Cause: The connection flow resolved hostnames to IP addresses early in the process but lost the original hostname string needed for SNI. When INetworkConnections::connect(host, service, isTLS) was called:
- resolveTCPEndpoint() resolved hostname to IP addresses
- One IP was selected and addr.fromHostname = true was set
- The original hostname string was discarded
- connectExternal(addr) was called with only the IP address
- During TLS handshake, no SNI was set because the hostname was lost

Solution
Modified the network connection chain to preserve hostname information for SNI

Testing
Verification Methods:

Network capture: tshark -Y "tls.handshake.extensions_server_name" confirms SNI is now sent in TLS Client Hello
Trace logs: Added SSLConnectionWithHostname and SSLSetSNI events for debugging
Real-world test: Backup agent connecting to storage.googleapis.com now sends proper SNI

[x] The PR has a description, explaining both the problem and the solution.
[x] The description mentions which forms of testing were done and the testing seems reasonable.
[x] Every function/class/actor that was touched is reasonably well documented.

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang-arm on Linux CentOS 7

  • Commit ID: 3d045ff
  • Duration 0:04:13
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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-clang-ide on Linux RHEL 9

  • Commit ID: 3d045ff
  • Duration 0:04:32
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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-clang on Linux RHEL 9

  • Commit ID: 3d045ff
  • Duration 0:04:30
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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 on Linux RHEL 9

  • Commit ID: 3d045ff
  • Duration 0:04:33
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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 on Linux RHEL 9

  • Commit ID: 3d045ff
  • Duration 0:04:33
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: 3d045ff
  • Duration 0:39:56
  • 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-clang-ide on Linux RHEL 9

  • Commit ID: b62a3cb
  • Duration 0:43:13
  • 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-clang-ide on Linux RHEL 9

  • Commit ID: cb4f651
  • Duration 0:42:09
  • 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-macos on macOS Ventura 13.x

  • Commit ID: 3d045ff
  • Duration 1:06:05
  • 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-clang-arm on Linux CentOS 7

  • Commit ID: cb4f651
  • Duration 0:49:21
  • 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-clang on Linux RHEL 9

  • Commit ID: b62a3cb
  • Duration 1:12:44
  • Result: ❌ FAILED
  • Error: Error while executing command: ctest -j ${NPROC} --no-compress-output -T test --output-on-failure. Reason: exit status 8
  • 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-clang-arm on Linux CentOS 7

  • Commit ID: b62a3cb
  • Duration 1:13:44
  • Result: ❌ FAILED
  • Error: Error while executing command: ctest -j ${NPROC} --no-compress-output -T test --output-on-failure. Reason: exit status 8
  • 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 on Linux RHEL 9

  • Commit ID: b62a3cb
  • Duration 1:14:22
  • Result: ❌ FAILED
  • Error: Error while executing command: ctest -j ${NPROC} --no-compress-output -T test --output-on-failure. Reason: exit status 8
  • Build Log terminal output (available for 30 days)
  • Build Workspace zip file of the working directory (available for 30 days)

@saintstack

Copy link
Copy Markdown
Contributor

These failed:

The following tests FAILED:
3 - bulkload_test (Failed)
12 - s3_backup_tests (Timeout)
Errors while running CTest

I have a fix coming for these transient failures... but not ready yet. Meantime, let me retry.

@saintstack saintstack closed this Sep 16, 2025
@saintstack saintstack reopened this Sep 16, 2025
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: b62a3cb
  • Duration 1:25:16
  • 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)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: cb4f651
  • Duration 1:24: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)
  • Cluster Test Logs zip file of the test logs (available for 30 days)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: cb4f651
  • Duration 0:32:53
  • 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-clang-arm on Linux CentOS 7

  • Commit ID: cb4f651
  • Duration 0:48:19
  • 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)

Comment thread flow/Net2.actor.cpp Resolved
Comment thread flow/Net2.actor.cpp Resolved
Comment thread flow/Net2.actor.cpp Resolved
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: ef89d47
  • Duration 0:04:26
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: ef89d47
  • Duration 0:04:29
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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-clang-arm on Linux CentOS 7

  • Commit ID: ef89d47
  • Duration 0:04:29
  • Result: ❌ FAILED
  • Error: Error while executing command: if [[ $(git diff --shortstat 2> /dev/null | tail -n1) == "" ]]; then echo "CODE FORMAT CLEAN"; else echo "CODE FORMAT NOT CLEAN"; echo; echo "THE FOLLOWING FILES NEED TO BE FORMATTED"; echo; git ls-files -m; echo; if [[ $FDB_VERSION =~ 7\.\3. ]]; then echo skip; else exit 1; fi; fi. Reason: exit status 1
  • 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-macos-m1 on macOS Ventura 13.x

  • Commit ID: ef89d47
  • Duration 0:40:16
  • 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-macos on macOS Ventura 13.x

  • Commit ID: ef89d47
  • Duration 1:04:58
  • 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)

@jzhou77 jzhou77 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like a clang-format is needed.

@evkuzin

evkuzin commented Sep 17, 2025

Copy link
Copy Markdown
Contributor Author

@jzhou77 thanks for the hint :)

@jzhou77 jzhou77 closed this Sep 18, 2025
@jzhou77 jzhou77 reopened this Sep 18, 2025
@foundationdb-ci

Copy link
Copy Markdown
Contributor

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

  • Commit ID: b54d8cf
  • Duration 0:23:13
  • 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-clang-arm on Linux CentOS 7

  • Commit ID: b54d8cf
  • Duration 0:47:28
  • 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-macos on macOS Ventura 13.x

  • Commit ID: b54d8cf
  • Duration 1:04:04
  • 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 on Linux RHEL 9

  • Commit ID: b54d8cf
  • Duration 1:13:09
  • 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)

@foundationdb-ci

Copy link
Copy Markdown
Contributor

Result of foundationdb-pr-clang on Linux RHEL 9

  • Commit ID: b54d8cf
  • Duration 1:13:30
  • 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 on Linux RHEL 9

  • Commit ID: b54d8cf
  • Duration 1:17:28
  • 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)

@jzhou77

jzhou77 commented Sep 18, 2025 •

Copy link
Copy Markdown
Collaborator

20250918-155625-jzhou-dab0cc3c453fcfef compressed=True data_size=40477684 duration=6080157 ended=100000 fail_fast=10 max_runs=100000 pass=100000 priority=100 remaining=0 runtime=1:02:14 sanity=False started=100000 stopped=20250918-165839 submitted=20250918-155625 timeout=5400 username=jzhou

@jzhou77
jzhou77 merged commit 947276f into apple:main Sep 18, 2025
jzhou77 pushed a commit to jzhou77/foundationdb that referenced this pull request Sep 22, 2025
* 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 <[email protected]>
jzhou77 added a commit that referenced this pull request Sep 23, 2025
* 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: Evgeny <[email protected]>
Co-authored-by: stack <[email protected]>
spraza pushed a commit to spraza/foundationdb that referenced this pull request Oct 6, 2025
* 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 <[email protected]>
laflechejonathan pushed a commit to laflechejonathan/foundationdb that referenced this pull request Nov 4, 2025
* 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: Evgeny <[email protected]>
Co-authored-by: stack <[email protected]>
arnav-ag pushed a commit to arnav-ag/foundationdb that referenced this pull request Apr 27, 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

---------

Co-authored-by: stack <[email protected]>
(cherry picked from commit 947276f)
spraza pushed a commit that referenced this pull request May 1, 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 <[email protected]>
Co-authored-by: stack <[email protected]>
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 <[email protected]>
Co-authored-by: stack <[email protected]>
androndo added a commit to cozystack/cozystack that referenced this pull request Oct 14, 2026
FoundationDB sends TLS SNI only from 7.3.78 and 7.4.6
(apple/foundationdb#12374). The provisioned bucket endpoint is an
ingress that routes by SNI and aborts the handshake without it, so the
7.3.63 binaries the operator ships, and the 7.3.63 backup_agent of a
default cluster, fail with "Network connection failed" before any S3
request.

Bump the operator's init containers, which supply the fdbbackup and
fdbrestore binaries picked by the cluster's major.minor, to 7.3.79 and
7.4.8. Add minimumAgentVersions to the FoundationDB strategy template:
a cluster on an older patch of a listed major.minor runs its
backup_agent at the listed version instead. Patch releases of one minor
are wire-compatible, so this needs no cluster upgrade. The default
strategy lists the same two versions as the operator.

Assisted-by: LLM
Signed-off-by: Andrey Kolkov <[email protected]>
androndo added a commit to cozystack/cozystack that referenced this pull request Nov 9, 2026
FoundationDB sends TLS SNI only from 7.3.78 and 7.4.6
(apple/foundationdb#12374). The provisioned bucket endpoint is an
ingress that routes by SNI and aborts the handshake without it, so the
7.3.63 binaries the operator ships, and the 7.3.63 backup_agent of a
default cluster, fail with "Network connection failed" before any S3
request.

Bump the operator's init containers, which supply the fdbbackup and
fdbrestore binaries picked by the cluster's major.minor, to 7.3.79 and
7.4.8. Add minimumAgentVersions to the FoundationDB strategy template:
a cluster on an older patch of a listed major.minor runs its
backup_agent at the listed version instead. Patch releases of one minor
are wire-compatible, so this needs no cluster upgrade. The default
strategy lists the same two versions as the operator.

Assisted-by: LLM
Signed-off-by: Andrey Kolkov <[email protected]>
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.

5 participants