TLS client Authentication?

Moved from GitHub dgraph-js/37

Posted by selmeci:

Hi,

I would like to secure my connection with TLS.
How I can setup client authentication?

Thank you.
Best regards,
Roman

gpahal commented :

You need to setup TLS as shown here: https://docs.dgraph.io/deploy#tls-configuration

On the client side, you need to add credentials to the DgraphClientStub constructor sa shown below:

const dgraph = require("dgraph-js");
const grpc = require("grpc");

const clientStub = new dgraph.DgraphClientStub(
  // addr: optional, default: "localhost:9080"
  "localhost:9080",
  // credentials: pass your root certificates here
  grpc.credentials.createSsl(root_certs),
);
const dgraphClient = new dgraph.DgraphClient(clientStub);

selmeci commented :

Hi @gpahal, thanks for hints ;).
There is some issue with TLS setup between dgraph and js but I found working solution.

mkucharz commented :

@selmeci what is you working solution? I’m try many different thing without success… I tried common way and with nginx grpc ssl proxy. It look fro me like some kind of problem with “dgraph-js” library.

selmeci commented :

@mkucharz Unfortunately I did not solve it directly and I have to use nginx grpc ssl proxy for authentication.

mkucharz commented :

@selmeci maybe this will help if you still need it: TLS connection - Error: 14 UNAVAILABLE: Connect Failed · Issue #50 · dgraph-io/dgraph-js · GitHub