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

Openscap template block may render invalid wodle block in ossec.conf #279

Closed
3 of 4 tasks
jm404 opened this issue Oct 21, 2019 · 0 comments · Fixed by #340
Closed
3 of 4 tasks

Openscap template block may render invalid wodle block in ossec.conf #279

jm404 opened this issue Oct 21, 2019 · 0 comments · Fixed by #340
Assignees
Milestone

Comments

@jm404
Copy link
Contributor

jm404 commented Oct 21, 2019

The openscap block in the template var-ossec-etc-ossec-server.conf.j2 is not properly rendered for Centos 8 and RHEL 8.

The code block causing the issue is the following:

<wodle name="open-scap">
<disabled>no</disabled>
<timeout>{{ wazuh_manager_config.openscap.timeout }}</timeout>
<interval>{{ wazuh_manager_config.openscap.interval }}</interval>
<scan-on-start>{{ wazuh_manager_config.openscap.scan_on_start }}</scan-on-start>
{% if ansible_distribution == 'Ubuntu' and ansible_distribution_release == 'xenial' %}
<content type="xccdf" path="ssg-ubuntu-1604-ds.xml">
<profile>xccdf_org.ssgproject.content_profile_common</profile>
</content>
{% elif ansible_distribution == 'Debian' %}
{% if ansible_distribution_release == 'jessie' %}
{% if openscap_version_valid.stdout == "0" %}
<content type="xccdf" path="ssg-debian-8-ds.xml">
<profile>xccdf_org.ssgproject.content_profile_common</profile>
</content>
<content type="oval" path="cve-debian-8-oval.xml"/>
{% endif %}
{% elif ansible_distribution_release == 'stretch' %}
<content type="oval" path="cve-debian-9-oval.xml"/>
{% endif %}
{% elif ansible_distribution == 'CentOS' %}
{% if ansible_distribution_major_version == '7' %}
<content type="xccdf" path="ssg-centos-7-ds.xml">
{% elif ansible_distribution_major_version == '6' %}
<content type="xccdf" path="ssg-centos-6-ds.xml">
{% endif %}
<profile>xccdf_org.ssgproject.content_profile_pci-dss</profile>
<profile>xccdf_org.ssgproject.content_profile_common</profile>
</content>
{% elif ansible_distribution == 'RedHat' %}
{% if ansible_distribution_major_version == '7' %}
<content type="xccdf" path="ssg-rhel-7-ds.xml">
{% elif ansible_distribution_major_version == '6' %}
<content type="xccdf" path="ssg-rhel-6-ds.xml">
{% endif %}
<profile>xccdf_org.ssgproject.content_profile_pci-dss</profile>
<profile>xccdf_org.ssgproject.content_profile_common</profile>
</content>
{% if ansible_distribution_major_version == '7' %}
<content type="oval" path="cve-redhat-7-ds.xml"/>
{% elif ansible_distribution_major_version == '6' %}
<content type="oval" path="cve-redhat-6-ds.xml"/>
{% endif %}
{% elif ansible_distribution == 'Fedora' %}
<content type="xccdf" path="ssg-fedora-ds.xml">
<profile>xccdf_org.ssgproject.content_profile_pci-dss</profile>
<profile>xccdf_org.ssgproject.content_profile_common</profile>
</content>
{% endif %}
</wodle>
{% endif %}

In RHEL8, as neither {% if ansible_distribution_major_version == '7' %} nor {% elif ansible_distribution_major_version == '6' %} are activated, the wodle is rendered as:

  <wodle name="open-scap">
    <disabled>no</disabled>
    <timeout>1800</timeout>
    <interval>1d</interval>
    <scan-on-start>yes</scan-on-start>
    
      
        <profile>xccdf_org.ssgproject.content_profile_pci-dss</profile>
        <profile>xccdf_org.ssgproject.content_profile_common</profile>
      </content>
    
  </wodle>

Notice there is no line that opens "content" that tag causing Wazuh Manager to fail when verifying the ossec.conf file.

This error affects different OS's and the following templates should be reviewed.

Tasks

  • Fix conditionals to don't render the wodle when OS can't be determined

  • Review rendered OS and update them if required

  • Test changes and verify template renders properly where OS detected

  • Update changelog

Best regards

Jose

@jm404 jm404 added the bug label Oct 21, 2019
@jm404 jm404 changed the title Openscap wodle may render broken wodle block in ossec.conf Openscap template block may render invalid wodle block in ossec.conf Oct 21, 2019
@jm404 jm404 added this to the Sprint - 105 milestone Dec 30, 2019
@xr09 xr09 self-assigned this Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants