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

Warn if ACL is enabled but no token is provided to Envoy #15967

Merged
merged 16 commits into from
Jan 16, 2023

Conversation

kisunji
Copy link
Contributor

@kisunji kisunji commented Jan 12, 2023

Description

When ACLs are enabled, the CLI command consul connect envoy requires a valid ACL token for the sidecar proxy to function. However, the command may not error in the absence of a token since the anonymous token fallback will usually be sufficient for consul connect envoy to complete execution.

This PR adds a call to check if ACLs are enabled then outputs a warning if ACLs are enabled but no token was provided.

This PR also adds a metric to count the number of unauthenticated streams in xDS.

PR Checklist

  • updated test coverage
  • external facing docs updated
  • not a security concern

@kisunji kisunji force-pushed the kisunji/NET-1826-envoy-warn-no-acl-token branch from 299ba29 to f48b94e Compare January 12, 2023 18:59
@github-actions github-actions bot added theme/cli Flags and documentation for the CLI interface theme/envoy/xds Related to Envoy support labels Jan 12, 2023
@kisunji kisunji force-pushed the kisunji/NET-1826-envoy-warn-no-acl-token branch 2 times, most recently from 98bdd2a to 0874992 Compare January 12, 2023 19:02
@kisunji kisunji changed the title Warn if ACL is enabled but token is not provided to Envoy Warn if ACL is enabled but no token is provided to Envoy Jan 12, 2023
@kisunji kisunji marked this pull request as ready for review January 12, 2023 21:42
@kisunji kisunji requested a review from a team as a code owner January 12, 2023 21:42
@kisunji kisunji requested review from a team, rboyer, pglass, DanStough and wilkermichael and removed request for a team January 12, 2023 21:42
agent/xds/server.go Outdated Show resolved Hide resolved
@kisunji kisunji force-pushed the kisunji/NET-1826-envoy-warn-no-acl-token branch from 978deec to 48f14ba Compare January 13, 2023 16:24
Help: "Measures the number of active xDS streams handled by the server split by protocol version.",
},
{
Name: []string{"xds", "server", "streamsUnauthenticated"},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Does this read better as unauthenticatedStreams?

I thought it would be nicer to close to the related streams gauge when sorted alphabetically.

Comment on lines +136 to +137
xDSv3 atomic.Uint64
unauthenticated atomic.Uint64
Copy link
Contributor Author

Choose a reason for hiding this comment

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

no need for manual alignment with these types:

Int64 and Uint64 are automatically aligned to 64-bit boundaries in structs and allocated data, even on 32-bit systems.

src: https://tip.golang.org/doc/go1.19

@kisunji kisunji requested a review from rboyer January 13, 2023 16:54
.changelog/15967.txt Show resolved Hide resolved
agent/grpc-external/metadata.go Outdated Show resolved Hide resolved
@@ -541,6 +541,7 @@ These metrics are used to monitor the health of the Consul servers.
| `consul.grpc.server.stream.count` | Counts the number of new gRPC streams received by the server. Includes a `server_type` label indicating either the `internal` or `external` gRPC server. | streams | counter |
| `consul.grpc.server.streams` | Measures the number of active gRPC streams handled by the server. Includes a `server_type` label indicating either the `internal` or `external` gRPC server. | streams | gauge |
| `consul.xds.server.streams` | Measures the number of active xDS streams handled by the server split by protocol version. | streams | gauge |
| `consul.xds.server.streamsUnauthenticated` | Measures the number of active xDS streams handled by the server that are unauthenticated because ACLs are not enabled or ACL tokens were missing. | streams | gauge |
Copy link

Choose a reason for hiding this comment

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

What does this gauge look like if ACLs are enabled. Will we have any (long-lived) xDS streams that are unauthenticated? Or would this basically be a gauge of the attempts to open an xDS stream that are unauthenticated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Whether ACLs are on or off this gauge will track streams that do not have tokens associated with them. I'm not entirely sure if any unauthenticated streams will be long-lived, unless the anonymous token is privileged enough to continue operating.

@kisunji kisunji force-pushed the kisunji/NET-1826-envoy-warn-no-acl-token branch from 7c54180 to 25760a9 Compare January 13, 2023 20:22
@kisunji kisunji merged commit e4a268e into main Jan 16, 2023
@kisunji kisunji deleted the kisunji/NET-1826-envoy-warn-no-acl-token branch January 16, 2023 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
theme/cli Flags and documentation for the CLI interface theme/envoy/xds Related to Envoy support
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants