Skip to content

Add generic transport security context#189

Closed
lizan wants to merge 2 commits intoenvoyproxy:masterfrom
lizan:transport_security_context
Closed

Add generic transport security context#189
lizan wants to merge 2 commits intoenvoyproxy:masterfrom
lizan:transport_security_context

Conversation

@lizan
Copy link
Copy Markdown
Member

@lizan lizan commented Oct 11, 2017

Context: envoyproxy/envoy#1840

Signed-off-by: Lizan Zhou zlizan@google.com

Signed-off-by: Lizan Zhou <zlizan@google.com>
@lizan
Copy link
Copy Markdown
Member Author

lizan commented Oct 11, 2017

api/sds.proto Outdated
import "api/transport_security.proto";

import "google/api/annotations.proto";
import "google/protobuf/wrappers.proto";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think google/protobuf/wrappers.proto can be removed now.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

ConfigSource sds_config = 2;
}

message TransportSecurityContext {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nit: feel free to add this before SdsSecretConfig, so it's next to other context definition.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done


// Implementation specific configuration which depends on the implementation being instantiated.
// See the supported transport security implementations for further documentation.
google.protobuf.Any config = 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

As discussed in person, I'm fine with Any, but we use Struct in other places for opaque configs.

cc @htuch @mattklein123

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes I am following discussion at envoyproxy/envoy#1680 . For this I feel Any is better since there won't be v1 compatibility issue with JSON.

My POC work actually does parsing Any from JSON without problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I honestly don't fully grok all the history on Struct vs. Any so will defer to @htuch on this.

Copy link
Copy Markdown
Member

@htuch htuch Oct 12, 2017

Choose a reason for hiding this comment

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

I followed up at envoyproxy/envoy#168, but I think that if this is another opaque config that isn't going to always have the proto descriptor available for the inner messages at data-plane-api, then we should at least make the option of Struct, and TBH, I would just defer the Any handling until #1680 gets done as an orthogonal piece of work.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Followed up on envoyproxy/envoy#1680 too.

Also note a Struct can be wrapped into Any. So it seems like for new opaque configs like this PR, can be defined with Any only, to avoid complexities and confusions between Struct and Any, while we provide both options, and gains from typed config.

Copy link
Copy Markdown
Member

@htuch htuch Oct 12, 2017

Choose a reason for hiding this comment

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

I rather not have inconsistency in how opaque configs are provided. Either we resolve envoyproxy/envoy#1680 and apply the solution across the API surface, or we stick with Struct here for now IMHO.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

OK, let's make this just an Any for now, but please document that the dynamically typed Struct equivalent for any proto that is supported by the Any will also be accepted as a value, and Envoy will do the work of attempting to parse this under the expected type for the transport security in question.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think we still need to sort out whether this is a transport security feature or not. Based on the implementation it seems like a full listener/connection swap? (Any/Struct is fine with me).

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sorry for the delay, yes I'm still figuring out the split between transport security or full connection impl. Yet busy with other stuff...

The implementation what I want to hook up (TSI) is just shuffling bytes, so it does't have to be a full listener/connection, though the existing BoringSSL does operate on file descriptors directly.

DownstreamTlsContext tls_context = 2;

oneof transport_security {
DownstreamTlsContext tls_context = 2;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While you're here, can you add comment here, similar to the one for UpstreamTlsContext?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Done

Signed-off-by: Lizan Zhou <zlizan@google.com>
Copy link
Copy Markdown
Contributor

@PiotrSikora PiotrSikora left a comment

Choose a reason for hiding this comment

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

LGTM, pending Any vs Struct decision from @htuch and @mattklein123.

@@ -0,0 +1,151 @@
syntax = "proto3";
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this is all just moves, right? did anything actually change in here beyond the addition of the opaque config message?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Right, just moved all contexts out of sds.proto to here, and added TransportSecurityContext.

@mattklein123
Copy link
Copy Markdown
Member

Seems reasonable to me. @lizan can you add a small amount of detail in terms of how this will work? Where will the dividing line be? Will these be new listeners and new connection impls? Or will this all be baked into SslConnectionImpl somehow?

@lizan
Copy link
Copy Markdown
Member Author

lizan commented Oct 12, 2017

@mattklein123 The plan is to add a factory via registry, which can instantiate listeners and connection impls. I'll make a POC branch in my envoy repo to show how this works.

@mattklein123
Copy link
Copy Markdown
Member

If that's the case, I'm not sure this is really related to security at all? It's basically about plugging in a new connection level stack (which is fine). Can we rename appropriately? Someone could come along and plug in QUIC or any other proprietary thing that can shuffle bytes around.

@lizan
Copy link
Copy Markdown
Member Author

lizan commented Oct 12, 2017

Hmm, I see your point. Let me play around this a bit more, may be next week, I'm busy with other stuff the rest of this week.

The internal PoC did have another listener / connection impls (they also inherits ConnectionImpl) just because Ssl::ConnectionImpl is tightly coupled with ConnectionImpl. I'll see if there are chances that they can be decoupled.

I'm not sure QUIC will fall into this or not (even we make it pluggable connection level stack). Will need to sync with @alyssawilk, since the new impls is still following TCP semantics.

@mattklein123
Copy link
Copy Markdown
Member

cc @jpinner-lyft ^

@htuch
Copy link
Copy Markdown
Member

htuch commented Oct 29, 2017

@lizan where are we with this PR? Do you have an update or should we close out for now?

@lizan
Copy link
Copy Markdown
Member Author

lizan commented Oct 30, 2017

Closing this, I'll make another PR based on conversation in envoyproxy/envoy#1924

@lizan lizan closed this Oct 30, 2017
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.

4 participants