The certificate lifecycle in Certimate encompasses the automated process of obtaining, persisting, deploying, and monitoring SSL/TLS certificates. This lifecycle is orchestrated by the workflow engine, which transitions certificates through various states—from initial ACME challenge validation to final deployment on cloud infrastructure or local servers.
The lifecycle is primarily driven by Workflow Nodes that interact with the Access & Provider system. A typical lifecycle follows this path:
bizApply node (WorkflowNodeTypeBizApply) using the ACME protocol.domain.Certificate entity internal/domain/certificate.go18-43 and stored in the certificate collection internal/domain/certificate.go16bizDeploy nodes (WorkflowNodeTypeBizDeploy) which push certificates to end-targets like Alibaba Cloud, AWS, or local servers.bizMonitor nodes (WorkflowNodeTypeBizMonitor) ensure certificates are valid and correctly installed.The following diagram maps the logical lifecycle stages to the specific code entities and data structures involved.
Certificate State & Entity Map
Sources: internal/domain/certificate.go18-43 internal/certificate/service.go22-38 internal/repository/certificate.go77-126
Certimate automates the issuance process using the ACME protocol via the internal/certacme package. The system manages the entire flow from ACME account registration to final certificate retrieval.
Key Features:
lego library internal/certacme/client_obtain.go82-112acme_accounts collection internal/domain/acme_account.go11 using the ACMEAccountRepository internal/repository/acme_account.go17-21For details, see ACME Certificate Issuance.
Once a certificate is issued and stored, it is deployed to targets via the bizDeploy node. This process involves retrieving the certificate from the CertificateRepository internal/repository/certificate.go15-19 and pushing it to remote providers.
Deployment Features:
Access system internal/domain/access.go9-16 which stores API keys, tokens, and SSH secrets.For details, see Certificate Deployment Providers.
Certimate provides built-in services for managing the ongoing validity of certificates and cleaning up history.
The CertificateService internal/certificate/service.go22-32 handles high-level operations including:
DownloadCertificate internal/certificate/service.go42-217 It handles conversion using utilities like xcert.TransformCertificateFromPEMToPFX internal/certificate/service.go124 and xcert.TransformCertificateFromPEMToJKS internal/certificate/service.go175RevokeCertificate internal/certificate/service.go219-257 This requires valid ACME account metadata (ACMEAccountUrl) and the certificate URL (ACMECertificateUrl) internal/certificate/service.go225-240cleanupExpiredCertificates, scheduled daily using the internal scheduler internal/certificate/service.go34-40Code Entity Interaction
Sources: internal/certificate/service.go42-217 internal/repository/certificate.go21-35 internal/domain/certificate.go84-97
domain.Certificate: The central entity storing PEM data, serial numbers, subject names, and ACME metadata internal/domain/certificate.go18-43domain.ACMEAccount: Stores ACME account registration details, including the private key, directory URLs, and the ResourceObject (updated to resourceObj in v0.4.25) internal/domain/acme_account.go13-21CertificateRepository: Provides methods to retrieve certificates by ID, Workflow ID, or Workflow Run ID internal/repository/certificate.go21-75Sources: internal/domain/certificate.go18-43 internal/certificate/service.go22-32 internal/repository/certificate.go15-19 internal/repository/acme_account.go17-21 internal/domain/acme_account.go13-21