Skip to content

Update config API for TLS to match DIP #126

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

Merged
merged 4 commits into from
Feb 22, 2016
Merged

Conversation

zhenlineo
Copy link
Contributor

No description provided.

jakewins and others added 2 commits February 15, 2016 14:35
This modifes the Config API to talk about encryption rather than TLS, as
well as renaming the on/off and the tls auth config to EncryptionLevel and
TrustStrategy, respectively.
public enum EncryptionLevel
{
/** With this level, the driver will only connect to the server if it can do it without encryption. */
REJECTED,
Copy link
Contributor

Choose a reason for hiding this comment

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

This name feels off. @nigelsmall?

Copy link
Contributor

Choose a reason for hiding this comment

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

Agreed. Not even sure we need two levels of settings (security on/off + security mode). We should probably be able to make do with something like SECURITY_NONE, SECURITY_TOFU and SECURITY_FULL.

Copy link

Choose a reason for hiding this comment

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

FULL is misleading also. I presume you mean certificate authority based? So perhaps SECURITY_CERT?

Which, I think, makes it the same as the TrustStrategy.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just ENCRYPTED and PLAIN_TEXT? Isn't that what this is about? And the class could be something like "EncryptionPolicy"

Copy link

Choose a reason for hiding this comment

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

+1. BTW, libneo4j-client handles this with a single INSECURE flag, which is essentially a Boolean, since there is only two different "levels" anyway.

Copy link
Contributor

Choose a reason for hiding this comment

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

The point of REQUIRED/REJECTED was that it allows adding OPTIONAL later, so if you're connecting to a server that may or may not require TLS, the driver will work either way. This is a nice option if you want to centralize control of this policy - you only have to configure the server to say REQUIRE, and as long as all the drivers are set to OPTIONAL they will follow suit.

Without that option it becomes hard, I think, to change the policy without full system downtime as well. This is how Oracle defines their encryption policy. (actually, they have a fourth, something like DESIRED which solves an ambiguity if both sides are configured as OPTIONAL, but I can't see a real use case for that, just default to using encryption if both sides are set to OPTIONAL)

Obviously, we don't have OPTIONAL on the driver side here, but the naming of the other two was intended to leave a slot for that in a later version.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, note that this policy is orthogonal to how the driver determines trust. This policy is choosing if encryption is required, optional or rejected. How trust is established is a separate variable.

Copy link

Choose a reason for hiding this comment

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

Right. But it's probably a bit speculative to leave an option for OPTIONAL on the client (driver) side. Indeed, it's not even possible in the current protocol, since the client starts the conversation and has to choose one or the other with no knowledge or negotiation.

Copy link
Contributor

Choose a reason for hiding this comment

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

It's certainly possible - the driver would try encrypted first, and degrade to non-encrypted. OPTIONAL was part of the design and was originally in the DIP, but we agreed to wait to include it due to time constraints. Since this is a useful operational feature, and the overhead of leaving space here (calling this EncryptionPolicy.REQUIRED/REJECTED vs EncryptionPolicy.SECURE/INSECURE as you suggest) is minimal, I think the alternative paints us into a corner for very little benefit while this leaves a nice door open to add this feature later.

Copy link

Choose a reason for hiding this comment

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

Ah, you mean try two independent connections? Yes, that'd work. I was referring to the inability to decline a TLS handshake, but of course that can be done by closing the connection and starting again.

@zhenlineo zhenlineo force-pushed the 1.0-tls branch 2 times, most recently from d132626 to e30758e Compare February 17, 2016 10:07
jakewins added a commit that referenced this pull request Feb 22, 2016
Update config API for TLS to match DIP
@jakewins jakewins merged commit 9d30dcc into neo4j:1.0 Feb 22, 2016
@zhenlineo zhenlineo deleted the 1.0-tls branch January 19, 2017 13:15
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.

5 participants