Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

WillChilds-Klein
Copy link
Contributor

@WillChilds-Klein WillChilds-Klein commented Aug 7, 2025

Release Summary:

Adds new TLSv1.3-enabled security policies for CloudFront's outbound ("upstream") connections to origin servers. We also add similar policies with PQ enabled.

Resolved issues:

n/a

Description of changes:

The new policies are identical to CloudFront's existing "upstream" policies, but with support for negotiating TLSv1.3 and expanding RSA PSS signature support for modern servers that expect it (strictly additive, we're not dropping any algorithms).

Call-outs:

n/a

Testing:

  • CI
  • Manual testing with s2nc
$ ./build/bin/s2nc  kms.us-east-1.amazonaws.com 443  -i -c CloudFront-Upstream-2025-08-08
Screenshot 2025-08-08 at 4 53 01 PM
$ ./build/bin/s2nc  kms.us-east-1.amazonaws.com 443  -i -c CloudFront-Upstream-2025-08-08-PQ
Screenshot 2025-08-08 at 4 53 21 PM

@WillChilds-Klein WillChilds-Klein marked this pull request as ready for review August 8, 2025 21:54
@WillChilds-Klein WillChilds-Klein changed the title Add PQ policies for CloudFront Upstream Add TLSv1.3 (classical + PQ) policies for CloudFront Upstream Aug 8, 2025

const struct s2n_security_policy security_policy_cloudfront_upstream_2025_08_08_tls13 = {
.minimum_protocol_version = S2N_TLS13,
.cipher_preferences = &cipher_preferences_cloudfront_upstream_2025_08_08_tls12,
Copy link
Contributor

Choose a reason for hiding this comment

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

if cipher preferences remain the same when minimum protocol is changed, does s2n still sends tls 1.2 ciphersuites?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

my understanding is that yes, it would still send 1.2 ciphersuites. so for a 1.3-requiring policy we can save some bytes on the wire by creating a new cipher_preferences list that elides ≤1.2 ciphersuites.

good catch, I'll create/use a new cipher_preferences list here for TLSv1.3.

.minimum_protocol_version = S2N_SSLv3,
.cipher_preferences = &cipher_preferences_cloudfront_upstream_2025_08_08,
.kem_preferences = &kem_preferences_null,
.signature_preferences = &s2n_signature_preferences_20201021,

Choose a reason for hiding this comment

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

As SHA1 & SHA224 are discouraged, Can we remove the support of these for all the new CloudFront upstream security policies added in this change?

Also, Since s2n_signature_preferences_20201021 is used by other policies, I think its better to create a new signature preferences list by excluding signature schemes containing SHA1 & SHA224 from s2n_signature_preferences_20201021.

Copy link
Contributor

Choose a reason for hiding this comment

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

for CloudFront-Upstream-TLS-1-3-2025 yes, but probably not all for now

Copy link
Contributor Author

Choose a reason for hiding this comment

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

From a security perspective, I agree that SHA1 should be actively discouraged, deprecated, and removed. I have fewer concerns with SHA2.

One goal of this change is to preserve CloudFront's compatibility with outbound connections. If CloudFront is OK with dropping support for SHA1 in signature preferences, I'm more than happy to create/use a new signature preference list for all or some of these policies.

cc @zz85

Copy link
Contributor

Choose a reason for hiding this comment

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

@gokul-sai-doppalapudi let's follow up once after this gets merged

@jouho jouho requested a review from lrstewart August 18, 2025 17:20
@lrstewart lrstewart requested a review from goatgoose August 18, 2025 18:08
@lrstewart lrstewart self-requested a review August 20, 2025 02:59
Comment on lines 10 to 11
- TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384
- TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
Copy link
Contributor

Choose a reason for hiding this comment

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

Did you intend to prefer aes 256 over aes 128? Just checking since the TLS 1.3 preference is inverted.

Copy link
Contributor Author

@WillChilds-Klein WillChilds-Klein Aug 20, 2025

Choose a reason for hiding this comment

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

Hm, not particularly, but this is how CloudFront had set preferences before, so I'm inclined to leave this as-is for when TLS ≤1.2 is negotiated.

Copy link
Contributor

Choose a reason for hiding this comment

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

To confirm, did previous Cloudfront policies also prefer aes128 over aes256 for TLS1.3? Like existing policies have both orderings?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This PR adds CloudFront's first "upstream" (i.e. outbound PoP => Origin connections) TLSv1.3-enabled policies. It looks like their existing server-side policies (i.e. inbound client => PoP connections) favor AES 128 over 256 for TLSv1.3.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I might have misunderstood your question Lindsay; my above answer is incomplete. CF's server-side policies appear to favor AES 128 over 256 for TLS ≤1.2 as well as TLS 1.3.

However, CF's upstream (i.e. client-side) policies seem to favor AES 256 over 128 for TLS ≤1.2. Should we follow that latter pattern for upstream TLS v1.3 and prefer AES 256 over 128? I'm not sure, but I suppose it's slightly more consistent than preferring 128 here. It's easy to prefer 256.

Thoughts @zz85?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Talked with @zz85 offline, and he's OK with reordering the ≤1.2 ciphersuite preferences to prefer AES 128 over 256 for performance + consistency with the TLSv1.3 ciphers. Done in 0455414.

Comment on lines 30 to 42
- rsa_pss_pss_sha256
- rsa_pss_pss_sha384
- rsa_pss_pss_sha512
- rsa_pss_rsae_sha256
- rsa_pss_rsae_sha384
- rsa_pss_rsae_sha512
- rsa_pkcs1_sha256
- rsa_pkcs1_sha384
- rsa_pkcs1_sha512
- legacy_rsa_pkcs1_sha224
- ecdsa_sha256
- ecdsa_sha384
- ecdsa_sha512
Copy link
Contributor

Choose a reason for hiding this comment

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

Also worth pointing out: given both an EC and RSA cert, this policy will choose the RSA cert. If there are any plans to actually support EC certs, the ECDSA ones should probably be at the top. Putting ECDSA second was a mistake we made on a bunch of early policies.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this to mirror prior CF Upstream policies. I agree that we should take this opportunity to prefer ECDSA over RSA (PKCS1 for security + performance reasons, PSS for performance reasons).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done in 71a7bce.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you do it only to the PQ policies intentionally, or by accident?

Copy link
Contributor Author

@WillChilds-Klein WillChilds-Klein Aug 21, 2025

Choose a reason for hiding this comment

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

To answer your question directly: by accident.

I'd previously relied on older signature preferences for non-PQ policies (no ML-DSA), so only updated the new signature preference list. I've created a new set of signature preferences w/o ML-DSA and prioritizing ECDSA over RSA PSS signatures (performance win there, in cases where the server wouldn't select ECDSA anyway).

A bit of an aside -- it's not totally clear to me that TLS 1.3's spec requires that the server honors the client's ordered preferences (although it does seem implied).

  Each SignatureScheme value lists a single signature algorithm that
   the client is willing to verify.  The values are indicated in
   descending order of preference.

If that ordering were required or reasonably expected to be honored by the server, I'd expect an RFC 2119 "MUST" or "SHOULD". Perhaps older TLS versions' RFCs were worded differently, I haven't read them as closely...

Anyway, easy to adjust here.

@lrstewart lrstewart requested a review from goatgoose August 21, 2025 07:17
@goatgoose goatgoose enabled auto-merge August 21, 2025 17:27
@goatgoose goatgoose added this pull request to the merge queue Aug 21, 2025
Merged via the queue into aws:main with commit a786223 Aug 21, 2025
54 of 58 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants