Skip to content

Fix bug configuring empty blocks in FIM#1897

Merged
vikman90 merged 3 commits into3.7from
fix-fim-empty-conf
Nov 21, 2018
Merged

Fix bug configuring empty blocks in FIM#1897
vikman90 merged 3 commits into3.7from
fix-fim-empty-conf

Conversation

@bah07
Copy link
Copy Markdown
Contributor

@bah07 bah07 commented Nov 16, 2018

Related issue:

When defining a second FIM configuration block, if it is empty, the module is disabled. If the agent in question had different configurations because it belonged to several groups, the last block would make the rest of the applied configurations unusable. This PR solve this behavior.

Tests

  • In the ossec.conf, after the default configuration defines an empty Syscheck block.
  • Define a block with a single directory and place an empty block above or below it.
  • Apply these settings via remote configuration.

@bah07 bah07 added the module/fim File Integrity Monitoring label Nov 16, 2018
@bah07 bah07 requested a review from albertomn86 November 16, 2018 15:44
@vikman90 vikman90 self-requested a review November 20, 2018 11:09
@vikman90
Copy link
Copy Markdown
Member

vikman90 commented Nov 20, 2018

Syscheck and Rootcheck now have different behaviors:

<rootcheck>
  <disabled>yes</disabled>
</rootcheck>

<rootcheck />

The second definition re-enables Rootcheck despite the first definition explicitly disables it.

<syscheck>
  <!--
  <disabled>no</disabled>
  -->
  <directories check_all="yes" realtime="yes">/root/test</directories>
</syscheck>

Syscheck is disabled because it was not explicitly enabled.

Change proposal

Both Syscheck and Rootcheck may have this behavior:

  • If one <syscheck> or <rootcheck> tag is defined at less, they may be enabled.
  • If no <syscheck> or <rootcheck> tag is defined, they may be disabled.
  • If <disabled> is defined in any stanza —if there are multiple definitions—, they may follow that definition.

If no component stanza defined, keep disabled.
If component stanza defined but no disabled tag defined, keep enabled.
@vikman90 vikman90 assigned vikman90 and unassigned albertomn86 Nov 21, 2018
@vikman90 vikman90 merged commit b4621c4 into 3.7 Nov 21, 2018
@vikman90 vikman90 deleted the fix-fim-empty-conf branch November 21, 2018 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module/fim File Integrity Monitoring

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants