diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/civetweb/resources/cert/make_certs.bat | |
parent | Initial commit. (diff) | |
download | ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/civetweb/resources/cert/make_certs.bat')
-rw-r--r-- | src/civetweb/resources/cert/make_certs.bat | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/civetweb/resources/cert/make_certs.bat b/src/civetweb/resources/cert/make_certs.bat new file mode 100644 index 000000000..66a091d37 --- /dev/null +++ b/src/civetweb/resources/cert/make_certs.bat @@ -0,0 +1,55 @@ +@echo off
+REM We need admin rights, otherwise the random state cannot be written
+REM Thanks to http://stackoverflow.com/a/10052222/1531708
+
+:: BatchGotAdmin
+:-------------------------------------
+REM --> Check for permissions
+ IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
+>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
+) ELSE (
+>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
+)
+
+REM --> If error flag set, we do not have admin.
+if '%errorlevel%' NEQ '0' (
+ echo Requesting administrative privileges...
+ goto UACPrompt
+) else ( goto gotAdmin )
+
+:UACPrompt
+ echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
+ set params = %*:"=""
+ echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params%", "", "runas", 1 >> "%temp%\getadmin.vbs"
+
+ "%temp%\getadmin.vbs"
+ del "%temp%\getadmin.vbs"
+ exit /B
+
+:gotAdmin
+ pushd "%CD%"
+ CD /D "%~dp0"
+:--------------------------------------
+
+del server.*
+
+c:\OpenSSL-Win32\bin\openssl.exe genrsa -des3 -out server.key 4096
+
+c:\OpenSSL-Win32\bin\openssl.exe req -sha256 -new -key server.key -out server.csr -utf8
+
+copy server.key server.key.orig
+
+c:\OpenSSL-Win32\bin\openssl.exe rsa -in server.key.orig -out server.key
+
+echo [ v3_ca ] > server.ext.txt
+echo [ req ] >> server.ext.txt
+echo req_extensions = my_extensions >> server.ext.txt
+echo [ my_extensions ] >> server.ext.txt
+echo extendedKeyUsage=serverAuth >> server.ext.txt
+echo crlDistributionPoints=URI:http://localhost/crl.pem >> server.ext.txt
+
+c:\OpenSSL-Win32\bin\openssl.exe x509 -req -days 365 -extensions v3_ca -extfile server.ext.txt -in server.csr -signkey server.key -out server.crt
+
+copy server.crt server.pem
+
+type server.key >> server.pem
|