This guide outlines best practices for certificate generation in a DevOps environment, focusing on different types of certificates and their appropriate use cases.
Public certificates are signed by a trusted Certificate Authority (CA), like DigiCert, Sectigo, or Let's Encrypt. They're essential for anything accessible by the general public, as they verify the identity of a server and encrypt data in transit. Your web browsers and operating systems automatically trust these CAs, ensuring a seamless user experience.
Private certificates are signed by your organization's own internal CA. They are used for internal, non-public-facing services and are not trusted by external browsers. Examples include communication between microservices, internal APIs, or internal tools. Using private certificates for internal services improves security by preventing man-in-the-middle attacks and ensures that traffic within your network remains encrypted.
A wildcard certificate is a single certificate that secures multiple subdomains under a domain. For instance, a certificate for *.example.com
would secure www.example.com
, api.example.com
, and blog.example.com
.
Do not use a wildcard at the sub-domain level (e.g., *.sub.example.com
). This practice can introduce security risks and management complexity. Instead, use a specific certificate for each sub-domain, such as app.sub.example.com
and api.sub.example.com
, or a wildcard at the top level (*.example.com
) if necessary.
Use a wildcard certificate at the sub-sub-domain level (e.g., *.app.team-a.example.com
). This is useful for environments where you have many dynamically provisioned services under a specific team or application, like service1.app.team-a.example.com
and service2.app.team-a.example.com
. This approach simplifies certificate management for a large number of internal-facing or test environments without compromising security.
A cross-domain certificate, also known as a Subject Alternative Name (SAN) certificate, secures multiple distinct domains on a single certificate. For example, a single SAN certificate can cover www.example.com
, www.example.org
, and api.example-a.net
. Use these when a single server or service needs to secure multiple, unrelated domains, which is common in a multi-tenant or consolidated hosting environment. This consolidates certificate management and simplifies deployment.
Choosing between a free certificate like those from Let's Encrypt and a paid one from a CA like DigiCert or Sectigo depends on the service's audience and purpose.