diff --git a/kubernetes/customresourcedefinitions.gen.yaml b/kubernetes/customresourcedefinitions.gen.yaml index 74011226d9..abe2d872d6 100644 --- a/kubernetes/customresourcedefinitions.gen.yaml +++ b/kubernetes/customresourcedefinitions.gen.yaml @@ -6251,6 +6251,7 @@ spec: enum: - ALLOW - DENY + - AUDIT type: string rules: description: Optional. diff --git a/proto.lock b/proto.lock index a179cb5c69..fb183c1356 100644 --- a/proto.lock +++ b/proto.lock @@ -13049,13 +13049,7 @@ "value": "/v1/services/{service_name}/configs/{config_id}" }, { - "name": "additional_bindings", - "aggregated": [ - { - "name": "get", - "value": "/v1/services/{service_name}/config" - } - ] + "name": "additional_bindings" } ] } @@ -46005,6 +45999,60 @@ ] } }, + { + "protopath": "security:/:v1alpha1:/:ca.proto", + "def": { + "messages": [ + { + "name": "IstioCertificateRequest", + "fields": [ + { + "id": 1, + "name": "csr", + "type": "string" + }, + { + "id": 3, + "name": "validity_duration", + "type": "int64" + } + ] + }, + { + "name": "IstioCertificateResponse", + "fields": [ + { + "id": 1, + "name": "cert_chain", + "type": "string", + "is_repeated": true + } + ] + } + ], + "services": [ + { + "name": "IstioCertificateService", + "rpcs": [ + { + "name": "CreateCertificate", + "in_type": "IstioCertificateRequest", + "out_type": "IstioCertificateResponse" + } + ] + } + ], + "package": { + "name": "istio.v1.auth" + }, + "options": [ + { + "name": "go_package", + "value": "istio.io/api/security/v1alpha1" + } + ] + } + }, { "protopath": "security:/:v1beta1:/:authorization.proto", "def": { @@ -46018,6 +46066,10 @@ { "name": "DENY", "integer": 1 + }, + { + "name": "AUDIT", + "integer": 2 } ] } diff --git a/python/istio_api/security/v1beta1/authorization_pb2.py b/python/istio_api/security/v1beta1/authorization_pb2.py index 4f6f16cd68..65517cc829 100644 --- a/python/istio_api/security/v1beta1/authorization_pb2.py +++ b/python/istio_api/security/v1beta1/authorization_pb2.py @@ -22,7 +22,7 @@ package='istio.security.v1beta1', syntax='proto3', serialized_options=_b('Z\035istio.io/api/security/v1beta1'), - serialized_pb=_b('\n$security/v1beta1/authorization.proto\x12\x16istio.security.v1beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1btype/v1beta1/selector.proto\"\xdd\x01\n\x13\x41uthorizationPolicy\x12\x36\n\x08selector\x18\x01 \x01(\x0b\x32$.istio.type.v1beta1.WorkloadSelector\x12+\n\x05rules\x18\x02 \x03(\x0b\x32\x1c.istio.security.v1beta1.Rule\x12\x42\n\x06\x61\x63tion\x18\x03 \x01(\x0e\x32\x32.istio.security.v1beta1.AuthorizationPolicy.Action\"\x1d\n\x06\x41\x63tion\x12\t\n\x05\x41LLOW\x10\x00\x12\x08\n\x04\x44\x45NY\x10\x01\"\x89\x02\n\x04Rule\x12/\n\x04\x66rom\x18\x01 \x03(\x0b\x32!.istio.security.v1beta1.Rule.From\x12+\n\x02to\x18\x02 \x03(\x0b\x32\x1f.istio.security.v1beta1.Rule.To\x12/\n\x04when\x18\x03 \x03(\x0b\x32!.istio.security.v1beta1.Condition\x1a\x36\n\x04\x46rom\x12.\n\x06source\x18\x01 \x01(\x0b\x32\x1e.istio.security.v1beta1.Source\x1a:\n\x02To\x12\x34\n\toperation\x18\x01 \x01(\x0b\x32!.istio.security.v1beta1.Operation\"\xc6\x01\n\x06Source\x12\x12\n\nprincipals\x18\x01 \x03(\t\x12\x16\n\x0enot_principals\x18\x05 \x03(\t\x12\x1a\n\x12request_principals\x18\x02 \x03(\t\x12\x1e\n\x16not_request_principals\x18\x06 \x03(\t\x12\x12\n\nnamespaces\x18\x03 \x03(\t\x12\x16\n\x0enot_namespaces\x18\x07 \x03(\t\x12\x11\n\tip_blocks\x18\x04 \x03(\t\x12\x15\n\rnot_ip_blocks\x18\x08 \x03(\t\"\x97\x01\n\tOperation\x12\r\n\x05hosts\x18\x01 \x03(\t\x12\x11\n\tnot_hosts\x18\x05 \x03(\t\x12\r\n\x05ports\x18\x02 \x03(\t\x12\x11\n\tnot_ports\x18\x06 \x03(\t\x12\x0f\n\x07methods\x18\x03 \x03(\t\x12\x13\n\x0bnot_methods\x18\x07 \x03(\t\x12\r\n\x05paths\x18\x04 \x03(\t\x12\x11\n\tnot_paths\x18\x08 \x03(\t\"A\n\tCondition\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0e\n\x06values\x18\x02 \x03(\t\x12\x12\n\nnot_values\x18\x03 \x03(\tB\x1fZ\x1distio.io/api/security/v1beta1b\x06proto3') + serialized_pb=_b('\n$security/v1beta1/authorization.proto\x12\x16istio.security.v1beta1\x1a\x1fgoogle/api/field_behavior.proto\x1a\x1btype/v1beta1/selector.proto\"\xe8\x01\n\x13\x41uthorizationPolicy\x12\x36\n\x08selector\x18\x01 \x01(\x0b\x32$.istio.type.v1beta1.WorkloadSelector\x12+\n\x05rules\x18\x02 \x03(\x0b\x32\x1c.istio.security.v1beta1.Rule\x12\x42\n\x06\x61\x63tion\x18\x03 \x01(\x0e\x32\x32.istio.security.v1beta1.AuthorizationPolicy.Action\"(\n\x06\x41\x63tion\x12\t\n\x05\x41LLOW\x10\x00\x12\x08\n\x04\x44\x45NY\x10\x01\x12\t\n\x05\x41UDIT\x10\x02\"\x89\x02\n\x04Rule\x12/\n\x04\x66rom\x18\x01 \x03(\x0b\x32!.istio.security.v1beta1.Rule.From\x12+\n\x02to\x18\x02 \x03(\x0b\x32\x1f.istio.security.v1beta1.Rule.To\x12/\n\x04when\x18\x03 \x03(\x0b\x32!.istio.security.v1beta1.Condition\x1a\x36\n\x04\x46rom\x12.\n\x06source\x18\x01 \x01(\x0b\x32\x1e.istio.security.v1beta1.Source\x1a:\n\x02To\x12\x34\n\toperation\x18\x01 \x01(\x0b\x32!.istio.security.v1beta1.Operation\"\xc6\x01\n\x06Source\x12\x12\n\nprincipals\x18\x01 \x03(\t\x12\x16\n\x0enot_principals\x18\x05 \x03(\t\x12\x1a\n\x12request_principals\x18\x02 \x03(\t\x12\x1e\n\x16not_request_principals\x18\x06 \x03(\t\x12\x12\n\nnamespaces\x18\x03 \x03(\t\x12\x16\n\x0enot_namespaces\x18\x07 \x03(\t\x12\x11\n\tip_blocks\x18\x04 \x03(\t\x12\x15\n\rnot_ip_blocks\x18\x08 \x03(\t\"\x97\x01\n\tOperation\x12\r\n\x05hosts\x18\x01 \x03(\t\x12\x11\n\tnot_hosts\x18\x05 \x03(\t\x12\r\n\x05ports\x18\x02 \x03(\t\x12\x11\n\tnot_ports\x18\x06 \x03(\t\x12\x0f\n\x07methods\x18\x03 \x03(\t\x12\x13\n\x0bnot_methods\x18\x07 \x03(\t\x12\r\n\x05paths\x18\x04 \x03(\t\x12\x11\n\tnot_paths\x18\x08 \x03(\t\"A\n\tCondition\x12\x10\n\x03key\x18\x01 \x01(\tB\x03\xe0\x41\x02\x12\x0e\n\x06values\x18\x02 \x03(\t\x12\x12\n\nnot_values\x18\x03 \x03(\tB\x1fZ\x1distio.io/api/security/v1beta1b\x06proto3') , dependencies=[google_dot_api_dot_field__behavior__pb2.DESCRIPTOR,type_dot_v1beta1_dot_selector__pb2.DESCRIPTOR,]) @@ -42,11 +42,15 @@ name='DENY', index=1, number=1, serialized_options=None, type=None), + _descriptor.EnumValueDescriptor( + name='AUDIT', index=2, number=2, + serialized_options=None, + type=None), ], containing_type=None, serialized_options=None, serialized_start=319, - serialized_end=348, + serialized_end=359, ) _sym_db.RegisterEnumDescriptor(_AUTHORIZATIONPOLICY_ACTION) @@ -93,7 +97,7 @@ oneofs=[ ], serialized_start=127, - serialized_end=348, + serialized_end=359, ) @@ -123,8 +127,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=502, - serialized_end=556, + serialized_start=513, + serialized_end=567, ) _RULE_TO = _descriptor.Descriptor( @@ -153,8 +157,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=558, - serialized_end=616, + serialized_start=569, + serialized_end=627, ) _RULE = _descriptor.Descriptor( @@ -197,8 +201,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=351, - serialized_end=616, + serialized_start=362, + serialized_end=627, ) @@ -277,8 +281,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=619, - serialized_end=817, + serialized_start=630, + serialized_end=828, ) @@ -357,8 +361,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=820, - serialized_end=971, + serialized_start=831, + serialized_end=982, ) @@ -402,8 +406,8 @@ extension_ranges=[], oneofs=[ ], - serialized_start=973, - serialized_end=1038, + serialized_start=984, + serialized_end=1049, ) _AUTHORIZATIONPOLICY.fields_by_name['selector'].message_type = type_dot_v1beta1_dot_selector__pb2._WORKLOADSELECTOR diff --git a/security/v1beta1/authorization.gen.json b/security/v1beta1/authorization.gen.json index 876d340db2..3cfad4f990 100644 --- a/security/v1beta1/authorization.gen.json +++ b/security/v1beta1/authorization.gen.json @@ -57,7 +57,8 @@ "type": "string", "enum": [ "ALLOW", - "DENY" + "DENY", + "AUDIT" ] }, "istio.security.v1beta1.Rule.From": { diff --git a/security/v1beta1/authorization.pb.go b/security/v1beta1/authorization.pb.go index 596ae6c246..c99afe9310 100644 --- a/security/v1beta1/authorization.pb.go +++ b/security/v1beta1/authorization.pb.go @@ -12,9 +12,19 @@ // 3. If any of the ALLOW policies match the request, allow the request. // 4. Deny the request. // -// For example, the following authorization policy sets the `action` to "ALLOW" -// to create an allow policy. The default action is "ALLOW" but it is useful -// to be explicit in the policy. +// Istio Authorization Policy also supports the AUDIT action to decide whether to log requests. +// AUDIT policies do not affect whether requests are allowed or denied to the workload. +// Requests will be allowed or denied based solely on ALLOW and DENY policies. +// +// A request will be internally marked that it should be audited if there is an AUDIT policy on the workload that matches the request. +// A separate plugin must be configured and enabled to actually fulfill the audit decision and complete the audit behavior. +// The request will not be audited if there are no such supporting plugins enabled. +// Currently, the only supported plugin is the [Telemetry v2 Stackdriver](https://istio.io/latest/docs/reference/config/proxy_extensions/stackdriver/) plugin. +// +// Here is an example of Istio Authorization Policy: +// +// It sets the `action` to "ALLOW" to create an allow policy. The default action is "ALLOW" +// but it is useful to be explicit in the policy. // // It allows requests from: // @@ -77,6 +87,27 @@ // methods: ["POST"] // ``` // +// The following authorization policy sets the `action` to "AUDIT". It will audit any GET requests to the path with the +// prefix "/user/profile". +// +// ```yaml +// apiVersion: security.istio.io/v1beta1 +// kind: AuthorizationPolicy +// metadata: +// namespace: ns1 +// name: anyname +// spec: +// selector: +// matchLabels: +// app: myapi +// action: audit +// rules: +// - to: +// - operation: +// methods: ["GET"] +// paths: [“/user/profile/*”] +// ```` +// // Authorization Policy scope (target) is determined by "metadata/namespace" and // an optional "selector". // @@ -160,16 +191,20 @@ const ( AuthorizationPolicy_ALLOW AuthorizationPolicy_Action = 0 // Deny a request if it matches any of the rules. AuthorizationPolicy_DENY AuthorizationPolicy_Action = 1 + // Audit a request if it matches any of the rules. + AuthorizationPolicy_AUDIT AuthorizationPolicy_Action = 2 ) var AuthorizationPolicy_Action_name = map[int32]string{ 0: "ALLOW", 1: "DENY", + 2: "AUDIT", } var AuthorizationPolicy_Action_value = map[string]int32{ "ALLOW": 0, "DENY": 1, + "AUDIT": 2, } func (x AuthorizationPolicy_Action) String() string { @@ -831,48 +866,49 @@ func init() { } var fileDescriptor_b72f4bc212a83269 = []byte{ - // 654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xdd, 0x6e, 0xd3, 0x4e, - 0x10, 0xc5, 0xff, 0x76, 0x12, 0x37, 0x9e, 0xea, 0x5f, 0x95, 0xa5, 0x54, 0x51, 0x4a, 0xd3, 0x62, - 0x15, 0xa9, 0x12, 0xc2, 0x51, 0xc3, 0xc7, 0x25, 0x90, 0x42, 0x11, 0xa0, 0xd2, 0x56, 0x6e, 0x45, - 0x55, 0x6e, 0x22, 0xc7, 0xd9, 0x36, 0xab, 0x3a, 0x1e, 0x63, 0xaf, 0x8b, 0xc2, 0x33, 0xf1, 0x08, - 0x3c, 0x00, 0x97, 0xbc, 0x01, 0x55, 0x1f, 0x82, 0x6b, 0xb4, 0x5f, 0x4e, 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e3, 0xaa, 0xfa, 0x6d, 0x19, 0xca, 0x17, 0xef, 0xef, 0xa7, 0xb3, 0xef, 0xc8, 0x77, 0xed, 0xd1, - 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x59, 0x1f, 0xf3, 0xa8, 0x55, 0x05, 0x00, 0x00, + // 660 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x94, 0xdf, 0x4e, 0x13, 0x41, + 0x14, 0xc6, 0xdd, 0x6d, 0xbb, 0x74, 0x0f, 0x91, 0xe0, 0x88, 0xa4, 0x29, 0x52, 0xb0, 0xc1, 0xa4, + 0x89, 0x71, 0x1b, 0xea, 0x9f, 0x4b, 0xb5, 0x08, 0x46, 0x0c, 0x02, 0x59, 0x50, 0x82, 0x37, 0xcd, + 0x76, 0x3b, 0xd0, 0x09, 0xdb, 0x3d, 0xeb, 0xee, 0x2c, 0xa6, 0xde, 0xf9, 0x3e, 0x3e, 0x82, 0x0f, + 0xe0, 0xa5, 0x6f, 0x20, 0xe1, 0x49, 0xcc, 0xfc, 0xdb, 0x56, 0x05, 0x2e, 0xcf, 0x9c, 0xdf, 0x77, + 0xbe, 0x6f, 0xce, 0x6e, 0x06, 0xd6, 0x32, 0x1a, 0xe6, 0x29, 0xe3, 0xe3, 0xf6, 0xf9, 0x7a, 0x9f, + 0xf2, 0x60, 0xbd, 0x1d, 0xe4, 0x7c, 0x88, 0x29, 0xfb, 0x1a, 0x70, 0x86, 0xb1, 0x97, 0xa4, 0xc8, + 0x91, 0x2c, 0xb2, 0x8c, 0x33, 0xf4, 0x0c, 0xeb, 0x69, 0xb6, 0xbe, 0x72, 0x8a, 0x78, 0x1a, 0xd1, + 0x76, 0x90, 0xb0, 0xf6, 0x09, 0xa3, 0xd1, 0xa0, 0xd7, 0xa7, 0xc3, 0xe0, 0x9c, 0x61, 0xaa, 0x84, + 0xf5, 0x25, 0x3e, 0x4e, 0x68, 0x31, 0x3a, 0xa3, 0x11, 0x0d, 0xb9, 0x69, 0x36, 0xbf, 0xd9, 0x70, + 0xb7, 0x3b, 0xed, 0xb6, 0x8f, 0x11, 0x0b, 0xc7, 0xe4, 0x15, 0x54, 0x0d, 0x59, 0xb3, 0x56, 0xad, + 0xd6, 0x6c, 0x67, 0xcd, 0x53, 0x01, 0xc4, 0x34, 0x63, 0xee, 0x1d, 0x61, 0x7a, 0x16, 0x61, 0x30, + 0x38, 0xd0, 0xac, 0x5f, 0xa8, 0x48, 0x07, 0x2a, 0x69, 0x1e, 0xd1, 0xac, 0x66, 0xaf, 0x96, 0x5a, + 0xb3, 0x9d, 0xfb, 0xde, 0xd5, 0xf9, 0x3d, 0x3f, 0x8f, 0xa8, 0xaf, 0x50, 0xf2, 0x0e, 0x9c, 0x20, + 0x14, 0x29, 0x6a, 0xa5, 0x55, 0xab, 0x35, 0xd7, 0xe9, 0x5c, 0x27, 0xba, 0x22, 0xb2, 0xd7, 0x95, + 0x4a, 0x5f, 0x4f, 0x68, 0xb6, 0xc0, 0x51, 0x27, 0xc4, 0x85, 0x4a, 0x77, 0x67, 0x67, 0xef, 0x68, + 0xfe, 0x16, 0xa9, 0x42, 0x79, 0x73, 0x6b, 0xf7, 0x78, 0xde, 0x92, 0x87, 0x1f, 0x36, 0xb7, 0x0f, + 0xe7, 0xed, 0xe6, 0x77, 0x1b, 0xca, 0x22, 0x05, 0x79, 0x06, 0xe5, 0x93, 0x14, 0x47, 0x35, 0x4b, + 0x26, 0x7e, 0x70, 0x53, 0x62, 0xef, 0x4d, 0x8a, 0x23, 0x5f, 0xe2, 0xa4, 0x0d, 0x36, 0x47, 0x7d, + 0xcd, 0x95, 0x1b, 0x45, 0x87, 0xe8, 0xdb, 0x1c, 0x85, 0xcf, 0x97, 0x21, 0x15, 0x97, 0xbc, 0xd1, + 0xe7, 0x35, 0xc6, 0x03, 0x26, 0xef, 0x24, 0xf1, 0xfa, 0x0b, 0x28, 0x0b, 0x57,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0xfc, 0xad, 0x6c, 0x2e, 0x40, 0x25, 0xc1, 0x94, 0x9b, 0x05, 0xa9, 0xc2, + 0x48, 0x54, 0xc7, 0x29, 0x24, 0xfb, 0xb2, 0x59, 0x83, 0x99, 0x11, 0xe5, 0x43, 0x1c, 0x98, 0x8b, + 0x9b, 0x92, 0xac, 0x80, 0x08, 0xd7, 0x33, 0xdd, 0x19, 0xbd, 0x16, 0xe4, 0xef, 0x35, 0x20, 0xdc, + 0x02, 0x3e, 0x34, 0x77, 0x55, 0x45, 0xe1, 0x26, 0x3b, 0xd5, 0x89, 0x9b, 0xa8, 0x9b, 0xc7, 0xe0, + 0x16, 0xbf, 0x2e, 0xb9, 0x07, 0xa5, 0x33, 0x3a, 0x96, 0x3f, 0x9a, 0xbb, 0x51, 0xba, 0xe8, 0xda, + 0xbe, 0xa8, 0xc9, 0x22, 0x38, 0xe7, 0x41, 0x94, 0x53, 0x73, 0x0b, 0x5d, 0x91, 0x65, 0x10, 0xe6, + 0x3d, 0xdd, 0x53, 0x61, 0x85, 0xd5, 0x47, 0x79, 0xb0, 0xf1, 0xe8, 0xe7, 0x65, 0xc3, 0xfa, 0x75, + 0xd9, 0xb0, 0x2e, 0x2e, 0x1b, 0xd6, 0xa7, 0x65, 0xf5, 0xdb, 0x32, 0x94, 0x8f, 0xdf, 0xbf, 0xaf, + 0x68, 0xdf, 0x91, 0x4f, 0xdc, 0x93, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x0a, 0xaa, 0xb3, 0x5d, + 0x60, 0x05, 0x00, 0x00, } func (m *AuthorizationPolicy) Marshal() (dAtA []byte, err error) { diff --git a/security/v1beta1/authorization.pb.html b/security/v1beta1/authorization.pb.html index 776cdd75ce..c09836d89a 100644 --- a/security/v1beta1/authorization.pb.html +++ b/security/v1beta1/authorization.pb.html @@ -22,9 +22,19 @@
  • Deny the request.
  • -

    For example, the following authorization policy sets the action to “ALLOW” -to create an allow policy. The default action is “ALLOW” but it is useful -to be explicit in the policy.

    +

    Istio Authorization Policy also supports the AUDIT action to decide whether to log requests. +AUDIT policies do not affect whether requests are allowed or denied to the workload. +Requests will be allowed or denied based solely on ALLOW and DENY policies.

    + +

    A request will be internally marked that it should be audited if there is an AUDIT policy on the workload that matches the request. +A separate plugin must be configured and enabled to actually fulfill the audit decision and complete the audit behavior. +The request will not be audited if there are no such supporting plugins enabled. +Currently, the only supported plugin is the Telemetry v2 Stackdriver plugin.

    + +

    Here is an example of Istio Authorization Policy:

    + +

    It sets the action to “ALLOW” to create an allow policy. The default action is “ALLOW” +but it is useful to be explicit in the policy.

    It allows requests from:

    @@ -89,22 +99,41 @@ methods: ["POST"] -

    Authorization Policy scope (target) is determined by “metadata/namespace” and -an optional “selector”.

    - - - -

    For example,

    - -

    The following authorization policy applies to workloads containing label -“app: httpbin” in namespace bar.

    +

    The following authorization policy sets the action to “AUDIT”. It will audit any GET requests to the path with the +prefix “/user/profile”.

    apiVersion: security.istio.io/v1beta1
     kind: AuthorizationPolicy
    +metadata:
    +  namespace: ns1
    +  name: anyname
    +spec:
    +  selector:
    +    matchLabels:
    +      app: myapi
    +  action: audit
    +  rules:
    +  - to:
    +    - operation:
    +        methods: ["GET"]
    +        paths: [“/user/profile/*”]
    +````
    +
    +Authorization Policy scope (target) is determined by "metadata/namespace" and
    +an optional "selector".
    +
    +- "metadata/namespace" tells which namespace the policy applies. If set to root
    +namespace, the policy applies to all namespaces in a mesh.
    +- workload "selector" can be used to further restrict where a policy applies.
    +
    +For example,
    +
    +The following authorization policy applies to workloads containing label
    +"app: httpbin" in namespace bar.
    +
    +```yaml
    +apiVersion: security.istio.io/v1beta1
    +kind: AuthorizationPolicy
     metadata:
      name: policy
      namespace: bar
    @@ -672,6 +701,13 @@ 

    AuthorizationPolicy.Action

    Deny a request if it matches any of the rules.

    + + + +AUDIT + +

    Audit a request if it matches any of the rules.

    + diff --git a/security/v1beta1/authorization.proto b/security/v1beta1/authorization.proto index 1a2cc76b53..ab3f062a3e 100644 --- a/security/v1beta1/authorization.proto +++ b/security/v1beta1/authorization.proto @@ -34,9 +34,19 @@ import "type/v1beta1/selector.proto"; // 3. If any of the ALLOW policies match the request, allow the request. // 4. Deny the request. // -// For example, the following authorization policy sets the `action` to "ALLOW" -// to create an allow policy. The default action is "ALLOW" but it is useful -// to be explicit in the policy. +// Istio Authorization Policy also supports the AUDIT action to decide whether to log requests. +// AUDIT policies do not affect whether requests are allowed or denied to the workload. +// Requests will be allowed or denied based solely on ALLOW and DENY policies. +// +// A request will be internally marked that it should be audited if there is an AUDIT policy on the workload that matches the request. +// A separate plugin must be configured and enabled to actually fulfill the audit decision and complete the audit behavior. +// The request will not be audited if there are no such supporting plugins enabled. +// Currently, the only supported plugin is the [Telemetry v2 Stackdriver](https://istio.io/latest/docs/reference/config/proxy_extensions/stackdriver/) plugin. +// +// Here is an example of Istio Authorization Policy: +// +// It sets the `action` to "ALLOW" to create an allow policy. The default action is "ALLOW" +// but it is useful to be explicit in the policy. // // It allows requests from: // @@ -99,6 +109,27 @@ import "type/v1beta1/selector.proto"; // methods: ["POST"] // ``` // +// The following authorization policy sets the `action` to "AUDIT". It will audit any GET requests to the path with the +// prefix "/user/profile". +// +// ```yaml +// apiVersion: security.istio.io/v1beta1 +// kind: AuthorizationPolicy +// metadata: +// namespace: ns1 +// name: anyname +// spec: +// selector: +// matchLabels: +// app: myapi +// action: audit +// rules: +// - to: +// - operation: +// methods: ["GET"] +// paths: [“/user/profile/*”] +// ```` +// // Authorization Policy scope (target) is determined by "metadata/namespace" and // an optional "selector". // @@ -220,6 +251,13 @@ message AuthorizationPolicy { // Deny a request if it matches any of the rules. DENY = 1; + + // Audit a request if it matches any of the rules. + AUDIT = 2; + + // $hide_from_docs + // Audit policy decisions can be read by telemetry plugins using the function getAuditPolicy + // defined [here](https://github.com/istio/proxy/blob/master/extensions/common/context.h). } // Optional. The action to take if the request is matched with the rules. diff --git a/security/v1beta1/authorization_deepcopy.gen.go b/security/v1beta1/authorization_deepcopy.gen.go index 091907ab7a..45ba558564 100644 --- a/security/v1beta1/authorization_deepcopy.gen.go +++ b/security/v1beta1/authorization_deepcopy.gen.go @@ -12,9 +12,19 @@ // 3. If any of the ALLOW policies match the request, allow the request. // 4. Deny the request. // -// For example, the following authorization policy sets the `action` to "ALLOW" -// to create an allow policy. The default action is "ALLOW" but it is useful -// to be explicit in the policy. +// Istio Authorization Policy also supports the AUDIT action to decide whether to log requests. +// AUDIT policies do not affect whether requests are allowed or denied to the workload. +// Requests will be allowed or denied based solely on ALLOW and DENY policies. +// +// A request will be internally marked that it should be audited if there is an AUDIT policy on the workload that matches the request. +// A separate plugin must be configured and enabled to actually fulfill the audit decision and complete the audit behavior. +// The request will not be audited if there are no such supporting plugins enabled. +// Currently, the only supported plugin is the [Telemetry v2 Stackdriver](https://istio.io/latest/docs/reference/config/proxy_extensions/stackdriver/) plugin. +// +// Here is an example of Istio Authorization Policy: +// +// It sets the `action` to "ALLOW" to create an allow policy. The default action is "ALLOW" +// but it is useful to be explicit in the policy. // // It allows requests from: // @@ -77,6 +87,27 @@ // methods: ["POST"] // ``` // +// The following authorization policy sets the `action` to "AUDIT". It will audit any GET requests to the path with the +// prefix "/user/profile". +// +// ```yaml +// apiVersion: security.istio.io/v1beta1 +// kind: AuthorizationPolicy +// metadata: +// namespace: ns1 +// name: anyname +// spec: +// selector: +// matchLabels: +// app: myapi +// action: audit +// rules: +// - to: +// - operation: +// methods: ["GET"] +// paths: [“/user/profile/*”] +// ```` +// // Authorization Policy scope (target) is determined by "metadata/namespace" and // an optional "selector". // diff --git a/security/v1beta1/authorization_json.gen.go b/security/v1beta1/authorization_json.gen.go index f7fb5d1179..2bb569014f 100644 --- a/security/v1beta1/authorization_json.gen.go +++ b/security/v1beta1/authorization_json.gen.go @@ -12,9 +12,19 @@ // 3. If any of the ALLOW policies match the request, allow the request. // 4. Deny the request. // -// For example, the following authorization policy sets the `action` to "ALLOW" -// to create an allow policy. The default action is "ALLOW" but it is useful -// to be explicit in the policy. +// Istio Authorization Policy also supports the AUDIT action to decide whether to log requests. +// AUDIT policies do not affect whether requests are allowed or denied to the workload. +// Requests will be allowed or denied based solely on ALLOW and DENY policies. +// +// A request will be internally marked that it should be audited if there is an AUDIT policy on the workload that matches the request. +// A separate plugin must be configured and enabled to actually fulfill the audit decision and complete the audit behavior. +// The request will not be audited if there are no such supporting plugins enabled. +// Currently, the only supported plugin is the [Telemetry v2 Stackdriver](https://istio.io/latest/docs/reference/config/proxy_extensions/stackdriver/) plugin. +// +// Here is an example of Istio Authorization Policy: +// +// It sets the `action` to "ALLOW" to create an allow policy. The default action is "ALLOW" +// but it is useful to be explicit in the policy. // // It allows requests from: // @@ -77,6 +87,27 @@ // methods: ["POST"] // ``` // +// The following authorization policy sets the `action` to "AUDIT". It will audit any GET requests to the path with the +// prefix "/user/profile". +// +// ```yaml +// apiVersion: security.istio.io/v1beta1 +// kind: AuthorizationPolicy +// metadata: +// namespace: ns1 +// name: anyname +// spec: +// selector: +// matchLabels: +// app: myapi +// action: audit +// rules: +// - to: +// - operation: +// methods: ["GET"] +// paths: [“/user/profile/*”] +// ```` +// // Authorization Policy scope (target) is determined by "metadata/namespace" and // an optional "selector". //