Claude Skills Guide

Managing SSL/TLS certificates is a critical yet often tedious task for developers and DevOps engineers. OpenSSL remains the gold standard for certificate operations, but its command-line interface can be complex and error-prone. This guide shows you how to use Claude Code to automate and simplify your OpenSSL certificate workflows, making certificate management more efficient and less prone to human error.

Why Automate OpenSSL Certificate Workflows?

Manual certificate management introduces several risks. Expiring certificates cause service outages. Misconfigured certificates lead to security vulnerabilities. Repeated manual commands lead to inconsistency and human error. By automating these workflows with Claude Code, you can ensure consistency, receive proactive reminders, and handle certificate operations with confidence.

Claude Code can help you generate certificates, validate configurations, automate renewals, and troubleshoot certificate issues—all through natural language commands. This approach reduces the learning curve for OpenSSL while providing reproducible, auditable certificate operations.

Generating Self-Signed Certificates for Development

Development environments often require self-signed certificates. Claude Code can generate these quickly with appropriate configurations. Here’s how to request a development certificate:

Generate a self-signed SSL certificate for localhost with Common Name set to localhost, valid for 365 days, using RSA 2048-bit key

Claude Code will execute the appropriate OpenSSL commands:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
  -keyout localhost.key -out localhost.crt \
  -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost"

For more complex development scenarios, you might need certificates with Subject Alternative Names (SANs):

Create a self-signed certificate with SANs for localhost, 127.0.0.1, and dev.example.com

This generates a certificate with multiple endpoints covered:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
  -keyout dev-multi.key -out dev-multi.crt \
  -subj "/C=US/ST=State/L=City/O=Organization/CN=localhost" \
  -addext "subjectAltName=DNS:localhost,DNS:dev.example.com,IP:127.0.0.1"

Creating Certificate Signing Requests (CSRs)

When you need certificates from a Certificate Authority (CA), you must first create a Certificate Signing Request. Claude Code can guide you through this process, ensuring all required fields are properly configured.

To generate a CSR for a production domain:

Generate a CSR for example.com with key size 4096 bits, including organization name and organizational unit

Claude Code will create both the private key and CSR:

# Generate private key
openssl genrsa -out example.com.key 4096

# Generate CSR with all required fields
openssl req -new -key example.com.key \
  -out example.com.csr \
  -subj "/C=US/ST=California/L=San Francisco/O=Example Inc/OU=IT/CN=example.com"

For multi-domain certificates, include SANs in your CSR configuration:

Create a CSR configuration file for example.com with www.example.com and api.example.com as alternative names

You’ll need a configuration file:

[req]
default_bits = 4096
prompt = no
default_md = sha256
req_extensions = v3_req
distinguished_name = dn

[dn]
C = US
ST = California
L = San Francisco
O = Example Inc
OU = IT
CN = example.com

[v3_req]
subjectAltName = @alt_names

[alt_names]
DNS.1 = example.com
DNS.2 = www.example.com
DNS.3 = api.example.com

Validating Certificate Chains and Configurations

Before deploying certificates, validation is crucial. Claude Code can perform comprehensive certificate checks:

Validate the certificate chain for server.crt and verify it was issued by Let's Encrypt

This performs multiple checks:

# Check certificate validity dates
openssl x509 -in server.crt -noout -dates

# Verify certificate against CA bundle
openssl verify -CAfile ca-bundle.crt server.crt

# Display certificate details
openssl x509 -in server.crt -noout -text | grep -E "(Issuer|Subject|Validity|SAN)"

For thorough validation of your entire certificate chain:

Check that the certificate chain is complete from leaf to root, and display the full path

This ensures your server is properly configured with intermediate certificates:

# Display the certificate chain
openssl s_client -connect example.com:443 -showcerts </dev/null 2>/dev/null | \
  openssl x509 -noout -subject -issuer

Converting Certificate Formats

Different systems require different certificate formats. Claude Code handles format conversions effortlessly:

Convert the PEM certificate to PKCS12 format for Windows/IIS deployment

This creates a PKCS#12 file bundling the certificate and private key:

openssl pkcs12 -export -out server.pfx \
  -inkey server.key \
  -in server.crt \
  -certfile ca-bundle.crt

For Java environments that require PKCS#12 or JKS:

Convert PEM to PKCS12, then to JKS format for Java application
# First to PKCS12
openssl pkcs12 -export -out keystore.p12 \
  -inkey server.key -in server.crt -certfile ca-bundle.crt \
  -name "tomcat"

# Then to JKS using keytool
keytool -importkeystore \
  -srckeystore keystore.p12 -srcstoretype PKCS12 \
  -destkeystore keystore.jks -deststoretype JKS

Automating Certificate Renewal Workflows

Certificate expiration is a common cause of service outages. Claude Code can help you set up renewal reminders and automate the renewal process.

To check certificate expiration:

Show all certificates in the /certs directory with their expiration dates, highlighting any expiring within 30 days

This script checks multiple certificates:

for cert in /certs/*.crt; do
  expiry=$(openssl x509 -in "$cert" -noout -enddate | cut -d= -f2)
  expiry_epoch=$(date -d "$expiry" +%s)
  now_epoch=$(date +%s)
  days_left=$(( (expiry_epoch - now_epoch) / 86400 ))
  
  if [ "$days_left" -lt 30 ]; then
    echo "WARNING: $cert expires in $days_left days"
  else
    echo "$cert: $days_left days remaining"
  fi
done

Troubleshooting Common Certificate Issues

When certificate errors occur, Claude Code can diagnose the problem quickly. Common issues include:

Certificate hostname mismatch:

Diagnose why my certificate shows a hostname mismatch error for www.example.com

The diagnosis involves checking the certificate’s Common Name and Subject Alternative Names:

openssl x509 -in server.crt -noout -text | grep -A1 "Subject Alternative Name"
openssl x509 -in server.crt -noout -subject

Expired certificates:

Check if the certificate is expired and show the validity period
openssl x509 -in server.crt -noout -dates -subject

Chain verification failures:

Debug why certificate chain verification is failing
openssl s_client -connect example.com:443 -verify_return_error -showcerts

Best Practices for Certificate Management

Follow these recommendations when managing certificates with Claude Code:

  1. Use strong key sizes: Always use at least 2048-bit RSA keys, preferably 4096-bit for sensitive applications.

  2. Keep private keys secure: Never commit private keys to version control. Use secure storage and restrict file permissions.

  3. Track certificate expiration: Set up automated monitoring at 30, 14, and 7 days before expiration.

  4. Document your certificate inventory: Maintain a registry of all certificates, their purposes, and renewal procedures.

  5. Test in staging first: Always test certificate deployments in a non-production environment before production rollout.

Claude Code transforms OpenSSL certificate management from a complex command-line task into an accessible, automated workflow. By using these patterns, you can reduce manual effort, prevent outages, and maintain robust security practices across your infrastructure.

Built by theluckystrike — More at zovo.one