Skip to content

Instantly share code, notes, and snippets.

@ifranco88
Forked from turtlepod/make-cert.bat
Last active February 16, 2021 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ifranco88/50c4b4a5a86613f09ad573c2dfe69619 to your computer and use it in GitHub Desktop.
Save ifranco88/50c4b4a5a86613f09ad573c2dfe69619 to your computer and use it in GitHub Desktop.
@echo off
SETLOCAL EnableDelayedExpansion
set /p domain="Enter Domain: "
set OPENSSL_CONF=../conf/openssl.cnf
set tmp_cert_conf=cert_%domain%.conf
del %tmp_cert_conf%
for /f "delims=" %%x in (cert.conf) do (
set "string=%%x"
set "modified=!string:{{DOMAIN}}=%domain%!"
echo !modified!>>"%tmp_cert_conf%"
)
if not exist .\%domain% mkdir .\%domain%
..\bin\openssl req -config %tmp_cert_conf% -new -sha256 -newkey rsa:2048 -nodes -keyout %domain%\server.key -x509 -days 365 -out %domain%\server.crt
del %tmp_cert_conf%
echo.
echo -----
echo The certificate was provided.
echo.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment