From 8e517e0a702f0c1f0ff336b64e7faba170e9ac0d Mon Sep 17 00:00:00 2001 From: Dirk Wetter Date: Sat, 23 Dec 2023 12:58:05 +0100 Subject: [PATCH 1/3] Bail out if user error bc of umask If a user chose a broken umask testssl.sh will start but emits subsequent errors. This patch adds two sanity checks whether it is allowed to create and read files in the temp directory. Fixes #2449 --- testssl.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index 6b694e4..acd0904 100755 --- a/testssl.sh +++ b/testssl.sh @@ -20518,7 +20518,9 @@ maketempf() { fi TEMPDIR=$(mktemp -d "$PWD/testssl.XXXXXX") || exit $ERR_FCREATE fi - TMPFILE=$TEMPDIR/tempfile.txt || exit $ERR_FCREATE + ls "$TEMPDIR/" 2>/dev/null || fatal "temporary directory needed not readeable" $ERR_FCREATE + TMPFILE=$TEMPDIR/tempfile.txt + touch $TEMPFILE 2>/dev/null || fatal "temporary directory needed not writeable" $ERR_FCREATE if [[ "$DEBUG" -eq 0 ]]; then ERRFILE="/dev/null" else From 3b5f2022b35ab7b72fa74685451d4912533b7bb0 Mon Sep 17 00:00:00 2001 From: Dirk Wetter Date: Sat, 23 Dec 2023 13:03:57 +0100 Subject: [PATCH 2/3] fix typo --- testssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index acd0904..baf226c 100755 --- a/testssl.sh +++ b/testssl.sh @@ -20518,7 +20518,7 @@ maketempf() { fi TEMPDIR=$(mktemp -d "$PWD/testssl.XXXXXX") || exit $ERR_FCREATE fi - ls "$TEMPDIR/" 2>/dev/null || fatal "temporary directory needed not readeable" $ERR_FCREATE + ls "$TEMPDIR/" 2>/dev/null || fatal "temporary directory needed not readable" $ERR_FCREATE TMPFILE=$TEMPDIR/tempfile.txt touch $TEMPFILE 2>/dev/null || fatal "temporary directory needed not writeable" $ERR_FCREATE if [[ "$DEBUG" -eq 0 ]]; then From c5265e33b7b239352d5796328e8e312fc075f3f0 Mon Sep 17 00:00:00 2001 From: Dirk Wetter Date: Sat, 23 Dec 2023 13:13:16 +0100 Subject: [PATCH 3/3] fix wrong temp file var --- testssl.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testssl.sh b/testssl.sh index baf226c..ef7be21 100755 --- a/testssl.sh +++ b/testssl.sh @@ -20520,7 +20520,7 @@ maketempf() { fi ls "$TEMPDIR/" 2>/dev/null || fatal "temporary directory needed not readable" $ERR_FCREATE TMPFILE=$TEMPDIR/tempfile.txt - touch $TEMPFILE 2>/dev/null || fatal "temporary directory needed not writeable" $ERR_FCREATE + touch $TMPFILE 2>/dev/null || fatal "temporary directory needed not writeable" $ERR_FCREATE if [[ "$DEBUG" -eq 0 ]]; then ERRFILE="/dev/null" else