Quantcast
Channel: VMware Communities : Discussion List - VMware {code}
Viewing all articles
Browse latest Browse all 2738

SSL Exception when using IP address as --servername: Host name does not match the certificate subject provided by the peer

$
0
0

SCENARIO

When attempting to run the command line sample:

 

$java -ea -cp target/vsphere-samples-6.5.0.jar vmware.samples.vcenter.vm.list.ListVMs --server servername --username username --password password --skip-server-verification

 

if I use the FQDN as the value for the servername parameter, then the command completes successfully, and returns the VM list.

 

ISSUE

However, if I use the IP Address for the servername, then I get the following error:

 

Connect Failed

java.lang.NullPointerException

  at vmware.samples.common.authentication.VimAuthenticationHelper.logout(VimAuthenticationHelper.java:102)

  at vmware.samples.common.SamplesAbstractBase.logout(SamplesAbstractBase.java:389)

  at vmware.samples.common.SamplesAbstractBase.execute(SamplesAbstractBase.java:426)

  at vmware.samples.vcenter.vm.list.ListVMs.main(ListVMs.java:128)

Exception in thread "main" com.vmware.vapi.client.exception.SslException: Host name '<IP Address>' does not match the certificate subject provided by the peer (C=US, CN=<FQDN>)

  at com.vmware.vapi.internal.protocol.client.rpc.http.HttpClient.send(HttpClient.java:185)

  at com.vmware.vapi.internal.protocol.client.msg.json.JsonApiProvider.sendRequest(JsonApiProvider.java:126)

  at com.vmware.vapi.internal.protocol.client.msg.json.JsonApiProvider.invoke(JsonApiProvider.java:307)

  at com.vmware.vapi.internal.bindings.Stub.invoke(Stub.java:205)

  at com.vmware.vapi.internal.bindings.Stub.invoke(Stub.java:186)

  at com.vmware.vapi.internal.bindings.Stub.invokeMethodAsync(Stub.java:150)

  at com.vmware.vapi.internal.bindings.Stub.invokeMethod(Stub.java:118)

  at com.vmware.cis.SessionStub.create(SessionStub.java:37)

  at com.vmware.cis.SessionStub.create(SessionStub.java:30)

  at vmware.samples.common.authentication.VapiAuthenticationHelper.loginByUsernameAndPassword(VapiAuthenticationHelper.java:70)

  at vmware.samples.common.SamplesAbstractBase.login(SamplesAbstractBase.java:306)

  at vmware.samples.common.SamplesAbstractBase.execute(SamplesAbstractBase.java:411)

  at vmware.samples.vcenter.vm.list.ListVMs.main(ListVMs.java:128)

Caused by: javax.net.ssl.SSLPeerUnverifiedException: Host name '<IP Address>' does not match the certificate subject provided by the peer (C=US, CN=<FQDN>)

  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.verifyHostname(SSLConnectionSocketFactory.java:465)

  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.createLayeredSocket(SSLConnectionSocketFactory.java:395)

  at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectSocket(SSLConnectionSocketFactory.java:353)

  at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect(DefaultHttpClientConnectionOperator.java:134)

  at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect(PoolingHttpClientConnectionManager.java:353)

  at org.apache.http.impl.execchain.MainClientExec.establishRoute(MainClientExec.java:380)

  at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:236)

  at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)

  at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)

  at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)

  at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)

  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)

  at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)

  at com.vmware.vapi.internal.protocol.client.rpc.http.HttpClient.invoke(HttpClient.java:147)

  at com.vmware.vapi.internal.protocol.client.rpc.http.HttpClient.send(HttpClient.java:166)

  ... 12 more

 

It is possible to connect successfully using the IP address from clients, or using the vSphere Web Services API. Should it not be possible to also use the IP address for this SDK?

 

Many thanks,

 

Warren


Viewing all articles
Browse latest Browse all 2738

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>