Skip to content

Instantly share code, notes, and snippets.

@ifranco88

ifranco88/make-cert.bat

Forked from turtlepod/make-cert.bat
Last active Feb 16, 2021
Embed
What would you like to do?
@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