2020-11-27 09:22:47 +01:00
|
|
|
# shellcheck shell=bash
|
2019-02-14 18:10:46 +01:00
|
|
|
# run-shellcheck
|
|
|
|
test_audit() {
|
2019-02-22 12:39:41 +01:00
|
|
|
|
2019-02-14 18:10:46 +01:00
|
|
|
describe Running on blank host
|
2019-02-22 12:39:41 +01:00
|
|
|
register_test retvalshouldbe 1
|
2019-02-14 18:10:46 +01:00
|
|
|
# shellcheck disable=2154
|
2023-09-25 14:24:01 +02:00
|
|
|
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
2019-02-14 18:10:46 +01:00
|
|
|
|
2019-02-22 12:39:41 +01:00
|
|
|
cp -a /etc/syslog-ng/syslog-ng.conf /tmp/syslog-ng.conf.bak
|
|
|
|
|
2020-12-04 14:08:01 +01:00
|
|
|
echo "destination mySyslog tcp (\"syslog.example.tld\")" >>/etc/syslog-ng/syslog-ng.conf
|
2019-02-22 12:39:41 +01:00
|
|
|
grep syslog.example.tld /etc/syslog-ng/syslog-ng.conf
|
|
|
|
|
|
|
|
describe Checking one line conf
|
|
|
|
register_test retvalshouldbe 0
|
2023-09-25 14:24:01 +02:00
|
|
|
run oneline "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
2019-02-22 12:39:41 +01:00
|
|
|
|
|
|
|
cp -a /tmp/syslog-ng.conf.bak /etc/syslog-ng/syslog-ng.conf
|
2020-12-04 14:08:01 +01:00
|
|
|
cat >>/etc/syslog-ng/syslog-ng.conf <<EOF
|
2019-02-22 12:39:41 +01:00
|
|
|
destination mySyslog {
|
|
|
|
tcp ("syslog.example.tld"),
|
|
|
|
port(1234),
|
|
|
|
EOF
|
|
|
|
|
|
|
|
describe Checking mutliline conf
|
|
|
|
register_test retvalshouldbe 0
|
2023-09-25 14:24:01 +02:00
|
|
|
run multiline "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
2019-02-22 12:39:41 +01:00
|
|
|
|
|
|
|
mv /tmp/syslog-ng.conf.bak /etc/syslog-ng/syslog-ng.conf
|
|
|
|
|
|
|
|
#echo "#Sample conf" >/etc/syslog-ng/conf.d/1_tcp_destination
|
2020-12-04 14:08:01 +01:00
|
|
|
echo "destination mySyslog tcp (\"syslog.example.tld\")" >>/etc/syslog-ng/conf.d/1_tcp_destination
|
2019-02-22 12:39:41 +01:00
|
|
|
cat /etc/syslog-ng/conf.d/1_tcp_destination
|
|
|
|
|
|
|
|
describe Checking file in subdirectory
|
|
|
|
register_test retvalshouldbe 0
|
2023-09-25 14:24:01 +02:00
|
|
|
run subfile "${CIS_CHECKS_DIR}/${script}.sh" --audit-all
|
2019-02-22 12:39:41 +01:00
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
rm /etc/syslog-ng/conf.d/1_tcp_destination
|
|
|
|
|
2019-02-14 18:10:46 +01:00
|
|
|
}
|