From a6db7f496f54312af2667f1d552f9ddbd0a0b272 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Tue, 29 Mar 2022 16:15:01 +0100 Subject: [PATCH] When initialising a new PKI, create "$EASYRSA_PKI/vars' from example Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index c34696751..20f0c86be 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -560,7 +560,7 @@ and initialize a fresh PKI here." done # Install data-files into ALL new PKIs - install_data_to_pki || \ + install_data_to_pki init || \ warn "Failed to install required data-files to PKI. (init)" # Verify that $EASYRSA_SAFE_CONF exists ($OPENSSL_CONF) @@ -667,6 +667,11 @@ install_data_to_pki () { fi done + # If this is init-pki then create PKI/vars from example + if [ -n "$1" ] && [ -e "${EASYRSA_PKI}/${vars_file_example}" ]; then + cp -f "${EASYRSA_PKI}/${vars_file_example}" "${EASYRSA_PKI}/${vars_file}" + fi + # Check PKI is updated - Omit 'vars' and example. #[ -e "${EASYRSA_PKI}/${vars_file}" ] || return #[ -e "${EASYRSA_PKI}/${vars_file_example}" ] || return