1 ##############################################################################
2 # Copyright (c) 2019 AT&T Intellectual Property. #
3 # Copyright (c) 2019 Nokia. #
5 # Licensed under the Apache License, Version 2.0 (the "License"); #
6 # you maynot use this file except in compliance with the License. #
8 # You may obtain a copy of the License at #
9 # http://www.apache.org/licenses/LICENSE-2.0 #
11 # Unless required by applicable law or agreed to in writing, software #
12 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
13 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
14 # See the License for the specific language governing permissions and #
15 # limitations under the License. #
16 ##############################################################################
20 Library OperatingSystem
22 Suite Setup Open Connection And Log In
23 Suite Teardown Close All Connections
26 ${LOG_PATH} /opt/akraino/validation/tests/os/vuls
30 Set Environment Variable GOROOT /root/go
31 Set Environment Variable GOPATH /root/go/src
32 Set Environment Variable PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/root/go/bin:/root/go/src/bin
33 Set Environment Variable LC_ALL en_US.UTF-8
34 Set Environment Variable LANG en_US.UTF-8
36 ${rc} = Run And Return Rc install -D /opt/akraino/validation/tests/os/vuls/config /root/.ssh/
37 Should Be Equal As Integers ${rc} 0
39 ${rc} = Run And Return Rc sed -i 's/HOST/${HOST}/g' config.toml
40 Should Be Equal As Integers ${rc} 0
42 ${rc} = Run And Return Rc sed -i 's/USERNAME/${USERNAME}/g' config.toml
43 Should Be Equal As Integers ${rc} 0
45 ${rc} = Run And Return Rc tar xvzf db.tar.gz -C /opt/akraino/validation/tests/os/vuls/
46 Should Be Equal As Integers ${rc} 0
48 ${os} = SSHLibrary.Execute Command source /etc/os-release && echo $ID
50 ${rc} = Run And Return Rc vuls scan -config config.toml -ssh-config
51 Should Be Equal As Integers ${rc} 0
53 Run Keyword IF '${os}' == 'ubuntu' Run vuls for ubuntu ELSE IF '${os}' == 'centos' Run vuls for centos ELSE FAIL Distro '${os}' not supported
57 ${os_version} = SSHLibrary.Execute Command source /etc/os-release && echo $VERSION_ID | cut -d '.' -f1
59 ${rc} ${output} = Run And Return Rc And Output vuls report -cvedb-sqlite3-path=${LOG_PATH}/cve.sqlite3 -ovaldb-sqlite3-path=${LOG_PATH}/oval_ubuntu_${os_version}.sqlite3
60 Should Be Equal As Integers ${rc} 0
61 Append To File ${LOG_PATH}/vuls.log ${output}${\n}
64 ${rc} ${output} = Run And Return Rc And Output vuls report -cvedb-sqlite3-path=${LOG_PATH}/cve.sqlite3 -ovaldb-sqlite3-path=${LOG_PATH}/oval_centos.sqlite3 -gostdb-sqlite3-path=${LOG_PATH}/gost_centos.sqlite3
65 Should Be Equal As Integers ${rc} 0
66 Append To File ${LOG_PATH}/vuls.log ${output}${\n}
68 Open Connection And Log In
69 Open Connection ${HOST}
70 Login With Public Key ${USERNAME} ${SSH_KEYFILE}