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

#[database] implementation for mongodb ssl support #1115

Closed
lemonxah opened this issue Sep 3, 2019 · 5 comments
Closed

#[database] implementation for mongodb ssl support #1115

lemonxah opened this issue Sep 3, 2019 · 5 comments
Labels
accepted An accepted request or suggestion enhancement A minor feature request request Request for new functionality

Comments

@lemonxah
Copy link

lemonxah commented Sep 3, 2019

Feature Request

Why i believe this feature is necessary

Using mongodb servers that is not in your local network like for example mongo atlas servers only use ssl connections. I have used the #[database] implementation for mongodb and it works really well while running it on my machine while coding, but for me to be able to go to staging or production with this i will have to use state management instead as the current #[database] implementation doesn't allow for ssl connections

@jebrosen jebrosen added accepted An accepted request or suggestion enhancement A minor feature request request Request for new functionality labels Sep 3, 2019
@jebrosen
Copy link
Collaborator

jebrosen commented Sep 4, 2019

In general, most Poolable implementations should expose support their database engine's respective options in some way - TLS is just one example.

For instance, we could support the following in Cargo.toml:

[global.databases.mongo]
url = "mongodb://localhost:27017"
ssl = { ca_file="...", verify_peer = true }

[global.databases.pg]
url = "postgres://"
tls = { mode="prefer", backend="openssl" }

I think it's inevitable that these additional options will all be database-specific.

It's also worth noting that the set of supported database crates and versions may change depending on how things go with #1065.

@nicolasbauw
Copy link

I have a same problematic situation with postgres, as my database provider requires a ssl connection. My api works on my non-ssl test database, but I can't put the api in production :-(

Here is what I can see in database.rs:

// TODO: Come up with a way to handle TLS
#[cfg(feature = "postgres_pool")]

Waiting for the todo to be done ;-)

@jebrosen
Copy link
Collaborator

jebrosen commented Sep 5, 2019

i will have to use state management instead

And for anyone needing to work around this issue, that is "the 0.3 way" to do databases as described in the old version of the guide, which is still largely applicable for this purpose: https://rocket.rs/v0.3/guide/state/#databases.

@nicolasbauw
Copy link

nicolasbauw commented Nov 8, 2019

I've written a code for postgresql / managed state / SSL:
https://github.com/nicolasbauw/rocket-postgresql-ssl

@jebrosen
Copy link
Collaborator

rocket_contrib does not have a mongodb integration at this time (see also #1378), and the latest version of mongodb allows configuring SSL in the URI string with ssl=true/false or tls=true/false (on by default with mongodb+srv). Therefore this should be solved "automatically" by #1117, so I'm closing this one out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted An accepted request or suggestion enhancement A minor feature request request Request for new functionality
Projects
None yet
Development

No branches or pull requests

3 participants