From e124499e27d48b85ca5fc2734247c47b94ee8ba5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Wed, 4 May 2022 10:51:35 +0200 Subject: [PATCH 1/6] Only test Compression if sshd version < 7.4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- include/tests_ssh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/tests_ssh b/include/tests_ssh index de3209ee..fb784d83 100644 --- a/include/tests_ssh +++ b/include/tests_ssh @@ -135,7 +135,6 @@ SSHOPS="AllowTcpForwarding:NO,LOCAL,YES:=\ ClientAliveCountMax:2,4,16:<\ ClientAliveInterval:300,600,900:<\ - Compression:NO,,YES:=\ FingerprintHash:SHA256,MD5,:=\ GatewayPorts:NO,,YES:=\ IgnoreRhosts:YES,,NO:=\ @@ -158,12 +157,12 @@ # OpenSSH had some options removed over time. Based on the version we add some additional options to check if [ ${OPENSSHD_VERSION_MAJOR} -lt 7 ]; then LogText "Result: added additional options for OpenSSH 6.x and lower" - SSHOPS="${SSHOPS} UsePrivilegeSeparation:SANDBOX,YES,NO:= Protocol:2,,1:=" + SSHOPS="${SSHOPS} Compression:(DELAYED|NO),,YES:= UsePrivilegeSeparation:SANDBOX,YES,NO:= Protocol:2,,1:=" elif [ ${OPENSSHD_VERSION_MAJOR} -eq 7 ]; then # Protocol 1 support removed (OpenSSH 7.4 and later) if [ ${OPENSSHD_VERSION_MINOR} -lt 4 ]; then LogText "Result: added additional options for OpenSSH < 7.4" - SSHOPS="${SSHOPS} Protocol:2,,1:=" + SSHOPS="${SSHOPS} Compression:(DELAYED|NO),,YES:= Protocol:2,,1:=" fi # UsePrivilegedSeparation removed (OpenSSH 7.5 and later) if [ ${OPENSSHD_VERSION_MINOR} -lt 5 ]; then From 975712a6164fcd9fe57202c9705eeadfb7c6b7f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Sj=C3=B6gren?= Date: Sun, 15 May 2022 23:58:43 +0200 Subject: [PATCH 2/6] add plocate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Thomas Sjögren --- include/tests_filesystems | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/tests_filesystems b/include/tests_filesystems index 480ba40a..ab6191aa 100644 --- a/include/tests_filesystems +++ b/include/tests_filesystems @@ -744,7 +744,7 @@ if [ ${SKIPTEST} -eq 0 ]; then LogText "Test: Checking locate database" FOUND=0 - LOCATE_DBS="${ROOTDIR}var/lib/mlocate/mlocate.db ${ROOTDIR}var/lib/locate/locatedb ${ROOTDIR}var/lib/locatedb ${ROOTDIR}var/lib/slocate/slocate.db ${ROOTDIR}var/cache/locate/locatedb ${ROOTDIR}var/db/locate.database" + LOCATE_DBS="${ROOTDIR}var/cache/locate/locatedb ${ROOTDIR}var/db/locate.database ${ROOTDIR}var/lib/locate/locatedb ${ROOTDIR}var/lib/locatedb ${ROOTDIR}var/lib/mlocate/mlocate.db ${ROOTDIR}var/lib/plocate/plocate.db ${ROOTDIR}var/lib/slocate/slocate.db" for FILE in ${LOCATE_DBS}; do if [ -f ${FILE} ]; then LogText "Result: locate database found (${FILE})" From 98ac5a562ad6f347bcde307d56466b2668251908 Mon Sep 17 00:00:00 2001 From: HansHoogerwerf Date: Mon, 17 Oct 2022 15:46:40 +0200 Subject: [PATCH 3/6] Verify the linux OS supports nanoseconds Add extra check to verify the linux OS supports nanoseconds. This might not be the case with certain busybox implementations. --- include/functions | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/include/functions b/include/functions index 5b211707..db4c7ef8 100644 --- a/include/functions +++ b/include/functions @@ -2562,15 +2562,17 @@ GetTimestamp() { ts=0 - case "${OS}" in - "Linux") - ts=$(date "+%s%N") - ;; - *) - ts=$(date "+%s") - ;; - esac - echo $ts + # Detect if the implementation of date supports nanoseconds, + if [ "${OS}" = "Linux" ]; then + current_nanoseconds=$(date "+%N") + # Verify if the result of the command is a number + if [ -n "$current_nanoseconds" ] && [ "$current_nanoseconds" -eq "$current_nanoseconds" ] 2>/dev/null; then + ts=$(date "+%s%N") + else + ts=$(date "+%s") + fi + fi + echo $ts } Register() { From ff26dca83a0f788ac7853b73e9d42cec49846aa7 Mon Sep 17 00:00:00 2001 From: HansHoogerwerf Date: Mon, 17 Oct 2022 16:24:59 +0200 Subject: [PATCH 4/6] Fix simple mistake --- include/functions | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/include/functions b/include/functions index db4c7ef8..5ae9b978 100644 --- a/include/functions +++ b/include/functions @@ -2562,17 +2562,19 @@ GetTimestamp() { ts=0 - # Detect if the implementation of date supports nanoseconds, - if [ "${OS}" = "Linux" ]; then - current_nanoseconds=$(date "+%N") - # Verify if the result of the command is a number + # Detect if the implementation of date supports nanoseconds, + if [ "${OS}" = "Linux" ]; then + current_nanoseconds=$(date "+%N") + # Verify if the result of the command is a number if [ -n "$current_nanoseconds" ] && [ "$current_nanoseconds" -eq "$current_nanoseconds" ] 2>/dev/null; then ts=$(date "+%s%N") else - ts=$(date "+%s") - fi + ts=$(date "+%s") + fi + else + ts=$(date "+%s") fi - echo $ts + echo $ts } Register() { From bbe135d56f13f3c05a4a328c504639c6568de8b2 Mon Sep 17 00:00:00 2001 From: HansHoogerwerf Date: Mon, 17 Oct 2022 16:27:21 +0200 Subject: [PATCH 5/6] Fix space --- include/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/functions b/include/functions index 5ae9b978..38cc46b3 100644 --- a/include/functions +++ b/include/functions @@ -2567,7 +2567,7 @@ current_nanoseconds=$(date "+%N") # Verify if the result of the command is a number if [ -n "$current_nanoseconds" ] && [ "$current_nanoseconds" -eq "$current_nanoseconds" ] 2>/dev/null; then - ts=$(date "+%s%N") + ts=$(date "+%s%N") else ts=$(date "+%s") fi From 59a3c4b5368cdbd96ba7cdddf0dce5410b30163c Mon Sep 17 00:00:00 2001 From: Michael Boelen Date: Mon, 24 Oct 2022 16:22:27 +0200 Subject: [PATCH 6/6] Updated log --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ad1cbeb8..bd37121c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Changed - DBS-1820 - added newer style format for Mongo authorization setting +- Extra check to verify if nanoseconds are supported by the date command ---------------------------------------------------------------------------------