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

Use system installed certificates by default and accept neo4j+ssc connections #180

Merged
merged 12 commits into from
Jul 25, 2024

Conversation

madchicken
Copy link
Contributor

Trying to fix #85

This PR allows to configure the connection manager with an additional client CA certificate.
I am honestly not very happy with the current implementation, it seems the process of configuring the connection should be refactored a bit, but I am new to this project, so take this as an attempt to solve this issue.

It also replaces webpki-roots with rustls-native-certs, in order to accept certificates installed (and trusted) on the local machine. This allows neo4j+ssc connections when the host system is configured in the proper way.

Accept +ssc connections
Allow additional certificates to be passed in the config
Copy link
Collaborator

@knutwalker knutwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey, thanks for adding this. I left some comments and I think we can simplify some stuff and don't need to introduce new abstractions already. Furthermore, in order to get the PR builds green, you need to update the lock files. This should get the test builds green, what's left is to run cargo fmt and go through the clippy warnings.

.idea/.gitignore Outdated Show resolved Hide resolved
lib/Cargo.toml Outdated Show resolved Hide resolved
lib/src/auth/mod.rs Outdated Show resolved Hide resolved
lib/src/auth/mod.rs Outdated Show resolved Hide resolved
lib/src/config.rs Outdated Show resolved Hide resolved
lib/src/connection.rs Outdated Show resolved Hide resolved
lib/src/connection.rs Outdated Show resolved Hide resolved
lib/src/connection.rs Show resolved Hide resolved
lib/src/connection.rs Outdated Show resolved Hide resolved
lib/src/pool.rs Outdated Show resolved Hide resolved
@madchicken
Copy link
Contributor Author

Fixed all comments, and tested locally with both scenarios: CA certificate passed to the config and CA certificate installed locally (and trusted)

@madchicken madchicken requested a review from knutwalker July 25, 2024 08:59
Copy link
Collaborator

@knutwalker knutwalker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks good now. We can always add some abstraction over different certificate providers if there is a need later. With providing a path, it would be up to the user to use whatever provider they have to generate a file. I think that should actually work for a lot of use-cases, though maybe providing something impl BufRef eventually would allow for in-memory certs.
At any rate, I think you still need to run cargo xtask min in addition to the msrv task.

lib/src/connection.rs Outdated Show resolved Hide resolved
@madchicken madchicken requested a review from knutwalker July 25, 2024 09:38
@knutwalker knutwalker merged commit d930f1a into neo4j-labs:main Jul 25, 2024
21 of 22 checks passed
@knutwalker
Copy link
Collaborator

Thanks for sticking with the review!

@knutwalker
Copy link
Collaborator

Fixed all comments, and tested locally with both scenarios: CA certificate passed to the config and CA certificate installed locally (and trusted)

I do have some plans to add tests over an encrypted connection in the future, this PR will certainly help with that :)

knutwalker pushed a commit that referenced this pull request Jul 31, 2024
…nections (#180)

* Use system installed certificates by default
Accept +ssc connections
Allow additional certificates to be passed in the config

* Remove .idea files

* Sort dependencies

* Address PR comments

* Nit: add CR add the end of the file

* Nit: use cloned instead of map

* Remove useless comment

* Update lock file

* update files with cargo fmt

* Remove wrong warning

* update cargo.lock.min

* formatting
@madchicken madchicken deleted the support-ssc branch January 27, 2025 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support self signed certificates (+ssc schemes)
2 participants