I am able to do MTLS connections to a given service using curl and httpie. That works fine.
An example of a working httpie command http post --cert=./cert.pem --cert-key=./cert.key <url>
The key is passphrase protected, but I have tried using an unprotected one in Req/elixir and no dice.
But as soon as I try to replicate that in elixir using Req I get errors from the service saying that there is no client certificate being used.
I have tried using certfile and keyfile and password but nothing seems to work and there is remarkably no documentation about this.
I could swear I had it working before but I cannot for the life of me get it working now.
I appreciate this will be reasonably tricky to identify as I cannot obviously share the keys. But I would love any help, I am going slowly insane.
What you’re probably missing is CAs for the sever you’re connecting to. curl has a bit of magic to look in your system for CA store files with all the typical globally trusted root CAs. However, you have to explicitly give that to erlang. Adding cacerts: :public_key.cacerts_get() option would probably fix it for you so the server chain can be validated.
When in doubt, you can also set log_level: :debug in the SSL options to get more hints about where it is failing
Great answer, I think there was something to do with a TLS1.3 → 1.2 bug in erlang itself. That might be partly to blame for this. I have to deprio this right now but Ill keep it in mind.