I'm following Amazon's documentation at access-graph-gremlin-dotnet
and trying to run it on a local windows machine that is connected to Neptune with an SSH tunnel through an EC2 instance.
I've tested the SSH tunnel with gremlin console and it works fine.
Running the program on an EC2 instance works as well, but when running the program on a local windows machine I'm getting the following exception because the Neptune's certificate needs to be added to trusted certificates:
System.Net.WebSockets.WebSocketException (0x80004005): Unable to connect to the remote server --->
System.Net.Http.HttpRequestException: The SSL connection could not be established, see inner
exception. ---> System.Security.Authentication.AuthenticationException: The remote certificate is
invalid according to the validation procedure.
I'm searching for how to do so in Gremlin.Net 3.4.6 (preferable C#).
You will need to do this:
notepad c:\windows\system32\drivers\hosts
127.0.0.1 <your neptune cluster endpoint just the name without port>
This is because you are most likely connecting to localhost
and the certificate is signed for the cluster's hostname, so there is a mismatch.
Another option is to use webSocketConfiguration parameter to the GremlinClient constructor and using the RemoteCertificateValidationCallback to do manual checking.
You should be extremely careful with the certificate validation because of the obvious security risks.
var webSocketConfiguration = new Action<ClientWebSocketOptions>(options => {options.RemoteCertificateValidationCallback=(o, c, ch, er) => Test and return true if certificate is valid;});
var gremlinServer = new GremlinServer(endpoint, 8182, enableSsl: true );
var gremlinClient = new GremlinClient(gremlinServer, webSocketConfiguration: webSocketConfiguration);
User contributions licensed under CC BY-SA 3.0