Skip to content

LOGG-2154: fix wazuh-agent status evaluation for syslog configuration - #1822

Open
rafaelsoje wants to merge 1 commit into
CISOfy:masterfrom
rafaelsoje:fix-logg-2154-wazuh-agent-condition
Open

rafaelsoje wants to merge 1 commit into
CISOfy:masterfrom
rafaelsoje:fix-logg-2154-wazuh-agent-condition

Conversation

@rafaelsoje

Copy link
Copy Markdown
Contributor

In include/tests_logging (test LOGG-2154), WAZUH_AGENT_RUNNING is an integer flag (0 or 1).

The condition if [ ${WAZUH_AGENT_RUNNING} ]; then evaluates to true in POSIX sh even when WAZUH_AGENT_RUNNING=0 because [ 0 ] evaluates to true (non-empty string). This causes /var/ossec/etc/ossec.conf to be inspected even when the agent is stopped.

This patch:

  • Compares WAZUH_AGENT_RUNNING numerically with -eq 1.
  • Initializes WAZUH_AGENT_CONF to avoid potential unbound variables.
  • Ensures the configuration path is non-empty before checking file existence on disk.

Closes #1801

In include/tests_logging (test LOGG-2154), WAZUH_AGENT_RUNNING is an integer
flag (0 or 1). The condition 'if [ ${WAZUH_AGENT_RUNNING} ]; then' evaluates
to true in POSIX sh even when WAZUH_AGENT_RUNNING is 0, causing ossec.conf to
be inspected even when the agent is stopped.

Compare numerically with -eq 1, initialize WAZUH_AGENT_CONF, and verify
the configuration path is non-empty before checking file existence.

Closes CISOfy#1801

Signed-off-by: Rafael Soje <[email protected]>
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.

LOGG-2154: Wazuh condition is always true; journald is not examined

1 participant