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

Can't deploy wazuh on OpenShift #790

Open
0xThegarlic opened this issue Mar 23, 2023 · 5 comments
Open

Can't deploy wazuh on OpenShift #790

0xThegarlic opened this issue Mar 23, 2023 · 5 comments
Assignees

Comments

@0xThegarlic
Copy link

Hi, I tried to deploy wazuh on the OpenShift platform as part of a monitoring of some servers following the documentation for deploying wazuh on kubernetes. Unfortunately, I was not able to deploy wazuh on OpenShift, since after my deployment, none of my pods were started and I still had this error message saying: /bin/bash: entrypoint.sh: Permission denied

image

Not understanding this problem, I started to do some research on the internet and I came across a document from OpenShift that explained that pods were starting with very restrictive rights on OpenShift, so I decided to pause the pod with the command :
command: ["sh", "-c", "while true; do sleep 5; done"]

image

Indeed, I noticed that the pod was starting with a random user 1009430000 and we can see that the entrypoint.sh file is executable only by the wazuh-dashboard user.

From there, I used these resources:

To allow my user 1009430000 to have the necessary permissions to perform my wazuh deployment but that didn't work either.
Not finding any solution, I decided to re-build the wazuh project via the build-docker-image ( https://github.com/wazuh/wazuh-docker/tree/master/build-docker-images) by changing the group and the uid of the wazuh-dashboard user.
So I made a modification in the dockerfile on the creation part of the wazuh-dashboard user like this:

image

After the build, I had the same problem on the indexer pod and I also modified the dockerfile of the indexer like this:

image

After these configurations, my pods were starting but I was facing a new problem with rights on files in the conf and cert directory and other problems.

kubectl get pod

image

For my dashboard pod :

image

For my indexer pod :

image

For my manager pod :

image

When I do the port forward, I also could not access the dashboard from the web interface, because the API cannot be contacted by the dashboard.

image

If you can figure out the problem, please let me know.

Thank you in advance!

@vcerenu
Copy link
Member

vcerenu commented Mar 27, 2023

Hello

We currently don't have Wazuh deployed configured or tested on openshift, but I can help you with some bugs you posted so they can help you fix it.

About this error:
image
You are having communication problems between pods, this message usually occurs due to several problems. First of all, you should check that the INDEXER_URL variable is pointing to the Wazuh indexer cluster endpoint, in our Kubernetes deployment the INDEXER_URL variable points to the name of pod 0 of the statefulset deployed for Wazuh indexer:
https://github.com/wazuh/wazuh-kubernetes/blob/3db7699f0ae11ce3ee0bb21c80bf451322d48ebd/wazuh/indexer_stack/wazuh-dashboard/dashboard-deploy.yaml#L61
If you are using the endpoint correctly, You should verify that the certificates are used correctly and that you have not modified the username and password of the admin user, which we have stored in a configmap in our Kubernetes deployment:
https://github.com/wazuh/wazuh-kubernetes/blob/3db7699f0ae11ce3ee0bb21c80bf451322d48ebd/wazuh/indexer_stack/wazuh-dashboard/dashboard-deploy.yaml#L63

About this error:
image
They are warnings instead of errors, it is recommended that the permission settings of the certificates be 600 instead of 700 as you are mounting them.

About this error:
image
In the entrypoint of the Wazuh manager image, the permissions of some files are corrected, so that the application does not have problems functioning, this may be because the container does not have root permissions and they are necessary to be able to start Wazuh manager.

About this error:
image
In addition to having problems connecting from the Wazuh dashboard to the Wazuh manager API, the No templates found problem appears, indicating that surely Filebeat, which runs inside the Wazuh manager pod, is not able to connect with Wazuh indexer, you should check all the connections between the pods, in addition to verifying that the certificates are correctly mounted in each of the paths.

@vcerenu vcerenu self-assigned this Mar 27, 2023
@0xThegarlic
Copy link
Author

Hello, thanks for your answer. Indeed, I tried to do what you recommended but it doesn't work unfortunately.

image

image

My indexer has :

image

For my manager pod, when I active root permissions, OpenShift blocks it, because it doesn't like this permissions

image

It forces me to disable this securitycontext :

image

When I do the port forward, now I also could not access the dashboard from the web interface, I just have this message :

image

Thank for your answer !

@vcerenu
Copy link
Member

vcerenu commented Mar 28, 2023

The error you have may be due to the fact that you have commented out the INDEXER_URL variable, that variable must carry the URL, service name or ip of the Wazuh indexer cluster, so you should check what is the name that Openshift assigns to node 0 of Wazuh indexer and complete it.

Regarding the Wazuh manager node, I know it should have root permissions, so you should find a way to have them assigned, we don't have any Openshift environment to check this error to help you with this. Feel free to open an issue requesting this compatibility and we will add it to our backlog and try to prioritize it.

@0xThegarlic
Copy link
Author

Hello @vcerenu, sorry for my late. I tried all of solutions but doesn't work. I don't know if you have others ideas ?

Thank!

@vcerenu
Copy link
Member

vcerenu commented Apr 19, 2023

Hello @0xThegarlic

As I mentioned in the previous post, we don't have an implementation in OpenShift, so we can't test the implementation you're making. The above messages have been created based on bugs that are generated in other similar implementations, but apparently the OpenShift implementation requires some additional considerations that are not currently covered and we would need to do some development on it.

If there are considerations that could be taken into account for the deployment, I invite you to create a PR for us and it will be analyzed to add it to our repositories.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants