ossec send not every alert

82 views
Skip to first unread message

Oleg Makarov

unread,
Aug 17, 2015, 6:06:12 AM8/17/15
to ossec-list
I have agent.conf
<agent_config>
<syscheck>
   
<frequency>600</frequency>
   
<alert_new_files>yes</alert_new_files>
   
<scan_on_start>no</scan_on_start>
   
<auto_ignore>no</auto_ignore>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/etc,/usr/bin,/usr/sbin</directories>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/bin,/sbin</directories>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/usr/local/sbin</directories>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/usr/local/bin</directories>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/var/www</directories>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/boot,/root</directories>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/opt/</directories>
</syscheck>
<rootcheck>
   
<rootkit_files>/var/ossec/etc/shared/rootkit_files.txt</rootkit_files>
   
<rootkit_trojans>/var/ossec/etc/shared/rootkit_trojans.txt</rootkit_trojans>
</rootcheck>
</agent_config>

I see that md5sum on agent and master are matched.
And in alerts.log I see that something changing like:
** Alert 1439801053.7257075: mail  - ossec,syscheck,
2015 Aug 17 11:44:13 (***) 192.168.95.11->syscheck
Rule: 552 (level 7) -> 'Integrity checksum changed again (3rd time).'
Integrity checksum changed for: '/etc/resolv.conf'
Size changed from '69' to '282'
Old md5sum was: '92afcc2863f403d86fe4befc8c54a0be'
New md5sum is : '71bc9f207c1f1a427d130647c1c608fb'
Old sha1sum was: '54dfdd362b1f2c060b2f250e15052078f1670af7'
New sha1sum is : 'e7a70a9a56d5f120cb4286ff416089e8f3bccf83'
But there is no email for this alert. Sometime I received it, sometimes not.
What I 'm doing wrong?
Master config:
<ossec_config>
 
<global>
   
<email_notification>yes</email_notification>
   
<email_to>it2@*.com</email_to>
   
<smtp_server>mail2.*.com</smtp_server>
   
<email_from>ossecmail@*.com</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>cimserver_rules.xml</include>
   
<include>vpopmail_rules.xml</include>
   
<include>vmpop3d_rules.xml</include>
   
<include>courier_rules.xml</include>
   
<include>web_rules.xml</include>
   
<include>web_appsec_rules.xml</include>
   
<include>apache_rules.xml</include>
   
<include>nginx_rules.xml</include>
   
<include>php_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>dovecot_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>ms-se_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>openbsd_rules.xml</include>
   
<include>clam_av_rules.xml</include>
   
<include>dropbear_rules.xml</include>
   
<include>local_rules.xml</include>
 
</rules>


 
<syscheck>
   
<!-- Frequency that syscheck is executed - default to every 22 hours -->
   
<frequency>300</frequency>


   
<!-- Directories to check  (perform all possible verifications) -->
   
<directories report_changes="yes" check_all="yes" realtime="yes">/etc,/usr/bin,/usr/sbin</directories>
   
<directories report_changes="yes" check_all="yes" realtime="yes">/bin,/sbin</directories>


   
<alert_new_files>yes</alert_new_files>


   
<!-- Files/directories to ignore -->
   
<ignore>/var/log/nginx</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/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>192.168.198.100</white_list>
   
<white_list>192.168.202.52</white_list>
   
<white_list>8.8.8.8</white_list>
 
</global>


 
<remote>
   
<connection>secure</connection>
 
</remote>


 
<alerts>
   
<log_alert_level>1</log_alert_level>
   
<email_alert_level>7</email_alert_level>
 
</alerts>


 
<command>
   
<name>host-deny</name>
   
<executable>host-deny.sh</executable>
   
<expect>srcip</expect>
   
<timeout_allowed>yes</timeout_allowed>
 
</command>


 
<command>
   
<name>firewall-drop</name>
   
<executable>firewall-drop.sh</executable>
   
<expect>srcip</expect>
   
<timeout_allowed>yes</timeout_allowed>
 
</command>


 
<command>
   
<name>disable-account</name>
   
<executable>disable-account.sh</executable>
   
<expect>user</expect>
   
<timeout_allowed>yes</timeout_allowed>
 
</command>


 
<command>
   
<name>restart-ossec</name>
   
<executable>restart-ossec.sh</executable>
   
<expect></expect>
 
