The tl;dr of this article is: It shows how to configure OSSEC, a host-based intrusion detection system, to not send email alerts whenever IPTables rejects or denies a traffic source.

The more detailed form follows.

So I use OSSEC to monitor and protect my cloud servers, which gives me a lot of confidence because OSSEC keeps me informed about what’s hitting my servers and what’s happening inside them.

In my setup, keeps me informed means that OSSEC sends me email alerts whenever something it’s been configured to monitor is triggered. And because I have active response enabled, with IPTables as the firewall application, OSSEC, by default, sends out alerts whenever IPTables denies a traffic source.

The content of such alerts, which are OSSEC level 2 alerts, take this form:

OSSEC HIDS Notification.
2015 Feb 26 20:33:35

Received From: container->/var/log/syslog
Rule: 1002 fired (level 2) -> "Unknown problem somewhere in the system."
Portion of the log(s):

Feb 26 20:33:34 container kernel: [455208.047536] iptables denied: IN=eth0 OUT= MAC=04:01:3f:81:38:01:.....:08:30:08:00 SRC= DST= LEN=40 TOS=0x00 PREC=0x00 TTL=247 ID=54321 PROTO=TCP SPT=51660 DPT=11211 WINDOW=65535 RES=0x00 SYN URGP=0


That, in a nut shell, is OSSEC informing me that the firewall denied a (potentially) bad guy. The problem: There can be at least a hundred of such alerts daily. And that’s from one server. From more than one server, it can get overwhelming. If I were using a web interface to manage the alerts, there’d be nothing to worry about, but I’m not.

Related Post:  Contributing with Git

Ideally in OSSEC, a rule like 1002, which has a level set to 2, will not result in an email alert being sent. That’s because of this default settings in ossec.conf, OSSEC’s configuration file.


email_alert_level is the “inimum alert level to send e-mail notifications”. However, rule 1002 has an email alert override in its definition, which goes like this:

    Unknown problem somewhere in the system.

So because of the alert_by_email option, OSSEC will alert when rule 1002 is triggered, even though its level is lower than the default email alert level. In its rule definition, $BAD_WORDS is a variable which contains this listing:

core_dumped|failure|error|attack|bad |illegal |denied|refused|unauthorized|fatal|failed|Segmentation Fault|Corrupted

The presence of denied in that variable is the reason OSSEC sends an alert when IPTables denies a traffic source with bad intentions. There are more than one solution to prevent OSSEC from alerting on IPTables denied messages but the best (I think) is to create a rule based on 1002 that does not send email alerts on such messages.

And here’s how it’s done: Define a custom rule that overrides part of rule 1002 that’s of interest.

In OSSEC, custom rules are defined in local_rules.xml (in /var/ossec/rules directory). So the plan is to create a variable in that file that contains the word(s) that I want to pass to my custom rule. Here’s the variable definition.


Yep, just one word. And the custom rule it’s used in is:

        Ignored IPTables deny messages.

After the variable and the custom rule are in place, a restart of OSSEC is, of course, required. Once that final step of the process is completed, no more level 2 alerts related to IPTables denied messages.


Share on facebook
Share on twitter
Share on pinterest
Share on linkedin

Hola! Did you notice that LinuxBSDos.com no longer runs network ads?  Yep, no more ads from the usual suspects that track you across the Internet.  But since  I still need to pay to keep the site running, feel free to make a small donation by PayPal.

Subscribe for updates. Trust me, no spam!

Mailchimp Signup Form

Sponsored links

1. Attend Algorithm Conference, a top AI and ML event for 2020.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.

One Response

Leave a Reply

Your email address will not be published. Required fields are marked *

Get the latest

On social media
Via my newsletter
Mailchimp Signup Form

Partner links

1. Attend Algorithm Conference, a top AI and ML event for 2021.
2. Reasons to use control panel for your server.
3. DHgate Computers Electronics, Cell Phones & more.
Hacking, pentesting distributions

Linux Distributions for Hacking

Experts use these Linux distributions for hacking, digital forensics, and pentesting.


The authors of these books are confirmed to speak during

Algorithm Conference

T-minus AI

Author was the first chairperson of AI for the U.S. Air Force.

The case for killer robots

Author is the Director of the Center for Natural and Artificial Intelligence.

Why greatness cannot be planned

Author works on AI safety as a Senior Research Scientist at Uber AI Labs.

Anastasia Marchenkova

An invitation from Anastasia Marchenkova

Hya, after stints as a quantum researcher at Georgia Tech Quantum Optics & Quantum Telecom Lab, and the University of Maryland Joint Quantum Institute, I’m now working on superconducting qubit quantum processors at Bleximo. I’ll be speaking during Algorithm Conference in Austin, Texas, July 16 – 18, 2020. Meet me there and let’s chat about progress and hype in quantum computing.