id: ssl-cert-renewal info: name: SSL/TLS Certificates in AWS IAM about to expire in 30 days author: princechaddha severity: medium description: | Checks if SSL/TLS certificates in AWS IAM are set for renewal 30 days before expiration. reference: - https://docs.aws.amazon.com/cli/latest/reference/iam/get-account-password-policy.html tags: cloud,devops,aws,amazon,iam,ssl,tls,aws-cloud-config self-contained: true code: - engine: - sh - bash source: | aws iam list-server-certificates | jq -r '.ServerCertificateMetadataList[] | select(.Expiration | fromdateiso8601 - now < (30 * 86400)) | .ServerCertificateName' extractors: - type: regex name: certificate internal: true regex: - '\b[a-zA-Z0-9]+\b' - type: dsl dsl: - 'certificate + " Certificate is about to expire in 30 days"' # digest: 4a0a00473045022100a517288f527ffb0f08d1f6803d7d738d8c9ed2a34f35e32b824cabbe7f3fa41b022028ebdfe7453cc66f3f511e46c5ffbda6db8dc43551271a101edb11021fad7fd3:922c64590222798bb761d5b6d8e72950