-
Notifications
You must be signed in to change notification settings - Fork 1k
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
"-c" cmdline option ignored in several executables #207
Comments
I can confirm for atleast The configuration option in I haven't looked at Atleast that is my understanding. Despite being able to specify different configuration locations it might not get you very far and your mileage may vary. That said, even though the "installer" is pretty hokey you can still install to different locations. The issue presented in #24 only really affects some scripts in "contrib". Right now that issue only lists two scripts. Fixing those would require a simple The configuration/help might need some updating to better describe things here. I'll work on fixing things when time permits. |
util.sh is fixed in my repo |
@awiddersheim Thanks for the reply, I'm aware of the chroot stuff you mentioned, but thanks for pointing it out for maybe others who didn't realize. Unfortunately if the "-c" option doesn't work the path is effectively hardcoded. I've spent the past few days packaging ossec for my production environment and in all the installer/make machinery I don't see any way to change the DEFAULTDIR without manually passing additional arguments into the makefile like:
The bug in ossec-execd seems pretty obvious to me, but I can't submit back a fix without doing a whole legal code release dance; so hopefully someone else will see the error in execd.c and correct them :)
snip
snip
A cursory glance at main.c of ossec-agentd shows that there isn't even a "c" switch defined in the case statement for parsing args. At any rate I think any reasonable person would consider it a bug for the usage statements to not match the actual available flags and/or advertised flag behaviors. edit: I added and removed a complaint here based on a misread of code... fwiw |
I think we are on the same page about what is broken and what needs to get fixed. I've seen the issues in Thanks for the feedback. |
On Fri, May 16, 2014 at 12:51 PM, Dave Rawks [email protected] wrote:
It's not obvious to me. Setting the group and a comment?
|
On Thu, May 15, 2014 at 4:27 PM, Dave Rawks [email protected] wrote:
I do not get this error when I use "-c /etc/ossec.conf"
|
I don't think
He is specifying My guess is I'd imagine if you removed/renamed the |
On Fri, May 16, 2014 at 1:41 PM, awiddersheim [email protected] wrote:
You're right, it doesn't.
Gotcha. Missed the silly situation. I'm still unable to recreate the
Nope.
|
Try removing/renaming your default So for example if I installed OSSEC to If I would remove the Hopefully that makes sense. This is all a bit tricky and I haven't fully tried it all yet either but I think that is what is happening. |
On Fri, May 16, 2014 at 2:04 PM, awiddersheim [email protected] wrote:
Ok, I had to remove several ossec.confs to get this to work. Thanks
|
It matters in the real world whenever you want to use the flags as they are described to point to a different config than the default compiled in location... I understand that there is some presumption that everyone (or near everyone) will just use the installer scripts, but in the real world I think it is reasonable that the usage statement matches reality. The "real world" is full of use cases... I hit this bug less than 24 hours after being asked to help prepare ossec for our environment. |
On Fri, May 16, 2014 at 2:29 PM, Dave Rawks [email protected] wrote:
And that's great, I hope you find a bunch more bugs.
|
This open is also related #24 ossec a fair amount of locations that get compiled in and cannot be changed with a recompile. Some tools this effects more then others but this is definitely an issue. |
Stop gap fixes to ossec-execd for issues raised in ossec#207. The same help statment gets printed for every OSSEC binary despite not every binary using or requiring the same arguments. A good example is '-D' which is used to specify an alternate chroot location but not every OSSEC binary seems to chroot. This commit makes the '-c' option work so a user can specify an alternate configuration location. Also, now if '-D' or '-u' are specified ossec-execd will exit with an error saying those options are unimplemented. This is important to note because previously if '-D' was specified it would just silently do nothing so there is the potential this breaks a setup somewhere where someone was specfiying this option that in reality did nothing. I can see where the method used now might have saved some time and code replication but since not all binaries are made equal you end up with misinformation. Need to decide on a better solution.
Stop gap fixes to ossec-agnetd for issues raised in ossec#207. This commit makes the '-c' option work so a user can specify an alternate configuration location.
Stop gap fixes to ossec-agentd for issues raised in ossec#207. This commit makes the '-c' option work so a user can specify an alternate configuration location.
I created some small fixes for this issue only for I want to see what peoples feelings are about this stop gap fix and if people agree that this is an acceptable solution to hold things over until a more permanent one is created. Once that is done I'll go through the rest of the binaries and fix any problems in them as well. Some main things I'd like people to look at are as follows:
The same help statement gets printed for every OSSEC binary despite not every binary using or requiring the same arguments. A good example is '-D' which is used to specify an alternate chroot location but not every OSSEC binary seems to chroot. I can see where the method used now might have saved some time and code replication but since not all binaries are made equal you end up with misinformation. There is probably a decent amount of work/testing involved with fixing this properly. The main thing is coming to a shared consensus on what the permanent solution should be. Whether that is making sure every binary does the exact same things so all command line arguments are valid or moving the help from Feel free to discuss. |
Woot this is great and really needed.
No security issue unless we have setuid programs. But is a great feature; as it will make things like testing even easier. (No need to install to test changes)
No - it's goal is to change the host environment. Chroot making that harder.
Yes - dropping group permissions is just good practice with doing fork/exec a lot, which is what ossec-execd.
We should have standard functions for each app to set options that they accept and then print only them. But we don't need one help page to rule them all. You have pointed out all the reasons why ;)
|
On 05/25/2014 11:51 AM, awiddersheim wrote:
I think as long as it's under the chroot dir, it's fine. If it's not,
I would say it should do what it says, so fixing this would be correct.
It doesn't seem to make sense to make these options shared, except for |
Perhaps I'll just get rid of the shared help and go through them all creating a proper help for each since that seems like the general consensus on what should happen. If I find anything common between all of them I'll consider getting that shared but it might not be worth it.
The problem is
Right, but it only drops group privileges but not user privileges. Note the disparity between https://github.com/ossec/ossec-hids/blob/master/src/os_execd/execd.c#L134 I guess only doing the user stuff is necessary when doing a chroot which |
No it does not add any security. To chroot you need root privs and we don't have any setuid apps in ossec. (Good thing) So if you run it as non root user this is a hugely useful feature as you can test config with out changing production.
No this is incorrect chroot with ossec-execd does not make sense. Every single use of active response I know of requires root access to full system.
|
Correct
|
@jrossi I'd argue that it could easily make sense to have execd run as a non-root user. Active response is essentially just exec'ing commands as configured and depending on the user's environment the commands that are called could have their own methods of priviledge escalation (sudo inside shell script for example) or could even be crafted setuid programs. Since I don't see any mechanism by which the configured actions of active response can be run in the context of another user or group it seems a bit ham fisted for execd to always run as root and always run it's child processes as root. As such it would seem, to me at least, a worthwhile effort to have execd be able to drop root at runtime if configured to do so AND also to enable it, if root isn't dropped, to exec child processes as different uid/gid as configured via active response command options. |
@drawks Ham fisted - yeah I will agree with that. But, then again I would say the same about sudo setup is also ham fisted. I feel that ossec-execd is feed from the another application that has already dropped privs so we are Basically we are re-arranging chairs. No gains and no loss. Chroot on the other hand is something that does NOT make sense even with sudo. Breaking out of your own chroot to update hosts is crazy and not something I would like to codify and leave around. |
+1 @drawks. While I agree that most current uses of active response might as well use root because of what they do, AR is a blank slate of opportunities and it makes sense to use the least privilege possible for the task. |
@drawks @mstarks01 great - look forward to what you guys come up with. It is a hard problem and something that I think was handle correctly and simply with ossec-execd, but "I think" only goes so far so look forward to what i can learn in this area about how to handle this. |
Please open another issue for this other issue if anyone feels it important enough so we can keep the original issue on topic. Didn't mean to start everyone in a different direction. Apologies. |
@awiddersheim you are absolutely right, sorry for piling on unrelated stuff in this issue. I've created #215 to specifically add a feature request/suggestion. |
Perfect. Thanks. It is no problem I somewhat brought it on myself. Will hopefully tackle fixing command line arguments and some path hardcoding this weekend now that we have a consensus on what should be done. |
Move away from the shared help(). Not all binaries are created equal and take the same arguments. The shared help caused confusion which was brought up in ossec#207. The '-c' option should now work so a user can specify an alternate configuration location. Also, the '-D' and '-u' options were removed. This is important to note because previously they would have just been silently ignored. With this commit, specifying these options will present the help() output and exit non-zero. Of course this has the potential to break a setup out there but I would imagine the likelyhood is low that people are specifying these options.
Implement fixes for ossec#207. This commit makes the '-c' option work so a user can specify an alternate configuration location. It also moves the ossec-agentd away from using the shared help.
Implement fixes for ossec#207. Stop using shared help in ossec-maild.
Implement fixes for ossec#207. Added better help output and figured out possible command line arguments.
Fixes to the command line arguments and help messages in ossec-reportd and ossec-monitord. This is related to the issues in ossec#207.
Been like 12 or 13 weekends since I said I would get to this. Been pretty busy with other things. Made some headway though. Any feedback thus far might be good. Planning on doing a bunch more though. Unfortunately, for a change like this, it is easier to make just a larger PR than just smaller ones I think. |
Fixes to the command line arguments and help messages in ossec-agentlessd. This is related to the issues in ossec#207.
Fixes to the command line arguments and help messages in ossec-logcollector. This is related to the issues in ossec#207.
Fixes to the command line arguments and help messages in ossec-logtest. This is related to the issues in ossec#207.
Fixes to the command line arguments and help messages in ossec-makelists. This is related to the issues in ossec#207.
Fixes to the command line arguments and help messages in ossec-analysisd. This is related to the issues in ossec#207.
Fixes to the command line arguments and help messages in ossec-syscheckd. This is related to the issues in ossec#207. Found that syscheck.workdir wasn't really used for anything that I could find. Removed it completely for now.
Fixes to the command line arguments and help messages in ossec-remoted. This is related to the issues in ossec#207.
Fixes to the command line arguments and help messages in ossec-dbd. This is related to the issues in ossec#207.
Fixes to the command line arguments and help messages in ossec-csyslogd. This is related to the issues in ossec#207.
Note that this PR #270 only really fixes the fact that the options are incorrect for some of the programs. It doesn't really address the fact that OSSEC isn't really flexible with where/how you install it which was also brought up in this issue. For example, in many programs you can specify an alternate location for chrooting or the configuration file to read but some programs will also try to read the OSSEC Another example is the I for one have little need to make OSSEC that flexible. By that I mean I don't plan on needing to change the name/location of the For those that don't know how to easily configure OSSEC's installation location at compile time doing the following should be all you need to do:
Changing anything else is pretty hit or miss. |
With the merger of #270 I'm going to close this as that should have fixed the issue where the help generated did not always show the correct options each binary was capable of. Another issue was spawned from this in #215 and that can be handled there. I also created a new issue for hard coded paths in #278. |
It looks like several (all?) of the binaries generated when building this project have the same usage statement:
But I've variously seen that the "-c" argument is ignored:
or even fully unimplemented:
Combined with #24 it becomes virtually impossible to install this software to any location aside from the defaults from the "installer".
The text was updated successfully, but these errors were encountered: