Review RSA certificate key strength

Use an RSA key size that meets the service and organization’s security requirements.

Description

Check the RSA public key in the certificate. If it is shorter than 2048 bits (256 bytes), reissue with a supported key of at least 2048 bits that meets your policy. Use algorithm-specific requirements for ECDSA and other key types.

Potential impact

A short RSA key weakens server authentication and can fall below organizational or client security requirements.

Remediation

ACM cannot change the key size on reimport. Import the certificate for the new key under a separate ARN and associate it with the service. Test the hostname, trust chain, validity period and TLS policy with a real client.

Examples

The legacy community.aws.aws_acm module identifies certificates by Name tag. Version 1.3.0 documents limitations with 4096-bit keys, so confirm that your module and service support the selected size.

Before

yaml
- name: upload a self-signed certificate
  community.aws.aws_acm:
    certificate: "{{ lookup('file', 'rsa1024.pem') }}"
    private_key: "{{ lookup('file', 'rsa1024-key.pem') }}"
    name_tag: my_cert

rsa1024.pem is a filename. Inspect the certificate to confirm its actual public-key size.

After

yaml
- name: upload a self-signed certificate
  community.aws.aws_acm:
    certificate: "{{ lookup('file', 'rsa4096.pem') }}"
    private_key: "{{ lookup('file', 'rsa4096-key.pem') }}"
    name_tag: my_cert_rsa4096

The second task imports the 4096-bit example under a separate tag. Choose an unused tag and verify that the certificate matches its private key.

References