Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Server Name Indication (SNI) Support #103

Closed
estolfo opened this issue Sep 8, 2016 · 8 comments
Closed

Server Name Indication (SNI) Support #103

estolfo opened this issue Sep 8, 2016 · 8 comments
Labels

Comments

@estolfo
Copy link

estolfo commented Sep 8, 2016

This comment implies that SNI is supported but I'm not finding that it's the case.

I've been working on adding in TLS SNI support to the MongoDB driver and when on MRI, I can set the hostname on the SSLSocket after this line.

MongoDB then logs:
new ssl connection, SNI server name [server]

where server is the hostname.

When I'm using JRuby, the MongoDB log shows:
new ssl connection, SNI server name []

Here is the relevant change to the MongoDB Ruby driver.

I've tried with JRuby 1.7.22 and 9.1.2.0.

Let me know if there something else I have to do to get SNI support from JRuby's openssl library. Thanks!

Emily

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/37691267-server-name-indication-sni-support?utm_campaign=plugin&utm_content=tracker%2F136995&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F136995&utm_medium=issues&utm_source=github).
@headius
Copy link
Member

headius commented Sep 13, 2016

Perhaps there's SNI tests somewhere we could try to run? It's really troublesome to support openssl features when there's no tests for most of them :-(

@prcongithub
Copy link

Any update here? I am trying to connect my JRuby 9.1.17.0 app to MongoDB Atlas with ssl: true. It's not able to connect to servers. Same thing works with Ruby 2.2.3 app.

@prcongithub
Copy link

@headius I am able to reproduce the issue with Ruby Mongo driver connecting to a TLS enabled MongoDB cluster.

jruby-9.1.15.0 :002 > client = Mongo::Client.new("mongodb+srv://<Username>:<Password>@sqcluster0-rntvf.mongodb.net/test")
 => #<Mongo::Client:0x2148 cluster=sqcluster0-shard-00-00-rntvf.mongodb.net:27017, sqcluster0-shard-00-01-rntvf.mongodb.net:27017, sqcluster0-shard-00-02-rntvf.mongodb.net:27017>
jruby-9.1.15.0 :003 > client.list_databases
=> Mongo::Error::NoServerAvailable: No server is available matching preference: #<Mongo::ServerSelector::Primary:0x2162 tag_sets=[] max_staleness=nil> using server_selection_timeout=30 and local_threshold=0.015
	from (irb):3:in `<eval>'

Do you need anything else? I can share a dummy username and password to connect with the real mongo cluster on MongoDB Atlas.

@prcongithub
Copy link

@estolfo Would it be safe to set hostname on the socket in a forked repo and use it to connect to MongoDB Atlas for now?

@estolfo
Copy link
Author

estolfo commented Sep 21, 2018

@prcongithub My apologies, I don't work on this project anymore. I suggest reaching out to @p-mongo or @saghm instead.

@p-mongo
Copy link

p-mongo commented Sep 25, 2018

SNI works with jruby 9.1.17.0 and 9.2.0.0 when using java 8.

We enabled it in mongodb/mongo-ruby-driver@e7421ba.

@kares
Copy link
Member

kares commented Sep 26, 2018

thanks Oleg, was pretty sure its already working, since Java 8 is the preferred stack this will stay as is.
also believe they also added the Java API in 8, so this will stay a wont fix for Java 7 users ...

@kares kares added the invalid label Sep 26, 2018
@p-mongo
Copy link

p-mongo commented Sep 10, 2020

Should this ticket be closed? It looks like SNI is supported with java 8 and higher and not supported with java 7 and this is the desired behavior going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants