HDFS-11302. Improve Logging for SSLHostnameVerifier. Contributed by Chen Liang.
(cherry picked from commit 32bb36b750ab656f2f32f6c74eaa1a3e68ae956e)
This commit is contained in:
parent
75e60b6bb7
commit
9016614eb1
@ -53,6 +53,8 @@
|
||||
import org.apache.hadoop.classification.InterfaceAudience;
|
||||
import org.apache.hadoop.classification.InterfaceStability;
|
||||
import org.apache.hadoop.util.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
************************************************************************
|
||||
@ -228,6 +230,12 @@ public final void check(final String[] host, final String[] cns,
|
||||
|
||||
abstract class AbstractVerifier implements SSLHostnameVerifier {
|
||||
|
||||
/**
|
||||
* Writes as SSLFactory logs as it is the only consumer of this verifier
|
||||
* class.
|
||||
*/
|
||||
static final Logger LOG = LoggerFactory.getLogger(SSLFactory.class);
|
||||
|
||||
/**
|
||||
* This contains a list of 2nd-level domains that aren't allowed to
|
||||
* have wildcards when combined with country-codes.
|
||||
@ -354,13 +362,24 @@ public void check(String[] host, X509Certificate cert)
|
||||
throws SSLException {
|
||||
String[] cns = Certificates.getCNs(cert);
|
||||
String[] subjectAlts = Certificates.getDNSSubjectAlts(cert);
|
||||
check(host, cns, subjectAlts);
|
||||
try {
|
||||
check(host, cns, subjectAlts);
|
||||
} catch (SSLException e) {
|
||||
LOG.error("Host check error {}", e);
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
public void check(final String[] hosts, final String[] cns,
|
||||
final String[] subjectAlts, final boolean ie6,
|
||||
final boolean strictWithSubDomains)
|
||||
throws SSLException {
|
||||
if (LOG.isTraceEnabled()) {
|
||||
LOG.trace("Hosts:{}, CNs:{} subjectAlts:{}, ie6:{}, " +
|
||||
"strictWithSubDomains{}", Arrays.toString(hosts),
|
||||
Arrays.toString(cns), Arrays.toString(subjectAlts), ie6,
|
||||
strictWithSubDomains);
|
||||
}
|
||||
// Build up lists of allowed hosts For logging/debugging purposes.
|
||||
StringBuffer buf = new StringBuffer(32);
|
||||
buf.append('<');
|
||||
|
Loading…
x
Reference in New Issue
Block a user