VMware Workstation: Generate a new selfsigned SSL/TLS certificate

Hi,

the VMware Workstation does not provide a program or script to generate a new pair of key and selfsigned certificate.

If’ve written a batch file which builds a new one. The scripts assumes that the Workstation is installed in the default folder C:\Program Files (x86)\VMware\VMware Workstation and uses the openssl command delivered with the program.

Adjust the Countryname, State, etc. to your own needs. Config is based on the VMware Docs.

@echo off
REM
REM Generate a new VMware Workstation Selfsigned Certificate
REM created: 14.05.2019 Michael Albert info@michlstechblog.info
REM 
set OPENSSL_DIR=C:\ProgramData\VMware\SSL

echo [req]                                                     >   %OPENSSL_DIR%\openssl.cnf
echo default_bits            = 2048                            >>  %OPENSSL_DIR%\openssl.cnf
echo default_keyfile         = rui.key                         >>  %OPENSSL_DIR%\openssl.cnf
echo distinguished_name      = req_distinguished_name          >>  %OPENSSL_DIR%\openssl.cnf
echo #Don't encrypt the key                                    >>  %OPENSSL_DIR%\openssl.cnf
echo encrypt_key             = no                              >>  %OPENSSL_DIR%\openssl.cnf
echo prompt                  = no                              >>  %OPENSSL_DIR%\openssl.cnf
echo string_mask             = nombstr                         >>  %OPENSSL_DIR%\openssl.cnf
echo.                                                          >>  %OPENSSL_DIR%\openssl.cnf
echo [ req_distinguished_name ]                                >>  %OPENSSL_DIR%\openssl.cnf
echo countryName             = US                              >>  %OPENSSL_DIR%\openssl.cnf
echo stateOrProvinceName     = California                      >>  %OPENSSL_DIR%\openssl.cnf
echo localityName            = Palo Alto                       >>  %OPENSSL_DIR%\openssl.cnf
echo 0.organizationName      = VMware, Inc.                    >>  %OPENSSL_DIR%\openssl.cnf
echo emailAddress            = ssl-certificates@vmware.com     >>  %OPENSSL_DIR%\openssl.cnf
echo commonName              = %COMPUTERNAME%                  >>  %OPENSSL_DIR%\openssl.cnf

SET OPENSSL_CONF=%OPENSSL_DIR%\openssl.cnf
SET RANDFILE=%temp%\openssl.rnd

cd /d %OPENSSL_DIR%
move /Y %OPENSSL_DIR%\rui.key %OPENSSL_DIR%\rui.key.old
move /Y %OPENSSL_DIR%\rui.crt %OPENSSL_DIR%\rui.crt.old
"C:\Program Files (x86)\VMware\VMware Workstation\openssl.exe" req -nodes -new -x509 -keyout %OPENSSL_DIR%\rui.key -out %OPENSSL_DIR%\rui.crt -days 3650

Import is to start the script elevated, with administrator permissions.

Michael

Generate a new selfsigned SSL/TLS certificate for VMware Workstation
GenCertificateVMwareWorkstation.cmd
Version: 1.0.0.0

Author:Michael
Category:Shell scripts
Date:May 15, 2019
2.0 KiB
993 Downloads
Details...

Leave a Reply Cancel reply