To ensure secure encrypted connections that are not vulnerable to MitM attacks
{:ok, _} = :ssl.listen(4001, [:inet6, {:packet, 0}, {:active, false}, {:keyfile, 'key.pem'}, {:certfile, 'cert.pem'}, {:versions, ['tlsv1.2']}, {:ciphers, [:'ECDH-ECDSA-AES128-GCM-SHA256', :anonymous] }])
This code snippet creates an SSL server that accepts connections using anonymous cipher suites. This means that it does not authenticate the server to the client, allowing potential MitM attacks.
{:ok, _} = :ssl.listen(4001, [:inet6, {:packet, 0}, {:active, false}, {:keyfile, 'key.pem'}, {:certfile, 'cert.pem'}, {:versions, ['tlsv1.2']}, {:ciphers, [:'ECDH-ECDSA-AES128-GCM-SHA256'] }])
This code snippet creates an SSL server that does not accept connections using anonymous cipher suites. By only allowing secure cipher suites, it ensures that all connections are authenticated and resistant to MitM attacks.