Thanks Daniel,

That is excellent news. Thanks for the prompt response.

Regards,
Dan

On Oct 8, 3:51 pm, Daniel Cid <[email protected]> wrote:
> Hi,
>
> Thanks for the detailed report. It really helps to understand what is
> going on. The issue
> here is that OSSEC keeps track of the messages sent by the agents and
> do not allow
> duplicates (or event injection).
>
> When you reinstall the operating system and reuse the same key, the
> agent will start the
> message count from zero, but the manager will have the count higher
> from the last time
> that agent used it.
>
> You have two solutions:
>
> -Remove the agent count from the manager. They are stored at
> /var/ossec/queue/rids/<agentid>.
> So every time the system is rebuild and you want to reuse the key, you
> need to make sure
> to remove that file.
>
> -Disable the message id checks. To do that, set the
> "remoted.verify_msg_id" to "0" in the internal_options.conf
> file. That way the manager will allow messages when the counter is zeroed.
>
> Hope it helps.
>
> --
> Daniel B. Cid
> dcid ( at ) ossec.net
>
> On Thu, Oct 8, 2009 at 9:40 AM, Heyzoos <[email protected]> wrote:
>
> > Hi,
>
> > I am having an intermittent communication problem with OSSEC.
>
> > Background:
> > As part of a large Security project we are adding HIDS to a large
> > number of Windows 2000 Workstations. We are in testing stage. I have
> > so far managed to automate the adding of the Windows agent to an
> > individual machine. My script will communicate with the HIDS server to
> > confirm if the windows host exists in /var/ossec/etc/client.keys. If
> > it does then it will extract the key and pass it back to the windows
> > host. If it doesn’t then it will add the agent with manage_agents,
> > extract the key and pass it back to the windows host.
>
> > Environment Details:
>
> > HIDS Windows Agent
> > OS: Windows 2000 Pro
> > IP: xxx.xxx.xxx.129
>
> > HIDS Server
> > OS: Redhat Enterprise Linux Server
> > IP: xxx.xxx.xxx.31
>
> > No firewalls/filters or ACLs between the agent and server and all the
> > devices are on the same subnet.
>
> > Issue Details:
> > The problem occurs when the Windows agent is reinstalled. In this
> > situation the client.keys file is created on the Windows host with
> > existing key information from /var/ossec/etc/client.keys on the HIDS
> > server.
>
> > The windows agent starts perfectly but when I check the log it always
> > has the following entries shortly after startup…
>
> > 2009/10/08 11:23:18 ossec-agent: INFO: Started (pid: 740).
> > 2009/10/08 11:23:28 ossec-agent: WARN: Process locked. Waiting for
> > permission...
> > 2009/10/08 11:23:39 ossec-agent(4101): WARN: Waiting for server reply
> > (not started). Tried: ‘xxx.xxx.xxx.31’.
> > 2009/10/08 11:23:41 ossec-agent: INFO: Trying to connect to server
> > (xxx.xxx.xxx.31:1514).
> > 2009/10/08 11:24:02 ossec-agent(4101): WARN: Waiting for server reply
> > (not started). Tried: ‘xxx.xxx.xxx.31’.
> > 2009/10/08 11:24:22 ossec-agent: INFO: Trying to connect to server
> > (xxx.xxx.xxx.31:1514).
> > 2009/10/08 11:24:43 ossec-agent(4101): WARN: Waiting for server reply
> > (not started). Tried: ‘xxx.xxx.xxx.31’.
>
> > On the server side the agent appears as Disconnected.
> > [r...@testlin /]# agent_control -l
>
> > OSSEC HIDS agent_control. List of available agents:
> >   ID: 000, Name: testlin (server), IP: 127.0.0.1, Active/Local
> >   ID: 004, Name: CORES-SPARE, IP: xxx.xxx.xxx.39, Active
> >   ID: 029, Name: EPOSPCI-xxx.xxx.xxx.129, IP: xxx.xxx.xxx.129,
> > Disconnected
>
> > Doing a tcpdump on the HIDS server show that the agent is trying to
> > communicate with HIDS but the server never replies back. With working
> > agents (Windows or otherwise) it is clear the server is replying back
> > to the agent.
>
> > Workaround: My current workaround is to remove the agent on the HIDS
> > server, re add it and then import the new agent key. This fixes the
> > agent, but is far from ideal. My problem is that there are going to be
> > thousands of agents on thousands of workstations. These workstations
> > are going to have their OS rebuilt a number of times during their life
> > and when my script runs it is going to pick up the existing agent key
> > and apply it. I don’t want to have to have a process from removing the
> > agent from the HIDS server when a station is rebuilt.
>
> > Can someone help?
>
> > ------------------Additional Detail
> > --------------------------------------------------------------------
> > [r...@testlin tmp]# ossec-control status
> > ossec-monitord is running...
> > ossec-logcollector is running...
> > ossec-remoted is running...
> > ossec-syscheckd is running...
> > ossec-analysisd is running...
> > ossec-maild is running...
> > ossec-execd is running...
>
> > [r...@testlin /]# ossec-analysisd -V
>
> > OSSEC HIDS v2.2 - Trend Micro Inc.
>
> > This program is free software; you can redistribute it and/or modify
> > it under the terms of the GNU General Public License (version 3) as
> > published by the Free Software Foundation. For more details, go to
> >http://www.ossec.net/main/license/
>
> > [r...@testlin /]# cat /etc/ossec-init.conf
> > DIRECTORY="/var/ossec"
> > VERSION="v2.2"
> > DATE="Wed Sep 23 12:12:59 BST 2009"
> > TYPE="server"
>
> > [r...@testlin /]# cat /var/ossec/etc/ossec.conf
> > <ossec_config>
> >  <global>
> >    <email_notification>yes</email_notification>
> >    <email_to>[email protected]</email_to>
> >    <smtp_server>localhost</smtp_server>
> >    <email_from>[email protected]</email_from>
> >  </global>
>
> >  <rules>
> >    <include>rules_config.xml</include>
> >    <include>pam_rules.xml</include>
> >    <include>sshd_rules.xml</include>
> >    <include>telnetd_rules.xml</include>
> >    <include>syslog_rules.xml</include>
> >    <include>arpwatch_rules.xml</include>
> >    <include>symantec-av_rules.xml</include>
> >    <include>symantec-ws_rules.xml</include>
> >    <include>pix_rules.xml</include>
> >    <include>named_rules.xml</include>
> >    <include>smbd_rules.xml</include>
> >    <include>vsftpd_rules.xml</include>
> >    <include>pure-ftpd_rules.xml</include>
> >    <include>proftpd_rules.xml</include>
> >    <include>ms_ftpd_rules.xml</include>
> >    <include>ftpd_rules.xml</include>
> >    <include>hordeimp_rules.xml</include>
> >    <include>roundcube_rules.xml</include>
> >    <include>wordpress_rules.xml</include>
> >    <include>vpopmail_rules.xml</include>
> >    <include>vmpop3d_rules.xml</include>
> >    <include>courier_rules.xml</include>
> >    <include>web_rules.xml</include>
> >    <include>apache_rules.xml</include>
> >    <include>mysql_rules.xml</include>
> >    <include>postgresql_rules.xml</include>
> >    <include>ids_rules.xml</include>
> >    <include>squid_rules.xml</include>
> >    <include>firewall_rules.xml</include>
> >    <include>cisco-ios_rules.xml</include>
> >    <include>netscreenfw_rules.xml</include>
> >    <include>sonicwall_rules.xml</include>
> >    <include>postfix_rules.xml</include>
> >    <include>sendmail_rules.xml</include>
> >    <include>imapd_rules.xml</include>
> >    <include>mailscanner_rules.xml</include>
> >    <include>ms-exchange_rules.xml</include>
> >    <include>racoon_rules.xml</include>
> >    <include>vpn_concentrator_rules.xml</include>
> >    <include>spamd_rules.xml</include>
> >    <include>msauth_rules.xml</include>
> >    <include>mcafee_av_rules.xml</include>
> >    <include>trend-osce_rules.xml</include>
> >    <!-- <include>policy_rules.xml</include> -->
> >    <include>zeus_rules.xml</include>
> >    <include>solaris_bsm_rules.xml</include>
> >    <include>vmware_rules.xml</include>
> >    <include>ms_dhcp_rules.xml</include>
> >    <include>asterisk_rules.xml</include>
> >    <include>ossec_rules.xml</include>
> >    <include>attack_rules.xml</include>
> >    <include>local_rules.xml</include>
> >  </rules>
>
> >  <syscheck>
> >    <!-- Frequency that syscheck is executed - default to every 22
> > hours -->
> >    <frequency>79200</frequency>
>
> >    <!-- Directories to check  (perform all possible verifications) --
>
> >    <directories check_all="yes">/etc,/usr/bin,/usr/sbin</directories>
> >    <directories check_all="yes">/bin,/sbin</directories>
>
> >    <!-- Files/directories to ignore -->
> >    <ignore>/etc/mtab</ignore>
> >    <ignore>/etc/mnttab</ignore>
> >    <ignore>/etc/hosts.deny</ignore>
> >    <ignore>/etc/mail/statistics</ignore>
> >    <ignore>/etc/random-seed</ignore>
> >    <ignore>/etc/adjtime</ignore>
> >    <ignore>/etc/httpd/logs</ignore>
> >    <ignore>/etc/utmpx</ignore>
> >    <ignore>/etc/wtmpx</ignore>
> >    <ignore>/etc/cups/certs</ignore>
> >    <ignore>/etc/dumpdates</ignore>
> >    <ignore>/etc/svc/volatile</ignore>
>
> >    <!-- Windows files to ignore -->
> >    <ignore>C:\WINDOWS/System32/LogFiles</ignore>
> >    <ignore>C:\WINDOWS/Debug</ignore>
> >    <ignore>C:\WINDOWS/WindowsUpdate.log</ignore>
> >    <ignore>C:\WINDOWS/iis6.log</ignore>
> >    <ignore>C:\WINDOWS/system32/wbem/Logs</ignore>
> >    <ignore>C:\WINDOWS/system32/wbem/Repository</ignore>
> >    <ignore>C:\WINDOWS/Prefetch</ignore>
> >    <ignore>C:\WINDOWS/PCHEALTH/HELPCTR/DataColl</ignore>
> >    <ignore>C:\WINDOWS/SoftwareDistribution</ignore>
> >    <ignore>C:\WINDOWS/Temp</ignore>
> >    <ignore>C:\WINDOWS/system32/config</ignore>
> >    <ignore>C:\WINDOWS/system32/spool</ignore>
> >    <ignore>C:\WINDOWS/system32/CatRoot</ignore>
> >  </syscheck>
>
> >  <rootcheck>
> >    <rootkit_files>/var/ossec/etc/shared/rootkit_files.txt</
> > rootkit_files>
> >    <rootkit_trojans>/var/ossec/etc/shared/rootkit_trojans.txt</
> > rootkit_trojans>
> >    <system_audit>/var/ossec/etc/shared/system_audit_rcl.txt</
> > system_audit>
> >    <system_audit>/var/ossec/etc/shared/cis_debian_linux_rcl.txt</
> > system_audit>
> >    <system_audit>/var/ossec/etc/shared/cis_rhel_linux_rcl.txt</
> > system_audit>
> >    <system_audit>/var/ossec/etc/shared/cis_rhel5_linux_rcl.txt</
> > system_audit>
> >  </rootcheck>
>
> >  <global>
> >    <white_list>127.0.0.1</white_list>
> >    <white_list>^localhost.localdomain$</white_list>
> >    <white_list>208.67.222.222</white_list>
> >    <white_list>216.185.111.10</white_list>
> >  </global>
>
> >  <remote>
> >    <connection>syslog</connection>
> >  </remote>
>
> >  <remote>
> >  
>
> ...
>
> read more »

Reply via email to