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

Integrate HAProxy helper into the cluster #23513

Merged
merged 57 commits into from
May 31, 2024

Conversation

nico-stefani
Copy link
Member

Related issue
#20887

Description

This PR closes #20887. Integrates the HAProxy Helper functionality into the Wazuh cluster.

Logs/Alerts example

Having the helper enabled in the cluster section of the ossec.conf

<cluster>
    <name>wazuh</name>
    <node_name>master-node</node_name>
    <node_type>master</node_type>
    <key>9d273b53510fef702b54a92e9cffc82e</key>
    <port>1516</port>
    <bind_addr>0.0.0.0</bind_addr>
    <nodes>
        <node>wazuh-master</node>
    </nodes>
    <hidden>no</hidden>
    <disabled>no</disabled>
    <haproxy_helper>
        <haproxy_disabled>no</haproxy_disabled>
        <haproxy_address>wazuh-proxy</haproxy_address>
        <haproxy_user>haproxy</haproxy_user>
        <haproxy_password>haproxy</haproxy_password>
    </haproxy_helper>
</cluster>
root@wazuh-master:/var/ossec# framework/python/bin/python3 framework/scripts/wazuh_clusterd.py -f
2024/05/17 19:18:26 DEBUG: [Cluster] [Main] Removing '/var/ossec/queue/cluster/'.
2024/05/17 19:18:26 DEBUG: [Cluster] [Main] Removed '/var/ossec/queue/cluster/'.
Starting cluster in foreground (pid: 19103)
2024/05/17 19:18:26 INFO: [Local Server] [Main] Serving on /var/ossec/queue/cluster/c-internal.sock
2024/05/17 19:18:26 DEBUG: [Local Server] [Keep alive] Calculating.
2024/05/17 19:18:26 DEBUG: [Local Server] [Keep alive] Calculated.
2024/05/17 19:18:26 INFO: [Master] [Main] Serving on ('0.0.0.0', 1516)
2024/05/17 19:18:26 DEBUG: [Master] [Keep alive] Calculating.
2024/05/17 19:18:26 DEBUG: [Master] [Keep alive] Calculated.
2024/05/17 19:18:26 INFO: [Master] [Local integrity] Starting.
2024/05/17 19:18:26 INFO: [Master] [Local agent-groups] Sleeping 30s before starting the agent-groups task, waiting for the workers connection.
+2024/05/17 19:18:26 INFO: [HAPHelper] [Main] Proxy was initialized
+2024/05/17 19:18:26 INFO: [HAPHelper] [Main] Ensuring only exists one HAProxy process. Sleeping 30s before start...
2024/05/17 19:18:26 INFO: [Master] [Local integrity] Finished in 0.081s. Calculated metadata of 34 files.
2024/05/17 19:18:30 INFO: [Worker] [Main] Connection from ('172.29.0.4', 58782)
2024/05/17 19:18:30 DEBUG: [Worker] [Main] Command received: b'hello'
2024/05/17 19:18:30 INFO: [Worker] [Main] Connection from ('172.29.0.5', 39832)
2024/05/17 19:18:30 DEBUG: [Worker] [Main] Command received: b'hello'
2024/05/17 19:18:34 INFO: [Master] [Local integrity] Starting.
2024/05/17 19:18:35 INFO: [Master] [Local integrity] Finished in 0.004s. Calculated metadata of 34 files.
2024/05/17 19:18:39 DEBUG: [Worker worker2] [Main] Command received: b'syn_i_w_m_p'
2024/05/17 19:18:39 DEBUG: [Worker worker2] [Main] Command received: b'syn_i_w_m'

@nico-stefani nico-stefani self-assigned this May 17, 2024
@nico-stefani nico-stefani linked an issue May 17, 2024 that may be closed by this pull request
12 tasks
Copy link
Member

@Selutario Selutario left a comment

Choose a reason for hiding this comment

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

Looks good—only one request.

framework/requirements.txt Outdated Show resolved Hide resolved
@nico-stefani nico-stefani force-pushed the epic-20887-migrate-haproxy-helper branch from 1fc6173 to efb7bc3 Compare May 29, 2024 15:31
Copy link
Member

@Selutario Selutario left a comment

Choose a reason for hiding this comment

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

Looks good! There are just some failing checks, take a look:

@nico-stefani
Copy link
Member Author

We validate the proper function of the RPM build in https://github.com/wazuh/wazuh/actions/runs/9319858112

Copy link
Member

@Selutario Selutario left a comment

Choose a reason for hiding this comment

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

LGTM. There are some failed checks related to RPM build, but we did not find the reason. Core team ran the test here as @nico-stefani mentioned and it was successful so I'm mergintg this.

Please, keep an eye on this in case we need to open an issue to fix any of the problems with those files @nico-stefani.

@Selutario Selutario merged commit 379de08 into 4.9.0 May 31, 2024
44 of 49 checks passed
@Selutario Selutario deleted the epic-20887-migrate-haproxy-helper branch May 31, 2024 15:01
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.

Migrate and adapt HAProxy helper to run in the manager
4 participants