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

Make Neo4j transport encryption configurable #6265

Conversation

michael-simons
Copy link
Contributor

This makes the encryption-option of the driver configurable (at least when not in native image mode). I chose the name Config for the class to align the naming with the integrations with other platforms. In case you can tell me how to have another class name map to config in the properties, than I would rather name DriverSettings (analogue to https://github.com/neo4j/neo4j-java-driver-spring-boot-starter/blob/master/neo4j-java-driver-spring-boot-autoconfigure/src/main/java/org/neo4j/driver/springframework/boot/autoconfigure/Neo4jDriverProperties.java#L287).

*/
@ConfigItem
@ConfigDocSection
public Config config;
Copy link
Member

Choose a reason for hiding this comment

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

You can name it DriverSettingsConfig and name the property driverSettings. Or maybe just driver (we are in the config anyway so you clearly expect settings).

It's the name of the property that is taken as the name of the config key. So you would have quarkus.neo4j.driver-settings.encrypted for instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think I than would rather prefer pulling that setting up into top level. I don't expect an object mapper for Neo4j in Quarkus anytime soon. Wdyt?

Copy link
Member

Choose a reason for hiding this comment

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

That was my first thought when I saw the patch so I think it will be good enough.

static class Config {

/**
* Flag, if the driver should use encrypted traffic.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* Flag, if the driver should use encrypted traffic.
* If the driver should use encrypted traffic.

@michael-simons michael-simons force-pushed the feature/make_neo4j_encryption_configurable branch 2 times, most recently from 446872c to ae8cb3f Compare December 20, 2019 09:39
@michael-simons
Copy link
Contributor Author

I have implemented the suggestion and added further settings, which I think will be necessary. Thanks for looking into this.

@michael-simons
Copy link
Contributor Author

Ping.

* Configures which trust strategy to apply when using encrypted traffic.
*/
@ConfigItem(defaultValue = "TRUST_SYSTEM_CA_SIGNED_CERTIFICATES")
public Strategy strategy = Strategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
public Strategy strategy = Strategy.TRUST_SYSTEM_CA_SIGNED_CERTIFICATES;
public Strategy strategy;

Copy link
Member

Choose a reason for hiding this comment

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

Oh I just saw that there is test defaultsShouldWork() so maybe let's keep it the way it was.

@michael-simons michael-simons force-pushed the feature/make_neo4j_encryption_configurable branch from ae8cb3f to 5d6d679 Compare February 5, 2020 08:31
@michael-simons
Copy link
Contributor Author

Thanks @machi1990 for your kind review. I adapted to not using default values in the class itself (I'm used to the way of Boot, need to switch here when working on Quarkus) and also rebased onto the current master.

@machi1990
Copy link
Member

Thanks @machi1990 for your kind review. I adapted to not using default values in the class itself (I'm used to the way of Boot, need to switch here when working on Quarkus) and also rebased onto the current master.

Thanks for the contribution.

I do not know much about neo4j, @michael-simons you are the expert here but LGTM otherwise. @gsmet WDYT?

@machi1990 machi1990 requested a review from gsmet February 5, 2020 11:08
@michael-simons
Copy link
Contributor Author

The change will allow connecting to Neo4j server using encrypted connection without manually providing the driver bean.

I plan to do a Quarkus example connecting to our cloud offering with it, so yes, I think it fulfills this goal.

@michael-simons
Copy link
Contributor Author

Ping?

1 similar comment
@michael-simons
Copy link
Contributor Author

Ping?

@gsmet
Copy link
Member

gsmet commented Apr 24, 2020

@michael-simons just a heads up that I'm back to addressing the huge backlog of PRs so you will have some news soon.

Sorry about the delay. Things have been a bit crazy until now!

@gastaldi gastaldi added the triage/needs-rebase This PR needs to be rebased first because it has merge conflicts label Jul 7, 2020
@gastaldi
Copy link
Contributor

@michael-simons mind rebasing this PR and squashing the commits? Looks good to me

@michael-simons
Copy link
Contributor Author

I’d love to. Will do next Monday (away from keyboard and things)

@michael-simons michael-simons force-pushed the feature/make_neo4j_encryption_configurable branch from 5d6d679 to 388afea Compare July 28, 2020 07:25
This adds the encrypted flag to the top level configuration and a new group that makes it possible to change the general trust settings. All settings have the same default as the underlying driver.

Polishing.
@michael-simons michael-simons force-pushed the feature/make_neo4j_encryption_configurable branch from 388afea to 67f6073 Compare July 28, 2020 07:26
@michael-simons
Copy link
Contributor Author

Rebased, squashed and pushed…. Thanks for reviving this.

I noticed that the configuration has been polished. While I of course accept Quarkus' way of doing it, I do think it's easier to read the explicitly stated defaults, even for scalar values (related: https://twitter.com/rotnroll666/status/1288009552777097216)

Thanks again!

@gastaldi gastaldi removed the triage/needs-rebase This PR needs to be rebased first because it has merge conflicts label Jul 28, 2020
@gsmet gsmet changed the title Make Neo4j transport encryption configurable. Make Neo4j transport encryption configurable Jul 29, 2020
@gsmet gsmet merged commit f80bb06 into quarkusio:master Jul 29, 2020
@gsmet
Copy link
Member

gsmet commented Jul 29, 2020

Sorry it took me so long to review it and merge it! Thanks!

@gsmet gsmet added this to the 1.7.0 - master milestone Jul 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants