From 82483f103e14cb790435a1cdc47478cb62a06a93 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Thu, 3 Nov 2022 21:59:56 +0000 Subject: [PATCH] Improve detect_host() and show_host() Squashed commit of the following: commit 5d48d39891b8ecd8c34f6faef1de06d327ed2b18 Merge: c905f09 2cfc18c Author: Richard T Bonhomme Date: Thu Nov 3 21:56:48 2022 +0000 Merge branch 'restrain-detect_host' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-restrain-detect_host Signed-off-by: Richard T Bonhomme commit 2cfc18c46bb23d1a2e88502ee76faf373f848155 Author: Richard T Bonhomme Date: Thu Nov 3 21:15:09 2022 +0000 Improve detect_host() and show_host() These changes make reductions to: - The effects of detect_host() - The output of show_host() detect_host: - Does not set an SSL library. - Is not essential, so can be run before all other essential code. show_host: - Only show extended details for -v 'verbose' output. Signed-off-by: Richard T Bonhomme Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index ae235f2..32e7c87 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -3920,7 +3920,7 @@ detect_host() { easyrsa_shell="$SHELL (Git)" easyrsa_win_git_bash="${EXEPATH}" # If found then set openssl NOW! - [ -e /usr/bin/openssl ] && set_var EASYRSA_OPENSSL /usr/bin/openssl + #[ -e /usr/bin/openssl ] && set_var EASYRSA_OPENSSL /usr/bin/openssl fi else easyrsa_host_os=nix @@ -3943,7 +3943,8 @@ detect_host() { # Extra diagnostics show_host() { print_version - print "$host_out | ${ssl_version:-ssl_version not currently set}" + [ "$EASYRSA_VERBOSE" ] || return 0 + print "$host_out" [ "$EASYRSA_DEBUG" ] || return 0 case "$easyrsa_host_os" in win) set ;; @@ -4890,6 +4891,9 @@ trap "exit 3" 3 trap "exit 6" 6 trap "exit 14" 15 +# Get host details - No configurable input allowed +detect_host + # Initialisation requirements unset -v die_error_exit easyrsa_error_exit \ user_san_true user_vars_true alias_days @@ -5077,9 +5081,6 @@ case "$cmd" in unset -v no_pki_required esac -# Get host details - does not require vars_setup -detect_host - # Mutual exclusions # --nopass cannot be used with --passin and --passout if [ "$EASYRSA_NO_PASS" ] && \