Support >
  About cybersecurity >
  Why does my website's SSL certificate show as insecure?
Why does my website's SSL certificate show as insecure?
Time : 2025-12-23 14:28:38
Edit : DNS.COM

If you encounter a website with a red "Insecure" warning while browsing, or if your program throws an "SSL certificate verification failed" error when connecting to your server's API, it usually means there's a problem with the website's SSL/TLS certificate. SSL certificates are the cornerstone of trust on the internet, and their verification is a complex process involving the certificate itself, server configuration, client systems, and accurate time synchronization. An error in any of these areas will lead to connection failure. Understanding the reasons for these failures is crucial for maintaining websites or services on cloud servers.

The most direct and common reason is that the certificate itself has expired or is not yet valid. Every SSL certificate has a defined validity period, typically ranging from a few months to several years. Once this period expires, the certificate automatically becomes invalid, and browsers and clients will refuse to connect because they cannot trust an "expired" identity credential. Similarly, if the server time is incorrectly set, causing the current time to be outside the certificate's validity period (for example, the server time is much slower than the actual time and the certificate's effective date has not yet arrived), verification will also fail. Maintaining accurate system time is a top priority on cloud servers. You should enable and configure the `ntp` service to ensure that the server time is synchronized with international standard time. A simple command to check the certificate's validity is:

# Check the current system time and timezone

date

# Check the certificate's validity (replace yourdomain.com with your domain name, 443 is the HTTPS port)

echo | openssl s_client -servername yourdomain.com -connect yourdomain.com:443 2>/dev/null | openssl x509 -noout -dates

This command will output the certificate's validity period (`notBefore`) and expiration date (`notAfter`). Please ensure the current time is within this range.

The second frequently encountered problem is a certificate mismatch between the certificate and the accessed domain. SSL certificates are issued for specific domains (or multiple domains). If you purchased a certificate for `www.example.com`, but a user directly accesses `example.com` (without www), or accesses a completely different subdomain, verification will fail. This includes two scenarios: first, the domain name you are accessing is not included in the certificate's "Optional User Names" list; second, you are using a wildcard certificate `*.example.com`, but it can only match one level of subdomains, not second-level subdomains (such as `test.www.example.com`). When applying for a certificate, you must ensure that all domains requiring HTTPS access are included in the certificate's coverage.

The third complex but crucial issue is an incomplete certificate chain. An SSL certificate does not exist in isolation; it needs to be verified by a higher-level certificate (intermediate CA certificate), which in turn needs to be verified by a root CA certificate, forming a complete "trust chain." During the handshake, your server must send the complete certificate chain (your site certificate + all intermediate CA certificates) to the client (such as a browser). If only your site certificate is sent, the client cannot find a trusted higher-level issuer and will declare verification failed because a complete trust chain cannot be built. When configuring certificates in Nginx or Apache, you need to merge the site certificate and intermediate certificates into a single file (usually the site certificate first, followed by the intermediate certificates), and then specify this merged file in the configuration. To check if the certificate chain is complete, you can use the OpenSSL command:

# Check the certificate chain returned by the server

echo | openssl s_client -connect yourdomain.com:443 -showcerts 2>/dev/null | openssl x509 -noout -text | grep -A 1 “Issuer”

# A more intuitive online tool is SSL Labs (https://www.ssllabs.com/ssltest/)

The fourth common reason is server configuration errors. This includes several situations: First, you may have specified the wrong certificate or private key file path in the web server (such as Nginx) configuration. Second, the private key file does not match the certificate—they must be a pair generated at the time of issuance. You can verify this using the following commands:

# Calculate the MD5 hashes of the certificate and private key separately. If they match, they are a pair.

`openssl x509 -noout -modulus -in /path/to/your_certificate.crt | openssl md5`

`openssl rsa -noout -modulus -in /path/to/your_private.key | openssl md5`

The hash values ​​output by these two commands must be exactly the same. Additionally, an outdated or insecure SSL/TLS protocol version or cryptographic suite configuration on the server can also cause some modern clients to refuse connections.

Besides the server-side reasons mentioned above, client-side and network environments can also cause problems. For example, the operating system or browser's root certificate store might be outdated and not contain the root CA that issued your certificate; or an intermediate network device (such as a company firewall, proxy server, or WAF) might be intercepting your SSL certificate, replacing it with its own certificate, which the client's trust store does not trust.

When faced with an "SSL certificate verification failed" message, a systematic troubleshooting path should be: first, check the certificate validity period and domain name matching; then, verify the integrity of the certificate chain and server configuration; finally, consider client and network factors. On cloud servers, a good practice is to establish an automatic certificate renewal and deployment process. If you are using Let's Encrypt free certificates, their official client, Certbot, can handle this task well. A simple cron job can achieve automatic renewal:

# Example: Attempt to renew all certificates at 3 AM on the 1st and 15th of each month (Certbot will automatically determine if they have expired)

0 3 1,15 * * /usr/bin/certbot renew --quiet --post-hook “systemctl reload nginx”

Simultaneously, you should configure monitoring to send alerts via email, DingTalk, etc., before certificates expire (e.g., 30 days or 7 days in advance), allowing sufficient processing time. For critical business operations, consider using the certificate service provided by your cloud service provider or the HTTPS endpoint of your load balancer, which can simplify certificate management and provide higher availability.

In summary, SSL certificate verification failure is a symptom, but its causes can be found at various stages of the certificate lifecycle. From precise time synchronization and meticulous domain planning to correct server configuration and complete certificate chain deployment, and then to automated renewal and monitoring, each step requires careful attention from the operations and maintenance personnel.

DNS Jude
DNS Puff
DNS Luna
DNS Grace
DNS Sugar
DNS Amy
DNS Becky
DNS NOC
Title
Email Address
Type
Information
Code
Submit