</command>




 
<command>
   
<name>route-null</name>
   
<executable>route-null.sh</executable>
   
<expect>srcip</expect>
   
<timeout_allowed>yes</timeout_allowed>
 
</command>




 
<!-- Active Response Config -->
 
<active-response>
   
<!-- This response is going to execute the host-deny
       - command for every event that fires a rule with
       - level (severity) >= 6.
       - The IP is going to be blocked for  600 seconds.
      -->

   
<command>host-deny</command>
   
<location>local</location>
   
<level>6</level>
   
<timeout>600</timeout>
 
</active-response>


 
<active-response>
   
<!-- Firewall Drop response. Block the IP for
       - 600 seconds on the firewall (iptables,
       - ipfilter, etc).
      -->

   
<command>firewall-drop</command>
   
<location>local</location>
   
<level>6</level>
   
<timeout>600</timeout>
 
</active-response>


 
<!-- Files to monitor (localfiles) -->


 
<localfile>
   
<log_format>syslog</log_format>
   
<location>/var/log/messages</location>
 
</localfile>


 
<localfile>
   
<log_format>syslog</log_format>
   
<location>/var/log/auth.log</location>
 
</localfile>


 
<localfile>
   
<log_format>syslog</log_format>
   
<location>/var/log/syslog</location>
 
</localfile>


 
<localfile>
   
<log_format>syslog</log_format>
   
<location>/var/log/mail.info</location>
 
</localfile>


 
<localfile>
   
<log_format>syslog</log_format>
   
<location>/var/log/dpkg.log</location>
 
</localfile>


 
<localfile>
   
<log_format>command</log_format>
   
<command>df -h</command>
 
</localfile>


 
<localfile>
   
<log_format>full_command</log_format>
   
<command>netstat -tan |grep LISTEN |grep -v 127.0.0.1 | sort</command>
 
</localfile>


 
<localfile>
   
<log_format>full_command</log_format>
   
<command>last -n 5</command>
 
</localfile>
</ossec_config>



Oleg Makarov

unread,
Aug 17, 2015, 10:38:06 AM8/17/15
to ossec-list
I'm trying to touch some file, but there is no alert about new file (

понедельник, 17 августа 2015 г., 13:06:12 UTC+3 пользователь Oleg Makarov написал:
...

dan (ddp)

unread,
Aug 17, 2015, 11:31:14 AM8/17/15
to ossec...@googlegroups.com
On Mon, Aug 17, 2015 at 9:20 AM, Oleg Makarov <theoleg...@gmail.com> wrote:
> I'm trying to touch some file, but there is no alert about new file (
>

Did you set rule 554 to a higher level than 0?
> --
>
> ---
> You received this message because you are subscribed to the Google Groups
> "ossec-list" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to ossec-list+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Oleg Makarov

unread,
Aug 18, 2015, 4:16:18 AM8/18/15
to ossec-list
In local_rules
<rule id="554" level="10" overwrite="yes">
<category>ossec</category>
<decoded_as>syscheck_new_entry</decoded_as>
<description>File added to the system.</description>
<group>syscheck,</group>
</rule>


понедельник, 17 августа 2015 г., 18:31:14 UTC+3 пользователь dan (ddpbsd) написал:

dan (ddp)

unread,
Aug 18, 2015, 8:36:43 AM8/18/15
to ossec...@googlegroups.com
On Tue, Aug 18, 2015 at 4:15 AM, Oleg Makarov <theoleg...@gmail.com> wrote:
> In local_rules
> <rule id="554" level="10" overwrite="yes">
> <category>ossec</category>
> <decoded_as>syscheck_new_entry</decoded_as>
> <description>File added to the system.</description>
> <group>syscheck,</group>
> </rule>
>

After making this change, did you restart the OSSEC processes?
Did syscheck complete a scan after creating the file you wanted it to detect?

Oleg Makarov

unread,
Aug 19, 2015, 6:01:27 AM8/19/15
to ossec-list
Yes, i restart ossec.
For example!
My server has 192.168.190.20 ip address, my client(logstashnode1) has 192.168.198.211 ip address.
Look by timestamp.
On client:
root@logstash-node1:~# apt-get install tcpdump

