Yes, that sounds very interesting. Please share with us :) If you need
any help, just ask.
Thanks,
--
Daniel B. Cid
dcid ( at ) ossec.net
-Derek Morris
This will be OK for testing, but you're probably better of using rule
IDs in the user range of 100,000-120,000 so that there aren't any
conflicts during an upgrade. When they get accepted into the project,
Daniel will assign a unique group of IDs.
> Before I send the updated decoders and rules, I wanted to get a better
> understanding of the rule alert levels and rule groups. I've been
> looking over some of the documentation between the manual and the FAQs.
> I'm not sure that either of them are documented? I've also not been able
> to find valid "log types" to monitor. In my case, I just used syslog and
> it's working but I'm not sure if I should use something else?
OSSEC Rule ID Groupings and Best Practices:
http://ossec.net/wiki/index.php/Know_How:RuleIDGrouping
As to the log type, are the DHCP logs in the event log format? In that
case, you may want to try <type>windows</type>.
> Where can I find out the alert level scale? Or, how should I assign
> alert levels to my rules? I've set all my rules to alert level 5 to start.
This should help: http://ossec.net/wiki/index.php/Know_How:Rules_Severity
In my experience, however, simply use this as a guide. If there is
something that warrants a larger or smaller severity then simply use
good judgment.
> Are the rule groups predefined or can I use my own? I've used some of
> the groups that I've seen defined in other rules such as
> "service_availability" but I've gone on to define my own such as
> "dhcp_lease_action","dhcp_maintenance","dhcp_dns_maintenance" and
> "dhcp_rogue_server".
You can make up your own groups, but try to use the pre-defined groups
where it makes sense. More info here:
http://ossec.net/wiki/index.php/Know_How:Rule_Groups
> Where is a list of valid log types that you define on the agent's
> ossec.conf file when you tell it to monitor a log?
You can use strftime or globbing in the log name definition, otherwise,
just feed it a log file and use the decoder as a guide for the log type.
One hint: single line ASCII log files can be defined as syslog even if
they aren't properly syslog-formatted.
One final tip: use the local_decoder.xml file until this is accepted
into the project, because if you don't, you might lose all your work
during an upgrade!
By adding all the days DHCP log files into my ossec.conf file on the Win2003
DHCP server we use worked, I now see the monitoring of the logs. Note: Restart
Ossec service, then DHCP Service, then Ossec service again. Will keep my eye on
it to make sure it still works ok after few days.
-Derek
2009/05/20 10:42:32 ossec-agent(1951): INFO: Analyzing event log: 'Application'.
2009/05/20 10:42:32 ossec-agent(1951): INFO: Analyzing event log: 'Security'.
2009/05/20 10:42:33 ossec-agent(1951): INFO: Analyzing event log: 'System'.
2009/05/20 10:42:34 ossec-agent(1103): ERROR: Unable to open file
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Sat.log'.
2009/05/20 10:42:34 ossec-agent(1950): INFO: Analyzing file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Sat.log'.
2009/05/20 10:42:34 ossec-agent(1103): ERROR: Unable to open file
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Sun.log'.
2009/05/20 10:42:34 ossec-agent(1950): INFO: Analyzing file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Sun.log'.
2009/05/20 10:42:34 ossec-agent(1103): ERROR: Unable to open file
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Mon.log'.
2009/05/20 10:42:34 ossec-agent(1950): INFO: Analyzing file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Mon.log'.
2009/05/20 10:42:34 ossec-agent(1103): ERROR: Unable to open file
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Tue.log'.
2009/05/20 10:42:34 ossec-agent(1950): INFO: Analyzing file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Tue.log'.
2009/05/20 10:42:34 ossec-agent(1103): ERROR: Unable to open file
'c:\windows\system32\dhcp\DhcpSrvLog-Wed.log'.
2009/05/20 10:42:34 ossec-agent(1950): INFO: Analyzing file:
'c:\windows\system32\dhcp\DhcpSrvLog-Wed.log'.
2009/05/20 10:42:34 ossec-agent(1103): ERROR: Unable to open file
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Thu.log'.
2009/05/20 10:42:34 ossec-agent(1950): INFO: Analyzing file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Thu.log'.
2009/05/20 10:42:34 ossec-agent(1103): ERROR: Unable to open file
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Fri.log'.
2009/05/20 10:42:34 ossec-agent(1950): INFO: Analyzing file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Fri.log'.
2009/05/20 10:42:34 ossec-agent: INFO: Started (pid: 3848).
I included those on the latest snapshot. I did a few changes so I
would like you to take a look:
-Modified the use of <match> to <id>
-Simplified the decoder to only extract the id, since we were not
using the other information
-Changed the ids to be in the 6300-6399 range (assigned now for MS DHCP)
-Changed the levels from some informative rules to 0 (like ip assigned, etc).
Can you test? Anyone here using ms dhcp to try it out?
Link: http://ossec.net/files/snapshots/ossec-hids-090528.tar.gz
Thanks,
--
Daniel B. Cid
dcid ( at ) ossec.net
2009/05/28 13:46:15 ossec-execd(1350): INFO: Active response disabled. Exiting.
2009/05/28 13:46:15 ossec-agent(1410): INFO: Reading authentication keys file.
2009/05/28 13:46:15 ossec-agent: INFO: Assigning counter for agent SERVERNAME:
'219:6044'.
2009/05/28 13:46:15 ossec-agent: INFO: Assigning sender counter: 35:1350
2009/05/28 13:46:15 ossec-agent: INFO: Trying to connect to server
(IPADDRESSREMOVED:1514).
2009/05/28 13:46:15 ossec-agent: Starting syscheckd thread.
2009/05/28 13:46:15 ossec-rootcheck: INFO: Started (pid: 3700).
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\Software\Policies'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\Software\Microsoft\Internet Explorer'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\Software\Classes'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring registry entry:
'HKEY_LOCAL_MACHINE\Security'.
2009/05/28 13:46:15 ossec-agent: INFO: Monitoring directory: 'C:\Windows/system32'.
2009/05/28 13:46:15 ossec-agent: INFO: Started (pid: 3700).
2009/05/28 13:46:16 ossec-agent(4102): INFO: Connected to the server
(IPADDRESSREMOVED:1514).
2009/05/28 13:46:16 ossec-agent: INFO: System is Vista or Windows Server 2008.
2009/05/28 13:46:16 ossec-agent(1951): INFO: Analyzing event log: 'Application'.
2009/05/28 13:46:16 ossec-agent(1951): INFO: Analyzing event log: 'Security'.
2009/05/28 13:46:34 ossec-agent(1951): INFO: Analyzing event log: 'System'.
2009/05/28 13:46:34 ossec-agent(1952): INFO: Monitoring variable log file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Thu.log'.
2009/05/28 13:46:34 ossec-agent(1103): ERROR: Unable to open file
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Thu.log'.
2009/05/28 13:46:34 ossec-agent(1950): INFO: Analyzing file:
'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Thu.log'.
2009/05/28 13:46:34 ossec-agent: INFO: Started (pid: 3700).
"2009/05/28 13:46:34 ossec-agent(1103): ERROR: Unable to open file"
Is not really related to the decoder/rules, since it happens way
before on the agent side. For
some reason when ossec tries to open the file, it fails.... Is there
a way to send me the content
of 'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Thu.log' ?
Or even running "type 'C:\WINDOWS\system32\dhcp\DhcpSrvLog-Thu.log'."
on the command prompt?
If there is one small typo in the file path ossec will not be able to open it.
As far as the decoder (and rules), I tried them using the log samples
provided in the rule file and
seemed to work (*make sure to remove your local decoders too):
2009/05/29 10:03:35 ossec-testrule: INFO: Started (pid: 22553).
ossec-testrule: Type one log per line.
24,3/10/2009,0:00:46,Database Cleanup Begin,,,,
**Phase 1: Completed pre-decoding.
full event: '24,3/10/2009,0:00:46,Database Cleanup Begin,,,,'
hostname: 'enigma'
program_name: '(null)'
log: '24,3/10/2009,0:00:46,Database Cleanup Begin,,,,'
**Phase 2: Completed decoding.
decoder: 'ms-dhcp-ipv4'
id: '24'
**Phase 3: Completed filtering (rules).
Rule id: '6316'
Level: '3'
Description: 'IP address cleanup operation has began.'
**Alert to be generated.
**Phase 1: Completed pre-decoding.
full event: '11011,05/05/09,10:50:55,DHCPV6 Stopped,,,,,,'
hostname: 'enigma'
program_name: '(null)'
log: '11011,05/05/09,10:50:55,DHCPV6 Stopped,,,,,,'
**Phase 2: Completed decoding.
decoder: 'ms-dhcp-ipv6'
id: '11011'
**Phase 3: Completed filtering (rules).
Rule id: '6362'
Level: '7'
Description: 'Stopped.'
**Alert to be generated.
Thanks,
--
Daniel B. Cid
dcid ( at ) ossec.net
On Windows 2008 32bit and 64bit DHCP or Windows 2003 64Bit DHCP, I had to move
the DHCP folder and Audit Logs out to C:\DHCP for the Ossec Agent on the Windows
server to start to open and read the files. I then made the change to the
decoder you mentioned below and works great now. Hope this helps!! Any questions
about it feel free to email me.
-Derek