Wednesday, October 17, 2012

CA signed SSL certificates with ESXi

After working through how to deploy the VCSA with CA signed certificates I began work on doing the same for ESXi. The VMware provided documentation on this is much better.

Take a look and my rundown on that for key references back to the VMware community forums (link)

Update 1:
While these instructions work and provide hosts with CA signed SSL certificates, I did run into a problem that I'm not sure I have a solution for.

In my test environment, and in fact the majority of the end customer systems I build, hosts are configured with private IP address subnets (10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16). I noticed that while access the host's internal HTTP server via it's IP address and performance operations like licensing or VM guest customization fail with an SSL certificate error.

It appears that the OS/Browser level libraries in IE/Safari/Chrome/Firefox no longer allow IANA reserved addresses in SSL certificates (See: GoDaddy KB ID6935). Somehow this change also applies to the VCSA and vSphere client.

I reserve the right to have done something wrong, but I suspect not in this case.

These steps assume ESXi 5.1 on a host that is not yet a member of a cluster or assosiated with a vCenter server.
  1. Create a private key
     gadget:host3 csdibiase$ openssl genrsa -out rui-3.key 2048  
     Generating RSA private key, 2048 bit long modulus  
     .................+++  
     ......................+++  
     e is 65537 (0x10001)  
    
  2. Create an openSSL configuration file
     [ req ]  
     default_bits            = 2048  
     default_keyfile         = host-03.pem  
     distinguished_name      = req_distinguished_name  
     attributes              = req_attributes  
     x509_extensions         = v3_ca  
     input_password          = testpassword  
     output_password         = testpassword  
     encrypt_key             = no  
     prompt                  = no  
     string_mask             = nombstr  
     req_extensions          = v3_req  
     [ v3_ca ]  
     subjectKeyIdentifier    = hash  
     authorityKeyIdentifier  = keyid:always,issuer:always  
     basicConstraints        = CA:true  
     [ v3_req ]  
     keyUsage                = digitalSignature, keyEncipherment  
     extendedKeyUsage        = serverAuth, clientAuth  
     subjectAltName          = DNS:demo-host-03.demo.local, DNS:demo-host-03, IP:172.16.10.35  
     [ req_distinguished_name ]  
     countryName             = US  
     stateOrProvinceName     = Ohio  
     localityName            = Cleveland  
     0.organizationName      = company name  
     organizationalUnitName  = unit name
     commonName              = demo-host-03.demo.local  
     emailAddress            = admin@demo.local  
     [ req_attributes ]  
    
  3. Create a certificate signing request
     gadget:host3 csdibiase$ openssl req -new -key rui-3.key -out rui-3.csr -config host-3.cfg   
     gadget:host3 csdibiase$ cat rui-3.csr   
     -----BEGIN CERTIFICATE REQUEST-----  
     MIIDYzCCAksCAQAwgagxCzAJBgNVBAYTAlVTMQ0wCwYDVQQIEwRPaGlvMRIwEAYD  
     VQQHEwlDbGV2ZWxhbmQxHDAaBgNVBAoTE1JvY2t3ZWxsIEF1dG9tYXRpb24xDDAK  
     BgNVBAsTA05TUzEgMB4GA1UEAxMXZGVtby1ob3N0LTAzLmRlbW8ubG9jYWwxKDAm  
     BgkqhkiG9w0BCQEWGWNzZGliaWFzZUByYS5yb2Nrd2VsbC5jb20wggEiMA0GCSqG  
     SIb3DQEBAQUAA4IBDwAwggEKAoIBAQC9ikx80HSGAzNAIelJHn+78rSwySkO/Qz8  
     iONqVe0PxH0rLyJekMpdL7FP3/wh71Rm70PeSKbyiSHAo0wzwKLcoODNUcl67zgt  
     SUFh6Vmj2I9IqJxy7aXRfJcCjdr7DfEJ3J+DNlhHzVs/s/BgMOKc031n7L7L8kc1  
     hVYyqoTXJ4BTKzS6+S1J5YBApG7KEPvh249koM9EIc8O8rZTlqyIRtjyPpnrrhtV  
     nxMxhXQfAzx+s+vVVgY42bAkH3eAbMmTl9afXUI2MMp7yBRntYK5cEPA7N4mu74M  
     /SGqc/PXWYnhzNd5VucLw+dmxUxHLuFDuGhjLkh7zCcjnTSXS5mFAgMBAAGgdTBz  
     BgkqhkiG9w0BCQ4xZjBkMAsGA1UdDwQEAwIFoDAdBgNVHSUEFjAUBggrBgEFBQcD  
     AQYIKwYBBQUHAwIwNgYDVR0RBC8wLYIXZGVtby1ob3N0LTAzLmRlbW8ubG9jYWyC  
     DGRlbW8taG9zdC0wM4cErBAKIzANBgkqhkiG9w0BAQUFAAOCAQEADO8W4b/V48N0  
     bMx4E3LlpiHAWRjNZJB/tDXmrtcvsSVdFnHfPgmjOBQgW1wjx96pftEZE/r4FMpm  
     rUacoPVNUoSilJ3izq0gAui35GbnIW0sfd7eh0cQhOM7RAg17TLzHBtOeoaPOaHs  
     3L93xEhWqiWmnhu5aHmWcOPdBYyQFQCGEdwm3DuONlUL4NGFlQ0zIQ9khew6LBHI  
     78GJg+RbyJGxAAqxK8eOWnnya5JPxAyUyfOuafIqi4CPB0jkyGudFKHA52T/iu4t  
     kFkCvBTm75LQv8mLttrzY4rqN/Nq0yEk2oGIA/h2y29Es4/5QIj5FTORF5TBMHNV  
     JZOFpK29KQ==  
     -----END CERTIFICATE REQUEST-----  
    
  4. Paste certificate request into Active Directory Certificate Enrollment web page and download DER encoded certificate. Downloaded certificate always has the name certnew.cer. Move to staging folder and rename then reprocess in openSSL to generate a base64 encoded certificate
     gadget:host3 csdibiase$ mv ~/Downloads/certnew.cer rui-3.cer  
     gadget:host3 csdibiase$ openssl x509 -in rui-3.cer -inform d -out rui-3.crt  
    
  5. Download the CA certificate as a DER encoded certificate and export a base64 encoded version
     gadget:host3 csdibiase$ mv ~/Downloads/certnew.cer ca.cer  
     gadget:host3 csdibiase$ openssl x509 -in ca.cer -inform d -out ca.crt  
    
  6. Concatenate the server and CA certificates together and rename the private key file.
     gadget:host3 csdibiase$ cat rui-3.crt ca.crt > rui.crt  
     gadget:host3 csdibiase$ cp rui-3.key rui.key  
    
  7. Enable SSH on the host and upload files
     gadget:host3 csdibiase$ scp rui.* root@demo-host-03.demo.local:/etc/vmware/ssl/  
     Password:   
     rui.crt                         100% 3416   3.3KB/s  00:00    
     rui.key                         100% 1675   1.6KB/s  00:00    
    
  8. Restart management agents on the host

No comments: