Add an NGINX reverse proxy to have a unique ip for registration and reporting. #966
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes the #308 #547 #961
The problem is:
Deployments exposes the master service on port 1515 for registration and the workers on port 1514 for agent events:
workers svc (Lets say IP 1.1.1.1)
Master svc: (lets say IP 2.2.2.2)
So far so good.
problem is an agent with this configuration:
ends up trying to connect to 1.1.1.1:1515
So it tries the agent IP with the master port:
wazuh-agentd: ERROR: (1208): Unable to connect to enrollment service at '[1.1.1.1]:1515'
Even with failover config . So multiple client blocks with the respective port configured (1414 for the worker IP svc and 1515 for the master)...
The client tries to enroll to the first client defined (1.1.1.1) on port 1515 even when this client block has only 1414 ports configured. It ends up failing over the workers to register and vice versa for reporting. So this is not ideal.
I've modified the worker svc also to expose 1515 and configure the agent to use just the worker ip. (no enrollment configuration). And they can register and report all good. But it leads to other problems...
Ive also found a comment there it modifies the master to also expose 1414 and use that IP for all agent communications. but I believe this is not the idea of master/worker .
The problem is this leads to other issues: source IPs are the Kubernetes nodes. I believe the worker is forwarding to the master and after k8s SNAT the outgoing IP is the node IP that messes things up.