Skip to content

Commit e6758e0

Browse files
committed
chore(elbv2): add RFC 9151 (CNSA 1.0) SSL security policies ALB / NLB
1 parent 51234fd commit e6758e0

3 files changed

Lines changed: 138 additions & 0 deletions

File tree

packages/aws-cdk-lib/aws-elasticloadbalancingv2/lib/shared/enums.ts

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,80 @@ export enum SslPolicy {
305305
*/
306306
FIPS_TLS13_10_PQ = 'ELBSecurityPolicy-TLS13-1-0-FIPS-PQ-2025-09',
307307

308+
/**
309+
* TLS 1.3 only, RFC 9151 (CNSA 1.0) strict policy. FIPS-compliant.
310+
*
311+
* Supports the single cipher TLS_AES_256_GCM_SHA384. Use a strict policy only when all
312+
* clients can negotiate RFC 9151 algorithms.
313+
*
314+
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html#rfc9151-security-policies
315+
*/
316+
RFC9151_TLS13_13 = 'ELBSecurityPolicy-TLS13-1-3-RFC9151-FIPS-2023-07',
317+
318+
/**
319+
* TLS 1.2 and 1.3, RFC 9151 (CNSA 1.0) strict policy. FIPS-compliant.
320+
*
321+
* Adds the ECDHE-ECDSA and ECDHE-RSA AES256-GCM-SHA384 ciphers on top of
322+
* {@link RFC9151_TLS13_13} for TLS 1.2 clients. Use a strict policy only when all clients
323+
* can negotiate RFC 9151 algorithms.
324+
*
325+
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html#rfc9151-security-policies
326+
*/
327+
RFC9151_TLS13_12 = 'ELBSecurityPolicy-TLS13-1-2-RFC9151-FIPS-2023-07',
328+
329+
/**
330+
* TLS 1.2 and 1.3, RFC 9151 (CNSA 1.0) strict policy. FIPS-compliant.
331+
*
332+
* Same as {@link RFC9151_TLS13_12} plus the non-ECDHE AES256-GCM-SHA384 cipher (extended
333+
* cipher suite 0). Use a strict policy only when all clients can negotiate RFC 9151 algorithms.
334+
*
335+
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html#rfc9151-security-policies
336+
*/
337+
RFC9151_TLS13_12_EXT0 = 'ELBSecurityPolicy-TLS13-1-2-Ext0-RFC9151-FIPS-2023-07',
338+
339+
/**
340+
* TLS 1.2 and 1.3, RFC 9151 (CNSA 1.0) interoperability policy. FIPS-compliant.
341+
*
342+
* Interop policies mix RFC 9151 and non-RFC 9151 ciphers so clients can transition gradually.
343+
* This variant adds the AES128-GCM-SHA256 ciphers (TLS_AES_128_GCM_SHA256,
344+
* ECDHE-ECDSA-AES128-GCM-SHA256, ECDHE-RSA-AES128-GCM-SHA256) to the RFC 9151 GCM ciphers.
345+
*
346+
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html#rfc9151-security-policies
347+
*/
348+
RFC9151_TLS13_12_INTEROP1 = 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP1-FIPS-2023-07',
349+
350+
/**
351+
* TLS 1.2 and 1.3, RFC 9151 (CNSA 1.0) interoperability policy. FIPS-compliant.
352+
*
353+
* Extends {@link RFC9151_TLS13_12_INTEROP1} with the AES-SHA256 CBC ciphers
354+
* (ECDHE-ECDSA/RSA-AES256-SHA384 and ECDHE-ECDSA/RSA-AES128-SHA256).
355+
*
356+
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html#rfc9151-security-policies
357+
*/
358+
RFC9151_TLS13_12_INTEROP2 = 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP2-FIPS-2023-07',
359+
360+
/**
361+
* TLS 1.2 and 1.3, RFC 9151 (CNSA 1.0) interoperability policy. FIPS-compliant.
362+
*
363+
* Adds the AES-SHA1 CBC ciphers (ECDHE-ECDSA/RSA-AES256-SHA and ECDHE-ECDSA/RSA-AES128-SHA)
364+
* on top of the GCM and SHA256 ciphers, for the widest client compatibility of the interop
365+
* policies.
366+
*
367+
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html#rfc9151-security-policies
368+
*/
369+
RFC9151_TLS13_12_INTEROP3 = 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP3-FIPS-2023-07',
370+
371+
/**
372+
* TLS 1.2 and 1.3, RFC 9151 (CNSA 1.0) interoperability policy. FIPS-compliant.
373+
*
374+
* AWS recommends starting with this policy: it supports clients that negotiate classical
375+
* TLS 1.3, TLS 1.2, or strict RFC 9151 algorithms, then move to a stricter policy as clients
376+
* gain RFC 9151 support. Also used for backend connections when any listener uses an RFC 9151 policy.
377+
*
378+
* @see https://docs.aws.amazon.com/elasticloadbalancing/latest/application/describe-ssl-policies.html#rfc9151-security-policies
379+
*/
380+
RFC9151_TLS13_12_INTEROP4 = 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP4-FIPS-2023-07',
381+
308382
/**
309383
* Strong foward secrecy ciphers and TLV1.2 only (2020 edition).
310384
* Same as FORWARD_SECRECY_TLS12_RES, but only supports GCM versions of the TLS ciphers

packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/alb/listener.test.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2329,6 +2329,36 @@ describe('tests', () => {
23292329
});
23302330
});
23312331
});
2332+
2333+
describe('RFC 9151 (CNSA 1.0) SSL policies', () => {
2334+
test.each([
2335+
[elbv2.SslPolicy.RFC9151_TLS13_13, 'ELBSecurityPolicy-TLS13-1-3-RFC9151-FIPS-2023-07'],
2336+
[elbv2.SslPolicy.RFC9151_TLS13_12, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-FIPS-2023-07'],
2337+
[elbv2.SslPolicy.RFC9151_TLS13_12_EXT0, 'ELBSecurityPolicy-TLS13-1-2-Ext0-RFC9151-FIPS-2023-07'],
2338+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP1, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP1-FIPS-2023-07'],
2339+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP2, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP2-FIPS-2023-07'],
2340+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP3, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP3-FIPS-2023-07'],
2341+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP4, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP4-FIPS-2023-07'],
2342+
])('sets SslPolicy %s on an HTTPS listener', (sslPolicy, expected) => {
2343+
// GIVEN
2344+
const stack = new cdk.Stack();
2345+
const vpc = new ec2.Vpc(stack, 'VPC');
2346+
const lb = new elbv2.ApplicationLoadBalancer(stack, 'LB', { vpc });
2347+
2348+
// WHEN
2349+
lb.addListener('Listener', {
2350+
protocol: elbv2.ApplicationProtocol.HTTPS,
2351+
certificates: [importedCertificate(stack)],
2352+
sslPolicy,
2353+
defaultAction: elbv2.ListenerAction.fixedResponse(200),
2354+
});
2355+
2356+
// THEN
2357+
Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', {
2358+
SslPolicy: expected,
2359+
});
2360+
});
2361+
});
23322362
});
23332363

23342364
class ResourceWithLBDependency extends cdk.CfnResource {

packages/aws-cdk-lib/aws-elasticloadbalancingv2/test/nlb/listener.test.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -750,6 +750,40 @@ describe('tests', () => {
750750
});
751751
});
752752
});
753+
754+
describe('RFC 9151 (CNSA 1.0) SSL policies', () => {
755+
test.each([
756+
[elbv2.SslPolicy.RFC9151_TLS13_13, 'ELBSecurityPolicy-TLS13-1-3-RFC9151-FIPS-2023-07'],
757+
[elbv2.SslPolicy.RFC9151_TLS13_12, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-FIPS-2023-07'],
758+
[elbv2.SslPolicy.RFC9151_TLS13_12_EXT0, 'ELBSecurityPolicy-TLS13-1-2-Ext0-RFC9151-FIPS-2023-07'],
759+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP1, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP1-FIPS-2023-07'],
760+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP2, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP2-FIPS-2023-07'],
761+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP3, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP3-FIPS-2023-07'],
762+
[elbv2.SslPolicy.RFC9151_TLS13_12_INTEROP4, 'ELBSecurityPolicy-TLS13-1-2-RFC9151-INTEROP4-FIPS-2023-07'],
763+
])('sets SslPolicy %s on a TLS listener', (sslPolicy, expected) => {
764+
// GIVEN
765+
const stack = new cdk.Stack();
766+
const vpc = new ec2.Vpc(stack, 'VPC');
767+
const lb = new elbv2.NetworkLoadBalancer(stack, 'LB', { vpc });
768+
const cert = new acm.Certificate(stack, 'Certificate', {
769+
domainName: 'example.com',
770+
});
771+
772+
// WHEN
773+
lb.addListener('Listener', {
774+
port: 443,
775+
protocol: elbv2.Protocol.TLS,
776+
certificates: [elbv2.ListenerCertificate.fromCertificateManager(cert)],
777+
sslPolicy,
778+
defaultTargetGroups: [new elbv2.NetworkTargetGroup(stack, 'Group', { vpc, port: 80 })],
779+
});
780+
781+
// THEN
782+
Template.fromStack(stack).hasResourceProperties('AWS::ElasticLoadBalancingV2::Listener', {
783+
SslPolicy: expected,
784+
});
785+
});
786+
});
753787
});
754788

755789
class ResourceWithLBDependency extends cdk.CfnResource {

0 commit comments

Comments
 (0)