Skip to content

Commit c7a0d16

Browse files
committed
Merge branch 'TinCanTech-bugfix-user-ssl-conf'
Signed-off-by: Richard T Bonhomme <[email protected]>
2 parents 187083a + d21946a commit c7a0d16

File tree

3 files changed

+29
-16
lines changed

3 files changed

+29
-16
lines changed

ChangeLog

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ Easy-RSA 3 ChangeLog
22

33
3.2.2 (TBD)
44

5+
* Rename global option --ssl-conf (DEPRECATED) to --ssl-cnf (c788423) (#1270)
6+
* bugfix: Save and Restore $EASYRSA_SSL_CONF for compound commands (7cdb14d) (#1270)
7+
* bugfix: Always use locate_support_files() after secure_session() (d530bc3) (#1270)
58
* bugfix: easyrsa-tools.lib: renew, write full metadata to temp-file (b47d2af) (#1267)
69
* Introduce new command 'revoke-issued' (38bf2d8) (#1266)
710
Commands 'revoke' and 'revoke-issued' are identical.

easyrsa3/easyrsa

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -625,7 +625,7 @@ General options:
625625
(Default PKI directory is sub-directory 'pki')
626626
See Advanced.md for in depth usage.
627627

628-
--ssl-conf=FILE : Define a specific OpenSSL config file for Easy-RSA to use
628+
--ssl-cnf=FILE : Define a specific OpenSSL config file for Easy-RSA to use
629629
(Default config file is in the EasyRSA PKI directory)
630630
--force-safe-ssl: Always generate a safe SSL config file
631631
(Default: Generate Safe SSL config once per instance)
@@ -840,8 +840,7 @@ secure_session - Missing temporary directory:
840840
die "secure_session - temp-file EXISTS"
841841

842842
# New session requires safe-ssl conf
843-
unset -v session OPENSSL_CONF \
844-
EASYRSA_SSL_CONF safe_ssl_cnf_tmp \
843+
unset -v session OPENSSL_CONF safe_ssl_cnf_tmp \
845844
working_safe_ssl_conf working_safe_org_conf
846845

847846
easyrsa_err_log="$secured_session/error.log"
@@ -859,8 +858,11 @@ remove_secure_session() {
859858
if rm -rf "$secured_session"; then
860859
verbose "\
861860
remove_secure_session: DELETED: $secured_session"
862-
unset -v secured_session OPENSSL_CONF \
863-
EASYRSA_SSL_CONF safe_ssl_cnf_tmp \
861+
862+
# Restore original EASYRSA_SSL_CONF
863+
EASYRSA_SSL_CONF="$original_ssl_cnf"
864+
865+
unset -v secured_session OPENSSL_CONF safe_ssl_cnf_tmp \
864866
working_safe_ssl_conf working_safe_org_conf
865867
return
866868
fi
@@ -2678,6 +2680,7 @@ basicConstraints is not defined, cannot use 'pathlen'"
26782680

26792681
# Get request CN
26802682
# EASYRSA_REQ_CN MUST always be set to the CSR CN
2683+
# or use --new-subect
26812684
EASYRSA_REQ_CN="$(
26822685
"$EASYRSA_OPENSSL" req -utf8 -in "$req_in" -noout \
26832686
-subject -nameopt multiline | grep 'commonName'
@@ -2984,8 +2987,8 @@ Conflicting file found at:
29842987
# Recreate temp-session and
29852988
# drop edits to SSL Conf file
29862989
remove_secure_session
2987-
locate_support_files
29882990
secure_session
2991+
locate_support_files
29892992
write_global_safe_ssl_cnf_tmp
29902993

29912994
# Require --copy-ext
@@ -4661,6 +4664,14 @@ verify_working_env() {
46614664
write_global_safe_ssl_cnf_tmp
46624665
fi
46634666
fi
4667+
4668+
# Find x509-types, openssl-easyrsa.cnf
4669+
# and easyrsa-tools.lib
4670+
locate_support_files
4671+
4672+
# Save original EASYRSA_SSL_CONF
4673+
original_ssl_cnf="$EASYRSA_SSL_CONF"
4674+
46644675
verbose "verify_working_env: COMPLETED Handover-to: $cmd"
46654676
} # => verify_working_env()
46664677

@@ -4716,6 +4727,10 @@ verify_working_env - easyrsa_mktemp global_safe_ssl_cnf_tmp"
47164727
# If the existing file has a known hash then use temp-file.
47174728
# Otherwise, use the file in place.
47184729
write_easyrsa_ssl_cnf_tmp() {
4730+
# If EASYRSA_SSL_CONF is undefined then use default
4731+
[ "$EASYRSA_SSL_CONF" ] || set_var \
4732+
EASYRSA_SSL_CONF "$EASYRSA_PKI"/openssl-easyrsa.cnf
4733+
47194734
if [ -f "$EASYRSA_SSL_CONF" ]; then
47204735
verbose "write_easyrsa_ssl_cnf_tmp: SSL config EXISTS"
47214736

@@ -5578,7 +5593,7 @@ while :; do
55785593
--tmp-dir)
55795594
export EASYRSA_TEMP_DIR="$val"
55805595
;;
5581-
--ssl-conf)
5596+
--ssl-cnf|--ssl-conf)
55825597
export EASYRSA_SSL_CONF="$val"
55835598
;;
55845599
--keep-tmp)
@@ -5832,9 +5847,6 @@ validate_default_vars
58325847
# Check for conflicting input options
58335848
mutual_exclusions
58345849

5835-
# Find x509-types, openssl-easyrsa.cnf and easyrsa-tools.lib
5836-
locate_support_files
5837-
58385850
# Verify SSL Lib - One time ONLY
58395851
verify_ssl_lib
58405852

easyrsa3/easyrsa-tools.lib

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -414,13 +414,11 @@ read_db() {
414414

415415
verbose "***** Read next record *****"
416416

417-
# Recreate temp session
418-
remove_secure_session || \
419-
die "read_db - remove_secure_session"
417+
# Recreate temp-session and
418+
# drop edits to SSL Conf file
419+
remove_secure_session
420+
secure_session
420421
locate_support_files
421-
secure_session || \
422-
die "read_db - secure_session"
423-
# Recreate openssl-easyrsa.cnf (Temp)
424422
write_global_safe_ssl_cnf_tmp
425423

426424
# Interpret the db/certificate record

0 commit comments

Comments
 (0)