java - Host name verification in Spring Web Services -


i'd inquire on origins of difference in host verification behavior i'm observing spring web services, 2.2.2.release (under spring boot 1.3.0.m4) on java 1.7.

when configuring webservicetemplate use httpcomponentsmessagesender end error reading follows:

i/o error: certificate <uswebservice.uat.hroffice.com> doesn't match of subject alternative names: [*.sbcsystems.com, sbcsystems.com]; nested exception javax.net.ssl.sslexception: certificate <uswebservice.uat.hroffice.com> doesn't match of subject alternative names: [*.sbcsystems.com, sbcsystems.com] 

when reconfigure webservicetemplate use httpsurlconnectionmessagesender instead, above error disappears , call verify host name (as per rfc 2818) doesn't seem occur vs. how in above case (or @ least i'm unable trace it) although see spring's httpurlconnectionmessagesender's connection (sun.net.www.protocol.https.delegatehttpsurlconnection:https:// uswebservice.uat.hroffice.com/iwsuat/customs...) assigned respective host name verifier in createconnection() method (javax.net.ssl.httpsurlconnection$defaulthostnameverifier).

whether host name verification occurs or doesn't occur here in successful case (i'm inclined think still does, appreciate hand in discovering how it's been invoked) i'm questioning httpcomponentsmessagesender (the erroneous case) obtains certificate makes verification fail. checked cacerts file comes java installation (\jdk1.7.0_76\jre\lib\security) - it's not there. certificate present @ secure url (above) contains correct subject alt name:

not critical dns name: *.uat.hroffice.com dns name: uat.hroffice.com 

whereas in case produces error, certificate seems have following values subject alt name field makes fail trying dereference uri above per spec :

[8]: objectid: 2.5.29.17 criticality=false subjectalternativename [   dnsname: *.sbcsystems.com   dnsname: sbcsystems.com ] 

the mysterious certificate in question visible in soapui (which how i'm able obtain in) running test in tool doesn't produce error - i'm assuming host name verification being somehow bypassed there (perhaps knows details).

the certificates 2 distinct ones have different expiration dates.

i tried disable host name verification via providing noop implementation of hostnameverifier seems questionable approach security in quest abandon i'm stumbled questions described above.

i appreciate in advance if shed bit more light @ symptoms i'm experiencing.

here related spring configurations:

@bean public keystore keystore() throws throwable {     keystorefactorybean keystorefactory = new keystorefactorybean();     keystorefactory.setpassword(keystorepassword);     keystorefactory.setlocation(new classpathresource(keystorename));     keystorefactory.settype("jks");     keystorefactory.afterpropertiesset();     return keystorefactory.getobject(); }  @bean  public keymanager[] keymanagers() throws throwable{     keymanagersfactorybean keymanagerfactory = new keymanagersfactorybean();     keymanagerfactory.setkeystore(keystore());     keymanagerfactory.setpassword(keystorepassword);     keymanagerfactory.afterpropertiesset();     return keymanagerfactory.getobject(); }  @bean public httpsurlconnectionmessagesender httpsurlsender() throws throwable {     httpsurlconnectionmessagesender sender = new httpsurlconnectionmessagesender();     sender.setsslprotocol("tls");     sender.setkeymanagers(keymanagers());      /*sender.sethostnameverifier(new hostnameverifier() {          @override         public boolean verify(string arg0, sslsession arg1) {             return true;         }});*/     return sender; }     @bean public webservicetemplate webservicetemplate() throws throwable {     webservicetemplate webservicetemplate = new webservicetemplate();     webservicetemplate.setmarshaller(marshaller());     webservicetemplate.setunmarshaller(marshaller());     webservicetemplate.setdefaulturi(defaulturi);     webservicetemplate.setmessagefactory(messagefactory());     webservicetemplate.setmessagesender(/*new httpcomponentsmessagesender()*/httpsurlsender());     return webservicetemplate; } 

when analyzing site @ ssllabs.com it's reported work in browsers sni support, perhaps fact it's used java has effect on above behavior (however java 1.7 seem have added correct sni behavior default)?

enter image description here


Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -