This is possible to do with the policy monitoring. For example, if you
modify the
file /var/ossec/etc/shared/system_audit_rcl.txt to include:
[File found on /tmp with perl on it] [any] []
d:/tmp -> -> r:<?|^#!;
It will alert if any file on tmp starts with #! or <? (php).
You can also restrict to any file that ends with .txt (for example):
[File found on /tmp with perl on it, ending with .txt] [any] []
d:/tmp -> .txt$ -> r:<?|^#!;
If you want more than one directory or for a few system commands:
[File found on /tmp with perl on it, ending with .txt] [any] []
d:/tmp,/var/tmp -> -> r:ls|rename|mkdir|id|whoami|cat;
Btw, you only need to change this file on the server side and it will be pushed
to your agents (after a while).
Thanks,
--
Daniel B. Cid
dcid ( at ) ossec.net
You need to have the <system_audit> entry for it to work and it has been
added by default since v1.5. However, if you have been upgrading from previous
versions, this entry is not added on updates. I will make sure to document it
better (there are lots of features not well documented in there).
For your other questions:
>1. Would I be correct in the php.ini checks that if I wanted to check
>for "On" and "1" I would use "On|1;" ?
Yes. However, you need to use the regex type: r:On|1; It is explained a bit
in here:
http://ossec.net/wiki/index.php/Know_How:WindowsPolicy#Format_of_policy_files
>2. How would I check for "Off,0, and then nothing such as
>"register_globals = " (when off)?
I didn't understand what you are trying to do in here...
>3. I'm having no success with the /tmp file check.
The easiest way to test is to go to inside the ossec package and to
src/rootcheck and run:
# make binary
# ./ossec-rootcheck
It will allow you to test it right away... You just need to modify the
files inside
the ./db directory of the package. Once you get it working in there, move your
changes to /var/ossec/etc/shared . Also note that you can't use version 1.5
of rootcheck to test them, since we changed it a lot for v1.6/v1.6.1.
If it is still not working, send to us the output from rootcheck and the entries
you added...
Hope it helps.
--
Daniel B. Cid
dcid ( at ) ossec.net
You are not getting the emails because the system auditing rule is by
default level 3:
<rule id="516" level="3">
<if_sid>510</if_sid>
<match>^System Audit</match>
<description>System Audit event.</description>
<group>rootcheck,</group>
</rule>
If you increase the severity, you will get the emails.
For the "d:/tmp -> -> r:<?|^#!;" pattern to work on all files inside
the /tmp, you need
to have an extra space between the 2 arrows: "d:/tmp -> ->
r:<?|^#!;". To alert
for any file except the compressed ones, you can ignore directly on the rule:
<match>.gz.|.tgz|.exe.</match>
Hope it helps.
--
Daniel B. Cid
dcid ( at ) ossec.net