mirror of
https://github.com/OpenVPN/openvpn.git
synced 2026-04-29 01:50:03 -04:00
Some checks are pending
Build / Check code style with clang-format (push) Waiting to run
Build / Android - arm64-v8a (push) Waiting to run
Build / gcc-mingw - x64 - Debug - OSSL (push) Waiting to run
Build / gcc-mingw - x64 - Release - OSSL (push) Waiting to run
Build / gcc-mingw - x86 - Debug - OSSL (push) Waiting to run
Build / gcc-mingw - x86 - Release - OSSL (push) Waiting to run
Build / mingw unittest argv - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest auth_token - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest buffer - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest crypto - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest cryptoapi - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest misc - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest ncp - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest options_parse - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest packet_id - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest pkt - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest provider - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest ssl - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest tls_crypt - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest user_pass - x64 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest argv - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest auth_token - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest buffer - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest crypto - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest cryptoapi - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest misc - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest ncp - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest options_parse - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest packet_id - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest pkt - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest provider - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest ssl - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest tls_crypt - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest user_pass - x64 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest argv - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest auth_token - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest buffer - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest crypto - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest cryptoapi - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest misc - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest ncp - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest options_parse - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest packet_id - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest pkt - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest provider - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest ssl - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest tls_crypt - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest user_pass - x86 - Debug - OSSL (push) Blocked by required conditions
Build / mingw unittest argv - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest auth_token - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest buffer - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest crypto - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest cryptoapi - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest misc - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest ncp - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest options_parse - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest packet_id - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest pkt - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest provider - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest ssl - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest tls_crypt - x86 - Release - OSSL (push) Blocked by required conditions
Build / mingw unittest user_pass - x86 - Release - OSSL (push) Blocked by required conditions
Build / gcc - ubuntu-24.04 - OpenSSL 3.0.13 --enable-pkcs11 (push) Waiting to run
Build / gcc - ubuntu-22.04 - OpenSSL 3.0.2 --enable-pkcs11 (push) Waiting to run
Build / clang-asan - ubuntu-22.04 - openssl (push) Waiting to run
Build / clang-asan - ubuntu-24.04 - openssl (push) Waiting to run
Build / macos-14 - libressl - asan (push) Waiting to run
Build / macos-14 - openssl@3 - asan (push) Waiting to run
Build / macos-15 - libressl - asan (push) Waiting to run
Build / macos-15 - openssl@3 - asan (push) Waiting to run
Build / macos-26 - libressl - asan (push) Waiting to run
Build / macos-26 - openssl@3 - asan (push) Waiting to run
Build / macos-14 - libressl - normal (push) Waiting to run
Build / macos-14 - openssl@3 - normal (push) Waiting to run
Build / macos-15 - libressl - normal (push) Waiting to run
Build / macos-15 - openssl@3 - normal (push) Waiting to run
Build / macos-26 - libressl - normal (push) Waiting to run
Build / macos-26 - openssl@3 - normal (push) Waiting to run
Build / msbuild - amd64 - openssl (push) Waiting to run
Build / msbuild - amd64-clang - openssl (push) Waiting to run
Build / msbuild - arm64 - openssl (push) Waiting to run
Build / msbuild - x86 - openssl (push) Waiting to run
Build / msbuild - x86-clang - openssl (push) Waiting to run
Build / clang asan - ubuntu-22.04 - libressl (push) Waiting to run
Build / gcc normal - ubuntu-22.04 - libressl (push) Waiting to run
Build / clang asan - ubuntu-22.04 - mbedtls3 (push) Waiting to run
Build / gcc normal - ubuntu-22.04 - mbedtls3 (push) Waiting to run
Build / clang asan - ubuntu-24.04 - awslc (push) Waiting to run
Build / gcc normal - ubuntu-24.04 - awslc (push) Waiting to run
Deploy Doxygen documentation to Pages / build (push) Waiting to run
Deploy Doxygen documentation to Pages / deploy (push) Blocked by required conditions
Change-Id: I1728fcb75284ba106e5c37ef53f6e568b64fb647 Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com> Acked-by: Gert Doering <gert@greenie.muc.de> Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1456 Message-Id: <20260108074915.9417-1-gert@greenie.muc.de> URL: https://sourceforge.net/p/openvpn/mailman/message/59280815/ Signed-off-by: Gert Doering <gert@greenie.muc.de>
104 lines
4.3 KiB
Bash
Executable file
104 lines
4.3 KiB
Bash
Executable file
#!/bin/sh
|
|
#
|
|
# Run this script to set up a test CA, and test key-certificate pair for a
|
|
# server, and various clients.
|
|
#
|
|
# Copyright (C) 2014-2026 Steffan Karger <steffan@karger.me>
|
|
set -eu
|
|
|
|
command -v openssl >/dev/null 2>&1 || { echo >&2 "Unable to find openssl. Please make sure openssl is installed and in your path."; exit 1; }
|
|
|
|
if [ ! -f openssl.cnf ]
|
|
then
|
|
echo "Please run this script from the sample directory"
|
|
exit 1
|
|
fi
|
|
|
|
# Generate static key for tls-auth (or static key mode)
|
|
top_builddir="${top_builddir:-$(dirname ${0})/../..}"
|
|
${top_builddir}/src/openvpn/openvpn --genkey tls-auth ta.key
|
|
|
|
# Create required directories and files
|
|
mkdir -p sample-ca
|
|
rm -f sample-ca/index.txt
|
|
touch sample-ca/index.txt
|
|
echo "01" > sample-ca/serial
|
|
|
|
# Generate CA key and cert
|
|
openssl req -new -newkey rsa:4096 -days 3650 -nodes -x509 \
|
|
-extensions easyrsa_ca -keyout sample-ca/ca.key -out sample-ca/ca.crt \
|
|
-subj "/C=KG/ST=NA/L=BISHKEK/O=OpenVPN-TEST/emailAddress=me@myhost.mydomain" \
|
|
-config openssl.cnf
|
|
|
|
# Create server key and cert
|
|
openssl req -new -nodes -config openssl.cnf -extensions server \
|
|
-keyout sample-ca/server.key -out sample-ca/server.csr \
|
|
-subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Server/emailAddress=me@myhost.mydomain"
|
|
openssl ca -batch -config openssl.cnf -extensions server \
|
|
-out sample-ca/server.crt -in sample-ca/server.csr
|
|
|
|
# Create client key and cert
|
|
openssl req -new -nodes -config openssl.cnf \
|
|
-keyout sample-ca/client.key -out sample-ca/client.csr \
|
|
-subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Client/emailAddress=me@myhost.mydomain"
|
|
openssl ca -batch -config openssl.cnf \
|
|
-out sample-ca/client.crt -in sample-ca/client.csr
|
|
|
|
# Create password protected key file
|
|
openssl rsa -aes256 -passout pass:password \
|
|
-in sample-ca/client.key -out sample-ca/client-pass.key
|
|
|
|
# Create pkcs#12 client bundle
|
|
openssl pkcs12 -export -nodes -password pass:password \
|
|
-out sample-ca/client.p12 -inkey sample-ca/client.key \
|
|
-in sample-ca/client.crt -certfile sample-ca/ca.crt
|
|
|
|
# Create a client cert, revoke it, generate CRL
|
|
openssl req -new -nodes -config openssl.cnf \
|
|
-keyout sample-ca/client-revoked.key -out sample-ca/client-revoked.csr \
|
|
-subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=client-revoked/emailAddress=me@myhost.mydomain"
|
|
openssl ca -batch -config openssl.cnf \
|
|
-out sample-ca/client-revoked.crt -in sample-ca/client-revoked.csr
|
|
openssl ca -config openssl.cnf -revoke sample-ca/client-revoked.crt
|
|
openssl ca -config openssl.cnf -gencrl -out sample-ca/ca.crl
|
|
|
|
# Create DSA server and client cert (signed by 'regular' RSA CA)
|
|
openssl dsaparam -out sample-ca/dsaparams.pem 2048
|
|
|
|
openssl req -new -newkey dsa:sample-ca/dsaparams.pem -nodes -config openssl.cnf \
|
|
-extensions server \
|
|
-keyout sample-ca/server-dsa.key -out sample-ca/server-dsa.csr \
|
|
-subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Server-DSA/emailAddress=me@myhost.mydomain"
|
|
openssl ca -batch -config openssl.cnf -extensions server \
|
|
-out sample-ca/server-dsa.crt -in sample-ca/server-dsa.csr
|
|
|
|
openssl req -new -newkey dsa:sample-ca/dsaparams.pem -nodes -config openssl.cnf \
|
|
-keyout sample-ca/client-dsa.key -out sample-ca/client-dsa.csr \
|
|
-subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Client-DSA/emailAddress=me@myhost.mydomain"
|
|
openssl ca -batch -config openssl.cnf \
|
|
-out sample-ca/client-dsa.crt -in sample-ca/client-dsa.csr
|
|
|
|
# Create EC server and client cert (signed by 'regular' RSA CA)
|
|
openssl ecparam -out sample-ca/secp256k1.pem -name secp256k1
|
|
|
|
openssl req -new -newkey ec:sample-ca/secp256k1.pem -nodes -config openssl.cnf \
|
|
-extensions server \
|
|
-keyout sample-ca/server-ec.key -out sample-ca/server-ec.csr \
|
|
-subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Server-EC/emailAddress=me@myhost.mydomain"
|
|
openssl ca -batch -config openssl.cnf -extensions server \
|
|
-out sample-ca/server-ec.crt -in sample-ca/server-ec.csr
|
|
|
|
openssl req -new -newkey ec:sample-ca/secp256k1.pem -nodes -config openssl.cnf \
|
|
-keyout sample-ca/client-ec.key -out sample-ca/client-ec.csr \
|
|
-subj "/C=KG/ST=NA/O=OpenVPN-TEST/CN=Test-Client-EC/emailAddress=me@myhost.mydomain"
|
|
openssl ca -batch -config openssl.cnf \
|
|
-out sample-ca/client-ec.crt -in sample-ca/client-ec.csr
|
|
|
|
# Generate DH parameters
|
|
openssl dhparam -out dh2048.pem 2048
|
|
|
|
# Copy keys and certs to working directory
|
|
cp sample-ca/*.key .
|
|
cp sample-ca/*.crt .
|
|
cp sample-ca/*.p12 .
|
|
cp sample-ca/*.crl .
|