Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
Use 'set -x'

Expect 'mkdir' to fail for commands 'init-pki' and 'build-ca'

Signed-off-by: Richard T Bonhomme <[email protected]>
  • Loading branch information
TinCanTech committed Feb 7, 2024
1 parent ee6ca2d commit 6e24864
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions easyrsa3/easyrsa
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
# and the Licensing/ directory of this project for full licensing
# details.

set -x

# Help/usage output to stdout
usage() {
# command help:
Expand Down Expand Up @@ -1375,8 +1377,14 @@ and initialize a fresh PKI here."
fi

# new dirs:
mkdir "$EASYRSA_PKI"
[ -d "$EASYRSA_PKI" ] || \
die "\
Failed to create PKI directory (permissions?)"

for i in issued private reqs inline; do
mkdir -p "$EASYRSA_PKI/$i" || \
mkdir "$EASYRSA_PKI/$i"
[ -d "$EASYRSA_PKI/$i" ] || \
die "\
Failed to create PKI file structure (permissions?)"
done
Expand Down Expand Up @@ -1576,11 +1584,16 @@ current CA. To start a new CA, run init-pki first."
# create necessary dirs:
err_msg="\
Unable to create necessary PKI files (permissions?)"

mkdir "$EASYRSA_PKI"/revoked
[ -d "$EASYRSA_PKI"/revoked ] || die "$err_msg (1)"

for i in certs_by_serial \
revoked/certs_by_serial revoked/private_by_serial \
revoked/reqs_by_serial
do
mkdir -p "$EASYRSA_PKI/$i" || die "$err_msg"
mkdir "$EASYRSA_PKI/$i"
[ -d "$EASYRSA_PKI/$i" ] || die "$err_msg (2)"
done

# create necessary files:
Expand Down

0 comments on commit 6e24864

Please sign in to comment.