{"id":100,"date":"2010-06-08T10:25:16","date_gmt":"2010-06-08T14:25:16","guid":{"rendered":"http:\/\/enterpriseadmins.org\/blog\/?p=100"},"modified":"2010-06-08T10:39:14","modified_gmt":"2010-06-08T14:39:14","slug":"configure-ssl-on-esxi","status":"publish","type":"post","link":"https:\/\/enterpriseadmins.org\/blog\/scripting\/configure-ssl-on-esxi\/","title":{"rendered":"Script to Configure SSL on ESX\/ESXi"},"content":{"rendered":"<p>I&#8217;ve had to create a bunch of SSL certificates for ESX\/ESXi hosts.  Its always a pain because there are a bunch of steps and I can&#8217;t remember what my company always uses for the Organization name\/Organizational unit name.  I created some documentation on the process and have to look at it every time I create a certificate.  It works okay, but who wants to read documentation when you can lean on a simple batch file&#8230;like this one?  You just need to specify the name of the batch file and the host name of your ESX\/ESXi host from a command prompt:<\/p>\n<pre><code class=\"language-1\">\r\n@echo off\r\nREM ======================================================================\r\nREM == Script to generate SSL Certificate for ESX\/ESXi host             ==\r\nREM == Usage: esx_ssl.bat esxhostname.domain.name                       ==\r\nREM == Note:  On Windows 7 this script must be ran from an              ==\r\nREM ==        elevated\/administrator command prompt.                    ==\r\nREM ======================================================================\r\n\r\nset pathToOpenSSLbin=C:\\OpenSSL\\bin\r\nset pathTovCLIbin=C:\\Program Files\\VMware\\VMware vSphere CLI\\bin\r\necho The specified ESX\/ESXi host: %1\r\n\r\nREM Generate the SSL\r\n\"%pathToOpenSSLbin%\\openssl.exe\" genrsa 1024 > \"%pathToOpenSSLbin%\\%1.key\"\r\n\"%pathToOpenSSLbin%\\openssl.exe\" req -new -key \"%pathToOpenSSLbin%\\%1.key\" -subj \"\/CN=%1\/OU=Department Name\/O=Company Name\/L=CityName\/ST=State\/C=US\/emailAddress=user@domain.name\" > \"%pathToOpenSSLbin%\\rui.csr\"\r\n\r\nREM Open the Certificate Signing Request in wordpad\r\n\"%ProgramFiles%\\Windows NT\\Accessories\\wordpad.exe\" \"%pathToOpenSSLbin%\\rui.csr\"\r\n\r\nREM The CSR contents must be manually copied to the internal cert server\r\necho\r\necho ======================================================================\r\necho The following steps must be manually completed\r\necho 1.) Select the contents of rui.csr and copy them to the clipboard\r\necho 2.) Open the certificate server site (https:\/\/internal-ca.domain.name\/certsrv)\r\necho 3.) Select \"Request a certificate\"\r\necho 4.) Select \"Advanced certificate Request\"\r\necho 5.) Paste the contents of rui.csr into the saved request box\r\necho 6.) Select \"Web Server\" in the certificate template drop down\r\necho 7.) Save the Base 64 version of the certificate in the following path:\r\necho      %pathToOpenSSLbin%\\certnew.csr\r\necho ======================================================================\r\npause\r\n\r\n\"%pathToOpenSSLbin%\\openssl.exe\" x509 \u2013in certnew.cer \u2013out %1.cer\r\n\r\nset \/p hostpass=Please enter the root password for %1 :\r\n\r\n\"%pathTovCLIbin%\\vifs.pl\" --server %1 --put \"%pathToOpenSSLbin%\\%1.key\" \/host\/ssl_key --username root --password %hostpass%\r\n\"%pathTovCLIbin%\\vifs.pl\" --server %1 --put \"%pathToOpenSSLbin%\\%1.cer\" \/host\/ssl_cert --username root --password %hostpass%\r\n\r\nREM Create a backup copy in case you need this SSL certificate again:\r\ncopy \"%pathToOpenSSLbin%\\%1.key\" \"\\\\vcenter\\SSL_Certificates$\\%1.key\" \/y\r\ncopy \"%pathToOpenSSLbin%\\%1.cer\" \"\\\\vcenter\\SSL_Certificates$\\%1.cer\" \/y\r\n\r\necho Please reboot the host %1 and verify the SSL certificate.\r\npause\r\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve had to create a bunch of SSL certificates for ESX\/ESXi hosts. Its always a pain because there are a bunch of steps and I can&#8217;t remember what my company always uses for the Organization name\/Organizational unit name. I created &hellip; <a href=\"https:\/\/enterpriseadmins.org\/blog\/scripting\/configure-ssl-on-esxi\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":6,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[3,4],"tags":[],"class_list":["post-100","post","type-post","status-publish","format-standard","hentry","category-scripting","category-virtualization"],"_links":{"self":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/100","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/users\/6"}],"replies":[{"embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/comments?post=100"}],"version-history":[{"count":15,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/100\/revisions"}],"predecessor-version":[{"id":115,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/posts\/100\/revisions\/115"}],"wp:attachment":[{"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/media?parent=100"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/categories?post=100"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enterpriseadmins.org\/blog\/wp-json\/wp\/v2\/tags?post=100"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}