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 ##############################################################################
19 Documentation Validation, Auditing Hardening Compliance
21 Library OperatingSystem
24 Suite Setup Run Keywords
25 ... Open Connection And Log In
27 Test Teardown Download Logs
28 Suite Teardown Run Keywords
30 ... Close All Connections
33 ${FULL_SUITE} ${SUITE_NAME.replace(' ','_')}
36 Run Lynis Audit System
37 [Documentation] Run Lynis
38 ${log} = Set Variable ${OUTPUT DIR}${/}${FULL_SUITE}.${TEST NAME.replace(' ','_')}.log
39 ${stdout} ${rc} = Execute Command cd lynis && sudo ./lynis audit system --quick return_rc=True
40 Append To File ${log} ${stdout}${\n}
41 Should Be Equal As Integers ${rc} 0
45 Open Connection And Log In
46 Open Connection ${HOST}
47 Login With Public Key ${USERNAME} ${SSH_KEYFILE}
50 [Documentation] Install Lynis
51 Put File /opt/akraino/lynis-remote.tar.gz
52 Execute Command tar xzf lynis-remote.tar.gz && sudo chown -R 0:0 lynis
55 [Documentation] Uninstall Lynis
56 Execute Command rm lynis-remote.tar.gz
57 Execute Command rm -rf ~/lynis /var/log/lynis.log /var/log/lynis-report.dat sudo=True
60 [Documentation] Downloading logs and removing them
61 SSHLibrary.Get File /var/log/lynis.log ${OUTPUT DIR}/lynis.log
62 Execute Command rm /var/log/lynis.log sudo=True
63 SSHLibrary.Get File /var/log/lynis-report.dat ${OUTPUT DIR}/lynis-report.dat
64 Execute Command rm /var/log/lynis-report.dat sudo=True