Merge pull request #2653 from testssl/address_addCA_issue

Address CA file parsing problem (3.2)
This commit is contained in:
Dirk Wetter 2025-02-07 14:18:51 +01:00 committed by GitHub
commit 4b4260831e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 6 deletions

View File

@ -109,7 +109,7 @@
* Renegotiation checks improved, also no false positive for Node.js anymore * Renegotiation checks improved, also no false positive for Node.js anymore
* Major update of client simulations with self-collected up-to-date data * Major update of client simulations with self-collected up-to-date data
* Update of CA certificate stores * Update of CA certificate stores
* Lots of bug fixes * Lots of bug and security fixes
* More travis/CI checks -- still place for improvements * More travis/CI checks -- still place for improvements
* Man page reviewed * Man page reviewed

View File

@ -23545,10 +23545,10 @@ set_skip_tests() {
# arg2: value (if no = provided) # arg2: value (if no = provided)
parse_opt_equal_sign() { parse_opt_equal_sign() {
if [[ "$1" == *=* ]]; then if [[ "$1" == *=* ]]; then
echo ${1#*=} safe_echo "${1#*=}"
return 1 # = means we don't need to shift args! return 1 # = means we don't need to shift args!
else else
echo "$2" safe_echo "${2}"
return 0 # we need to shift return 0 # we need to shift
fi fi
} }
@ -24205,13 +24205,16 @@ parse_cmd_line() {
[[ $CMDLINE_IP == one ]] && ( is_ipv4addr "$URI" || is_ipv6addr "$URI" ) && fatal_cmd_line "\"--ip=one\" plus supplying an IP address doesn't work" $ERR_CMDLINE [[ $CMDLINE_IP == one ]] && ( is_ipv4addr "$URI" || is_ipv6addr "$URI" ) && fatal_cmd_line "\"--ip=one\" plus supplying an IP address doesn't work" $ERR_CMDLINE
"$do_mx_all_ips" && [[ "$NODNS" == none ]] && fatal_cmd_line "\"--mx\" and \"--nodns=none\" don't work together" $ERR_CMDLINE "$do_mx_all_ips" && [[ "$NODNS" == none ]] && fatal_cmd_line "\"--mx\" and \"--nodns=none\" don't work together" $ERR_CMDLINE
if [[ -d $ADDTL_CA_FILES ]]; then if [[ "${ADDTL_CA_FILES}" =~ \ ]]; then
fatal_cmd_line "The CA file \"${ADDTL_CA_FILES}\" must not contain spaces" $ERR_RESOURCE
fi
if [[ -d "${ADDTL_CA_FILES}" ]]; then
ADDTL_CA_FILES="$ADDTL_CA_FILES/*.pem" ADDTL_CA_FILES="$ADDTL_CA_FILES/*.pem"
else else
ADDTL_CA_FILES="${ADDTL_CA_FILES//,/ }" ADDTL_CA_FILES="${ADDTL_CA_FILES//,/ }"
fi fi
for fname in $ADDTL_CA_FILES; do for fname in ${ADDTL_CA_FILES}; do
[[ -s "$fname" ]] || fatal_cmd_line "CA file \"$fname\" does not exist" $ERR_RESOURCE [[ -s "$fname" ]] || fatal_cmd_line "The CA file \"$fname\" does not exist" $ERR_RESOURCE
grep -q 'BEGIN CERTIFICATE' "$fname" || fatal_cmd_line "\"$fname\" is not CA file in PEM format" $ERR_RESOURCE grep -q 'BEGIN CERTIFICATE' "$fname" || fatal_cmd_line "\"$fname\" is not CA file in PEM format" $ERR_RESOURCE
done done