Skip to content

Commit

Permalink
enh: add test for 4.2.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
ThibaultDewailly committed Dec 27, 2023
1 parent 58f4ca0 commit 796a561
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 4 deletions.
2 changes: 1 addition & 1 deletion tests/hardening/4.2.1.5_syslog-ng_remote_host.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@ EOF
run subfile "${CIS_CHECKS_DIR}/${script}.sh" --audit-all

# Cleanup
rm /etc/syslog-ng/conf.d/1_tcp_destination
rm -f /etc/syslog-ng/conf.d/1_tcp_destination

}
33 changes: 30 additions & 3 deletions tests/hardening/4.2.1.6_remote_syslog-ng_acl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,37 @@
# run-shellcheck
test_audit() {
describe Running on blank host
register_test retvalshouldbe 0
dismiss_count_for_test
register_test retvalshouldbe 1
# shellcheck disable=2154
echo 'REMOTE_HOST="true"' >>"${CIS_CONF_DIR}/conf.d/${script}.cfg"
run blank "${CIS_CHECKS_DIR}/${script}.sh" --audit-all

# TODO fill comprehensive tests
cp -a /etc/syslog-ng/syslog-ng.conf /tmp/syslog-ng.conf.bak
echo "source mySyslog tcp (\"127.0.0.1\")" >>/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
source mySyslog {
tcp ("127.0.0.1"),
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 "source mySyslog tcp (\"127.0.0.1\")" >>/etc/syslog-ng/conf.d/1_tcp_source
cat /etc/syslog-ng/conf.d/1_tcp_source

describe Checking file in subdirectory
register_test retvalshouldbe 0
run subfile "${CIS_CHECKS_DIR}/${script}.sh" --audit-all

rm -f /etc/syslog-ng/conf.d/1_tcp_source

}

0 comments on commit 796a561

Please sign in to comment.