gausby / tortoise

A MQTT Client written in Elixir
Apache License 2.0
314 stars 54 forks source link

how to setup ssl without certificate and key? what are their default values? #60

Closed zentechlinhnguyen closed 6 years ago

gausby commented 6 years ago

The Tortoise.Transport.SSL transport will take an opts field, and its default opts is @default_opts [verify: :verify_peer].

The transport uses the Erlang :ssl module, please refer to the documentation for and user guide in the Erlang documentation:

voltone commented 6 years ago

Since Erlang does not come with a CA trust store, you're going to want to add one in order for server certificate verification to work. You can put a file with the root CA used by your server in your project's priv directory, or add the certifi package as a dependency, then configure Tortoise like this:

server: {
  Tortoise.Transport.SSL,
  host: mqtt_server,
  port: mqtt_port,
  cacertfile: :certifi.cacertfile()
}

Alternatively, for testing purposes, you can disable server certificate verification by passing verify: :verify_none in the server options. In that case there is no need for CA certificates, but you don't get the protections against impersonation or MitM attacks.

voltone commented 6 years ago

I updated the README file with these instructions in #65

gausby commented 6 years ago

@zentechlinhnguyen does the additions to the documentation in #65 answer your question ?

gausby commented 6 years ago

Closing this issue; it seems inactive.