@@ -317,6 +317,7 @@ OSSL_VER="" # openssl version, will be auto-determin
317317OSSL_VER_MAJOR=0
318318OSSL_VER_MINOR=0
319319OSSL_VER_APPENDIX="none"
320+ OSSL_SHORT_STR="" # short string for banner
320321CLIENT_PROB_NO=1
321322
322323GOOD_CA_BUNDLE="" # A bundle of CA certificates that can be used to validate the server's certificate
@@ -20127,6 +20128,21 @@ find_openssl_binary() {
2012720128 OSSL_VER_PLATFORM=$($OPENSSL version -p 2>/dev/null | sed 's/^platform: //')
2012820129 OSSL_BUILD_DATE=$($OPENSSL version -a 2>/dev/null | grep '^built' | sed -e 's/built on//' -e 's/: ... //' -e 's/: //' -e 's/ UTC//' -e 's/ +0000//' -e 's/.000000000//')
2012920130
20131+ # Determine an OpenSSL short string for the banner
20132+ # E.g MacOS' homebrew and Debian add a library string: OpenSSL 3.3.1 4 Jun 2024 (Library: OpenSSL 3.3.1 4 Jun 2024),
20133+ # so we omit the part after the round bracket as it breaks formatting and doesn't provide more useful info
20134+ OSSL_SHORT_STR=$($OPENSSL version 2>/dev/null)
20135+ OSSL_SHORT_STR=${OSSL_SHORT_STR%\(*}
20136+ # Now handle strings like this: OpenSSL 1.1.1l-fips 24 Aug 2021 SUSE release 150500.17.34.1
20137+ # we find the year, remove until first occurrence, re-add it
20138+ for yr in {2014..2029} ; do
20139+ if [[ $OSSL_SHORT_STR =~ \ $yr ]] ; then
20140+ OSSL_SHORT_STR=${OSSL_SHORT_STR%%$yr*}
20141+ OSSL_SHORT_STR="${OSSL_SHORT_STR}${yr}"
20142+ break
20143+ fi
20144+ done
20145+
2013020146 # see #190, reverting logic: unless otherwise proved openssl has no dh bits
2013120147 case "$OSSL_VER_MAJOR.$OSSL_VER_MINOR" in
2013220148 1.0.2|1.1.0|1.1.1|3.*) HAS_DH_BITS=true ;;
@@ -20765,47 +20781,56 @@ prepare_arrays() {
2076520781
2076620782mybanner() {
2076720783 local bb1 bb2 bb3
20784+ local spaces=" "
20785+ local full="$1"
2076820786
2076920787 "$QUIET" && return
2077020788 "$CHILD_MASS_TESTING" && return
2077120789 OPENSSL_NR_CIPHERS=$(count_ciphers "$(actually_supported_osslciphers 'ALL:COMPLEMENTOFALL:@STRENGTH' 'ALL')")
2077220790 bb1=$(cat <<EOF
2077320791
20774- ###########################################################
20775- $PROG_NAME $VERSION from
20792+ #####################################################################
2077620793EOF
2077720794)
20778- bb2=$(cat <<EOF
20795+ bb2=$(cat <<EOF
2077920796
20780- This program is free software. Distribution and
20781- modification under GPLv2 permitted.
20782- USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!
20797+ This program is free software. Distribution and modification under
20798+ GPLv2 permitted. USAGE w/o ANY WARRANTY. USE IT AT YOUR OWN RISK!
2078320799
20784- Please file bugs @
2078520800EOF
2078620801)
20787- bb3=$(cat <<EOF
20802+ bb3=$(cat <<EOF
2078820803
20789- ###########################################################
20804+ #####################################################################
2079020805EOF
2079120806)
20792- pr_bold "$bb1 "
20807+ prln_bold "$bb1"; out "$spaces" ; pr_bold "$PROG_NAME"; out " version " ; pr_bold "$VERSION" ; out " from "
2079320808 pr_boldurl "$SWURL"; outln
2079420809 if [[ -n "$GIT_REL" ]]; then
20795- pr_bold " ("
20810+ out "$spaces"
20811+ pr_bold "("
2079620812 pr_litegrey "$GIT_REL"
2079720813 prln_bold ")"
2079820814 fi
20799- pr_bold "$bb2 "
20815+ prln_bold "$bb2"
20816+ out "\n${spaces}" ; out "Please file bugs @ "
2080020817 pr_boldurl "https://testssl.sh/bugs/"; outln
2080120818 pr_bold "$bb3"
2080220819 outln "\n"
20803- outln " Using \"$($OPENSSL version 2>/dev/null)\" [~$OPENSSL_NR_CIPHERS ciphers]"
20804- out " on $HNAME:"
20820+ out "${spaces}Using "
20821+ pr_italic "$OSSL_SHORT_STR"
20822+ outln " [~$OPENSSL_NR_CIPHERS ciphers]"
20823+ out "${spaces}on $HNAME:"
2080520824 outln "$OPENSSL_LOCATION"
20806- outln " (built: \"$OSSL_BUILD_DATE\", platform: \"$OSSL_VER_PLATFORM\")\n"
20825+ if [[ -n $full ]] || [[ $DEBUG -ge 1 ]]; then
20826+ out "${spaces}built: "; pr_italic "$OSSL_BUILD_DATE"; out ", platform: "; prln_italic "$OSSL_VER_PLATFORM"
20827+ out "${spaces}Using "
20828+ pr_italic "bash ${BASH_VERSINFO[0]}.${BASH_VERSINFO[1]}.${BASH_VERSINFO[2]}"
20829+ fi
20830+ outln
2080720831}
2080820832
20833+
2080920834calc_scantime() {
2081020835 END_TIME=$(date +%s)
2081120836 SCAN_TIME=$(( END_TIME - START_TIME ))
@@ -23318,7 +23343,8 @@ parse_cmd_line() {
2331823343 get_install_dir
2331923344 find_openssl_binary
2332023345 prepare_debug
23321- mybanner
23346+ # full banner
23347+ mybanner true
2332223348 exit $ALLOK
2332323349 ;;
2332423350 esac
0 commit comments