The log messages are read by the agent processes, and transferred to
the manager. The manager analyzes these log messages, and if a rule
matches it will alert as configured. The alert will be stored on the
manager in /var/ossec/logs/alerts/alerts.log. The actual log message
will not be saved if there is no alert and the <logall> option is not
set on the manager.
/var/ossec/logs/ossec.log is for logs created by the actual OSSEC processes.
I should be seeing IIS log entries going to alerts.log shouldn't I?
--
Shane Castle
Data Security Mgr, Boulder County IT
CISSP GSEC GCIH
On Jun 20, 2011 9:50 AM, "GeorgeY" <georg...@gmail.com> wrote:
>
> Hi Dan,
>
> > Check the agent's logs to see if that file is being read.
>
> Yes, they are being read. As per my first post, I see the following in
> the agent's log
>
> 2011/06/09 23:33:02 ossec-agent(1952): INFO: Monitoring variable log
> file: 'C:\WINDOWS\\System32\\LogFiles\\W3SVC1\\ex110609.log'.
> 2011/06/09 23:33:02 ossec-agent(1950): INFO: Analyzing file: 'C:
> \WINDOWS\\System32\\LogFiles\\W3SVC1\\ex110609.log'.
>
> > Also, the logs won't end up in alerts.log, the alerts will (as Christopher Moraes pointed out).
>
> Please excuse my ignorance but I do not completely understand what
> Christopher meant by the following:
> > if your IIS logs do not contain any events that are generating alerts, then you will not see anything in alerts.log.
>
> Does OSSEC already contain rules to alert when there is a problem with
> IIS? Does it have anything to do with web_rules.xml?
>
> > Also, you need to have the IIS rules set in your ossec.conf (should be enabled by default)
>
> I do not see any "IIS rules set" in the default ossec.conf. Do you
> mean <include>web_rules.xml</include>?
>
It looks like web_rules would apply. They're probably very basic, and probably provide building blocks for more specific rules. They're open source and plain text, give'em a read.
https://bitbucket.org/dcid/ossec-hids/src/392c217c553b/etc/rules/web_rules.xml
> I see this line in the ossec.conf on the server but it doesn't apply
> to the agent right?
>
> <!-- Windows files to ignore -->
> <ignore>C:\WINDOWS/System32/LogFiles</ignore>
>
This will aplly to the agents too. Only remove it if you want syscheck file changed alerts everytime a log message is written.
Base your rule off of:
<rule id="31101" level="5">
<if_sid>31100</if_sid>
<id>^4</id>
<description>Web server 400 error code.</description>
</rule>
On Tue, Jul 12, 2011 at 3:23 AM, GeorgeY <georg...@gmail.com> wrote:
> Hi Dan,
>
> Here is what i did.
>
> On OSSEC server web_rules.xml, I added the following and restarted
> OSSEC:
>
> <rule id="31164" level="5">
> <if_sid>31100</if_sid>
> <id>^404</id>
> <description>Web server 404 error code.</description>
> </rule>
>
> on the OSSEC client, i restarted OSSEC and confirmed that the logs are
> being monitored:
>
> 2011/07/12 00:02:18 ossec-agent(1952): INFO: Monitoring variable log
> file: 'C:\WINDOWS\\System32\\LogFiles\\W3SVC1\\ex110712.log'.
>
> I opened the ex110712.log and noticed this entry:
>
> 2011-07-12 07:09:07 W3SVC1 hostname xx.xx.xx.xx GET /abcdef - 80 -
> xx.xx.xx.xx Mozilla/5.0+(Windows;+U;+Windows+NT+5.1;+en-US;+rv:
> 1.9.2.18)+Gecko/20110614+Firefox/3.6.18 hostname 404 0 2
>
> However, nothing logged in alerts.log on the server. is there
> something i'm missing?
>
I passed the log message through ossec-logtest for you, and apparently
it's in the wrong format.
It doesn't seem to get recognized as an IIS formatted log message, or
IIS messages aren't decoded very well.
You'll need a decoder for this.
<decoder name="iis-stuff">
<parent>windows-date-format</parent>
<use_own_name>true</use_own_name>
<prematch offset="after_parent">^\S+ \S+ \S+ \S+ /\S* </prematch>
<regex offset="after_parent">^\S+ \S+ (\S+) (\S+) (\S*) - (\d+) -
\S+ \S+\p\.\p\.+ \S+ \S+ (\d+)</regex>
<order>srcip,action,url,dstport,id</order>
</decoder>
The decoder I gave you isn't working. There should be more goodies
decoded in Phase 2.
Paste it immediately after the windows-date-format decoder.
Make sure you test this thoroughly! I don't know what else this will screw up.
Seriously. This could break all other windows-date-format based decoders.
<decoder name="web-accesslog-iis6">
<parent>windows-date-format</parent>
<type>web-log</type>
<use_own_name>true</use_own_name>
<prematch offset="after_parent">^W3SVC\d+ \S+ \S+ \S+ </prematch>
<regex offset="after_prematch">^(\S+ \S+) \d+ \S+ (\d+.\d+.\d+.\d+) </regex>
<regex>\S+ \S+ \S+ \S+ \S+ (\d+) |</regex>
<regex>^(\S+ \S+) \d+ \S+ (\d+.\d+.\d+.\d+) \S+ \S+ (\d+) </regex>
<order>url, srcip, id</order>
</decoder>
I'm not sure why your format is so funky, but this will hopefully not
break anything.