{"record":{"id":"15b4a96b1525e66e","repo":"apache/hadoop","slug":"hostname-in-certificate-didn-t-match-hostnames","errorCode":null,"errorMessage":"hostname in certificate didn't match: {hostnames} !={buf}","messagePattern":"hostname in certificate didn't match: (.+?) !=(.+?)","errorType":"exception","errorClass":"SSLException","httpStatus":null,"severity":"error","filePath":"hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java","lineNumber":457,"sourceCode":"                    final String hostName =\n                        StringUtils.toLowerCase(hosts[i].trim());\n                    if (doWildcard) {\n                        match = hostName.endsWith(cn.substring(1));\n                        if (match && strictWithSubDomains) {\n                            // If we're in strict mode, then [*.foo.com] is not\n                            // allowed to match [a.b.foo.com]\n                            match = countDots(hostName) == countDots(cn);\n                        }\n                    } else {\n                        match = hostName.equals(cn);\n                    }\n                    if (match) {\n                        break out;\n                    }\n                }\n            }\n            if (!match) {\n                throw new SSLException(\"hostname in certificate didn't match: \" + hostnames + \" !=\" + buf);\n            }\n        }\n\n        public static boolean isIP4Address(final String cn) {\n            boolean isIP4 = true;\n            String tld = cn;\n            int x = cn.lastIndexOf('.');\n            // We only bother analyzing the characters after the final dot\n            // in the name.\n            if (x >= 0 && x + 1 < cn.length()) {\n                tld = cn.substring(x + 1);\n            }\n            for (int i = 0; i < tld.length(); i++) {\n                if (!Character.isDigit(tld.charAt(0))) {\n                    isIP4 = false;\n                    break;\n                }\n            }","sourceCodeStart":439,"sourceCodeEnd":475,"githubUrl":"https://github.com/apache/hadoop/blob/2add9630210752f88ceb1bb74eb65e37bf41da8e/hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java#L439-L475","documentation":"SSLHostnameVerifier strict matching: after extracting the CN (including wildcard forms) from the certificate's subject, none of the candidate hostnames equals or wildcard-matches the expected host, so the certificate was issued for a different host.","triggerScenarios":"Thrown at hadoop-common-project/hadoop-common/src/main/java/org/apache/hadoop/security/ssl/SSLHostnameVerifier.java:457 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a certificate whose CN or subjectAltName matches the hostname being connected to.","Fix DNS or the configured hostname so it matches the certificate identity.","If intentional (e.g. testing), use an appropriate hostname verifier policy, but prefer issuing a correct certificate."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"2add9630210752f88ceb1bb74eb65e37bf41da8e","analyzedAt":"2026-08-22T19:55:07.957Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}