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

manage_agent bulk load fails #454

Closed
ccx004 opened this issue Nov 25, 2014 · 10 comments
Closed

manage_agent bulk load fails #454

ccx004 opened this issue Nov 25, 2014 · 10 comments
Labels

Comments

@ccx004
Copy link

ccx004 commented Nov 25, 2014

manage_agents -f /tmp/agents fails with "file not found". I have since worked out that it does a chroot to /var/ossec and that is why it cannot find the files. So this is a query and a suggestion. The query is, is there any need for this program to do a chroot? The suggestion is to add some text to the help message that manage_agents -? produces to say that the file must be stored in the /var/ossec file structure somewhere.

Best wishes...
Colin

@ddpbsd
Copy link
Member

ddpbsd commented Nov 25, 2014

Taking a quick look at it, I see a call to nowChroot() in main.c. So manage_agents chroots to /var/ossec. Trying to load the file relative to this chroot (bin/manage_agents -f bin/xxx) gives a different error:
randombytes failed for all possible methods for accessing random data

So it appears there is a call to srandom_init() that happens after the chroot.

@ddpbsd
Copy link
Member

ddpbsd commented Nov 25, 2014

It appears to work with a dev/random and dev/urandom available.

@jrossi
Copy link
Member

jrossi commented Nov 25, 2014

Srandom_init must happe. Before chroot

@ddpbsd
Copy link
Member

ddpbsd commented Nov 25, 2014

@jrossi unfortunately there are 3 srandom_init() calls, and 2 aren't as easy as moving them up a few lines (validate.c being one example). That's definitely the issue, but I don't know how to fix it off hand.

@jrossi
Copy link
Member

jrossi commented Nov 25, 2014

Yeah a lot of the utils and management cli apps suffer from copy and paste code hell. The real only way to fix to start refactoring out things into shared or another common location. This will take some work.

@jrossi jrossi added the bug label Jan 5, 2015
@jrossi jrossi added this to the ossec-hids-2.9 milestone Feb 1, 2015
@awiddersheim
Copy link
Member

This is a big breaking fix if bulk loads don't work in 2.9. Probably should fix this before it's released.

@coffmant
Copy link

There is a similar (same?) issue on the client side.

manage_agents(1128): ERROR: Could not create temporary file
'tmp/client.keys55sUAS' due to [(2)-(No such file or directory)].

@Fadavvi
Copy link

Fadavvi commented Aug 24, 2016

Any work around??

@sarah336
Copy link

sarah336 commented Sep 2, 2016

Circle :)

@Fadavvi
Copy link

Fadavvi commented Sep 3, 2016

:)))

ddpbsd added a commit that referenced this issue Dec 1, 2016
Prevent manage_agents from chrooting in bulk mode
Currently using -f will fail because of attempts to access random,
 which isn't possible in the chroot (without extra work).
Prevent the chroot in this mode. Fixes issue #454
Not sure this is ready yet, I'm hoping for comments.
This may be the wrong way to solve it (it feels like a hack instead of a proper fix).
ddpbsd added a commit that referenced this issue Dec 1, 2016
Prevent manage_agents from chrooting in bulk mode
Currently using -f will fail because of attempts to access random,
 which isn't possible in the chroot (without extra work).
Prevent the chroot in this mode. Fixes issue #454
Not sure this is ready yet, I'm hoping for comments.
This may be the wrong way to solve it (it feels like a hack instead of a proper fix).
@ddpbsd ddpbsd closed this as completed Oct 23, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants