mirror of
https://github.com/ovh/debian-cis.git
synced 2024-11-24 06:21:24 +01:00
32886d3a3d
* Replace CIS_ROOT_DIR by a more flexible system * Try to adapt the logic change to the functional tests
44 lines
1.3 KiB
Bash
44 lines
1.3 KiB
Bash
# shellcheck shell=bash
|
|
# run-shellcheck
|
|
test_audit() {
|
|
|
|
describe Running on blank host
|
|
register_test retvalshouldbe 1
|
|
# shellcheck disable=2154
|
|
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
|
|
|
cp -a /etc/syslog-ng/syslog-ng.conf /tmp/syslog-ng.conf.bak
|
|
|
|
echo "destination mySyslog tcp (\"syslog.example.tld\")" >>/etc/syslog-ng/syslog-ng.conf
|
|
grep syslog.example.tld /etc/syslog-ng/syslog-ng.conf
|
|
|
|
describe Checking one line conf
|
|
register_test retvalshouldbe 0
|
|
run oneline "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
|
|
|
cp -a /tmp/syslog-ng.conf.bak /etc/syslog-ng/syslog-ng.conf
|
|
cat >>/etc/syslog-ng/syslog-ng.conf <<EOF
|
|
destination mySyslog {
|
|
tcp ("syslog.example.tld"),
|
|
port(1234),
|
|
EOF
|
|
|
|
describe Checking mutliline conf
|
|
register_test retvalshouldbe 0
|
|
run multiline "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
|
|
|
mv /tmp/syslog-ng.conf.bak /etc/syslog-ng/syslog-ng.conf
|
|
|
|
#echo "#Sample conf" >/etc/syslog-ng/conf.d/1_tcp_destination
|
|
echo "destination mySyslog tcp (\"syslog.example.tld\")" >>/etc/syslog-ng/conf.d/1_tcp_destination
|
|
cat /etc/syslog-ng/conf.d/1_tcp_destination
|
|
|
|
describe Checking file in subdirectory
|
|
register_test retvalshouldbe 0
|
|
run subfile "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
|
|
|
# Cleanup
|
|
rm /etc/syslog-ng/conf.d/1_tcp_destination
|
|
|
|
}
|