|
| 1 | +--- |
| 2 | +title: CA Certificate Close to Expiration |
| 3 | +--- |
| 4 | + |
| 5 | +# RDSCACertificateCloseToExpiration |
| 6 | + |
| 7 | +## Meaning |
| 8 | + |
| 9 | +Alert is triggered when an RDS instance is detected using a CA certificate which is going to expire in less than 15 days. |
| 10 | + |
| 11 | +## Impact |
| 12 | + |
| 13 | +If the certificate is not renewed before expiration, all attempts to initiate an SSL/TLS connection to the RDS instance will fail. |
| 14 | + |
| 15 | +{{< hint warning >}} |
| 16 | +**Important** |
| 17 | + |
| 18 | +The `Amazon RDS Root 2019 CA` certificate expires on **Aug 22 17:08:50 2024 UTC**. |
| 19 | + |
| 20 | +- Starting January 25th 2024, RDS instances created without specifying the CA will use `rds-ca-rsa2048-g1``. |
| 21 | +- In August 2024, AWS will enforce the CA rotation on all RDS instances on the expiring CA during a window maintenance |
| 22 | +{{< /hint >}} |
| 23 | + |
| 24 | +## Diagnosis |
| 25 | + |
| 26 | +- Identify the instance(s) concerned by either: |
| 27 | + - opening the `RDS instances` dashboard |
| 28 | + - or using the following AWS CLI command |
| 29 | + |
| 30 | + ```bash |
| 31 | + aws rds describe-db-instances | jq ' |
| 32 | + [ |
| 33 | + .DBInstances[] | |
| 34 | + { |
| 35 | + db_instance_identifier: .DBInstanceIdentifier, |
| 36 | + ca_certificate_identifier: .CACertificateIdentifier, |
| 37 | + ca_certificate_valid_until: .CertificateDetails.ValidTill |
| 38 | + } | |
| 39 | + (now + 1296000) as $date | |
| 40 | + select ( |
| 41 | + (.ca_certificate_valid_until | split("+")[0] + "Z" | fromdate) < $date |
| 42 | + ) |
| 43 | + ]' |
| 44 | + ``` |
| 45 | + |
| 46 | + Note: `1296000` seconds = 15 days |
| 47 | + |
| 48 | +## Mitigation |
| 49 | + |
| 50 | +Renew your certificate for the instances retrieved above by running: |
| 51 | + |
| 52 | +```bash |
| 53 | +aws rds modify-db-instance \ |
| 54 | + --db-instance-identifier <your_db_instance> \ |
| 55 | + --ca-certificate-identifier <your_new_certificate> |
| 56 | +``` |
| 57 | + |
| 58 | +Use the `--apply-immediately` flag if you wish to change the certificate immediately, otherwise it will apply during your next scheduled maintenance window. |
| 59 | + |
| 60 | +{{< hint info >}} |
| 61 | +**Tips** |
| 62 | + |
| 63 | +We recommend using the `rds-ca-rsa2048-g1` certificate authority which: |
| 64 | + |
| 65 | +- Has the same properties as `rds-ca-2019` (2048 private key, SHA256 signing alg.) so no risk of incompatibility |
| 66 | +- Is valid until 2061 |
| 67 | +- Change can be done without restarting the instances |
| 68 | +{{< /hint >}} |
| 69 | + |
| 70 | +## Additional resources |
| 71 | + |
| 72 | +- [Using SSL with RDS](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL.html) |
| 73 | +- [SSL Certificate Rotation](https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.SSL-certificate-rotation.html) |
0 commit comments