Skip to content

Support ACM certs without CN#9912

Open
charhate wants to merge 3 commits intogetmoto:masterfrom
charhate:acm_cert_cn
Open

Support ACM certs without CN#9912
charhate wants to merge 3 commits intogetmoto:masterfrom
charhate:acm_cert_cn

Conversation

@charhate
Copy link
Copy Markdown

@charhate charhate commented Mar 24, 2026

Problem

import_certificate raises IndexError: list index out of range when the certificate has no Common Name (CN) in its subject. The bug is in acm/models.py:

Modern certificates commonly omit CN and rely solely on Subject Alternative Names (SANs). Real AWS ACM accepts such certificates without issue.

Fix

  • CN is parsed defensively; falls back to the first SAN when absent (matching real AWS ACM DomainName behaviour), or "" if there are no SANs either
  • Issuer CN is also parsed defensively
  • SANs are parsed once in init into self.sans and reused in describe(), removing the duplicate SAN-parsing block that was there before
  • domain_names in describe() guards against adding an empty string when both CN and SANs are absent

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.

1 participant