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

Improves configuration of OVAL updates #416

Merged
merged 15 commits into from
Mar 23, 2018
Merged

Improves configuration of OVAL updates #416

merged 15 commits into from
Mar 23, 2018

Conversation

crolopez
Copy link
Contributor

@crolopez crolopez commented Feb 26, 2018

The way in which OVAL updates are configured has been restructured. Now each source is configured separately and not in groups as before.

To configure the update we will use the feed tag, followed by the name attribute. The value of this attribute must be the operating system followed by the version (OS-VERSION).

We can also deactivate each source with disable and configure a custom update interval with update_interval.

Before

  <wodle name="vulnerability-detector">
    <disabled>no</disabled>
    <interval>30s</interval>
    <run_on_start>yes</run_on_start>
    <update_ubuntu_oval interval="45m" version="16,14">yes</update_ubuntu_oval>
    <update_redhat_oval interval="1h" version="7">yes</update_redhat_oval> -->
  </wodle>

Now

  <wodle name="vulnerability-detector">
    <disabled>no</disabled>
    <interval>30s</interval>
    <run_on_start>yes</run_on_start>
    <feed name="ubuntu-16">
     <disabled>no</disabled>
     <update_interval>45</update_interval>
    </feed>
    <feed name="ubuntu-14">
      <disabled>no</disabled>
      <update_interval>45</update_interval>
    </feed>
    <feed name="redhat-7">
      <disabled>no</disabled>
      <update_interval>1h</update_interval>
    </feed>
  </wodle>

Two new options have also been added to configure alternative sources to the official repositories:

  • path: With this option you can specify a local path from which to take the OVAL in XML format.
  • url: With this option you can specify a URL from which to extract the XML file. If the port option is not indicated will take the default 443.

The syntax of these sources must be the same as that used by official repositories.

    <feed name="ubuntu-16">
      <disabled>no</disabled>
      <update_interval>2h</update_interval>
      <url port="80">http://myhost.com/com.ubuntu.xenial.cve.oval.xml</url> 
    </feed>
    <feed name="redhat-7">
      <disabled>no</disabled>
      <update_interval>2h</update_interval>
      <path>/home/user/com.ubuntu.xenial.cve.oval.xml</path> 
    </feed>

@crolopez crolopez self-assigned this Feb 26, 2018
@vikman90 vikman90 self-assigned this Mar 7, 2018
@vikman90 vikman90 changed the base branch from dev-vuln-soft-upd to master March 21, 2018 21:07
#define VU_MODERATE "Moderate"
#define VU_MEDIUM "Medium"
#define VU_HIGH "High"
#define VU_IMPORTANT "Important"

extern const wm_context WM_VULNDETECTOR_CONTEXT;

static const char *vu_dist[] = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Declaring static (private) strings in a header has no sense. It produces warnings in all source files except which they are used in:

In file included from wazuh_modules/wmodules.h:64:0,
                 from wazuh_modules/main.c:12:
wazuh_modules/wm_vuln_detector.h:53:20: warning: ‘vu_dist’ defined but not used [-Wunused-variable]
 static const char *vu_dist[] = {
                    ^~~~~~~

}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing OS_ClearNode(chld_node);

os_strdup(chld_node[j]->content, upd->path);
} else {
merror("Invalid option '%s' for tag '%s' at module '%s'.", chld_node[j]->element, XML_FEED , WM_VULNDETECTOR_CONTEXT.name);
return OS_INVALID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing OS_ClearNode(chld_node);

} else if (!strcmp(chld_node[j]->element, XML_UPDATE_INTERVAL)) {
if (get_interval(chld_node[j]->content, &upd->interval)) {
merror("Invalid content for '%s' option at module '%s'", XML_UPDATE_INTERVAL, WM_VULNDETECTOR_CONTEXT.name);
return OS_INVALID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing OS_ClearNode(chld_node);.

}
} else {
merror("Invalid content for '%s' option at module '%s'", XML_DISABLED, WM_VULNDETECTOR_CONTEXT.name);
return OS_INVALID;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing OS_ClearNode(chld_node);.

@crolopez crolopez removed their assignment Mar 22, 2018
@vikman90 vikman90 force-pushed the master branch 2 times, most recently from 03e4e3c to f6871c4 Compare March 22, 2018 19:18
@vikman90 vikman90 merged commit e3da20e into master Mar 23, 2018
@vikman90 vikman90 deleted the dev-vuln-conf branch March 23, 2018 01:59
@vikman90
Copy link
Member

GJ @crolopez!

@crolopez crolopez restored the dev-vuln-conf branch April 10, 2018 15:20
@crolopez crolopez deleted the dev-vuln-conf branch April 10, 2018 15:21
@soynof soynof mentioned this pull request Aug 7, 2023
4 tasks
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 this pull request may close these issues.

2 participants