<div dir="ltr">Hi Matthias,<div><br></div><div>Thanks for the response.  For connecting to ESXi, I couldn't find any environment setting to make 'curl' point to the client certificates.  So, for the time being, I hard-coded the location in libvirt-<version>/src/esx/esx_vi.c.</div>
<div><br></div><div><div>esx_vi.c:    curl_easy_setopt(curl->handle, CURLOPT_SSLCERT, "/etc/pki/libvirt/clientcert.pem");</div><div>esx_vi.c:    curl_easy_setopt(curl->handle, CURLOPT_SSLKEY, "/etc/pki/libvirt/private/clientkey.pem");</div>
<div>esx_vi.c:    curl_easy_setopt(curl->handle, CURLOPT_CAINFO, "/etc/pki/CA/cacert.pem");</div></div><div><br></div><div><br></div><div>This has worked for me.  Perhaps there's a cleaner way of doing this?  If I find something, I'll share w/ everybody on the list.</div>
<div><br></div><div>regards,</div><div>Shiva</div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Thu, Oct 31, 2013 at 7:16 AM, Matthias Bolte <span dir="ltr"><<a href="mailto:matthias.bolte@googlemail.com" target="_blank">matthias.bolte@googlemail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">2013/10/30 Shiva Bhanujan <<a href="mailto:sxb075@gmail.com">sxb075@gmail.com</a>>:<br>
<div><div class="h5">> Hi Daniel,<br>
><br>
> thanks for the reply - The procedure I use is the same as I use for<br>
> XenServer, and the certificate exchange works just fine.  The only thing I'm<br>
> a bit unclear on, is the location of the CA cert, which in the case of<br>
> XenServer, I simply put it in /etc/pki/CA.  And when I start the libvirtd<br>
> daemon, it successfully picks it up.  If I put the Server key and cert in<br>
> /etc/vmware/ssl for ESXi, is there a location where I put the CA cert<br>
> (cacert.pem)?  Also, following are the log errors that I see -<br>
><br>
> 2013-10-30T18:32:25.405Z [FFE81B90 error 'Default']<br>
> SSLStreamImpl::DoServerHandshake (ffd005d0) SSL_accept failed. Dumping SSL<br>
> error queue:<br>
> 2013-10-30T18:32:25.405Z [FFE81B90 error 'Default'] [0] error:14094418:SSL<br>
> routines:SSL3_READ_BYTES:tlsv1 alert unknown ca<br>
> 2013-10-30T18:32:25.405Z [FFE81B90 warning 'Default'] SSL Handshake failed<br>
> for stream TCP(local=<ESXi>:443, peer=<client>:33776), error:<br>
> N7Vmacore3Ssl12SSLExceptionE(SSL Exception: error:14094418:SSL<br>
> routines:SSL3_READ_BYTES:tlsv1 alert unknown ca)<br>
><br>
><br>
> Doesn't this mean the CA cert wasn't found on the ESXi?<br>
><br>
> Regards,<br>
> Shiva<br>
><br>
><br>
><br>
> On Wed, Oct 30, 2013 at 2:45 AM, Daniel P. Berrange <<a href="mailto:berrange@redhat.com">berrange@redhat.com</a>><br>
> wrote:<br>
>><br>
>> On Tue, Oct 29, 2013 at 06:48:46PM -0700, Shiva Bhanujan wrote:<br>
>> > Hello,<br>
>> ><br>
>> > I'm using certtool to generate the server certificates for ESXi -<br>
>> > <a href="http://libvirt.org/remote.html#Remote_TLS_CA" target="_blank">http://libvirt.org/remote.html#Remote_TLS_CA</a>.  I just copy the server<br>
>> > certificate and key as /etc/vmware/ssl/rui.crt and<br>
>> > /etc/vmware/ssl/rui.key.<br>
>> >  And then use virsh to connect from a CentOS 6.4 VM running on it -<br>
>> > "virsh<br>
>> > -c esx://<esx IP>.  I get the following error -<br>
>> ><br>
>> > error: internal error curl_easy_perform() returned an error: Peer<br>
>> > certificate cannot be authenticated with known CA certificates (60) :<br>
>> > Peer<br>
>> > certificate cannot be authenticated with known CA certificates<br>
>> > error: failed to connect to the hypervisor<br>
>> ><br>
>> > is there something basic that I'm missing?<br>
>><br>
>> I'm not sure what you're missing, but the error message means that the<br>
>> VMWare server certificate was not signed by any CA certificate that<br>
>> the libvirt client has access to. So it is a client side CA cert config<br>
>> problem most likely.<br>
<br>
</div></div>I think this problem has already been discussed on this mailing list, see:<br>
<br>
<a href="https://www.redhat.com/archives/libvir-list/2012-March/msg00342.html" target="_blank">https://www.redhat.com/archives/libvir-list/2012-March/msg00342.html</a><br>
<br>
What you basically have to do is create your own Certificate Authority<br>
(CA) and then issue a new server certificate with that CA as described<br>
in the guide you mentioned. Then transfer this server certificate to<br>
the ESX server and put it into the correct place. I think you already<br>
have done this correctly<br>
<br>
The last thing that's missing (the same as in the mailing list thread<br>
I linked above) is that you need to configure your client properly.<br>
The SSL infrastructure on your client needs to know about your custom<br>
CA. libcurl has to be able to find and use it in order to verify that<br>
the certificate your ESXi server present is valid. How this has to be<br>
done depends on the SSL backend libcurl is using and on your distro.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Matthias Bolte<br>
<a href="http://photron.blogspot.com" target="_blank">http://photron.blogspot.com</a><br>
</font></span></blockquote></div><br></div>