Developer support

Ignoring SSL Verification (curl, Python, Java): Risks and Safe Fixes

Turning off SSL verification makes an error disappear by trusting any certificate, including an attacker's. Fix the trust problem instead: point your tool at the right CA bundle or trust your private CA.

“SSL accept all certificates” means your client stops checking who it is talking to. Flags such as curl -k, wget --no-check-certificate or Python’s verify=False keep encryption on but skip the certificate check, so any server – including a man-in-the-middle (an attacker who intercepts the connection) – is accepted. Use them only for a one-off local test, never in shipped code.

The better fix takes a minute: give your tool the CA certificate it is missing. Below you find the risky flag for each tool, then the safe replacement.

Testing against an internal server?

Learn when a self-signed certificate is fine, when to run a private CA, and how to create certificates your clients will trust.

Read: self-signed vs CA-signed certificates

Is it safe to disable SSL verification in curl or Python for testing?

Only for a quick test against a machine you control, on a network you trust. Once a skip-verification flag lands in a script, a container image or production code, every connection it makes can be silently intercepted.

The danger is that nothing visibly breaks. Data still flows encrypted – just to whoever answered. Safe alternatives exist for every case:

  • Proper CA bundle: update the system or language CA store when public certificates fail.
  • Private CA: trust your internal root once instead of ignoring every certificate.
  • Pinned test certificate: trust exactly one self-signed test certificate with --cacert or verify=.

How to disable SSL certificate checks – and what to use instead

Each block below shows the “ignore SSL certificate” option first (what NOT to ship) and then the safe fix. Replace internal-ca.pem with the PEM file of the CA that signed your server’s certificate.

curl

# Do NOT ship: accepts any certificate
curl -k https://api.internal.example.com/

# Safe: trust a specific CA file
curl --cacert internal-ca.pem https://api.internal.example.com/

# Safe: set a CA bundle for all curl calls in this shell
export CURL_CA_BUNDLE=/etc/ssl/certs/ca-bundle-with-internal.pem

wget (ignore SSL certificate)

# Do NOT ship
wget --no-check-certificate https://files.internal.example.com/app.tar.gz

# Safe
wget --ca-certificate=internal-ca.pem https://files.internal.example.com/app.tar.gz

Python requests

import requests

# Do NOT ship: also triggers InsecureRequestWarning
requests.get("https://api.internal.example.com/", verify=False)

# Safe: trust your CA bundle
requests.get("https://api.internal.example.com/", verify="/etc/ssl/certs/internal-ca.pem")

Or set REQUESTS_CA_BUNDLE=/path/to/bundle.pem in the environment. A custom bundle replaces the default one, so if you also call public sites, append your CA to a copy of the default bundle (from the certifi package) instead of using it alone.

Overview

Java: the “trust all” TrustManager

The classic Java SSL accept-all-certificates pattern is a TrustManager with empty check methods. It disables every certificate check for the whole SSLContext:

// Do NOT ship: trusts every certificate
TrustManager[] trustAll = { new X509TrustManager() {
    public void checkClientTrusted(X509Certificate[] chain, String authType) {}
    public void checkServerTrusted(X509Certificate[] chain, String authType) {}
    public X509Certificate[] getAcceptedIssuers() { return new X509Certificate[0]; }
}};
SSLContext ctx = SSLContext.getInstance("TLS");
ctx.init(null, trustAll, new SecureRandom());

The safe fix is to import your CA into a trust store. On Java 9 and later, -cacerts targets the JDK’s default store (you are prompted for its password):

keytool -importcert -cacerts -alias internal-ca -file internal-ca.pem

For one application only, create a separate store and start the JVM with -Djavax.net.ssl.trustStore=truststore.p12. That store replaces the default, so include public roots if the app needs them.

Node.js

# Do NOT ship: disables verification for the whole process
NODE_TLS_REJECT_UNAUTHORIZED=0 node app.js

# Safe: add your CA to Node's built-in roots
NODE_EXTRA_CA_CERTS=/path/to/internal-ca.pem node app.js

