Skip to content

Commit 3f0fc04

Browse files
committed
Force TLS 1.2 to avoid middleboxes TCP resets
The source code comment has the explanation since explicitly forcing TLS 1.2 will likely generate a red flag for anyone reading the code.
1 parent 6754afc commit 3f0fc04

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

lib/nerves/utils/http_client.ex

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,17 @@ defmodule Nerves.Utils.HTTPClient do
165165
timeout: :infinity,
166166
autoredirect: false,
167167
ssl: [
168+
# Erlang's SSL client defaults to TLS 1.3 which is great, but if can
169+
# fail if you're on a network with a middlebox that only support TLS
170+
# 1.2. Those boxes will reset the connection and if you test with a
171+
# web browser or curl, it will appear to work since those either
172+
# start with TLS 1.2 or drop back to it. That makes the issue look
173+
# like a Nerves issue.
174+
#
175+
# Since this is being used to download large binary assets and TLS
176+
# 1.2 is still secure enough for general Internet use, just use it so
177+
# that the downloads work.
178+
versions: [:"tlsv1.2"],
168179
verify: :verify_peer,
169180
cacerts: :public_key.cacerts_get(),
170181
depth: 3,

0 commit comments

Comments
 (0)