Skip to content

Enable metadata for Network::RBAC#5106

Merged
mattklein123 merged 7 commits intoenvoyproxy:masterfrom
rshriram:rbac_network_metadata
Nov 28, 2018
Merged

Enable metadata for Network::RBAC#5106
mattklein123 merged 7 commits intoenvoyproxy:masterfrom
rshriram:rbac_network_metadata

Conversation

@rshriram
Copy link
Copy Markdown
Member

@rshriram rshriram commented Nov 25, 2018

Description: PR #4910 missed removing validation constraints that PR #4910 forgot to address. Also fixed API docs to indicate that metadata matching is supported for network level RBAC. Since metadata can be generated during every onData call by a codec (e.g., mongo/mysql/kafka), the RBAC network filter implementation is also modified to use a new (user configured) enforcement type (continuous). When the enforcement type is set to continuous, policy checks will be performed at every onData call.

Risk Level: Low
Testing: Unit tests
Docs Changes: API
Release Notes:

Signed-off-by: Shriram Rajagopalan shriramr@vmware.com

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: mac (failed build)

🐱

Caused by: a #5106 (comment) was created by @rshriram.

see: more, trace.

Shriram Rajagopalan added 2 commits November 26, 2018 03:17
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
…data

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: build_image (failed build)

🐱

Caused by: a #5106 (comment) was created by @rshriram.

see: more, trace.

@rshriram
Copy link
Copy Markdown
Member Author

cc @yangminzhu / @quanjielin

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: build_image (failed build)

🐱

Caused by: a #5106 (comment) was created by @rshriram.

see: more, trace.

Copy link
Copy Markdown
Contributor

@liminw liminw left a comment

Choose a reason for hiding this comment

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

Thanks for the change. It looks good to me overall. One comment regarding shadow rules evaluation.

// calls to onData() could just use the cached result and no need to increase the stats anymore.
// When the enforcement type is continuous always do the RBAC checks. If its connect time check
// only, run the check once and skip for subsequent onData calls.
if (config_->enforcementType() == envoy::config::filter::network::rbac::v2::RBAC::CONTINUOUS) {
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.

In the continuous case, shadow rules should stop evaluation if the result is DENY:

if (config_->enforcementType() == envoy::config::filter::network::rbac::v2::RBAC::CONTINUOUS) {
  if (shadow_engine_result_ != DENY) {
     shadow_engine_result_ = checkEngine(Filters::Common::RBAC::EnforcementMode::Shadow);
  }
  engine_result_ = checkEngine(Filters::Common::RBAC::EnforcementMode::Enforced);
}
...

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.

Would you mind to clarify more about why should we stop the shadow rule evaluation if the result is DENY?
The metadata generated by other filters could be different in following onData() calls which means the shadow rule evaluation could also have different results for each onData() call.

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.

Thats a good point.. Unlike the real rule that terminates the connection, SHADOW rules simply spit out stats about whether each query was allowed or denied..

// establishment to upstream. When used in conjunction with filters that emit
// dynamic metadata after decoding a payload (e.g., Mongo, MySQL, Kafka) set the
// enforcement type to CONTINUOUS.
EnforcementType enforcement_type = 4;
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.

A general question: how this work with allow-list type of rules? i.e. during the connection establishment the connection doesn't have enough metadata, but after decoding it will gain the access, won't the connection be dropped during connection establishment? Definitely worth more comment.

// calls to onData() could just use the cached result and no need to increase the stats anymore.
// When the enforcement type is continuous always do the RBAC checks. If its connect time check
// only, run the check once and skip for subsequent onData calls.
if (config_->enforcementType() == envoy::config::filter::network::rbac::v2::RBAC::CONTINUOUS) {
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.

Would you mind to clarify more about why should we stop the shadow rule evaluation if the result is DENY?
The metadata generated by other filters could be different in following onData() calls which means the shadow rule evaluation could also have different results for each onData() call.

@rshriram
Copy link
Copy Markdown
Member Author

/assign @mattklein123

Copy link
Copy Markdown
Member

@mattklein123 mattklein123 left a comment

Choose a reason for hiding this comment

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

Generally LGTM.

/wait

Shriram Rajagopalan added 2 commits November 27, 2018 20:51
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
…data

Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@mattklein123
Copy link
Copy Markdown
Member

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: tsan (failed build)

🐱

Caused by: a #5106 (comment) was created by @mattklein123.

see: more, trace.

mattklein123
mattklein123 previously approved these changes Nov 27, 2018
// TODO(quanlin): Pass the shadow engine results to other filters.
// Only check the engine and increase stats for the first time call to onData(), any following
// calls to onData() could just use the cached result and no need to increase the stats anymore.
// When the enforcement type is continuous always do the RBAC checks. If its connect time check
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.

nit: s/its/it's

nit
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
@rshriram
Copy link
Copy Markdown
Member Author

/retest

@repokitteh-read-only
Copy link
Copy Markdown

🔨 rebuilding ci/circleci: ipv6_tests (failed build)

🐱

Caused by: a #5106 (comment) was created by @rshriram.

see: more, trace.

@mattklein123 mattklein123 merged commit 87d1c78 into envoyproxy:master Nov 28, 2018
fredlas pushed a commit to fredlas/envoy that referenced this pull request Mar 5, 2019
Signed-off-by: Shriram Rajagopalan <shriramr@vmware.com>
Signed-off-by: Fred Douglas <fredlas@google.com>
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