Skip to content

Commit

Permalink
chore: update charm libraries (#130)
Browse files Browse the repository at this point in the history
  • Loading branch information
observability-noctua-bot authored Sep 16, 2024
1 parent 0cf4684 commit 25754ab
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions charm/lib/charms/observability_libs/v1/cert_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

LIBID = "b5cd5cd580f3428fa5f59a8876dcbe6a"
LIBAPI = 1
LIBPATCH = 12
LIBPATCH = 13

VAULT_SECRET_LABEL = "cert-handler-private-vault"

Expand Down Expand Up @@ -584,9 +584,19 @@ def server_cert(self) -> Optional[str]:

@property
def chain(self) -> Optional[str]:
"""Return the ca chain bundled as a single PEM string."""
"""Return the entire chain bundled as a single PEM string. This includes, if available, the certificate, intermediate CAs, and the root CA.
If the server certificate is not set in the chain by the provider, we'll add it
to the top of the chain so that it could be used by a server.
"""
cert = self.get_cert()
return cert.chain_as_pem() if cert else None
if not cert:
return None
chain = cert.chain_as_pem()
if cert.certificate not in chain:
# add server cert to chain
chain = cert.certificate + "\n\n" + chain
return chain

def _on_certificate_expiring(
self, event: Union[CertificateExpiringEvent, CertificateInvalidatedEvent]
Expand Down

0 comments on commit 25754ab

Please sign in to comment.