Skip to content

Commit

Permalink
Allow vars file to exist in current directory (Fix make-cadir)
Browse files Browse the repository at this point in the history
The utility script 'make-cadir' creates a CA directory with a vars file.
This vars file conflicts with the preferred PKI-vars file.

This patch changes 'init-pki' to allow make-cadir vars file to over-ride
the preferred PKI-vars file, without error.

Closes: #633

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
  • Loading branch information
TinCanTech committed Aug 13, 2022
1 parent 5b4fd2b commit f4a6044
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ and initialize a fresh PKI here."
Your newly created PKI dir is:
* $EASYRSA_PKI"

if [ "$user_vars_true" ]; then
if [ "$user_vars_true" ] || [ "$old_vars_true" ]; then
: # ok - No message required
else
message "\
Expand Down Expand Up @@ -1079,12 +1079,18 @@ install_data_to_pki () {
fi

# Create PKI/vars from PKI/example
unset -v old_vars_true
case "$context" in
init-pki)
if [ -e "${EASYRSA_PKI}/${vars_file_example}" ]; then
[ -e "${EASYRSA_PKI}/${vars_file}" ] || \
cp "${EASYRSA_PKI}/${vars_file_example}" \
"${EASYRSA_PKI}/${vars_file}" || :
if [ -e ./vars ]; then
# If the old vars exists then do nothing
old_vars_true=1
else
if [ -e "${EASYRSA_PKI}/${vars_file_example}" ]; then
[ -e "${EASYRSA_PKI}/${vars_file}" ] || \
cp "${EASYRSA_PKI}/${vars_file_example}" \
"${EASYRSA_PKI}/${vars_file}" || :
fi
fi
;;
vars-setup)
Expand Down

1 comment on commit f4a6044

@TinCanTech
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.