diff options
author | Capashenn <37273010+Capashenn@users.noreply.github.com> | 2018-12-17 11:55:41 +0300 |
---|---|---|
committer | Michael Boelen <michael.boelen@cisofy.com> | 2018-12-17 11:55:41 +0300 |
commit | 47e37bf058d3125c6dc4938ad649a21092389209 (patch) | |
tree | 196c5ec77fb70dbbd2ebcffdd5fd801bc42f31e1 | |
parent | d024d5296ea9dbc3b58b6569d4fcc341ab517a75 (diff) |
[AUTH-9282][AUTH-9283] Add support for RedHad and clones (#609)
[AUTH-9282][AUTH-9283] Add support for Red Hat and clones
-rw-r--r-- | include/tests_authentication | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/include/tests_authentication b/include/tests_authentication index a7e03cb0..cf1409a5 100644 --- a/include/tests_authentication +++ b/include/tests_authentication @@ -711,20 +711,24 @@ case ${LINUX_VERSION} in "SuSE") PREQS_MET="YES" - FIND=$(passwd -a -S 2> /dev/null | ${AWKBINARY} '{ if ($2=="P" && $5=="99999") print $1 }') + FIND1=$(passwd -a -S 2> /dev/null | ${AWKBINARY} '{ if ($2=="P" && $5=="99999") print $1 }') FIND2=$(passwd -a -S 2> /dev/null | ${AWKBINARY} '{ if ($2=="NP") print $1 }') ;; *) PREQS_MET="YES" - FIND=$(passwd --all --status 2> /dev/null | ${AWKBINARY} '{ if ($2=="P" && $5=="99999") print $1 }') + FIND1=$(passwd --all --status 2> /dev/null | ${AWKBINARY} '{ if ($2=="P" && $5=="99999") print $1 }') FIND2=$(passwd --all --status 2> /dev/null | ${AWKBINARY} '{ if ($2=="NP") print $1 }') ;; esac - else + elif [ ${OS_REDHAT_OR_CLONE} -eq 1 ]; then + PREQS_MET="YES" + FIND1=$(for I in $(${AWKBINARY} -F: '{print $1}' ${ROOTDIR}etc/passwd) ; do passwd -S $I | ${AWKBINARY} '{ if ($2=="PS" && $5=="99999") print $1 }' ; done) + FIND2=$(for I in $(${AWKBINARY} -F: '{print $1}' ${ROOTDIR}etc/passwd) ; do passwd -S $I | ${AWKBINARY} '{ if ($2=="NP") print $1 }' ; done) + else LogText "Result: skipping test for this Linux version" ReportManual "AUTH-9282:01" PREQS_MET="NO" - FIND="" + FIND1="" FIND2="" fi else @@ -736,12 +740,12 @@ Register --test-no AUTH-9282 --preqs-met ${PREQS_MET} --weight L --network NO --category security --description "Checking password protected account without expire date" if [ ${SKIPTEST} -eq 0 ]; then LogText "Test: Checking Linux version and password expire date status" - if [ -z "${FIND}" ]; then + if [ -z "${FIND1}" ]; then LogText "Result: all accounts seem to have an expire date" Display --indent 2 --text "- Accounts without expire date" --result "${STATUS_OK}" --color GREEN else LogText "Result: found one or more accounts with expire date set" - for I in ${FIND}; do + for I in ${FIND1}; do LogText "Account without expire date: ${I}" done Display --indent 2 --text "- Accounts without expire date" --result "${STATUS_SUGGESTION}" --color YELLOW |