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

api: add stdout audit logger for RBAC audit logging. #26453

Merged
merged 4 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ proto_library(
"//envoy/extensions/quic/proof_source/v3:pkg",
"//envoy/extensions/quic/server_preferred_address/v3:pkg",
"//envoy/extensions/rate_limit_descriptors/expr/v3:pkg",
"//envoy/extensions/rbac/audit_loggers/stream/v3:pkg",
"//envoy/extensions/rbac/matchers/upstream_ip_port/v3:pkg",
"//envoy/extensions/regex_engines/v3:pkg",
"//envoy/extensions/request_id/uuid/v3:pkg",
Expand Down
9 changes: 9 additions & 0 deletions api/envoy/extensions/rbac/audit_loggers/stream/v3/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# DO NOT EDIT. This file is generated by tools/proto_format/proto_sync.py.

load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")

licenses(["notice"]) # Apache 2

api_proto_package(
deps = ["@com_github_cncf_udpa//udpa/annotations:pkg"],
)
20 changes: 20 additions & 0 deletions api/envoy/extensions/rbac/audit_loggers/stream/v3/stream.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
syntax = "proto3";

package envoy.extensions.rbac.audit_loggers.stream.v3;

import "udpa/annotations/status.proto";

option java_package = "io.envoyproxy.envoy.extensions.rbac.audit_loggers.stream.v3";
option java_outer_classname = "StreamProto";
option java_multiple_files = true;
option go_package = "github.com/envoyproxy/go-control-plane/envoy/extensions/rbac/audit_loggers/stream/v3;streamv3";
option (udpa.annotations.file_status).package_version_status = ACTIVE;

// [#protodoc-title: Standard Streams RBAC Audit Loggers]
// [#not-implemented-hide:]

// Custom configuration for the RBAC audit logger that writes log entries
// directly to the operating system's standard output.
// The logger outputs in JSON format and is currently not configurable.
message StdoutAuditLog {
Copy link
Contributor

Choose a reason for hiding this comment

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

stdout is only one type of log sink, that may not be usable by everyone. Please add something similar to the request access log configuration https://www.envoyproxy.io/docs/envoy/latest/api-v3/config/accesslog/v3/accesslog.proto#config-accesslog-v3-accesslog which allows different implementations of log sinks (i.e. gRPC).

You can exclude the filter field, since there are no defined filtering semantics for RBAC log yet (although I can see someone only logging denied requests).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the review! I realized I forgot to include enough context in the PR description, this logger type is specifically for the API created in #26001 (#26415 as an amendment). The AuditCondition there specifies when to log the request and the logger configuration itself is already a TypedExtensionConfig. We don't need an access log like configuration in this case, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the directory/file names and the proto name should match. If we're calling this StdoutLogger, then let's rename the directory from stream to stdout and the filename from stream.proto to stdout.proto.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, wait, just realized that these names are what is used for the stdout access logger you mentioned above. In that case, this is fine as-is.

}
1 change: 1 addition & 0 deletions api/versioning/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ proto_library(
"//envoy/extensions/quic/proof_source/v3:pkg",
"//envoy/extensions/quic/server_preferred_address/v3:pkg",
"//envoy/extensions/rate_limit_descriptors/expr/v3:pkg",
"//envoy/extensions/rbac/audit_loggers/stream/v3:pkg",
"//envoy/extensions/rbac/matchers/upstream_ip_port/v3:pkg",
"//envoy/extensions/regex_engines/v3:pkg",
"//envoy/extensions/request_id/uuid/v3:pkg",
Expand Down