On server:
And there is no email alert.
Next I change a file and 
root@logstash-node1:~# tcpdump host 192.168.190.20
tcpdump
: verbose output suppressed, use -v or -vv for full protocol decode
listening on eth1
, link-type EN10MB (Ethernet), capture size 65535 bytes
09:23:22.302340 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 329
09:25:28.437477 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 361
09:25:28.439484 IP 192.168.190.20.1514 > 192.168.198.211.46259: UDP, length 73
09:25:32.396813 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 89
w09
:27:42.527598 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 569
09:28:08.271268 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 89
09:29:25.883934 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 129
09:29:52.660490 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 513
09:30:56.247744 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 137
09:31:16.422701 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 137
09:32:02.785489 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 217
w09
:33:08.820036 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 137
09:34:12.913942 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 185
09:34:14.284525 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 145
09:34:16.627091 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 137
09:34:38.638144 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 89
09:34:38.638292 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 81
09:35:28.690221 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 281
09:35:28.692716 IP 192.168.190.20.1514 > 192.168.198.211.46259: UDP, length 73
09:36:23.042208 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 185
09:38:33.163604 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 441
09:40:43.291763 IP 192.168.198.211.46259 > 192.168.190.20.1514: UDP, length 409

on client:
w2015/08/19 09:28:08 ossec-syscheckd: INFO: Starting syscheck scan.
2015/08/19 09:34:38 ossec-syscheckd: INFO: Ending syscheck scan.

and no alert on email!

What is going on? :(

вторник, 18 августа 2015 г., 15:36:43 UTC+3 пользователь dan (ddpbsd) написал:

dan (ddp)

unread,
Aug 19, 2015, 9:31:31 AM8/19/15
to ossec...@googlegroups.com
Is the new file in the syscheck db (/var/ossec/queue/syscheck/SOMETHING)?

Oleg Makarov

unread,
Aug 20, 2015, 5:08:47 AM8/20/15
to ossec-list
I see this
-rw-r-----  1 ossec ossec 350K Aug 19 09:33 (logstashnode1) 192.168.198.211->syscheck



среда, 19 августа 2015 г., 16:31:31 UTC+3 пользователь dan (ddpbsd) написал:

dan (ddp)

unread,
Aug 20, 2015, 8:26:53 AM8/20/15
to ossec...@googlegroups.com


On Aug 20, 2015 5:08 AM, "Oleg Makarov" <theoleg...@gmail.com> wrote:
>
> I see this
> -rw-r-----  1 ossec ossec 350K Aug 19 09:33 (logstashnode1) 192.168.198.211->syscheck
>
>

That file is a text file, see if the file you created is listed in it.

Oleg Makarov

unread,
Aug 20, 2015, 10:22:04 AM8/20/15
to ossec-list
+++949728:33261:0:0:4d0c26d748241dd469466b303317c43b:f0ab007d37cf65a28db32c8e6fbd79b2448dd2cc !1439965988 /usr/sbin/tcpdump



четверг, 20 августа 2015 г., 15:26:53 UTC+3 пользователь dan (ddpbsd) написал:

Oleg Makarov

unread,
Aug 20, 2015, 10:22:04 AM8/20/15
to ossec-list
Yeap!
+++8:33188:0:0:5a240539db1c79fbb90dbe9350ac9500:31ff3921d12f0a0139ddb926e8474970347fde60 !1439823529 /etc/xyu
+++3:33188:0:0:f6255bb01c648fe967714d52a89e8e9c:dcdc24e139db869eb059c9355c89c382de15b987 !1439965765 /etc/test2




четверг, 20 августа 2015 г., 15:26:53 UTC+3 пользователь dan (ddpbsd) написал:

dan (ddp)

unread,
Aug 20, 2015, 10:52:25 AM8/20/15
to ossec...@googlegroups.com
On Thu, Aug 20, 2015 at 10:21 AM, Oleg Makarov <theoleg...@gmail.com> wrote:
> Yeap!
> +++8:33188:0:0:5a240539db1c79fbb90dbe9350ac9500:31ff3921d12f0a0139ddb926e8474970347fde60
> !1439823529 /etc/xyu
> +++3:33188:0:0:f6255bb01c648fe967714d52a89e8e9c:dcdc24e139db869eb059c9355c89c382de15b987
> !1439965765 /etc/test2
>

Ok, the next step is to check /var/ossec/logs/alerts/alerts.log (or
the archives for previous days) for any alerts including those files.
Reply all
Reply to author
Forward
0 new messages