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

Cluster is not deleting temporary files in worker nodes #3379

Closed
crd1985 opened this issue May 23, 2019 · 1 comment
Closed

Cluster is not deleting temporary files in worker nodes #3379

crd1985 opened this issue May 23, 2019 · 1 comment

Comments

@crd1985
Copy link
Contributor

crd1985 commented May 23, 2019

Wazuh version Component Install type Install method Platform
3.9.1-rev Cluster Manager Any Any

After synchronizing integrity data, unzipped temporary files are not being deleted under path WAZUH_HOME/queue/cluster/WORKER_NAME/*.zipdir/. The problem is in line

shutil.rmtree(zip_path)

where the rmtree function is being called only in the else block.

Furthermore, the full temp files management should be reviewed to detect other leaks.

@crd1985
Copy link
Contributor Author

crd1985 commented May 23, 2019

To replicate the above, I have created a cluster environment and perform the steps below:

  • Create a new agent group test (in master node):
root@9fe0df68a6a2:/var/ossec/queue/cluster# curl -u foo:bar "http://localhost:55000/agents/groups/test" -XPUT
{"error":0,"data":"Group 'test' created."}
  • Add an agent to that group (in worker1 node):
root@51281ed56879:/var/ossec/queue/cluster/worker1# curl -u foo:bar "http://localhost:55000/agents/002/group/test" -XPUT
{"error":0,"data":"Group 'test' added to agent '002'."}
  • Re-register the agent. Then check the directory (in worker1 node):
root@51281ed56879:/var/ossec/queue/cluster/worker1# ls -lrth
total 16K
drwxrwx--- 2 ossec ossec 4.0K May 23 07:26 worker1-1558596395.4412985-04139153837307563.zipdir
drwxrwx--- 2 ossec ossec 4.0K May 23 07:39 worker1-1558597171.7910607-4362109828528633.zipdir
-rw-r--r-- 1 ossec ossec   41 May 23 07:39 agent-groups.merged
-rw-r--r-- 1 ossec ossec  366 May 23 07:40 agent-info.merged
  • To ensure the hypothesis, grep the cluster.log:
root@51281ed56879:/var/ossec/queue/cluster/worker1# grep 'Worker meets integrity checks. No actions.' /var/ossec/logs/cluster.log 
2019/05/23 07:26:35 wazuh-clusterd: INFO: [Worker worker1] [Integrity] Worker meets integrity checks. No actions.
2019/05/23 07:39:31 wazuh-clusterd: INFO: [Worker worker1] [Integrity] Worker meets integrity checks. No actions.

@crd1985 crd1985 added this to To do in Wazuh 3.9.2 via automation May 23, 2019
@crd1985 crd1985 added this to To do in Wazuh 3.10.0 via automation May 23, 2019
@crd1985 crd1985 added this to the 21st week milestone May 23, 2019
@crd1985 crd1985 added the type/bug Something isn't working label May 23, 2019
@crd1985 crd1985 moved this from To do to Review in progress in Wazuh 3.9.2 May 28, 2019
@crd1985 crd1985 closed this as completed May 28, 2019
Wazuh 3.10.0 automation moved this from To do to Done May 28, 2019
Wazuh 3.9.2 automation moved this from Review in progress to Done May 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Wazuh 3.10.0
  
Done
Wazuh 3.9.2
  
Done
Development

No branches or pull requests

1 participant