From d28b2edfb02daea9caca8bd54a5facf364f0c65a Mon Sep 17 00:00:00 2001 From: Richard Bonhomme Date: Fri, 10 Jan 2020 17:08:13 +0000 Subject: [PATCH 1/4] Ignore serial.old Signed-off-by: Richard Bonhomme --- easyrsa3/easyrsa | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index fded6f8..6ca1e4b 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -1865,8 +1865,8 @@ up23_create_new_pki () up23_verbose ">> Copy database to NEW PKI .." # Failure for these is not optional - # DO NOT DELETE - Files ignored: index.txt.old - for i in index.txt serial serial.old ca.crt index.txt.attr + # Files ignored: index.txt.old serial.old + for i in index.txt serial ca.crt index.txt.attr do cp "$KEY_DIR/$i" "$EASYRSA_PKI" \ || up23_fail_upgrade "Failed to copy $KEY_DIR/$i to $EASYRSA_PKI" From 8cd88a14bbd1d427b3474f2a788b11643cc5f624 Mon Sep 17 00:00:00 2001 From: Richard Bonhomme Date: Fri, 10 Jan 2020 23:17:30 +0000 Subject: [PATCH 2/4] Inline credentials Signed-off-by: Richard Bonhomme --- easyrsa3/easyrsa | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 6ca1e4b..3a81fc4 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -100,7 +100,8 @@ cmd_help() { This mode uses the as the X509 CN." opts=" - nopass - do not encrypt the private key (default is encrypted)" ;; + nopass - do not encrypt the private key (default is encrypted) + inline - create an inline credentials file for this node" ;; revoke) text=" revoke [reason] Revoke a certificate specified by the filename_base, with an optional @@ -914,6 +915,7 @@ Run easyrsa without commands for usage and commands." while [ -n "$1" ]; do case "$1" in nopass) req_opts="$req_opts nopass" ;; + inline) EASYRSA_INLINE=1 ;; *) warn "Ignoring unknown command option: '$1'" ;; esac shift @@ -939,8 +941,34 @@ Matching file found at: " die "Failed to sign '$name'" } + # inline it + [ $EASYRSA_INLINE ] && inline_creds + } # => build_full() +#Create inline credentials file for this node +inline_creds () +{ + [ -f "$EASYRSA_PKI/$EASYRSA_REQ_CN.creds" ] \ + && die "Inline file exists: $EASYRSA_PKI/$EASYRSA_REQ_CN.creds" + { + printf "%s\n" "# $crt_type: $EASYRSA_REQ_CN" + printf "%s\n" "" + printf "%s\n" "" + cat "$EASYRSA_PKI/ca.crt" + printf "%s\n" "" + printf "%s\n" "" + printf "%s\n" "" + cat "$crt_out" + printf "%s\n" "" + printf "%s\n" "" + printf "%s\n" "" + cat "$key_out" + printf "%s\n" "" + printf "%s\n" "" + } > "$EASYRSA_PKI/$EASYRSA_REQ_CN.creds" +} # => inline_creds () + # revoke backend revoke() { verify_ca_init From ef2fc88cf0480e1e8192ac85f9427a4213bc9cdb Mon Sep 17 00:00:00 2001 From: Richard Bonhomme Date: Sat, 11 Jan 2020 00:36:51 +0000 Subject: [PATCH 3/4] Exit function with correct code Signed-off-by: Richard Bonhomme --- easyrsa3/easyrsa | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 3a81fc4..0165a9a 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -942,8 +942,9 @@ Matching file found at: " } # inline it - [ $EASYRSA_INLINE ] && inline_creds - + if [ $EASYRSA_INLINE ]; then + inline_creds + fi } # => build_full() #Create inline credentials file for this node From 7ccec6e7bcf42082b334d8501487ee190f82c5b2 Mon Sep 17 00:00:00 2001 From: Richard Bonhomme Date: Sat, 11 Jan 2020 03:14:04 +0000 Subject: [PATCH 4/4] Add easyrsa-unit-tests to gitignore Signed-off-by: Richard Bonhomme --- .gitignore | 2 ++ easyrsa3/easyrsa | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 1148130..24b9c14 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ easyrsa3/pki +easyrsa3/unit-tests-temp +easyrsa-unit-tests.sh easyrsa3/vars dist-staging easyrsa3/safessl-easyrsa.cnf diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 0165a9a..e6e243d 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -947,7 +947,7 @@ Matching file found at: " fi } # => build_full() -#Create inline credentials file for this node +# Create inline credentials file for this node inline_creds () { [ -f "$EASYRSA_PKI/$EASYRSA_REQ_CN.creds" ] \