Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/peridiod/config.ex
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ defmodule Peridiod.Config do
|> Map.put(:ssl,
server_name_indication: to_charlist(config.device_api_host),
verify: verify,
cacertfile: config.device_api_ca_certificate_path
cacertfile: config.device_api_ca_certificate_path,
versions: [:"tlsv1.3", :"tlsv1.2"]
)
Comment thread
jasontwong marked this conversation as resolved.
Comment thread
jasontwong marked this conversation as resolved.

case config.key_pair_source do
Expand Down Expand Up @@ -413,7 +414,6 @@ defmodule Peridiod.Config do
ssl =
base.ssl
|> Keyword.put_new(:verify, :verify_peer)
|> Keyword.put_new(:versions, [:"tlsv1.2"])
|> Keyword.put_new(:server_name_indication, to_charlist(base.device_api_sni))

%{base | socket: socket, ssl: ssl}
Expand Down
10 changes: 10 additions & 0 deletions test/peridiod/config_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,16 @@ defmodule Peridiod.ConfigTest do
end
end

describe "tls versions" do
test "ssl options include both TLS 1.2 and TLS 1.3" do
with_config_file("test/fixtures/peridio.json", fn ->
config = build_config()
assert :"tlsv1.2" in config.ssl[:versions]
assert :"tlsv1.3" in config.ssl[:versions]
end)
end
end

describe "device_api_verify" do
test "struct default is :verify_peer" do
assert %Peridiod.Config{}.device_api_verify == :verify_peer
Expand Down
Loading