What does “SSL/TLS accept all certificates” mean in tools?

It is a setting in API clients, mail clients, HTTP libraries and monitoring tools that switches off certificate validation, often labeled “SSL certificate verification” or “Trust all certificates.” Its effect is the same as curl -k: encryption without authentication.

When a tool shows “verification of SSL certificates is disabled” as a warning, treat it as a to-do item. Turn verification back on and import the missing CA certificate in the tool’s settings.

How to disable Chrome checking SSL certificates

Chrome lets you click “Advanced” and proceed past a single warning, and it accepts the --ignore-certificate-errors command-line flag. Use that flag only in a throwaway test profile, because it turns off protection for every site.

The lasting fix for an untrusted SSL certificate on your own servers is to add your private root CA to the operating system’s trust store. Chrome then trusts every certificate that CA signs, with no warnings and no flags.

Tip: On a corporate network, “self signed certificate in certificate chain” often comes from a TLS-inspecting proxy. Ask IT for the proxy’s root certificate and add it to your tool’s CA bundle instead of disabling verification.

Common verification errors: cause and fix

Error messageLikely causeSafe fix
unable to get local issuer certificateServer sends no intermediate, or client lacks the CAInstall the full chain on the server; update the client CA bundle
self signed certificate in certificate chainPrivate CA or inspecting proxyAdd that root to the client’s trust store
certificate has expiredServer certificate or an old root expiredRenew the server certificate; update the client’s root store
hostname mismatch / no alternative certificate subject name matchesYou call an IP or name not in the SANUse the hostname on the certificate or reissue with the right SAN

The first error is often a server problem: read how the certificate chain works and install the missing intermediate. For browser-side messages, see our guide to SSL certificate errors. You can confirm the fix with the SSL checker.

Is “SSL accept all certificates” ever safe?

Practically never outside a single local test. If your server needs a certificate your clients can trust, use a private CA or a publicly trusted certificate – compare the options in self-signed vs CA-signed certificates.

Fix trust instead of ignoring it

Choose between a self-signed certificate, a private CA and a public certificate for your internal and test servers.

Read: self-signed vs CA-signed certificates

Categories

  • DV SSL Certificates

    Fast domain validation for websites that primarily need HTTPS and do not require organization-level…

    from $8.99

Related articles

Frequently asked questions

Is it safe to disable SSL verification in curl or Python for testing?

Only for a brief test against a server you control on a trusted network. Disabling verification keeps encryption but accepts any certificate, so a man-in-the-middle can intercept traffic unnoticed. The flag also tends to slip into scripts and production. Safer options are pointing curl's --cacert or Python's verify parameter at your CA file, trusting a private CA, or pinning a single test certificate.

How do I disable SSL certificate verification?

The common flags are curl -k, wget --no-check-certificate, requests with verify=False and, in Java, a TrustManager with empty check methods. Treat these as temporary debugging switches only. The safe fix is to trust the right CA: use curl --cacert, wget --ca-certificate, the REQUESTS_CA_BUNDLE variable in Python, or keytool -importcert to add the CA to a Java trust store.

How do I disable Chrome checking SSL certificates?

You can click "Advanced" to proceed past one warning, or start Chrome with --ignore-certificate-errors, which disables checks for every site and should only be used in a throwaway test profile. The proper fix for your own servers is to add your private root CA to the operating system's trust store. Chrome then trusts all certificates that CA signs, without flags or warnings.

What is SSL/TLS "accept all certificates"?

It is an option in API clients, HTTP libraries, mail clients and monitoring tools that turns off certificate validation. The connection stays encrypted, but the client no longer checks whether the certificate is valid, unexpired and issued for the right hostname. That means any server, including an attacker's, is accepted. Re-enable verification and import the missing CA certificate instead.

Is SSL accept all certificates safe?

No. Accepting all certificates removes server authentication, the part of TLS that proves you are talking to the right server. Anyone able to intercept the connection – on public Wi-Fi, a compromised router or a misconfigured proxy – can read and change the data. Use it only for a one-off local test, and fix the underlying trust issue with a CA bundle or private CA.