Wouldn't running as an unprivileged user significantly reduce the functionality?
---------------------------
Jason 'XenoPhage' Frisvold
xeno...@godshell.com
---------------------------
"Any sufficiently advanced magic is indistinguishable from technology."
- Niven's Inverse of Clarke's Third Law
I am currently getting a lot of emails in regards to a php issue on the
server... ...this issue is not really a major problem, the server should
run without any problem even if i can see this in the logs...
...therefore, i would like to add an exception in Ossec, to stop
receiving those emails... here is the email i am getting... could
someone tell me exactly what to do to add an exception for it?? (i am
new to OSSEC... ...so please explain step by step ;o)
Received From: i51->/var/log/messages
Rule: 1002 fired (level 2) -> "Unknown problem somewhere in the system."
Portion of the log(s):
Apr 17 11:59:00 i51 kernel: xmlrpc[23889]: segfault at 0000000000000000 rip 0000000000416e7d rsp 00000000427080a0 error 4
OSSEC can be installed without root access but the install script would
likely fail. It needs to place an init script for startup, one file in
/etc and create the users and groups. Finally, it needs to create
/var/osssec. This can all be done manually, but someone obviously needs
to have some privileges to perform these steps.
OSSEC can be administered with someone who has sudo access to
impersonate/become the ossec user account. I tried this several years
ago. I recall that there was one daemon that failed to start because it
started as root and then dropped privileges. The situation may be
slightly different today since there have been a few more daemons added.
You can probably design a strategy around allowing someone to become the
ossec user then granting sudo root access to perform bin/ossec-control
stop|start|restart, or something along those lines.
--
Michael Starks
[I] Immutable Security
http://www.immutablesecurity.com
A segfault is never good and I would recommend looking at this
application to see why it is crashing. A simple rule to
ignore it:
<rule id="100121" level="0">
<if_sid>1002</if_sid>
<match>^xmlrpc</match>
<regex> segfault at </regex>
<description>Ignoring segaults from xmlrpc</description>
</rule>
thanks,
I agree that the problem should be fixed and not just ignored.
--
Shane Castle
Data Security Mgr, Boulder County IT
CISSP GSEC GCIH
It can't switch because you're not root. Make sure "sudo -u ossec"
changes the group as well (and/or try it with "-g ossec" as well).
You may run into other problems running the daemon processes though.
For those you'd have to break out a text editor. (I'm thinking the
chroot code.)
> I can probably convince them to let us have superuser via sudo to run
> the ossec-control, but they're going to balk if I say "...and
> everything under /var/ossec/bin" due to how they manage the sudoers
> across production systems on our campus. They are (rightly) adverse
> to one-offs and "special snowflakes".
>
>
You don't need sudo access to ossec-control, just the binaries in
/var/ossec/bin (and a couple of quick mods to ossec-control to utilize
sudo).
> It can't switch because you're not root. Make sure "sudo -u ossec"
> changes the group as well (and/or try it with "-g ossec" as well).
> You may run into other problems running the daemon processes though.
> For those you'd have to break out a text editor. (I'm thinking the
> chroot code.)
My understanding is that sudo runs as root, since it is setuid root.
I should be able to switch to any user or group I want as superuser,
and I have tried setting the user to ossec with `-u ossec` and the
group to ossec with `-g ossec`, and even spawning an ossec uid-owned
shell with group `ossec`.
The binaries in $ossec/bin still report that they cannot switch to
group: 'ossec' even though I am already in the group ossec.
bash-3.2$ id
uid=501(ossec) gid=508(ossec) groups=508(ossec)
bash-3.2$ /var/ossec/bin/manage_agents
2011/05/09 10:51:25 manage_agents(1207): ERROR: Unable to switch to
group: 'ossec'.
I'm aleady group 'ossec'. Why am I trying to switch to it? And more
importantly, why does manage_agents think I'm unable to do so?
> You don't need sudo access to ossec-control, just the binaries in
> /var/ossec/bin (and a couple of quick mods to ossec-control to utilize
> sudo).
So are you saying that they all require root permissions to use those
binaries? Is there no supported mechanism to manage agents and
provision devices without super-user permissions?
You are saying "sudo access", do you mean "sudo root" or "sudo ossec"?
chroot + setuid + setgid.
Meaning that even if you are running OSSEC as the user "ossec", it
will still try to chroot, setuid, etc. All of those
will fail because only root can do that. Not doing the setuid should
be a simple change (maybe via command line
argument), but removing the chroot is a lot more work since some of
the code expect to be in a chroot and will
use the OSSEC root (/var/ossec) as their main root directory.
thanks,
Ok, now it is making a lot of sense. :) To the original poster, there
are a few ways that can be approached:
1. Add the non-privileged user to the ossec group. You should be able
to at least read the log files, etc, which may be the main point.
2. Optionally, give limited sudo access to some of the ossec binaries,
or maybe even just ossec-control. Something like: sudo
/var/ossec/ossec-control restart. I *think* since ossec-control would be
calling the binaries that it would inherit the rights.
3. It's also possible to set acls on a filesystem that supports it,
such that the permissions can be a bit more granularly defined. This
would allow ossec to run normally under the usual Unix permissions but
you could still have access to all of the files. Although to be truly
effective, you should not be able to execute commands, which ossec-exexd
can do, and if you could modify ossec.conf then you have root access via
proxy.