Skip to content

Cannot get mutual TLS to work with gRPC over Mint adapter, even though I can get it working with native Mint adapter. Syntax? #393

@vegabook

Description

@vegabook

Hello!

When I use elixir Mint directly using mutual TLS, it works fine, but if I try to use the Mint adapter with elixir-grpc, it doesn't.

This works:
https://github.com/user-attachments/assets/095e5450-ae2b-49e5-86fe-eb3f300fbc50
(gives no errors server side)

But this doesn't:
https://github.com/user-attachments/assets/0373023a-df53-40de-b4f0-0b9b9c056034
Server side error:
https://github.com/user-attachments/assets/f985d534-6964-45b9-b726-aef6e0ffa94d

I've tried putting the configs into my config.exs (duplicating because syntax is not obvious from docs):
https://github.com/user-attachments/assets/79be4544-938c-4f18-832f-a4afaca2aa7d

Any idea how I can get the working mint connection, working with elixir-grpc?

I have this working with mutual TLS in Python just for guide: https://github.com/vegabook/gBLP/blob/main/gBLP/client_gblp.py#L135-L166

Here is the text of the connection code:

channel = GRPC.Stub.connect("signaliser.com:50051", adapter: GRPC.Client.Adapters.Mint, custom_opts: [certfile: "/home/tbrowne/scratch/client_combined.pem", cacertfile: "/home/tbrowne/scratch/cacert.pem"]) |> elem(1)

I should add that the WRONG_VERSION_NUMBER error is the same one I was getting when my python code was not sending keys and certs properly, and is also what happens if you send no keys and certs.

Note that even if you do not provide any certs whatsoever, it still appears to connect:
https://github.com/user-attachments/assets/3c26c12e-91f0-49dc-a7c5-27a8ee511b4c

whereas if you do the same on Mint without gRPC you definitely get an error:

https://github.com/user-attachments/assets/aaa565cf-387b-422d-ae73-0bfe31991df0

How do I get the working Mint config to be passed via elixir-grpc? Or maybe Gun adapter can do this?

(just for guide if you want to generate a CA authority and server and client authority, this python code will do it)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions