X-Git-Url: https://gerrit.akraino.org/r/gitweb?p=validation.git;a=blobdiff_plain;f=tests%2Fos%2Fvuls%2Fvuls.robot;h=3c401813c9a999a10a264f21a62025e65c6f98c0;hp=d79fab9fc05f1d30b54ac025a5025b1d3bd5359a;hb=3e9a406ebb1bfe87144abc024136aba695c45398;hpb=e9165d042a6012b82fa79f0cf245bd4f8b1e385d diff --git a/tests/os/vuls/vuls.robot b/tests/os/vuls/vuls.robot index d79fab9..3c40181 100644 --- a/tests/os/vuls/vuls.robot +++ b/tests/os/vuls/vuls.robot @@ -20,7 +20,9 @@ Library SSHLibrary Library OperatingSystem Library BuiltIn Suite Setup Open Connection And Log In -Suite Teardown Close All Connections +Suite Teardown Run Keywords +... Cleanup ssh +... Close All Connections *** Test Cases *** Run Vuls test @@ -41,6 +43,8 @@ Run Vuls test ${os} = SSHLibrary.Execute Command source /etc/os-release && echo $ID + Run Keyword IF '${SSH_KEYFILE}' == 'None' Create ssh_keyfile + ${rc} = Run And Return Rc vuls scan -config ${CURDIR}/config.toml -ssh-config Should Be Equal As Integers ${rc} 0 @@ -65,6 +69,19 @@ Run vuls for centos Append To File ${LOG_PATH}/vuls.log ${output}${\n} Set Global Variable ${LOG} ${output} +Create ssh_keyfile + ${rc} = Run And Return Rc ssh-keygen -t rsa -b 4096 -f /root/.ssh/id_rsa -N "" + Should Be Equal As Integers ${rc} 0 + + ${rc} = Run and Return Rc sshpass -p '${PASSWORD}' ssh-copy-id -i /root/.ssh/id_rsa.pub '${USERNAME}'@'${HOST}' + Should Be Equal As Integers ${rc} 0 + +Cleanup ssh + ${rc} ${idssh} = Run And Return Rc And Output cat /root/.ssh/id_rsa.pub + Should Be Equal As Integers ${rc} 0 + ${rc} = Run And Return Rc ssh '${USERNAME}'@'${HOST}' "sed -i 's#${idssh}##' ~/.ssh/authorized_keys" + Should Be Equal As Integers ${rc} 0 + Open Connection And Log In Open Connection ${HOST} - Login With Public Key ${USERNAME} ${SSH_KEYFILE} + Run Keyword IF '${SSH_KEYFILE}' != 'None' Login With Public Key ${USERNAME} ${SSH_KEYFILE} ELSE IF '${PASSWORD}' != 'None' Login ${USERNAME} ${PASSWORD} ELSE FAIL