Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix config paths and regex for auditd_audispd_configure_remote_server #11857

Merged
merged 3 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
AUDITCONFIG={{{ audisp_conf_path }}}/audisp-remote.conf

{{% if 'ubuntu' in product %}}
AUREMOTECONFIG=/etc/audisp/plugins.d/au-remote.conf
AUREMOTECONFIG={{{ audisp_conf_path }}}/plugins.d/au-remote.conf

{{{ bash_replace_or_append("$AUREMOTECONFIG", '^active', 'yes') }}}
{{{ set_config_file("$AUREMOTECONFIG", 'active', 'yes', insensitive="true", separator=" = ", separator_regex="\s*=\s*") }}}
{{% endif %}}

{{{ bash_replace_or_append("$AUDITCONFIG", '^remote_server', "$var_audispd_remote_server") }}}
{{{ set_config_file("$AUDITCONFIG", 'remote_server', "$var_audispd_remote_server", insensitive="true", separator=" = ", separator_regex="\s*=\s*") }}}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{% set audisp_config_file_path = audisp_conf_path + "/audisp-remote.conf" %}}
{{% set auremoteconfig = "/etc/audisp/plugins.d/au-remote.conf" %}}
{{% set auremoteconfig = audisp_conf_path + "/plugins.d/au-remote.conf" %}}
<def-group>
<definition class="compliance" id="auditd_audispd_configure_remote_server" version="1">
{{{ oval_metadata("remote_server setting in " + audisp_config_file_path + " is set to a certain IP address or hostname") }}}
Expand All @@ -20,7 +20,7 @@
<ind:filepath>{{{ audisp_config_file_path }}}</ind:filepath>
<!-- Allow only space (exactly) as delimiter -->
<!-- Require at least one space before and after the equal sign -->
<ind:pattern operation="pattern match">^[ ]*remote_server[ ]+=[ ]+(\S+)[ ]*$</ind:pattern>
<ind:pattern operation="pattern match">^[ ]*(?i)remote_server(?-i)[ ]+=[ ]+(\S+)[ ]*$</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
</ind:textfilecontent54_object>

Expand All @@ -37,7 +37,7 @@

<ind:textfilecontent54_object id="object_au_remote_config" version="1">
<ind:filepath>{{{ auremoteconfig }}}</ind:filepath>
<ind:pattern operation="pattern match">^[ ]*active[ ]+=[ ]+(yes)[ ]*$</ind:pattern>
<ind:pattern operation="pattern match">^[ ]*(?i)active(?-i)[ ]+=[ ]+(yes)[ ]*$</ind:pattern>
<ind:instance datatype="int">1</ind:instance>
</ind:textfilecontent54_object>
{{% endif %}}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
# packages = audit,audispd-plugins
# platform = multi_platform_ubuntu
# variable = var_auditspd_remote_server=logcollector

{{{ set_config_file(path=audisp_conf_path + "/audisp-remote.conf",
parameter="Remote_server",
value="logcollector",
separator=" = ") }}}

{{{ set_config_file(path=audisp_conf_path + "/plugins.d/au-remote.conf",
parameter="Active",
value="yes",
separator=" = ") }}}

echo "#Remote_server = logcollector" > {{{ audisp_conf_path ~ "/audisp-remote.conf" }}}
echo "#Active = yes" > {{{ audisp_conf_path ~ "/plugins.d/au-remote.conf" }}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# packages = audit,audispd-plugins
# platform = multi_platform_ubuntu
# variable = var_auditspd_remote_server=logcollector

echo " Remote_server = logcollector" > {{{ audisp_conf_path ~ "/audisp-remote.conf" }}}
echo " Active = yes" > {{{ audisp_conf_path ~ "/plugins.d/au-remote.conf" }}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
# packages = audit,audispd-plugins
# platform = multi_platform_ubuntu
# variable = var_auditspd_remote_server=logcollector

echo " Remote_server = logcollector" > {{{ audisp_conf_path ~ "/audisp-remote.conf" }}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# packages = audit,audispd-plugins
# platform = multi_platform_ubuntu
# variable = var_auditspd_remote_server=logcollector

echo " Remote_server = wrongvalue" > {{{ audisp_conf_path ~ "/audisp-remote.conf" }}}
echo " Active = yes" > {{{ audisp_conf_path ~ "/plugins.d/au-remote.conf" }}}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/bash
# packages = audit,audispd-plugins
# platform = multi_platform_ubuntu
# variable = var_auditspd_remote_server=logcollector

echo " Remote_server = logcollector" > {{{ audisp_conf_path ~ "/audisp-remote.conf" }}}
echo " Active = no" > {{{ audisp_conf_path ~ "/plugins.d/au-remote.conf" }}}
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ template:
pkgname@ubuntu1604: audispd-plugins
pkgname@ubuntu1804: audispd-plugins
pkgname@ubuntu2004: audispd-plugins
pkgname@ubuntu2204: audispd-plugins

{{% if product in ["rhel7", "rhel8", "rhel9"] %}}
warnings:
Expand Down
1 change: 1 addition & 0 deletions products/ubuntu2004/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ sshd_distributed_config: "true"
aide_bin_path: "/usr/bin/aide.wrapper"
aide_conf_path: "/etc/aide/aide.conf"
aide_default_path: "/etc/default/aide"
audisp_conf_path: "/etc/audisp"
chrony_conf_path: "/etc/chrony/chrony.conf"

cpes_root: "../../shared/applicability"
Expand Down
1 change: 1 addition & 0 deletions products/ubuntu2204/product.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ sshd_distributed_config: "true"

aide_bin_path: "/usr/bin/aide"
aide_conf_path: "/etc/aide/aide.conf"
audisp_conf_path: "/etc/audit"
chrony_conf_path: "/etc/chrony/chrony.conf"

cpes_root: "../../shared/applicability"
Expand Down
2 changes: 1 addition & 1 deletion tests/data/product_stability/ubuntu2004.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ aide_also_checks_rsyslog: 'no'
aide_bin_path: /usr/bin/aide.wrapper
aide_conf_path: /etc/aide/aide.conf
aide_default_path: /etc/default/aide
audisp_conf_path: /etc/audit
audisp_conf_path: /etc/audisp
auid: 1000
basic_properties_derived: true
benchmark_id: UBUNTU_20-04
Expand Down
Loading