Skip to content

Commit b2e74d7

Browse files
redis: implement AWS IAM authentication (#39645)
Commit Message: redis: implement AWS IAM authentication Additional Description: Adds an aws_iam_authenticator to the redis proxy filter. The authenticator is instantiated when a relevant `aws_iam` configuration is found in the filter settings. The AWS IAM Authenticator supports common features from the AWS extensions - particularly customisation of the credential provider chain, so that each instantiation can have its own set of credentials and mechanisms for credential retrieval. AWS IAM Authentication is also supported in the redis health checker, using the same functionality as the redis proxy filter. The implementation does not support redis cluster, and AWS IAM authentication will not be used if configured against a redis cluster instance. This feature supports IAM Authentication for ElastiCache both Redis OSS and Valkey engines, as well as Amazon MemoryDB. Addresses feature request envoyproxy/envoy#38439 Risk Level: Low Testing: Unit Docs Changes: Yes - updated with sample Release Notes: Updated Platform Specific Features: [Optional Runtime guard:] [Optional Fixes #Issue] envoyproxy/envoy#38439 [Optional Fixes commit #PR or SHA] [Optional Deprecated:] [Optional [API Considerations](https://github.com/envoyproxy/envoy/blob/main/api/review_checklist.md):] --------- Signed-off-by: Nigel Brittain <[email protected]> Mirrored from https://github.com/envoyproxy/envoy @ 48fff0217727f669aa5df1186dd8bbbe1c620b9f
1 parent dd8baae commit b2e74d7

File tree

4 files changed

+42
-1
lines changed

4 files changed

+42
-1
lines changed

envoy/extensions/filters/network/redis_proxy/v3/BUILD

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ api_proto_package(
88
deps = [
99
"//envoy/annotations:pkg",
1010
"//envoy/config/core/v3:pkg",
11+
"//envoy/extensions/common/aws/v3:pkg",
1112
"//envoy/extensions/common/dynamic_forward_proxy/v3:pkg",
1213
"@com_github_cncf_xds//udpa/annotations:pkg",
1314
],

envoy/extensions/filters/network/redis_proxy/v3/redis_proxy.proto

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ package envoy.extensions.filters.network.redis_proxy.v3;
44

55
import "envoy/config/core/v3/base.proto";
66
import "envoy/config/core/v3/grpc_service.proto";
7+
import "envoy/extensions/common/aws/v3/credential_provider.proto";
78
import "envoy/extensions/common/dynamic_forward_proxy/v3/dns_cache.proto";
89

910
import "google/protobuf/duration.proto";
@@ -381,11 +382,42 @@ message RedisProtocolOptions {
381382

382383
// Upstream server password as defined by the ``requirepass`` directive
383384
// `<https://redis.io/topics/config>`_ in the server's configuration file.
385+
// If ``aws_iam`` is set, this field is ignored.
384386
config.core.v3.DataSource auth_password = 1 [(udpa.annotations.sensitive) = true];
385387

386388
// Upstream server username as defined by the ``user`` directive
387389
// `<https://redis.io/topics/acl>`_ in the server's configuration file.
390+
// If ``aws_iam``` is set, this field will be used as the authenticating user for redis IAM authentication.
391+
// See ``Create a new IAM-enabled user`` under `Setup <https://docs.aws.amazon.com/AmazonElastiCache/latest/dg/auth-iam.html#auth-iam-setup>`_ for more details.
388392
config.core.v3.DataSource auth_username = 2 [(udpa.annotations.sensitive) = true];
393+
394+
// The cluster level configuration for AWS IAM authentication
395+
AwsIam aws_iam = 3;
396+
}
397+
398+
// [#next-free-field: 6]
399+
message AwsIam {
400+
// An AwsCredentialProvider, allowing the use of a specific credential provider chain or specific provider settings
401+
common.aws.v3.AwsCredentialProvider credential_provider = 1;
402+
403+
// The name of the cache, used when generating the authentication token.
404+
string cache_name = 2 [(validate.rules).string = {min_len: 1}];
405+
406+
// The optional service name to be used in AWS IAM authentication. If not provided, the service name will be set to ``elasticache``. For Amazon MemoryDB
407+
// the service name should be set to ``memorydb``.
408+
string service_name = 3;
409+
410+
// The optional AWS region that your cache is located in. If not provided, the region will be deduced using the region provider chain
411+
// as described in :ref:`config_http_filters_aws_request_signing_region`.
412+
string region = 4;
413+
414+
// Number of seconds before the IAM authentication token will expire. If not set, defaults to 60s (1 minute). Maximum of 900s (15 minutes)
415+
// Expiration of the current authentication token will automatically trigger generation of a new token.
416+
// As envoy will automatically continue to generate new tokens as required, there is no substantial benefit to using a long expiration value here.
417+
google.protobuf.Duration expiration_time = 5 [(validate.rules).duration = {
418+
lte {seconds: 900}
419+
gte {}
420+
}];
389421
}
390422

391423
// RedisExternalAuthProvider specifies a gRPC service that can be used to authenticate Redis clients.

envoy/extensions/health_checkers/redis/v3/BUILD

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,8 @@ load("@envoy_api//bazel:api_build_system.bzl", "api_proto_package")
55
licenses(["notice"]) # Apache 2
66

77
api_proto_package(
8-
deps = ["@com_github_cncf_xds//udpa/annotations:pkg"],
8+
deps = [
9+
"//envoy/extensions/filters/network/redis_proxy/v3:pkg",
10+
"@com_github_cncf_xds//udpa/annotations:pkg",
11+
],
912
)

envoy/extensions/health_checkers/redis/v3/redis.proto

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ syntax = "proto3";
22

33
package envoy.extensions.health_checkers.redis.v3;
44

5+
import "envoy/extensions/filters/network/redis_proxy/v3/redis_proxy.proto";
6+
57
import "udpa/annotations/status.proto";
68
import "udpa/annotations/versioning.proto";
79

@@ -24,4 +26,7 @@ message Redis {
2426
// than 0 is considered a failure. This allows the user to mark a Redis instance for maintenance
2527
// by setting the specified key to any value and waiting for traffic to drain.
2628
string key = 1;
29+
30+
// Use AWS IAM for health checker authentication
31+
filters.network.redis_proxy.v3.AwsIam aws_iam = 2;
2732
}

0 commit comments

Comments
 (0)