<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Zen Dzign &#187; Security</title>
	<atom:link href="http://www.zendzign.com/category/security/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.zendzign.com</link>
	<description>The official ZZ Servers Blog - Visit http://www.zzservers.com for your business hosting needs.</description>
	<lastBuildDate>Thu, 26 Jan 2012 05:59:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>ZZ Servers Managing Partner to speak at #Shmoocon #Firetalks</title>
		<link>http://www.zendzign.com/2012/01/zz-servers-managing-partner-to-speak-at-shmoocon-firetalks/</link>
		<comments>http://www.zendzign.com/2012/01/zz-servers-managing-partner-to-speak-at-shmoocon-firetalks/#comments</comments>
		<pubDate>Thu, 26 Jan 2012 05:57:21 +0000</pubDate>
		<dc:creator>David M. Zendzian</dc:creator>
				<category><![CDATA[Announcements]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Alarm]]></category>
		<category><![CDATA[Firetalk]]></category>
		<category><![CDATA[Presentation]]></category>
		<category><![CDATA[Shmoocon]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=266</guid>
		<description><![CDATA[ZZ Servers Managing Partner, David M. Zendzian (@dmz006) will be presenting How Do You Know Your Colo Isn’t “Inside” Your Cabinet, A Simple Alarm Using Teensy” which is based on a prior blog post. Shmoocon Firetalks are hosted by the NOVAHackers Who: ShmooCon/NovaInfosecPortal.com What: ShmooCon 2012 FireTalks When: 1/27 to 1/28/2011 Where: Washington Hilton Hotel [...]]]></description>
			<content:encoded><![CDATA[<p>ZZ Servers Managing Partner, David M. Zendzian (@dmz006) will be presenting How Do You Know Your Colo Isn’t “Inside” Your Cabinet, A Simple Alarm Using Teensy” which is based on a prior blog <a title="Server cabinet door alarm" href="http://www.zendzign.com/2012/01/home-brew-server-cabinet-door-alarm/">post</a>.<br />
<span id="more-266"></span><br />
Shmoocon Firetalks are hosted by the <a title="NOVASec" href="http://www.novainfosecportal.com/2011/12/13/shmoocon-2012-firetalks/">NOVAHackers </a></p>
<p>Who: ShmooCon/NovaInfosecPortal.com<br />
What: ShmooCon 2012 FireTalks<br />
When: 1/27 to 1/28/2011<br />
Where: Washington Hilton Hotel (1919 Connecticut Avenue, NW Washington, DC 20009)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2012/01/zz-servers-managing-partner-to-speak-at-shmoocon-firetalks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Server cabinet door alarm</title>
		<link>http://www.zendzign.com/2012/01/home-brew-server-cabinet-door-alarm/</link>
		<comments>http://www.zendzign.com/2012/01/home-brew-server-cabinet-door-alarm/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 03:08:38 +0000</pubDate>
		<dc:creator>David M. Zendzian</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[arduino]]></category>
		<category><![CDATA[embedded]]></category>
		<category><![CDATA[physical security]]></category>
		<category><![CDATA[teensy]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=220</guid>
		<description><![CDATA[The first step in securing servers is to ensure that they are physically as secure as possible and and then monitored for unauthorized access  Many times when setting up servers in a small office or co-location facility many people have their systems in a locking cabinet within a moderately secured physical building.  However a determined [...]]]></description>
			<content:encoded><![CDATA[<p>The first step in securing servers is to ensure that they are physically as secure as possible and and then monitored for unauthorized access  Many times when setting up servers in a small office or co-location facility many people have their systems in a locking cabinet within a moderately secured physical building.  However a <a title="Tiger Team" href="http://video.google.com/videoplay?docid=5642547759793319840">determined attacker</a> can usually bypass many physical controls so adding as many layers and monitoring helps can help both to thwart an attacker or be used to monitor for authorized equipment access through change management filtering on your <a title="Zabbix Maintenance Mode" href="http://www.zabbix.com/documentation/1.8/manual/maintenance_mode_for_gui">monitoring and alerting system</a>.</p>
<p><span id="more-220"></span>One problem with the small office or colo environment is there are very few affordable solutions that can be used to monitor for authorized and unauthorized access.  To solve this problem, ZZ Servers has implemented a cabinet monitoring solution that is able to not only monitor for cabinet door entry but also has the ability to have temperature and humidity sensors (which we do not actually do in this initial proof of concept).</p>
<p>The cabinet door alarm is based on a <a title="PJRC Teensy" href="http://pjrc.com/store/teensy.html">teensy 2.0</a> USB device that uses digital inputs to determine if magnetic alarm door switches are open or closed and then monitor their status with any standard monitoring system through a USB connection to the Teensy device. The teensy can be ordered from <a title="PJRC Teensy" href="http://pjrc.com/store/teensy.html">PJRC</a> for $16. The LED, Resistor and remaining components can be purchased from <a title="Jameco" href="http://www.jameco.com">Jameco</a>, Amazon, Home Depot, Radio Shack or any other similar store.</p>
<p>The teensy is connected through USB to a linux server in the cabinet that runs an application to query the status of each sensor. The teensy provides a +5V pin that will be connected to a 10k ohm resistor which is then connected to the GND with one connection to each of 4 input pins for the door sensor and an LED connected to interface 11.</p>
<p><a href="http://www.zendzign.com/wp-content/uploads/2012/01/zz-cabinetalarm.jpg"><img class="alignnone size-full wp-image-221" title="zz-cabinetalarm-teensy-layout" src="http://www.zendzign.com/wp-content/uploads/2012/01/zz-cabinetalarm.jpg" alt="ZZ Servers Homebrew Teensy Cabinet Alarm Layout" width="225" height="227" /></a></p>
<p>The current design is for only 4 alarm switches; but there is no reason the other inputs can&#8217;t be used. If additional inputs are used then the associated firmware and software programs will need to be updated to reflect the number of interfaces.</p>
<p>This design also expects there to be a closed circuit on all monitored ports otherwise an alarm will be raised. A simple closed loop will work for any alarm switches not installed.</p>
<p>Once the circuit is assembled the firmware needs to be uploaded to the teensy. The firmware used is based on the arduino support for Teensy that can be <a title="Teensy Development Download" href="http://pjrc.com/teensy/td_download.html">downloaded</a>.  The steps to setup the Teensy/Arduino development environment are found on the page and need to be followed to allow for proper aduino sketch to be built and loaded onto the teensy flash.</p>
<ul>
<li><a>Extract Arduino Software</a></li>
<li>Install <a title="Teensy UDEV Rules" href="http://pjrc.com/teensy/49-teensy.rules">49-teensy.rules</a> in /etc/udev/rules.d (see below for contents of this file)</li>
<li><a title="Teensy Duino Download" href="http://www.pjrc.com/teensy/td_download.html">Download</a> &amp; Run teensy duino installer. Examples/samples are not needed unless doing future development</li>
</ul>
<p>Once the development tools are installed:</p>
<ul>
<li>Start the arduino IDE (found in arduino software extract)</li>
<li>Connect the teensy usb interface</li>
<li>Set board type to Teensy 2.0 (Tools/Board/Teensy 2.0)</li>
<li>Load the code (below)</li>
<li>Verify (checkbox in IDE) the code</li>
<li>Upload (right arrow in IDE) the HEX firmware</li>
</ul>
<p><strong>Teensy Firmware:</strong><br />
The firmware has 3 main sections; the Header where the various variables are defined that are used within the program, The setup function which runs when the teensy is powered on (plugged into USB) and then the loop which is executed after setup executing the designed function.</p>
<p>When the teensy boots, it load the setup function which initializes the device allowing for INPUT_PULLUP functionality for the 4 pins used for the alarm. This creates the alert when the switch is opened. The setup then initializes the USB serial device at 38400 8n1 and configures the LED output PIN and makes sure the LED is off.</p>
<p>The loop function is the core of the firmware. This is the function that the teensy executes over and over. In this function the first thing to do is read each of the alarm interfaces and if there is an alert flag it so we can be sure to blink the LED. Next the loop will see if there are any requests on the serial port, which will come from the serial program further down in this post. If there is input from the serial interface, the loop confirms it is a valid request [1,2,3,4] and then prints back on the serial interface a simple message showing the status of the serial ports.</p>
<p>Finally the loop ends by running the BlinkLED function if there is an alarm otherwise if the LED is on be sure to turn it off.</p>
<p>The BlinkLED function works by using a nice variable type provided by the Teensy &#8220;elapsedMillis&#8221; which creates a timer that is used to trace the time since the variable was created. Using this variable if it has been one second (1000ms) then reset the timer and if the LED is on turn it off, otherwise turn it on.<br />
<em>zz_alarm0.ino</em></p><pre class="crayon-plain-tag"><code>// Header Section
int ledPin =&nbsp; 11;
int ledon = 0;
int ALARM_1 = 1;
int ALERT_1 = 0;
int ALARM_2 = 2;
int ALERT_2 = 0;
int ALARM_3 = 3;
int ALERT_3 = 0;
int ALARM_4 = 4;
int ALERT_4 = 0;
int alarmnow = 0;
char alarmcheck = ' ';
elapsedMillis sinceAlarm;
//End Header Section

// The setup() method runs once, when the sketch starts
void setup()&nbsp;&nbsp; {
     pinMode(ALARM_1, INPUT_PULLUP);
     pinMode(ALARM_2, INPUT_PULLUP);
     pinMode(ALARM_3, INPUT_PULLUP);
     pinMode(ALARM_4, INPUT_PULLUP);
     Serial.begin(38400);
     pinMode(ledPin, OUTPUT);
     digitalWrite(ledPin, LOW);
}

// the loop() method runs over and over again, checking for events
void loop()&nbsp;&nbsp; {
     alarmnow = 0;
     alarmcheck = ' ';

     ALERT_1 = digitalRead(ALARM_1);
     ALERT_2 = digitalRead(ALARM_2);
     ALERT_3 = digitalRead(ALARM_3);
     ALERT_4 = digitalRead(ALARM_4);

     if (ALERT_1 || ALERT_2 || ALERT_3 || ALERT_4) {
          alarmnow = 1;
     }

     if (Serial.available()) {
          alarmcheck = Serial.read();
     }

     switch (alarmcheck) {
          case '1':
               if (ALERT_1) {
                    Serial.println(&quot;1:1&quot;);
               } else {
                    Serial.println(&quot;1:0&quot;);
               }
               break;
          case '2':
               if (ALERT_2) {
                    Serial.println(&quot;2:1&quot;);
               } else {
                    Serial.println(&quot;2:0&quot;);
               }
               break;
          case '3':
               if (ALERT_3) {
                    Serial.println(&quot;3:1&quot;);
               } else {
                    Serial.println(&quot;3:0&quot;);
               }
               break;
          case '4':
               if (ALERT_4) {
                    Serial.println(&quot;4:1&quot;);
               } else {
                    Serial.println(&quot;4:0&quot;);
               }
               break;
          case ' ':
               break;
          default:
               Serial.println(&quot;X:1&quot;);
               break;
     }

     if (alarmnow) {
          BlinkLED();
     } else if (ledon) {
          digitalWrite(ledPin, LOW);
     }
}

void BlinkLED() {
     if (sinceAlarm &gt;= 1000) {
          sinceAlarm = sinceAlarm - 1000;
          if (ledon) {
               ledon = 0;
               digitalWrite(ledPin, LOW);
          } else {
               ledon = 1;
               digitalWrite(ledPin, HIGH);
          }
     }
}</code></pre><p>Once the firmware is loaded onto the teensy and all the switches are in place the linux system that will interface with the alarm needs to have a udev rule created that will allow the usbSerial interface to function.<br />
<strong>Linux UDEV rules</strong><em><br />
/etc/udev/rules/49-teensy.rules</em></p>
<blockquote><p>SUBSYSTEMS==&#8221;usb&#8221;, ATTRS{idVendor}==&#8221;16c0&#8243;, ATTRS{idProduct}==&#8221;04[789]?&#8221;, MODE:=&#8221;0666&#8243; KERNEL==&#8221;ttyACM*&#8221;, ATTRS{idVendor}==&#8221;16c0&#8243;, ATTRS{idProduct}==&#8221;04[789]?&#8221;, SYMLINK+=&#8221;ttyUSB00%n&#8221;, MODE:=&#8221;0666&#8243;, ENV{ID_MM_DEVICE_IGNORE}=&#8221;1&#8243;</p></blockquote>
<p>The host that connects to the ZZ-Teensy-Alarm needs to be able to query to the teensy on the USB Serial device to determine the status of any of the configured alarm switch inputs.  This is accomplished using a C program that will open the USB serial device presented by the teensy and write/read to the running firmware queries on port status.</p>
<p>The alarm-monitor application is a very simple C application. After initializing some variables it performs a quick check on the number of command line arguments, providing help and exiting if it is not correct. Next the application confirms that the query provided on the command line is a valid interface to query. Alarm-monitor then initializes the specified serial device to 38400 8n1 and writes out the query to the teensy serial device. Once the query is written the application will wait for a response for 10 seconds after which the appropriate response is sent back to the user.<br />
<strong>Linux Command line zz-teensy-alarm query:</strong><br />
<em>alarm-monitor.c</em></p><pre class="crayon-plain-tag"><code>#include &lt;string.h&gt;
#include &lt;stdlib.h&gt;
#include &lt;stdio.h&gt;
#include &lt;unistd.h&gt;
#include &lt;fcntl.h&gt;
#include &lt;termios.h&gt;
#include &lt;time.h&gt;
 
int main(int argc,char** argv)
{
        struct termios tio;
        struct termios stdio;
        time_t start,now;
        int diff;
        int tty_fd;
        fd_set rdset;
        struct flock fl;
 
        unsigned char c=' ';
 
        if (argc&lt;3) {
          printf(&quot;%s /dev/ttyUSB000 [1|2|3|4]\n\n&quot;,argv[0]);
          exit(1);
        }
 
        switch (argv[2][0]) {
          case '1':
            break;
          case '2':
            break;
          case '3':
            break;
          case '4':
            break;
          default:
            printf(&quot;Can only query alarms 1, 2, 3 or 4\n\n&quot;);
            exit(1);
            break;
        }

        fl.l_type   = F_WRLCK;  /* F_RDLCK, F_WRLCK, F_UNLCK    */
        fl.l_whence = SEEK_SET; /* SEEK_SET, SEEK_CUR, SEEK_END */
        fl.l_start  = 0;        /* Offset from l_whence         */
        fl.l_len    = 0;        /* length, 0 = to EOF           */
        fl.l_pid    = getpid(); /* our PID                      */

        tty_fd=open(argv[1], O_RDWR | O_NONBLOCK);
        fcntl(tty_fd, F_SETLKW, &amp;fl);

        memset(&amp;tio,0,sizeof(tio));
        tio.c_iflag=0;
        tio.c_oflag=0;
        // 8n1, see termios.h for more information
        tio.c_cflag=CS8|CREAD|CLOCAL;           
        tio.c_lflag=0;
        tio.c_cc[VMIN]=1;
        tio.c_cc[VTIME]=5;
 
        cfsetospeed(&amp;tio,B38400);            
        cfsetispeed(&amp;tio,B38400);           
 
        tcsetattr(tty_fd,TCSANOW,&amp;tio);
  
        write(tty_fd,argv[2],1);

        start = time(NULL);
        now = time(NULL);
        diff = (int)difftime(now,start);
        while ((c != '\n') &amp;&amp; (diff &lt; 10)) {
          if (read(tty_fd,&amp;c,1)&gt;0) {
            write(STDOUT_FILENO,&amp;c,1);
          }
          now = time(NULL);
          diff = (int)difftime(now,start);
        }

        fl.l_type   = F_UNLCK;
        fcntl(tty_fd, F_SETLK, &amp;fl);
        close(tty_fd);

        if (diff &gt;= 10) {
          printf(&quot;X:X\n&quot;);
          exit(1);
        }
        exit(0);
}</code></pre><p><p>
The alarm_monitor application can be compiled with gcc:</p>
<p style="padding-left: 30px;">gcc -o alarm_monitor alarm_monitor.c</p>
<p>alarm_monitor has 2 inputs, the first is the USB device of the ZZ-Teensy-Alarm, the 2nd is the port to be queried (1-4 is hard coded, any additional ports need to be expanded on for alarm_monitor.c and zz_alarm0.ino).</p>
<p>EX:</p>
<p style="padding-left: 30px;">alarm_monitor /dev/ttyUSB000 1<br />
1:0</p>
<p>Would query alarm switch 1 and as this example shows returns the alarm #:status where 0 is OK and 1 is switch open (alarm).</p>
<p>There is a 10 second timeout if ZZ-Teensy-Alarm device isn&#8217;t connected or if there are connectivity issues.  An error code of X:X is returned for any timeout and any query to ports other than 1,2,3,4 return invalid query.</p>
<p><strong>Concept Assembly</strong></p>
<p>The initial design was built using a breadboard and is pictured below:</p>
<div id="attachment_225" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/Zz-teensy-alarm.jpg"><img class="size-medium wp-image-225" title="ZZ Servers Teensy Cabinet Alarm Prototype" src="http://www.zendzign.com/wp-content/uploads/2012/01/Zz-teensy-alarm-300x199.jpg" alt="ZZ Servers Home Brew Server Alarm Concept" width="300" height="199" /></a><p class="wp-caption-text">ZZ Servers Teensy Cabinet Alarm Prototype</p></div>
<p>Once the design was tested a standard radio shack project box was acquired along with a few screw down termination jacks.  These were assembled into the following picture</p>
<div id="attachment_254" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0644.jpg"><img class="size-medium wp-image-254" title="ZZ Cabinet Alarm Prototype - Assembly" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0644-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - Assembly" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - Assembly</p></div>
<div id="attachment_255" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0645.jpg"><img class="size-medium wp-image-255" title="ZZ Cabinet Alarm Prototype - Assembly" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0645-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - Assembly" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - Assembly</p></div>
<p>The final configuration has the usb cable coming out one side, an led on one side and the screw on terminators ready to be connected to magnetic door switches.</p>
<div id="attachment_256" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0650.jpg"><img class="size-medium wp-image-256" title="ZZ Cabinet Alarm Prototype - Assembled" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0650-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - Assembled" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - Assembled</p></div>
<div id="attachment_257" class="wp-caption alignnone" style="width: 310px"><a href="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0651.jpg"><img class="size-medium wp-image-257" title="ZZ Cabinet Alarm Prototype - LED on" src="http://www.zendzign.com/wp-content/uploads/2012/01/IMAG0651-300x179.jpg" alt="ZZ Cabinet Alarm Prototype - LED on" width="300" height="179" /></a><p class="wp-caption-text">ZZ Cabinet Alarm Prototype - LED on</p></div>
<p><strong>Zabbix Integration</strong></p>
<p>Once the alarm is in place it needs to be monitored. Here at ZZ Servers we leverage Zabbix but any system such as Nagios could work as long as they can execute a script for input.</p>
<p>Zabbix monitoring can monitor the status of each door alarm through the configuration of UserParameters.  A full configuration will follow in a future post with templates for items / alerts but for now below is a sample UserParameter for each of the 4 configured alarm monitors:</p>
<p><em>/etc/zabbix/zabbix_agentd.conf</em></p>
<blockquote><p>UserParameter=CB001.0001F,/usr/local/bin/alarm-monitor /dev/ttyUSB000 1|cut -d&#8221;:&#8221; -f 2<br />
UserParameter=CB001.0001B,/usr/local/bin/alarm-monitor /dev/ttyUSB000 2|cut -d&#8221;:&#8221; -f 2<br />
UserParameter=CB001.0002F,/usr/local/bin/alarm-monitor /dev/ttyUSB000 3|cut -d&#8221;:&#8221; -f 2<br />
UserParameter=CB001.0002B,/usr/local/bin/alarm-monitor /dev/ttyUSB000 4|cut -d&#8221;:&#8221; -f 2</p></blockquote>
<p>Details on how to configure the zabbix template including the appropriate items, triggers and alerts will be posted in my next blog post.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2012/01/home-brew-server-cabinet-door-alarm/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OSSEC Daily Reports</title>
		<link>http://www.zendzign.com/2011/06/ossec-daily-reports/</link>
		<comments>http://www.zendzign.com/2011/06/ossec-daily-reports/#comments</comments>
		<pubDate>Mon, 20 Jun 2011 19:05:39 +0000</pubDate>
		<dc:creator>David M. Zendzian</dc:creator>
				<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[HIDS]]></category>
		<category><![CDATA[OSSEC]]></category>
		<category><![CDATA[Reports]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=204</guid>
		<description><![CDATA[As with any user of OSSEC, analyzing and working with the data is the key to successfully managing your environment.  From a prior post you can see we are monitoring events as they occur which is good for catching serious issues as they occur; however, it is not usually the best way to document what [...]]]></description>
			<content:encoded><![CDATA[<p>As with any user of OSSEC, analyzing and working with the data is the key to successfully managing your environment.  From a prior <a title="Zabbix &amp; OSSEC" href="http://www.zendzign.com/2010/04/zabbix-ossec-open-source-compliance-and-security-monitoring/" target="_self">post</a> you can see we are monitoring events as they occur which is good for catching serious issues as they occur; however, it is not usually the best way to document what was identified and track what is being done to correct it.</p>
<p><span id="more-204"></span>Until OSSEC can have a better UI, I have decided to use the built in daily reports to automatically create tickets in our ticket system to be manually reviewed by security engineers documenting the steps taken to resolve what was identified.</p>
<p>In setting up the daily reports google helped me find the v2.5 documentation on the configuration options for daily reports (<a title="ossec.conf" href="http://www.ossec.net/doc/syntax/head_ossec_config.global.html" target="_self">ossec.conf</a>).  Some reports shown in the examples google found show access attempts or file integrity changes (<a title="OSSEC samples" href="http://dcid.me/2010/03/daily-email-reports/" target="_self">examples</a>).  This and other examples were very helpful in providing examples on how OSSEC could handle daily reports.</p>
<p>When setting up daily reports, the first thing to do is determine what variables will determine the report creation and the best way to do this is to use the ossec-reportd to  quickly test the various fields needed to search &amp; create your reports.</p>
<p>For example, say you wanted to get the reports for file integrity changes in the 192.168.1 subnet, you would execute:</p>
<blockquote><p>cat logs/alerts/2011/Jun/ossec-alerts-20.log | bin/ossec-reportsd -f group syscheck -f location 192.168.1</p></blockquote>
<p>Valid ossec-reportd filters include: group, rule, level, location,user, srcip</p>
<p>Now to convert this into a daily report, edit: etc/ossec.conf, and add the following:</p>
<blockquote><p>&lt;reports&gt;<br />
&lt;location&gt;192.168.1.&lt;/location&gt;<br />
&lt;group&gt;syscheck&lt;/group&gt;<br />
&lt;title&gt;Daily OSSEC report: ZZ Syscheck Test Location&lt;/title&gt;<br />
&lt;email_to&gt;support@zzservers.com&lt;/email_to&gt;<br />
&lt;showlogs&gt;yes&lt;/showlogs&gt;<br />
&lt;/reports&gt;</p></blockquote>
<p>Rules can have the following options: group, categories, rule, level, location, srcip, user, title, email_to and showlogs.</p>
<p>The &lt;showlogs&gt; option is not listed on the ossec wiki and other documentation.  I only noticed it while reading through the source code trying to identify why the daily reports were not working for me.  It is a great option and determines whether the reports include or do not include the log items found when creating the report.</p>
<p>You can setup as many &lt;reports&gt;&lt;/reports&gt; as you need to within the ossec_config and they will all be generated when the ossec logs rotate at the change of every day.</p>
<p>However you may want to test your config or run reports without waiting for the automatic run at midnight. For those needing that functionality I have created the attached patch that can be applied within the ossec directory (cd ossec-hids-2.5.1; patch -p1 &lt; ossec-dmz-forcedailyreports.diff).</p>
<p>This patch enables a &#8220;-R&#8221; option to ossec-monitord allowing it to be run from the command line processing all of the defined daily reports.  You may want to include the -d (debug) option if you are having problems or want to see what it is doing.</p>
<p>Please note that the -f (force foreground) is enabled by default when -R is selected.</p>
<p>Also, when researching what was needed for this patch I identified that the outgoing mail did not have 2 \r\n (\r\n\r\n) between the subject and the messages so the patch updates that so messages will be sent cleanly.</p>
<p>I also noticed that when ossec loads up the ossec.conf file it only accepts a-z,A-Z,0-9, &#8211; and _.  I had made the assumption that ossec-reportd used the same input details as ossec-monitord, however after hours of tracing I realized that the ossec.conf file was loaded with the prior mentioned input characters only.  So the config function was updated to allow &#8220;.&#8221; and &#8220;/&#8221; allowing for full neworks and log paths be entered.</p>
<p>Please let me know if I missed anything or if there are problems with my patch.</p>
<p>- David<br />
- dmz</p>
<p><a href="http://www.zendzign.com/wp-content/uploads/2011/06/ossec-dmz-forcedailyreports.diff_.gz">ossec-dmz-forcedailyreports.diff</a></p>
<blockquote><p>diff -Naur -x &#8216;*.a&#8217; -x &#8216;*.o&#8217; ossec-hids-2.5.1/src/config/reports-config.c ossec-hids-2.5.1-manualreports/src/config/reports-config.c<br />
&#8212; ossec-hids-2.5.1/src/config/reports-config.c    2010-10-12 19:17:37.000000000 +0000<br />
+++ ossec-hids-2.5.1-manualreports/src/config/reports-config.c    2011-06-19 04:45:56.000000000 +0000<br />
@@ -30,7 +30,7 @@<br />
if((*mystr &gt;= &#8216;a&#8217; &amp;&amp; *mystr &lt;= &#8216;z&#8217;) ||<br />
(*mystr &gt;= &#8216;A&#8217; &amp;&amp; *mystr &lt;= &#8216;Z&#8217;) ||<br />
(*mystr &gt;= &#8217;0&#8242; &amp;&amp; *mystr &lt;= &#8217;9&#8242;) ||<br />
-           *mystr == &#8216;-&#8217; || *mystr == &#8216;_&#8217;)<br />
+           *mystr == &#8216;-&#8217; || *mystr == &#8216;_&#8217; || *mystr == &#8216;.&#8217; || *mystr == &#8216;/&#8217;)<br />
{<br />
mystr++;<br />
}<br />
diff -Naur -x &#8216;*.a&#8217; -x &#8216;*.o&#8217; ossec-hids-2.5.1/src/monitord/main.c ossec-hids-2.5.1-manualreports/src/monitord/main.c<br />
&#8212; ossec-hids-2.5.1/src/monitord/main.c    2010-10-12 19:17:37.000000000 +0000<br />
+++ ossec-hids-2.5.1-manualreports/src/monitord/main.c    2011-06-19 02:50:33.000000000 +0000<br />
@@ -18,13 +18,19 @@</p>
<p>int main(int argc, char **argv)<br />
{<br />
-    int c, test_config = 0, run_foreground = 0;<br />
+    time_t tm;<br />
+    struct tm *p;<br />
+    int c, test_config = 0, run_foreground = 0, generate_manual_reports = 0;<br />
int uid=0,gid=0;<br />
+    int today = 0;<br />
+    int thismonth = 0;<br />
+    int thisyear = 0;<br />
char *dir  = DEFAULTDIR;<br />
char *user = USER;<br />
char *group = GROUPGLOBAL;<br />
char *cfg = DEFAULTCPATH;</p>
<p>+<br />
/* Initializing global variables */<br />
mond.a_queue = 0;</p>
<p>@@ -32,11 +38,15 @@<br />
OS_SetName(ARGV0);</p>
<p>-    while((c = getopt(argc, argv, &#8220;Vdhtfu:g:D:c:&#8221;)) != -1){<br />
+    while((c = getopt(argc, argv, &#8220;RVdhtfu:g:D:c:&#8221;)) != -1){<br />
switch(c){<br />
case &#8216;V&#8217;:<br />
print_version();<br />
break;<br />
+            case &#8216;R&#8217;:<br />
+                generate_manual_reports = 1;<br />
+                run_foreground = 1;<br />
+                break;<br />
case &#8216;h&#8217;:<br />
help(ARGV0);<br />
break;<br />
@@ -198,6 +207,19 @@<br />
/* Start up message */<br />
verbose(STARTUP_MSG, ARGV0, (int)getpid());</p>
<p>+    if(generate_manual_reports)<br />
+    {<br />
+        /* Getting currently time before starting */<br />
+        tm = time(NULL);<br />
+        p = localtime(&amp;tm);<br />
+<br />
+        today = p-&gt;tm_mday;<br />
+        thismonth = p-&gt;tm_mon;<br />
+        thisyear = p-&gt;tm_year+1900;<br />
+<br />
+       generate_reports(today, thismonth, thisyear, p);<br />
+       exit(0);<br />
+    }</p>
<p>/* the real daemon now */<br />
Monitord();<br />
diff -Naur -x &#8216;*.a&#8217; -x &#8216;*.o&#8217; ossec-hids-2.5.1/src/os_maild/sendcustomemail.c ossec-hids-2.5.1-manualreports/src/os_maild/sendcustomemail.c<br />
&#8212; ossec-hids-2.5.1/src/os_maild/sendcustomemail.c    2010-10-12 19:17:37.000000000 +0000<br />
+++ ossec-hids-2.5.1-manualreports/src/os_maild/sendcustomemail.c    2011-06-19 04:12:35.000000000 +0000<br />
@@ -33,7 +33,7 @@<br />
#define FROM            &#8221;From: OSSEC HIDS &lt;%s&gt;\r\n&#8221;<br />
#define TO                &#8220;To: &lt;%s&gt;\r\n&#8221;<br />
#define CC                &#8220;Cc: &lt;%s&gt;\r\n&#8221;<br />
-#define SUBJECT            &#8221;Subject: %s\r\n&#8221;<br />
+#define SUBJECT            &#8221;Subject: %s\r\n\r\n&#8221;<br />
#define ENDDATA            &#8221;\r\n.\r\n&#8221;<br />
#define QUITMSG         &#8221;QUIT\r\n&#8221;</p>
<p>diff -Naur -x &#8216;*.a&#8217; -x &#8216;*.o&#8217; ossec-hids-2.5.1/src/shared/help.c ossec-hids-2.5.1-manualreports/src/shared/help.c<br />
&#8212; ossec-hids-2.5.1/src/shared/help.c    2010-10-12 19:17:37.000000000 +0000<br />
+++ ossec-hids-2.5.1-manualreports/src/shared/help.c    2011-06-20 04:13:07.000000000 +0000<br />
@@ -21,12 +21,24 @@</p>
<p>void help(const char *prog)<br />
{<br />
+    int ismonitord = 0;<br />
+    char helpopts[6];<br />
+    helpopts[5] = &#8216;\0&#8242;;<br />
+    snprintf(helpopts, 5, &#8220;Vhdt&#8221;);<br />
+<br />
+    if (strstr(prog, &#8220;monitord&#8221;))<br />
+    {<br />
+      ismonitord = 1;<br />
+      snprintf(helpopts, 5, &#8220;VRhdt&#8221;);<br />
+    }<br />
print_out(&#8221; &#8220;);<br />
print_out(&#8220;%s %s &#8211; %s (%s)&#8221;, __name, __version, __author, __contact);<br />
print_out(&#8220;%s&#8221;, __site);<br />
print_out(&#8221; &#8220;);<br />
-    print_out(&#8220;  %s: -[Vhdt] [-u user] [-g group] [-c config] [-D dir]&#8220;, prog);<br />
+    print_out(&#8220;  %s: -[%s] [-u user] [-g group] [-c config] [-D dir]&#8220;, prog,helpopts);<br />
print_out(&#8220;    -V          Version and license message&#8221;);<br />
+    if (ismonitord)<br />
+       print_out(&#8220;    -R          Run daily report&#8221;);<br />
print_out(&#8220;    -h          This help message&#8221;);<br />
print_out(&#8220;    -d          Execute in debug mode&#8221;);<br />
print_out(&#8220;    -t          Test configuration&#8221;);</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2011/06/ossec-daily-reports/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Vyatta border gateway passthrough filtering</title>
		<link>http://www.zendzign.com/2010/11/vyatta-border-gateway-passthrough-filtering/</link>
		<comments>http://www.zendzign.com/2010/11/vyatta-border-gateway-passthrough-filtering/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 15:04:56 +0000</pubDate>
		<dc:creator>David M. Zendzian</dc:creator>
				<category><![CDATA[HIPPA]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[vyatta router firewall filter security PCI HIPAA]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=189</guid>
		<description><![CDATA[Vyatta routers bring high-quality enterprise routing in an open-source package.  Like many projects it was originally designed for small office/home configurations but has grown to enterprise solutions.  The current documentation on filtering between zones does not tie everything together well enough to understand zone filtering.  This post will walk through a complex filter configuration for a vyatta running as a border gateway and not a small office/home gateway.]]></description>
			<content:encoded><![CDATA[<p>It is generally a best practice to include multiple layers of security for any infrastructure.  Even if you are just routing packets, your routers are your outside perimeter and should include tools to restrict traffic not only to the device itself but also to the traffic that passes through.</p>
<p><span id="more-189"></span>This doesn&#8217;t mean the router should be your firewall, firewalls serve a different purpose for segmentation.  The border router has only the outside &amp; inside; no real segmentation but at the same time the best place to block a wide variety of traffic at a single point.</p>
<p>We here at <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> leverage the best technology for a situation and as such utilize the <a title="Vyatta" href="http://www.vyatta.com" target="_self">vyatta</a> router for our core routing devices (well custom hardware but running vyatta).  There is extensive documentation on vyatta filtering but it is mainly focused on the filtering of traffic into and out of the router directly.  The little there is on the traffic going &#8220;through&#8221; the device was focused on the vyatta box in a small office or home environment performing NAT and other &#8220;gateway&#8221; services.</p>
<p>When your router is a border gateway vs a network gateway the configuration is a little different and can be expanded to provide easy ways to block traffic.</p>
<p>The vyatta <a title="Vyatta Documentation" href="http://www2.vyatta.com/support/documentation" target="_self">documentation</a> is exceptional and a great starting point to getting a new system online and configuring as a NAT gateway so I will focus only on the filtering configuration needed for restricting access to / from and through the router as it simply routes traffic between networks.</p>
<p>From the vyatta firewall documentation the &#8220;The Vyatta firewall features IPv4/IPv6 stateful packet inspection to intercept and inspect network activity and allow or deny the attampt. Vyatta advanced firewall capabilities include stateful failover, zone and time-based firewalling, P2P filtering and more.&#8221;</p>
<p>It is the zone features that we will be working with for ingress and egress filter for traffic going through our border router.  The vyatta documentation best describes it&#8217;s approach to interface and &#8220;zone&#8221; filtering:</p>
<blockquote><p>Ordinary firewall rule sets are applied on a per-interface basis to act as a packet filter for the interface. In zone-based firewall, interfaces are grouped into security “zones,” where each interface in the zone has the same security level.</p>
<p>Packet-filtering policies are applied to traffic flowing between zones. Traffic flowing traffic flowing between interfaces lying in the same zone is not filtered and flows freely, as the interfaces share the same security level.</p></blockquote>
<p>When configuring the router for zone based routing there are a few notes highlighted in the vyatta documentation:</p>
<ul>
<li>An interface can be associated with only one zone.</li>
<li>An interface belonging to a zone cannot have a per-interface firewall rule set applied and vice versa.</li>
<li>Traffic between interfaces not belonging to any zone flows unfiltered and per-interface firewall rule sets can be applied to those interfaces.</li>
<li>By default, all traffic to a zone is dropped unless explicitly allowed by a filtering policy for a from_zone.</li>
<li>Filtering policies are unidirectional: they are defined as a “zone pair” defining the zone from which traffic is sourced (the from_zone) and the zone to which traffic is destined (the to_zone). In Figure 1-6, these unidirectional policies can be seen as follows:
<ul>
<li>From Private to DMZ</li>
<li>From Public to DMZ</li>
<li>From Private to Public</li>
<li>From DMZ to Public</li>
<li>From Public to Private</li>
<li>From DMZ to Private</li>
</ul>
</li>
</ul>
<p><a href="http://www.zendzign.com/wp-content/uploads/2010/11/vyatta-zones.png"><img class="alignnone size-full wp-image-192" title="vyatta-zones" src="http://www.zendzign.com/wp-content/uploads/2010/11/vyatta-zones.png" alt="vyatta-zones" width="456" height="282" /></a></p>
<p>The  configuration used in the example presented in this post has a router with 2 interfaces one &#8220;Internet&#8221; and the other &#8220;<a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a>&#8221; (or your inside; name yours as you will) with the internet on eth0 and <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">zzservers</a> on eth1.</p>
<p>The network segments for this vyatta configuration are then set to:</p>
<ul>
<li><a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> &#8211; The <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> public (internet) networks</li>
<li>Internet &#8211; The Internet (outside <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a>)</li>
<li>Local &#8211; The local vyatta router</li>
</ul>
<p>With these segments the vyatta zones will be configured as follows:</p>
<ul>
<li>Internet / Routed Network Traffic
<ul>
<li>Internet -&gt; <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a></li>
<li><a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> -&gt; Internet</li>
</ul>
</li>
<li>Traffic directly to or from the router
<ul>
<li>Internet -&gt; Local</li>
<li>Local -&gt; Internet</li>
<li><a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> -&gt; Local</li>
<li>Local -&gt; <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a></li>
</ul>
</li>
</ul>
<p><a href="http://www.zendzign.com/wp-content/uploads/2010/11/router-vyatta.png"><img class="size-full wp-image-190 alignnone" title="router-vyatta" src="http://www.zendzign.com/wp-content/uploads/2010/11/router-vyatta.png" alt="" width="189" height="428" /></a></p>
<p>With the zones defined and router configured, the steps needed to configure the filtering include:</p>
<ul>
<li>Define various groups used</li>
<li>Set rules from Internet directly to router</li>
<li>Set rules from router to Internet</li>
<li>Set rules from <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> directly to router</li>
<li>Set rules from router to <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a></li>
<li>Set rules for Internet to <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a></li>
<li>Set rules for <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> to Internet</li>
</ul>
<p>The differences between the router ingress &amp; egress rules and the network rules is the direct rules will only allow what is specifically allowed and then deny all and the rules for the flow of traffic between the Internet and <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> will by default route (allow) all traffic and then deny only what we specify.</p>
<p>The first step is to enter the vyatta configuration mode and edit the firewall configuration, starting with the groups used in the rules.</p>
<p>The groups include:</p>
<ul>
<li>REJECTED-SERVERS: Will contain a list of IP addresses blocked from passing through to or from <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> and the Internet.</li>
<li>REJECTED-NETWORKS: Will contain a list network segments blocked from passing through to or from <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> and the Internet.</li>
<li>REJECTED-PORTS: Will contain a list of connection ports from passing  through to or from <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> and the Internet.</li>
<li>SSH-FROM: Contains a list of IP addresses allowed to connect to the device</li>
<li>SMB: Contains a list of ports used in SMB traffic (to block and not log the annoying microsoft broadcast traffic); NOTE &#8211; only blocking on direct access to/from device, not from passing through to or from <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a> &amp; the Internet.</li>
</ul>
<blockquote><p>configure<br />
edit firewall</p>
<p># Rejected Servers Group<br />
set group address-group REJECT-SERVERS description &#8220;Block IP List&#8221;</p>
<p># Rejected Networks Group<br />
set group network-group REJECT-NETWORKS description &#8220;Block Network List&#8221;</p>
<p># Rejected Ports Group<br />
set group port-group REJECT-PORTS description &#8220;Block Port List&#8221;</p>
<p># SSH Allowed Hosts List<br />
set group address-group SSH-FROM description &#8220;IPs allowed to SSH into router&#8221;<br />
set group address-group SSH-FROM address &lt;management ip 1&gt;<br />
set group address-group SSH-FROM address &lt;management ip 2&gt;</p>
<p># SMB Ports to drop and not log<br />
set group port-group SMB description &#8220;SMB Ports to block and not log from ZZ Windows customers to local router&#8221;<br />
set group port-group SMB port 67<br />
set group port-group SMB port 135<br />
set group port-group SMB port 137<br />
set group port-group SMB port 138<br />
set group port-group SMB port 139</p></blockquote>
<p>Now with the groups defined the next thing is to setup the rules to filter traffic from the internet directly into the router.  The rule syntax is similar to a Cisco configuration; but significantly different as it sits on top of iptables which has extensive capabilities beyond basic filtering that will not be explored here.</p>
<p>We will not be doing anything fancy with this configuration; only defining what is and is not allowed.</p>
<p>The rules for ingress and egress directly on the router are very similar in structure:</p>
<ul>
<li>Set default policy to Deny, dropping any unauthorized connection</li>
<li>Allow established and related connections</li>
<li>Drop all invalid states</li>
<li>Drop and do not log SMB broadcasts</li>
<li>Accept ICMP</li>
<li>Accept VRRP</li>
<li>Accept BGP</li>
<li>Accept HEARTBEAT</li>
<li>Accept SSH</li>
<li>Deny and log everything else</li>
</ul>
<p>BGP packets are broadcast from peers with source port 179 and sent to peers on source port 179<br />
HEARTBEAT packets are broadcast from peers to destination port 694.</p>
<p>With both BGP &amp; HEARTBEAT I have setup source &amp; destination port filters.  From my tests so far these may be adjusted; I&#8217;ve just not tested all situations so it may not need both sets of source &amp; destination filters, so any feedback is welcome.</p>
<blockquote><p># Default deny<br />
set name internet-local default-action drop</p>
<p># Accept established &amp; related<br />
set name internet-local rule 1 action accept<br />
set name internet-local rule 1 state established enable<br />
set name internet-local rule 1 state related enable<br />
set name internet-local rule 2 action drop<br />
set name internet-local rule 2 log enable<br />
set name internet-local rule 2 state invalid enable</p>
<p># Drop and do not log Customer SMB<br />
set name internet-local rule 3 action drop<br />
set name internet-local rule 3 log disable<br />
set name internet-local rule 3 destination group port-group SMB</p>
<p># Allow inbound ICMP<br />
set name internet-local rule 4 action accept<br />
set name internet-local rule 4 protocol icmp</p>
<p># Allow inbound VRRP<br />
set name internet-local rule 5 action accept<br />
set name internet-local rule 5 protocol vrrp</p>
<p># Allow inbound BGP<br />
set name internet-local rule 6 action accept<br />
set name internet-local rule 6 port 179<br />
set name internet-local rule 6 protocol tcp</p>
<p># Allow inbound BGP<br />
set name internet-local rule 7 action accept<br />
set name internet-local rule 7 source port 179<br />
set name internet-local rule 7 protocol tcp</p>
<p># Allow inbound HEARTBEAT<br />
set name internet-local rule 8 action accept<br />
set name internet-local rule 8 destination port 694<br />
set name internet-local rule 8 protocol udp</p>
<p># Allow inbound HEARTBEAT<br />
set name internet-local rule 9 action accept<br />
set name internet-local rule 9 source port 694<br />
set name internet-local rule 9 protocol udp</p>
<p># Allow inbound SSH<br />
set name internet-local rule 10 action accept<br />
set name internet-local rule 10 log enable<br />
set name internet-local rule 10 source group address-group SSH-FROM<br />
set name internet-local rule 10 destination port 22<br />
set name internet-local rule 10 protocol tcp</p>
<p># Logging rule<br />
set name internet-local rule 9999 action drop<br />
set name internet-local rule 9999 log enable</p></blockquote>
<p>The router to internet egress filters are similar but add additional rules for outbound upgrades, dns and ntp all of which could use groups for more specific filters.</p>
<ul>
<li>Set default policy to Deny, dropping any unauthorized connection</li>
<li>Allow established and related connections</li>
<li>Drop all invalid states</li>
<li>Accept ICMP</li>
<li>Accept VRRP</li>
<li>Accept BGP</li>
<li>Accept HEARTBEAT</li>
<li>Accept DNS</li>
<li>Accept NTP</li>
<li>Upgrade rules</li>
<li>Deny and log everything else</li>
</ul>
<blockquote><p># Default deny<br />
set name local-internet default-action drop</p>
<p># Accept established &amp; related<br />
set name local-internet rule 1 action accept<br />
set name local-internet rule 1 state established enable<br />
set name local-internet rule 1 state related enable<br />
set name local-internet rule 2 action drop<br />
set name local-internet rule 2 log enable<br />
set name local-internet rule 2 state invalid enable</p>
<p># Allow outbound ICMP<br />
set name local-internet rule 4 action accept<br />
set name local-internet rule 4 protocol icmp</p>
<p># Allow outbound VRRP<br />
set name local-internet rule 5 action accept<br />
set name local-internet rule 5 protocol vrrp</p>
<p># Allow outbound BGP<br />
set name local-internet rule 6 action accept<br />
set name local-internet rule 6 destination port 179<br />
set name local-internet rule 6 protocol tcp</p>
<p># Allow outbound BGP<br />
set name local-internet rule 7 action accept<br />
set name local-internet rule 7 source port 179<br />
set name local-internet rule 7 protocol tcp</p>
<p># Allow outbound HEARTBEAT<br />
set name local-internet rule 8 action accept<br />
set name local-internet rule 8 destination port 694<br />
set name local-internet rule 8 protocol udp</p>
<p># Allow outbound HEARTBEAT<br />
set name local-internet rule 9 action accept<br />
set name local-internet rule 9 source port 694<br />
set name local-internet rule 9 protocol udp</p>
<p># Accept outbound DNS requests<br />
set name local-internet rule 10 action accept<br />
set name local-internet rule 10 destination port 53<br />
set name local-internet rule 10 protocol tcp_udp</p>
<p># Accept outbound NTP<br />
set name local-internet rule 15 action accept<br />
set name local-internet rule 15 destination port 123<br />
set name local-internet rule 15 protocol tcp_udp</p>
<p># Allow upgrade &#8211; only during valid changes<br />
#set name local-internet rule 69 action accept<br />
#set name local-internet rule 69 log enable<br />
#set name local-internet rule 69 destination port 80<br />
#set name local-internet rule 69 protocol tcp</p>
<p># Logging rule<br />
set name local-internet rule 9999 action drop<br />
set name local-internet rule 9999 log enable</p></blockquote>
<p>The rules between the router &amp; the internal (<a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a>) public networks are basically the same as the internet rules.</p>
<ul>
<li>Set default policy to Deny, dropping any unauthorized connection</li>
<li>Allow established and related connections</li>
<li>Drop all invalid states</li>
<li>Drop and do not log SMB broadcasts</li>
<li>Accept ICMP</li>
<li>Accept VRRP</li>
<li>Accept BGP</li>
<li>Accept HEARTBEAT</li>
<li>Accept SSH</li>
<li>Deny and log everything else</li>
</ul>
<blockquote><p># Default Deny<br />
set name zzservers-local default-action drop</p>
<p># Accept established and related<br />
set name zzservers-local rule 1 action accept<br />
set name zzservers-local rule 1 state established enable<br />
set name zzservers-local rule 1 state related enable<br />
set name zzservers-local rule 2 action drop<br />
set name zzservers-local rule 2 log enable<br />
set name zzservers-local rule 2 state invalid enable</p>
<p># Drop and do not log Customer SMB<br />
set name zzservers-local rule 3 action drop<br />
set name zzservers-local rule 3 log disable<br />
set name zzservers-local rule 3 destination group port-group SMB<br />
set name zzservers-local rule 3 protocol udp</p>
<p># Allow inbound ICMP<br />
set name zzservers-local rule 4 action accept<br />
set name zzservers-local rule 4 protocol icmp</p>
<p># Allow inbound VRRP<br />
set name zzservers-local rule 5 action accept<br />
set name zzservers-local rule 5 protocol vrrp</p>
<p># Allow inbound BGP<br />
set name zzservers-local rule 6 action accept<br />
set name zzservers-local rule 6 destination port 179<br />
set name zzservers-local rule 6 protocol tcp</p>
<p># Allow inbound BGP<br />
set name zzservers-local rule 7 action accept<br />
set name zzservers-local rule 7 source port 179<br />
set name zzservers-local rule 7 protocol tcp</p>
<p># Allow inbound HEARTBEAT<br />
set name zzservers-local rule 8 action accept<br />
set name zzservers-local rule 8 destination port 694<br />
set name zzservers-local rule 8 protocol udp</p>
<p># Allow inbound HEARTBEAT<br />
set name zzservers-local rule 9 action accept<br />
set name zzservers-local rule 9 source port 694<br />
set name zzservers-local rule 9 protocol udp</p>
<p># Allow inbound SSH<br />
set name zzservers-local rule 10 action accept<br />
set name zzservers-local rule 10 log enable<br />
set name zzservers-local rule 10 source group address-group SSH-FROM<br />
set name zzservers-local rule 10 destination port 22<br />
set name zzservers-local rule 10 protocol tcp</p>
<p># Logging rule<br />
set name zzservers-local rule 9999 action drop<br />
set name zzservers-local rule 9999 log enable</p></blockquote>
<p>And the final rules for direct access from the router are the rules from the local interface to zzservers.</p>
<ul>
<li>Set default policy to Deny, dropping any unauthorized connection</li>
<li>Allow established and related connections</li>
<li>Drop all invalid states</li>
<li>Accept ICMP</li>
<li>Accept VRRP</li>
<li>Accept BGP</li>
<li>Accept HEARTBEAT</li>
<li>Accept DNS</li>
<li>Deny and log everything else</li>
</ul>
<blockquote><p># Default Deny<br />
set name local-zzservers default-action drop</p>
<p># Accept established and related<br />
set name local-zzservers rule 1 action accept<br />
set name local-zzservers rule 1 state established enable<br />
set name local-zzservers rule 1 state related enable<br />
set name local-zzservers rule 2 action drop<br />
set name local-zzservers rule 2 log enable<br />
set name local-zzservers rule 2 state invalid enable</p>
<p># Allow outbound ICMP<br />
set name local-zzservers rule 4 action accept<br />
set name local-zzservers rule 4 protocol icmp</p>
<p># Allow outbound VRRP<br />
set name local-zzservers rule 5 action accept<br />
set name local-zzservers rule 5 protocol vrrp</p>
<p># Allow outbound BGP<br />
set name local-zzservers rule 6 action accept<br />
set name local-zzservers rule 6 destination port 179<br />
set name local-zzservers rule 6 protocol tcp</p>
<p># Allow outbound BGP<br />
set name local-zzservers rule 7 action accept<br />
set name local-zzservers rule 7 source port 179<br />
set name local-zzservers rule 7 protocol tcp</p>
<p># Allow outbound HEARTBEAT<br />
set name local-zzservers rule 8 action accept<br />
set name local-zzservers rule 8 destination port 694<br />
set name local-zzservers rule 8 protocol udp</p>
<p># Allow outbound HEARTBEAT<br />
set name local-zzservers rule 9 action accept<br />
set name local-zzservers rule 9 source port 694<br />
set name local-zzservers rule 9 protocol udp</p>
<p># Allow outbound dns lookups<br />
set name local-zzservers rule 10 action accept<br />
set name local-zzservers rule 10 destination port 53<br />
set name local-zzservers rule 10 protocol tcp_udp</p>
<p># Allow upgrades &#8211; only during valid change<br />
#set name local-zzservers rule 69 action accept<br />
#set name local-zzservers rule 69 log enable<br />
#set name local-zzservers rule 69 destination port 80<br />
#set name local-zzservers rule 69 protocol tcp# Logging rule<br />
set name local-zzservers rule 9999 action drop<br />
set name local-zzservers rule 9999 log enable</p></blockquote>
<p>Now the rules are defined for inbound and outbound directly to and from the router.  The final set of rules to build are the rules for the traffic that flows &#8220;through&#8221; the router between the Internet &amp; <a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a>.  There will again be 2 sets of rules for the ingress and egress packets.</p>
<p>The routing rules are different from the other rules in that they:</p>
<ul>
<ul>
<li>Default <strong>allow</strong> all packets</li>
<li>Block Servers specified in REJECT-SERVERS</li>
<li>Block IP address ranges specified in REJECT-NETWORKS</li>
<li>Block Ports specified in REJECT-PORTS</li>
</ul>
</ul>
<p># Default route all packets<br />
set name internet-zzservers default-action accept</p>
<p># Deny and reject blocked servers / networks / ports<br />
set name internet-zzservers rule 10 action reject<br />
set name internet-zzservers rule 10 log enable<br />
set name internet-zzservers rule 10 source group address-group REJECT-SERVERS<br />
set name internet-zzservers rule 11 action reject<br />
set name internet-zzservers rule 11 log enable<br />
set name internet-zzservers rule 11 destination group address-group REJECT-SERVERS<br />
set name internet-zzservers rule 15 action reject<br />
set name internet-zzservers rule 15 log enable<br />
set name internet-zzservers rule 15 source group network-group REJECT-NETWORKS<br />
set name internet-zzservers rule 16 action reject<br />
set name internet-zzservers rule 16 log enable<br />
set name internet-zzservers rule 16 destination group network-group REJECT-NETWORKS<br />
set name internet-zzservers rule 20 action reject<br />
set name internet-zzservers rule 20 log enable<br />
set name internet-zzservers rule 20 source group port-group REJECT-PORTS<br />
set name internet-zzservers rule 21 action reject<br />
set name internet-zzservers rule 21 log enable<br />
set name internet-zzservers rule 21 destination group port-group REJECT-PORTS</p>
<p>The final set of rules are the same as internet-zzsevers but for traffic going out from zzservers-internet.</p>
<blockquote><p># Default route all packets<br />
set name zzservers-internet default-action accept<br />
# Deny and reject blocked servers / networks / ports<br />
set name zzservers-internet rule 10 action reject<br />
set name zzservers-internet rule 10 log enable<br />
set name zzservers-internet rule 10 source group address-group REJECT-SERVERS<br />
set name zzservers-internet rule 11 action reject<br />
set name zzservers-internet rule 11 log enable<br />
set name zzservers-internet rule 11 destination group address-group REJECT-SERVERS<br />
set name zzservers-internet rule 15 action reject<br />
set name zzservers-internet rule 15 log enable<br />
set name zzservers-internet rule 15 source group network-group REJECT-NETWORKS<br />
set name zzservers-internet rule 16 action reject<br />
set name zzservers-internet rule 16 log enable<br />
set name zzservers-internet rule 16 destination group network-group REJECT-NETWORKS<br />
set name zzservers-internet rule 20 action reject<br />
set name zzservers-internet rule 20 log enable<br />
set name zzservers-internet rule 20 source group port-group REJECT-PORTS<br />
set name zzservers-internet rule 21 action reject<br />
set name zzservers-internet rule 21 log enable<br />
set name zzservers-internet rule 21 destination group port-group REJECT-PORTS</p></blockquote>
<p>With all of the filters now defined the final detail is to assign the segments (internet/zzservers/local) the appropriate devices.</p>
<p>You first will exit the firewall editor and edit the &#8220;zone-policy&#8221;</p>
<blockquote><p>exit</p>
<p>edit zone-policy</p></blockquote>
<p>Within the zone-policy we will configure:</p>
<ul>
<li>Default policy for all zones (internet/zzservers/local) to be to drop</li>
<li>Identify the internet with eth0</li>
<li>Identify the zz servers network with eth1</li>
<li>Map the various rules to the appropriate policies</li>
<li>Exit / Save and commit</li>
</ul>
<blockquote><p># Set the default policy for zone internet to drop<br />
set zone internet default-action drop<br />
# For internet zone, traffic from zzservers to internet uses firewall filter zzservers-internet<br />
set zone internet from zzservers firewall name zzservers-internet<br />
# For internet zone, traffic from local router to internet  uses firewall filter local-internet<br />
set zone internet from local firewall name local-internet<br />
# Set internet zone assignment to eth0<br />
set zone internet interface eth0</p>
<p># Set the default policy for zzservers zone to drop<br />
set zone zzservers default-action drop<br />
# For zzservers zone, traffic from internet to zzservers uses firewall filter internet-zzservers<br />
set zone zzservers from internet firewall name internet-zzservers<br />
# For zzservers zone, traffic from local router to zzservers uses firewall filter local-zzservers<br />
set zone zzservers from local firewall name local-zzservers<br />
# Set zzservers interface eth1<br />
set zone zzservers interface eth1</p>
<p># Set the default policy for local zone to drop<br />
set zone local default-action drop<br />
# For local zone, traffic from internet to the local router uses firewall  filter internet-local<br />
set zone local from internet firewall name internet-local<br />
# For local zone, traffic from zzservers to the local router uses firewall filter zzservers-local<br />
set zone local from zzservers firewall name zzservers-local<br />
set zone local local-zone</p>
<p>exit<br />
save<br />
commit</p></blockquote>
<p>With the rules now in place it is easy to block inappropriate traffic by adding the specific host/ip/port to the correct group.  The commands to add / remove items from the defined groups are as follows:</p>
<blockquote><p>To add new IPs to the REJECT-IPS group and cause them to be rejected from the ZZ network, logon to the router and use the following command:</p>
<ul>
<li>configure</li>
<li>set firewall group address-group REJECT-SERVERS address &lt;ip to reject&gt;</li>
<li>commit</li>
<li>save</li>
</ul>
<p>To remove an IP address use a similar command replacing &#8220;set&#8221; with &#8220;delete&#8221;:</p>
<ul>
<li>configure</li>
<li>delete firewall group address-group REJECT-SERVERS address &lt;ip to remove&gt;</li>
<li>commit</li>
<li>save</li>
</ul>
<p>To reject subnets or ports use same syntax but change REJECT-SERVERS to REJECT-NETWORKS or REJECT-PORTS</p></blockquote>
<p>The configuration generated by this example is attached below.  Good luck and remember, security should be a layered risk based approach and be sure to use all of the resources available to you.</p>
<p><a href="http://www.zendzign.com/wp-content/uploads/2010/11/vyatta-zone-firewall1.txt">vyatta-zone-firewall</a></p>
<p>References:<br />
<a title="Vyatta" href="http://www.vyatta.com" target="_self">Vyatta</a><br />
Vyatta is revolutionizing the networking industry by delivering a software-based, open-source, network operating system that is portable to standard x86 hardware as well as common virtualization and cloud computing platforms. By deploying Vyatta, users benefit from a flexible enterprise-class routing and security feature set capable of scaling from DSL to 20Gbps performance at a fraction of the cost of proprietary solutions. Thousands of physical and virtual infrastructures around the world, from small enterprise to Fortune 500, are connected and protected by Vyatta software and appliances.</p>
<p><a title="Vyatta Community Version" href="http://www.vyatta.org" target="_self">Vyatta Community Edition</a><br />
The free community Vyatta Core software(VC) is an award-winning open source network operating system providing advanced IPv4 and IPv6 routing, stateful firewalling, IPSec and SSL OpenVPN, intrusion prevention, and more. When you add Vyatta to a standard x86 hardware system, you can create an enterprise grade network appliance that easily scales from DSL to 10Gbps. Vyatta is also optimized to run in VMware, Citrix XenServer, Xen, KVM, and other hypervisors, providing networking and security services to virtual machines and cloud computing environments. Vyatta has been downloaded over 600,000 times, has a community of hundreds of thousands of registered users and counts dozens of fortune 500 businesses among its commercial customers.</p>
<p><a title="Vyatta Documentation" href="http://www.vyatta.org/documentation" target="_self">Vyatta Documentation</a><br />
<a href="http://www.vyatta.com/downloads/docdl.php" target="_self">Firewall</a> (IPv4, IPv6, Zone-based Firewall) &#8211; Vyatta_Firewall_R6.1_v02.pdf</p>
<p><a title="ZZ Servers" href="http://www.zzservers.com" target="_self">ZZ Servers</a><br />
ZZ Servers was founded in 2006 by brothers Peter and David Zendzian to provide business and enterprise level hosted network environments at affordable prices. Our commitment to a high level of customer service and belief in personalized customer service for every client is an integral component of our business philosophy. Our goal is to work collaboratively with industry professionals, our clients and consumers to provide not just a source for affordable and secure hosted network infrastructures but also provide a friendly family oriented customer support experience.</p>
<p>ZZ Servers delivers a comprehensive collection of hosting services to organizations of all sizes. Our hosting services are at the core of our security and and management services and have been engineered for industry regulations including PCI, GLBA, SOX, HIPPA and ISO 27002.</p>
<p>We understand for your business to remain competitive and profitable, it needs to be on-line. We offer web hosting options that are custom tailored to fit your specific business needs. From our ultra affordable shared web hosting to state of the art geographically redundant solutions, we can meet your needs.</p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 9166px; width: 1px; height: 1px; overflow: hidden;"><!-- p { margin-bottom: 0.08in; } --></p>
<p style="margin-bottom: 0in;">show firewall</p>
<p style="margin-bottom: 0in;">all-ping enable</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">address-group REJECT-SERVERS {</p>
<p style="margin-bottom: 0in;">description &#8220;Block IP List&#8221;</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">address-group SSH-FROM {</p>
<p style="margin-bottom: 0in;">address &lt;mgmt-ip1&gt;</p>
<p style="margin-bottom: 0in;">address &lt;mgmt-ip2&gt;</p>
<p style="margin-bottom: 0in;">description &#8220;IPs allowed to SSH into router&#8221;</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">network-group REJECT-NETWORKS {</p>
<p style="margin-bottom: 0in;">description &#8220;Block Network List&#8221;</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">port-group REJECT-PORTS {</p>
<p style="margin-bottom: 0in;">description &#8220;Block Port List&#8221;</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">port-group SMB {</p>
<p style="margin-bottom: 0in;">description &#8220;SMB Ports to block and not log from ZZ Windows customers to local router&#8221;</p>
<p style="margin-bottom: 0in;">port 67</p>
<p style="margin-bottom: 0in;">port 135</p>
<p style="margin-bottom: 0in;">port 137</p>
<p style="margin-bottom: 0in;">port 138</p>
<p style="margin-bottom: 0in;">port 139</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">name internet-local {</p>
<p style="margin-bottom: 0in;">default-action drop</p>
<p style="margin-bottom: 0in;">rule 1 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">established enable</p>
<p style="margin-bottom: 0in;">related enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 2 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">invalid enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 3 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">port-group SMB</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log disable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 4 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol icmp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 5 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol vrrp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 6 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 7 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 8 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 10 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 22</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">address-group SSH-FROM</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9999 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">name internet-zzservers {</p>
<p style="margin-bottom: 0in;">default-action accept</p>
<p style="margin-bottom: 0in;">rule 10 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">address-group REJECT-SERVERS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 11 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">address-group REJECT-SERVERS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 15 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">network-group REJECT-NETWORKS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 16 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">network-group REJECT-NETWORKS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 20 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">port-group REJECT-PORTS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 21 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">port-group REJECT-PORTS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">name local-internet {</p>
<p style="margin-bottom: 0in;">default-action drop</p>
<p style="margin-bottom: 0in;">rule 1 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">established enable</p>
<p style="margin-bottom: 0in;">related enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 2 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">invalid enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 4 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol icmp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 5 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol vrrp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 6 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 7 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 8 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 10 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 53</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol tcp_udp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9999 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">name local-zzservers {</p>
<p style="margin-bottom: 0in;">default-action drop</p>
<p style="margin-bottom: 0in;">rule 1 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">established enable</p>
<p style="margin-bottom: 0in;">related enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 2 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">invalid enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 4 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol icmp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 5 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol vrrp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 6 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 7 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 8 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 10 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 53</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol tcp_udp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9999 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">name zzservers-internet {</p>
<p style="margin-bottom: 0in;">default-action accept</p>
<p style="margin-bottom: 0in;">rule 10 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">address-group REJECT-SERVERS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 11 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">address-group REJECT-SERVERS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 15 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">network-group REJECT-NETWORKS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 16 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">network-group REJECT-NETWORKS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 20 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">port-group REJECT-PORTS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 21 {</p>
<p style="margin-bottom: 0in;">action reject</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">port-group REJECT-PORTS</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">name zzservers-local {</p>
<p style="margin-bottom: 0in;">default-action drop</p>
<p style="margin-bottom: 0in;">rule 1 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">established enable</p>
<p style="margin-bottom: 0in;">related enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 2 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">state {</p>
<p style="margin-bottom: 0in;">invalid enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 3 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">port-group SMB</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log disable</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 4 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol icmp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 5 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol vrrp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 6 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 7 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 179</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 8 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">protocol udp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">port 694</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 10 {</p>
<p style="margin-bottom: 0in;">action accept</p>
<p style="margin-bottom: 0in;">destination {</p>
<p style="margin-bottom: 0in;">port 22</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">protocol tcp</p>
<p style="margin-bottom: 0in;">source {</p>
<p style="margin-bottom: 0in;">group {</p>
<p style="margin-bottom: 0in;">address-group SSH-FROM</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">rule 9999 {</p>
<p style="margin-bottom: 0in;">action drop</p>
<p style="margin-bottom: 0in;">log enable</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">show zone-policy</p>
<p style="margin-bottom: 0in;">zone internet {</p>
<p style="margin-bottom: 0in;">default-action drop</p>
<p style="margin-bottom: 0in;">from local {</p>
<p style="margin-bottom: 0in;">firewall {</p>
<p style="margin-bottom: 0in;">name local-internet</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">from zzservers {</p>
<p style="margin-bottom: 0in;">firewall {</p>
<p style="margin-bottom: 0in;">name zzservers-internet</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">interface eth0</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">zone local {</p>
<p style="margin-bottom: 0in;">default-action drop</p>
<p style="margin-bottom: 0in;">from internet {</p>
<p style="margin-bottom: 0in;">firewall {</p>
<p style="margin-bottom: 0in;">name internet-local</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">from zzservers {</p>
<p style="margin-bottom: 0in;">firewall {</p>
<p style="margin-bottom: 0in;">name zzservers-local</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">local-zone</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">zone zzservers {</p>
<p style="margin-bottom: 0in;">default-action drop</p>
<p style="margin-bottom: 0in;">from internet {</p>
<p style="margin-bottom: 0in;">firewall {</p>
<p style="margin-bottom: 0in;">name internet-zzservers</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">from local {</p>
<p style="margin-bottom: 0in;">firewall {</p>
<p style="margin-bottom: 0in;">name local-zzservers</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">}</p>
<p style="margin-bottom: 0in;">interface eth1</p>
<p style="margin-bottom: 0in;">}</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2010/11/vyatta-border-gateway-passthrough-filtering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kerio Connect Protects Your Privacy with &#8220;Remote Wipe&#8221;</title>
		<link>http://www.zendzign.com/2010/04/kerio-connect-protects-your-privacy-with-remote-wipe/</link>
		<comments>http://www.zendzign.com/2010/04/kerio-connect-protects-your-privacy-with-remote-wipe/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 11:34:19 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Kerio Mail Server]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Email]]></category>
		<category><![CDATA[mail server]]></category>
		<category><![CDATA[Small Business]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=151</guid>
		<description><![CDATA[Smart phones have become an essential part of our lives, and we store everything on them, from our emails, facebook, text messages, events, tasks and contacts. Losing such a device is therefore a real nightmare, as you will not only lose access to all of this information, but if your device falls into the wrong [...]]]></description>
			<content:encoded><![CDATA[<p>Smart phones have become an essential part of our lives, and we store everything on them, from our emails, facebook, text messages, events, tasks and contacts. Losing such a device is therefore a real nightmare, as you will not only lose access to all of this information, but if your device falls into the wrong hands, this person will know everything about you!</p>
<p><span id="more-151"></span> If a phone is lost or stolen, your natural reaction may be to change your password. This is not a good idea, because changing the password will make it impossible to do a &#8220;remote wipe&#8221; of the phone. Fortunately, Kerio Connect offers a solution called &#8220;remote wipe&#8221;. A &#8220;remote wipe&#8221; will erase all data on the phone completely resetting all accounts, and in the case of most phones, erasing all apps and completely resetting the phone. Remote wipe is much more effective than changing a password because it protects the user&#8217;s privacy, and should be used instead. More information regarding the remote wipe feature can be found at <a href="http://www.zzservers.com/hosting/mail-server/">ZZ Servers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2010/04/kerio-connect-protects-your-privacy-with-remote-wipe/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Zabbix &amp; OSSEC: Open-Source compliance and security monitoring</title>
		<link>http://www.zendzign.com/2010/04/zabbix-ossec-open-source-compliance-and-security-monitoring/</link>
		<comments>http://www.zendzign.com/2010/04/zabbix-ossec-open-source-compliance-and-security-monitoring/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 14:11:53 +0000</pubDate>
		<dc:creator>David M. Zendzian</dc:creator>
				<category><![CDATA[HIPPA]]></category>
		<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sysadmin]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=96</guid>
		<description><![CDATA[Good security, not just compliance requirements, encourages IT &#38; Security staff to spend time reviewing security events.  There are many tools available for many security components of your network; this article will focus on host security and host log monitoring using OSSEC and Zabbix. After having used many open and commercial  monitoring systems, we have [...]]]></description>
			<content:encoded><![CDATA[<p>Good security, not just compliance requirements, encourages IT &amp; Security staff to spend time reviewing security events.  There are many tools available for many security components of your network; this article will focus on host security and host log monitoring using <a title="OSSEC" href="http://www.ossec.net" target="_self">OSSEC</a> and <a title="Zabbix" href="http://www.zabbix.com" target="_self">Zabbix</a>.</p>
<p><span id="more-96"></span>After having used many open and commercial  monitoring systems, we have settled on <a title="Zabbix" href="http://www.zabbix.com" target="_self">Zabbix</a> because of it&#8217;s extensive features and expandability (especially with the new integrated <a title="API" href="http://www.zabbix.com/documentation/1.8/api" target="_self">API</a>).  That and it doesn&#8217;t hurt that it is well designed for expanded enterprises and is <a title="OpenSource" href="http://www.zabbix.com/licence.php" target="_self">OpenSource</a>.</p>
<p>This article was originally posted with details for Zabbix 1.6 and was updated on April 10 to reflect how to set it up under Zabbix 1.8.</p>
<p>OSSEC is a great tool provided by Trend Micro and is also an <a title="OpenSource" href="http://www.ossec.net/main/license/" target="_self">OpenSource</a> application. OSSEC provides a variety of tools for host based intrusion detection including:  log analysis, file integrity checking, policy monitoring, rootkit detection, real-time alerting and active response.  All of which support several <a title="compliance" href="http://www.ossec.net/ossec-docs/ossec-PCI-Solution.pdf" target="_self">compliance</a> and basic security requirements. OSSEC is deployed in a client-server model with all alerting and active response features being controlled and sent through the central server.</p>
<p>To integrate OSSEC and Zabbix we will be using the active-response feature of OSSEC integrated with zabbix_sender to send the active response alert to the zabbix server.   Configuring for this integration requires a simple script, a quick change to the ossec.conf and the creation of an OSSEC template in the zabbix system.</p>
<p>We will start with the OSSEC changes.  First, we will edit the OSSEC/etc/ossec.conf file, where OSSEC is the path to your OSSEC installation.  In this file you will need to add the following items:</p>
<blockquote><p>&lt;command&gt;<br />
&lt;name&gt;zabbix-alert&lt;/name&gt;<br />
&lt;executable&gt;zabbix-alert.sh&lt;/executable&gt;<br />
&lt;timeout_allowed&gt;no&lt;/timeout_allowed&gt;<br />
&lt;expect&gt;&lt;/expect&gt;<br />
&lt;/command&gt;</p>
<p>&lt;active-response&gt;<br />
&lt;disabled&gt;no&lt;/disabled&gt;<br />
&lt;command&gt;zabbix-alert&lt;/command&gt;<br />
&lt;location&gt;server&lt;/location&gt;<br />
&lt;level&gt;1&lt;/level&gt;<br />
&lt;/active-response&gt;<strong><br />
</strong></p></blockquote>
<p>The first &lt;command&gt; item defines the script we will be using for the zabbix-alert.  The &lt;active-response&gt; item defines when the system will use this script.  The defined configuration above has all alerts at and above level &#8220;1&#8243; sent to the zabbix-alert command.  This can be modified for higher levels or specific rules or rule groups.  More information on this configuration can be found in the OSSEC <a title="manual" href="http://www.ossec.net/main/manual/manual-active-responses/" target="_self">manual</a>.</p>
<p>Now the zabbix-alert.sh script needs to be put into the OSSEC/active-response/bin directory (be sure to watch for lines that are wrapped around but shouldn&#8217;t be).  You can download the script here: <a href="http://www.zendzign.com/wp-content/uploads/2010/04/ossec-zabbix-alert.zip">zabbix-alert.sh</a>.</p>
<blockquote><p>#!/bin/sh<br />
#<br />
# Submits an OSSEC alert as a passive service check result to zabbix.<br />
#<br />
# Author: David M. Zendzian<br />
# ZZ Servers, LLC 2010<br />
#<br />
# Idea from Dave Stycos post: http://groups.google.com/group/ossec-dev/browse_thread/thread/e29c5d71926b8af5<br />
#<br />
# This script is Public Domain, and is provided AS-IS.  There is no<br />
# warranty, and no support given for its contents.<br />
#<br />
# Version 1.0: Apr. 6, 2010<br />
#</p>
<p>DEBUG=&#8221;false&#8221;<br />
ACTION=$1<br />
USER=$2<br />
IP=$3<br />
ALERTID=$4<br />
RULEID=$5</p>
<p>LOCAL=`dirname $0`;<br />
cd $LOCAL<br />
cd ../<br />
PWD=`pwd`<br />
UNAME=`uname`</p>
<p># Zabbix Sender<br />
ZabbixSender=&#8221;/usr/bin/zabbix_sender&#8221;<br />
#ZabbixSender=&#8221;/usr/sbin/zabbix_sender&#8221;</p>
<p># Zabbix Server<br />
ZabbixServer=&lt;your zabbix server ip&gt;</p>
<p># Zabbix Port<br />
ZabbixPort=10051</p>
<p># All alerts will be processed by Zabbix under this key.<br />
ZabbixKeyName=OSSEC</p>
<p># Check that zabbix_sender file exists.<br />
if [ ! -w $ZabbixSender ]; then<br />
logger -p local0.err &#8220;$0: File $ZabbixSender not found.  Exiting.&#8221;<br />
exit 1<br />
fi</p>
<p># Getting alert time<br />
ALERTTIME=`echo &#8220;$ALERTID&#8221; | cut -d  &#8220;.&#8221; -f 1`</p>
<p># Getting end of alert<br />
ALERTLAST=`echo &#8220;$ALERTID&#8221; | cut -d  &#8220;.&#8221; -f 2`</p>
<p># Getting full alert<br />
ALERTTEXT=`grep -A 10 &#8220;$ALERTTIME&#8221; $PWD/../logs/alerts/alerts.log | grep -v &#8220;.$ALERTLAST: &#8221; -A 10 `</p>
<p># Extract host (agent) name from alert.<br />
HOSTNAME=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;1,1s/^.*\:[0-9][0-9]\:[0-9][0-9][^A-Za-z0-9_]*\([-A-Za-z0-9_]*\)\-&gt;.*$/\1/p&#8217;`</p>
<p># if hostname alert wasn&#8217;t from local host, the host value is &#8220;(hostname) ip&#8221;, which extracts differently<br />
if [ "$HOSTNAME" = "" ]<br />
then<br />
HOSTNAME=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;1,1s/^.*\:[0-9][0-9]\:[0-9][0-9] (\([-A-Za-z0-9_]*\)) .*\-&gt;.*$/\1/p&#8217;`<br />
fi<br />
if [ "$HOSTNAME" = "" ]<br />
then<br />
exit 0<br />
fi</p>
<p># Extract alert level from alert.<br />
ALERTLVL=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;2,2s/^.*(level \([0-9]*\).*$/\1/p&#8217;`</p>
<p># Extract description from alert.<br />
ALERTMSG=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;5,5p&#8217;`</p>
<p># Create Alert message<br />
# Short MSG version<br />
#ZMSG=&#8221;$ALERTID | $ALERTLVL | $RULEID &#8211; $ALERTMSG&#8221;<br />
# Full MSG Version<br />
ZMSG=&#8221;AlertID: $ALERTID | User: $USER | IP: $IP | Level: $ALERTLVL | RuleID: $RULEID &#8211; $ALERTMSG&#8221;</p>
<p># Send result to zabbix for logging and notification alerts.<br />
$ZabbixSender &#8211;zabbix-server $ZabbixServer &#8211;port $ZabbixPort &#8211;host $HOSTNAME &#8211;key $ZabbixKeyName &#8211;value &#8220;$ZMSG&#8221;</p>
<p>if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;$ZabbixSender &#8211;zabbix-server $ZabbixServer &#8211;port $ZabbixPort &#8211;host $HOSTNAME &#8211;key $ZabbixKeyName &#8211;value &#8216;$ZMSG&#8217;&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ACTION: $ACTION&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;USER: $USER&#8221;<br />
echo &#8220;IP: $IP&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ALERTID: $ALERTID&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ALERTLVL: $ALERTLVL&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;RULEID: $RULEID&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi<strong><br />
</strong></p></blockquote>
<p>With the script saved, you can restart OSSEC (OSSEC/bin/ossec-control restart) or wait until zabbix is setup then restart.</p>
<p>UPDATE 07-16-2010 &#8211; If you are using zabbix-proxies then you need to have the OSSEC alerts for proxy monitored hosts submitted through the proxy server.  This isn&#8217;t a problem with the existing script if the proxy server is also monitored through the proxy; just update the server IP to be the proxy not the central zabbix server.  If you monitor your proxy directly from the central zabbix server then the script needs to be updated to support sending proxy hosts though proxy and the host itself directly to zabbix.  The script can be found <a title="zabbix-alert.zip" href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-alert.zip">here</a>; or below.  Again be sure to watch for broken wrapped lines:</p>
<blockquote><p>#!/bin/sh<br />
#<br />
# Submits an OSSEC alert as a passive service check result to zabbix.<br />
#<br />
# Author: David M. Zendzian<br />
#<br />
# Idea from Dave Stycos post: http://groups.google.com/group/ossec-dev/browse_thread/thread/e29c5d71926b8af5<br />
#<br />
# Updated 7/15/10 &#8211; using 2 server hosts in case using proxies and local host is monitored directly by central server and not proxy.<br />
#<br />
# This script is Public Domain, and is provided AS-IS.  There is no<br />
# warranty, and no support given for its contents.<br />
#<br />
# Version 1.1: Jul. 15, 2010<br />
#</p>
<p>DEBUG=&#8221;true&#8221;<br />
ACTION=$1<br />
USER=$2<br />
IP=$3<br />
ALERTID=$4<br />
RULEID=$5</p>
<p>if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;NOTICE: Starting Zabbix sender&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi</p>
<p>LOCAL=`dirname $0`;<br />
cd $LOCAL<br />
cd ../<br />
PWD=`pwd`<br />
UNAME=`uname`</p>
<p># Zabbix Sender<br />
ZabbixSender=&#8221;/usr/bin/zabbix_sender&#8221;<br />
#ZabbixSender=&#8221;/usr/sbin/zabbix_sender&#8221;</p>
<p># Zabbix Server<br />
# Set server2 to be the same if all hosts monitored through proxy or the same server; otherwise<br />
# set ZabbixServer to the proxy for non-localhost and then ZabbixServer2 to the host that the<br />
# local proxy uses<br />
ZabbixServer=&lt;Server/Proxy&gt;<br />
ZabbixServer2=&lt;Server for &#8220;Localhost&#8221;&gt;</p>
<p># Zabbix Port<br />
ZabbixPort=10051</p>
<p># All alerts will be processed by Zabbix under this key.<br />
ZabbixKeyName=OSSEC</p>
<p># Check that zabbix_sender file exists.<br />
if [ ! -w $ZabbixSender ]; then<br />
logger -p local0.err &#8220;$0: File $ZabbixSender not found.  Exiting.&#8221;<br />
if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;ERROR: No Zabbix Sender&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi<br />
exit 1<br />
fi</p>
<p># Getting alert time<br />
ALERTTIME=`echo &#8220;$ALERTID&#8221; | cut -d  &#8220;.&#8221; -f 1`</p>
<p># Getting end of alert<br />
ALERTLAST=`echo &#8220;$ALERTID&#8221; | cut -d  &#8220;.&#8221; -f 2`</p>
<p># Getting full alert<br />
ALERTTEXT=`grep -A 10 &#8220;$ALERTTIME&#8221; $PWD/../logs/alerts/alerts.log | grep -v &#8220;.$ALERTLAST: &#8221; -A 10 `</p>
<p># Extract host (agent) name from alert.<br />
HOSTNAME=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;1,1s/^.*\:[0-9][0-9]\:[0-9][0-9][^A-Za-z0-9_]*\([-A-Za-z0-9_]*\)\-&gt;.*$/\1/p&#8217;`</p>
<p># if hostname alert wasn&#8217;t from local host, the host value is &#8220;(hostname) ip&#8221;, which extracts differently<br />
if [ "$HOSTNAME" = "" ]<br />
then<br />
HOSTNAME=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;1,1s/^.*\:[0-9][0-9]\:[0-9][0-9] (\([-A-Za-z0-9_]*\)) .*\-&gt;.*$/\1/p&#8217;`<br />
fi<br />
if [ "$HOSTNAME" = "" ]<br />
then<br />
if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;ERROR: No Hostname&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi<br />
exit 0<br />
fi</p>
<p># if the local host is a proxy then monitored items submitted through proxy, localhost probably monitored directly from central server (if not change comment this out)<br />
LOCALHOSTNAME=`hostname -s`<br />
if [ "$HOSTNAME" = "$LOCALHOSTNAME" ]<br />
then<br />
ZabbixServer=$ZabbixServer2<br />
fi</p>
<p>if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;ZabbixServer: $ZabbixServer&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi</p>
<p># Extract alert level from alert.<br />
ALERTLVL=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;2,2s/^.*(level \([0-9]*\).*$/\1/p&#8217;`</p>
<p># Extract description from alert.<br />
ALERTMSG=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;5,5p&#8217;`</p>
<p># Create Alert message<br />
ZMSG=&#8221;$ALERTID | $ALERTLVL | $RULEID &#8211; $ALERTMSG&#8221;</p>
<p># Send result to zabbix for logging and notification alerts.<br />
$ZabbixSender &#8211;zabbix-server $ZabbixServer &#8211;port $ZabbixPort &#8211;host $HOSTNAME &#8211;key $ZabbixKeyName &#8211;value &#8220;$ZMSG&#8221;</p>
<p>if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;$ZabbixSender &#8211;zabbix-server $ZabbixServer &#8211;port $ZabbixPort &#8211;host $HOSTNAME &#8211;key $ZabbixKeyName &#8211;value &#8216;$ZMSG&#8217;&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ACTION: $ACTION&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;USER: $USER&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;IP: $IP&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ALERTID: $ALERTID&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ALERTLVL: $ALERTLVL&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;RULEID: $RULEID&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi</p>
<p>exit 0</p></blockquote>
<p>UPDATE 09-24-2010 &#8211; If you happen to use full domain names, the regex for getting the name needs to allow &#8220;.&#8221;  &#8211; The script can be found <a title="here" href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-alert2.zip">zabbix-alert-201009</a>; or below.  Again be sure to watch for broken wrapped lines:</p>
<blockquote><p>#!/bin/sh<br />
#<br />
# Submits an OSSEC alert as a passive service check result to zabbix.<br />
#<br />
# Author: David M. Zendzian<br />
#<br />
# Idea from Dave Stycos post: http://groups.google.com/group/ossec-dev/browse_thread/thread/e29c5d71926b8af5<br />
#<br />
# Updated 7/15/10 &#8211; using 2 server hosts in case using proxies and  local host is monitored directly by central server and not proxy.<br />
#<br />
# This script is Public Domain, and is provided AS-IS.  There is no<br />
# warranty, and no support given for its contents.<br />
#<br />
# Version 1.1: Jul. 15, 2010<br />
#</p>
<p>DEBUG=&#8221;true&#8221;<br />
ACTION=$1<br />
USER=$2<br />
IP=$3<br />
ALERTID=$4<br />
RULEID=$5</p>
<p>if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;NOTICE: Starting Zabbix sender&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi</p>
<p>LOCAL=`dirname $0`;<br />
cd $LOCAL<br />
cd ../<br />
PWD=`pwd`<br />
UNAME=`uname`</p>
<p># Zabbix Sender<br />
ZabbixSender=&#8221;/usr/bin/zabbix_sender&#8221;<br />
#ZabbixSender=&#8221;/usr/sbin/zabbix_sender&#8221;</p>
<p># Zabbix Server<br />
# Set server2 to be the same if all hosts monitored through proxy or the same server; otherwise<br />
# set ZabbixServer to the proxy for non-localhost and then ZabbixServer2 to the host that the<br />
# local proxy uses<br />
ZabbixServer=&lt;Server/Proxy&gt;<br />
ZabbixServer2=&lt;Server for &#8220;Localhost&#8221;&gt;</p>
<p># Zabbix Port<br />
ZabbixPort=10051</p>
<p># All alerts will be processed by Zabbix under this key.<br />
ZabbixKeyName=OSSEC</p>
<p># Check that zabbix_sender file exists.<br />
if [ ! -w $ZabbixSender ]; then<br />
logger -p local0.err &#8220;$0: File $ZabbixSender not found.  Exiting.&#8221;<br />
if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;ERROR: No Zabbix Sender&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi<br />
exit 1<br />
fi</p>
<p># Getting alert time<br />
ALERTTIME=`echo &#8220;$ALERTID&#8221; | cut -d  &#8220;.&#8221; -f 1`</p>
<p># Getting end of alert<br />
ALERTLAST=`echo &#8220;$ALERTID&#8221; | cut -d  &#8220;.&#8221; -f 2`</p>
<p># Getting full alert<br />
ALERTTEXT=`grep -A 10 &#8220;$ALERTTIME&#8221; $PWD/../logs/alerts/alerts.log | grep -v &#8220;.$ALERTLAST: &#8221; -A 10 `</p>
<p># Extract host (agent) name from alert.<br />
HOSTNAME=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;1,1s/^.*\:[0-9][0-9]\:[0-9][0-9][^A-Za-z0-9_]*\([-A-Za-z0-9_.]*\)\-&gt;.*$/\1/p&#8217;`</p>
<p># if hostname alert wasn&#8217;t from local host, the host value is &#8220;(hostname) ip&#8221;, which extracts differently<br />
if [ "$HOSTNAME" = "" ]<br />
then<br />
HOSTNAME=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;1,1s/^.*\:[0-9][0-9]\:[0-9][0-9] (\([-A-Za-z0-9_.]*\)) .*\-&gt;.*$/\1/p&#8217;`<br />
fi<br />
if [ "$HOSTNAME" = "" ]<br />
then<br />
if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;ERROR: No Hostname&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi<br />
exit 0<br />
fi</p>
<p>#  if the local host is a proxy then monitored items submitted through  proxy, localhost probably monitored directly from central server (if not  change comment this out)<br />
LOCALHOSTNAME=`hostname -s`<br />
if [ "$HOSTNAME" = "$LOCALHOSTNAME" ]<br />
then<br />
ZabbixServer=$ZabbixServer2<br />
fi</p>
<p>if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;ZabbixServer: $ZabbixServer&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi</p>
<p># Extract alert level from alert.<br />
ALERTLVL=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;2,2s/^.*(level \([0-9]*\).*$/\1/p&#8217;`</p>
<p># Extract description from alert.<br />
ALERTMSG=`echo &#8220;$ALERTTEXT&#8221; | sed -n &#8217;5,5p&#8217;`</p>
<p># Create Alert message<br />
ZMSG=&#8221;$ALERTID | $ALERTLVL | $RULEID &#8211; $ALERTMSG&#8221;</p>
<p># Send result to zabbix for logging and notification alerts.<br />
$ZabbixSender &#8211;zabbix-server $ZabbixServer &#8211;port $ZabbixPort &#8211;host $HOSTNAME &#8211;key $ZabbixKeyName &#8211;value &#8220;$ZMSG&#8221;</p>
<p>if [ "$DEBUG" = "true" ]<br />
then<br />
echo &#8220;$ZabbixSender &#8211;zabbix-server $ZabbixServer &#8211;port $ZabbixPort  &#8211;host $HOSTNAME &#8211;key $ZabbixKeyName &#8211;value &#8216;$ZMSG&#8217;&#8221; &gt;&gt;  /tmp/zabbix-test.log<br />
echo &#8220;ACTION: $ACTION&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;USER: $USER&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;IP: $IP&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ALERTID: $ALERTID&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;ALERTLVL: $ALERTLVL&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;RULEID: $RULEID&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
echo &#8220;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8221; &gt;&gt; /tmp/zabbix-test.log<br />
fi</p>
<p>exit 0</p></blockquote>
<p>For this integration to work, <strong>the host names used in OSSEC need to match the host names defined in Zabbix</strong>.  If they do not match, then zabbix_sender results will not make it into the hosts items correctly.</p>
<p>The easiest way to setup zabbix is to setup a <a title="template" href="http://www.zabbix.com/wiki/templates/start" target="_self">template</a>.  This template will define the application, item and triggers for OSSEC and can easily be linked to the hosts you are monitoring.</p>
<p>In zabbix goto Configure/Hosts and select &#8216;templates&#8217;.</p>
<p>Create a new template called OSSEC and be sure to add it to the Templates group.</p>
<div id="attachment_98" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-add-template.png"><img class="size-large wp-image-98" title="Zabbix: Add OSSEC Template" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-add-template-1024x570.png" alt="Add OSSEC Template" width="525" height="292" /></a><p class="wp-caption-text">Zabbix 1.6: Add OSSEC Template </p></div>
<div id="attachment_144" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-template.png"><img class="size-large wp-image-144" title="Zabbix 1.8: Add OSSEC Template" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-template-1024x759.png" alt="Zabbix 1.8: Add OSSEC Template" width="525" height="389" /></a><p class="wp-caption-text">Zabbix 1.8: Add OSSEC Template</p></div>
<p>With the template created, a new application needs to be created so the OSSEC items have a place to be organized.  Staying in Configuration / Hosts (for Zabbix 1.6 &amp; 1.8), in the drop down on the upper right, select &#8220;Applications&#8221; and then from the group and host dropdown, select Templates / Template_OSSEC that was just created.  There should be no Applications in the list. If you do not see Template_OSSEC that was just created, go back to templates and edit the OSSEC item and be sure that it is in the &#8220;Templates&#8221; group.</p>
<p>Click on &#8220;Create application&#8221; and create &#8220;OSSEC Monitor&#8221; or whatever you want to call it.</p>
<div id="attachment_99" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-create-application.png"><img class="size-full wp-image-99" title="Zabbix 1.6: Create OSSEC Template Application" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-create-application.png" alt="Create OSSEC Template Application" width="525" height="191" /></a><p class="wp-caption-text">Zabbix 1.6: Create OSSEC Template Application</p></div>
<div id="attachment_145" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-application.png"><img class="size-full wp-image-145" title="Zabbix 1.8: Create OSSEC Application" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-application.png" alt="Zabbix 1.8: Create OSSEC Application" width="525" height="220" /></a><p class="wp-caption-text">Zabbix 1.8: Create OSSEC Application</p></div>
<p>Now we are ready to create the Item &amp; Trigger for the OSSEC data.  In Zabbix 1.6, select &#8220;Configuration / Items&#8221; and select &#8220;Templates / Template_OSSEC&#8221; from the group and host selections and then click on &#8220;Create Item.&#8221;  The important item here is the Key which we will setup as OSSEC and is required to match the ZabbixKeyName in the zabbix-alert.sh script on the OSSEC server.</p>
<div id="attachment_100" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/create-item.png"><img class="size-full wp-image-100" title="Zabbix 1.6: Create OSSEC Item" src="http://www.zendzign.com/wp-content/uploads/2010/04/create-item.png" alt="Zabbix Create OSSEC Item" width="525" height="355" /></a><p class="wp-caption-text">Zabbix 1.6: Create OSSEC Item</p></div>
<p>In Zabbix 1.8, remain in the &#8220;Configuration / Hosts&#8221; menu and in the upper right drop down select &#8220;Items&#8221;.  Click on &#8220;Create Item.&#8221;  When the new form is up, click on &#8220;Select&#8221; for the Host and select Template_OSSEC that we created above.  The same values will be set as with Zabbix 1.6.</p>
<div id="attachment_146" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-item.png"><img class="size-full wp-image-146" title="Zabbix 1.8: Create OSSEC Item" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-item.png" alt="Zabbix 1.8: Create OSSEC Item" width="525" height="365" /></a><p class="wp-caption-text">Zabbix 1.8: Create OSSEC Item</p></div>
<p>As you can see, the item is a &#8220;Text&#8221; type getting data from a Zabbix Trapper event.  The things to not forget here are to enter your OSSEC server(s) in the Allowed Host line and to select the OSSEC Monitor application.</p>
<p>The next step is to create a trigger which will let us know when new data has arrived from OSSEC. Select &#8220;Configuration / Triggers&#8221; in Zabbix 1.6.</p>
<p>If you are using 1.8 then remain on the &#8220;Configuration / Hosts&#8221; page and select &#8220;Triggers&#8221; from the dropdown box on the upper right.</p>
<p>It should default to the Template_OSSEC host, but if it doesn&#8217;t then select Templates from groups and the Template_OSSEC host.</p>
<p>There are several ways to monitor the OSSEC text data, but I have selected to alert if there is new data in the last 10 minutes.  As you can see from the screenshot, the expression I used is {Template_OSSEC:OSSEC.nodata(600)}#1.  This works because the nodata(600) will return a 1 if no data is received in the time period specified (600 sec or 10 min).  So if it ever returns anything other than 1, we have new data.  For more information on trigger functions, consult the zabbix <a title="manual" href="http://www.zabbix.com/documentation/1.8/manual/config/triggers" target="_self">manual</a>.</p>
<p>Now click on &#8220;Create Trigger&#8221; go create the trigger.</p>
<div id="attachment_101" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-create-trigger.png"><img class="size-full wp-image-101" title="Zabbix 1.6: Create OSSEC Zabbix Trigger" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-create-trigger.png" alt="Create OSSEC Zabbix Trigger" width="525" height="355" /></a><p class="wp-caption-text">Zabbix 1.6: Create OSSEC Zabbix Trigger</p></div>
<div id="attachment_147" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-trigger.png"><img class="size-full wp-image-147" title="Zabbix 1.8: Create OSSEC Zabbix Trigger" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-ossec-trigger.png" alt="Zabbix 1.8: Create OSSEC Zabbix Trigger" width="525" height="365" /></a><p class="wp-caption-text">Zabbix 1.8: Create OSSEC Zabbix Trigger</p></div>
<p>I have set the alert severity to &#8220;average&#8221; but you may want to change that depending on your needs.  The zabbix actions we will define will send all OSSEC alerts so the severity will not really matter.  One thing that is worth examining is to change the OSSEC item value to log instead of text which could allow for log severity and other values that could be used with the OSSEC alert levels; but that project is for another time.</p>
<p><strong>Updated: 4/16/10 &#8211; </strong>What I have done for alerting based on level is to use the &#8220;short&#8221; ZMSG message type in the zabbix-alert.sh script and define a trigger such as:</p>
<p style="padding-left: 30px;">({Template_OSSEC:OSSEC.<strong>nodata(</strong>600<strong>)</strong>}#1)&amp;({Template_OSSEC:OSSEC.<strong>str(</strong> | 1 | <strong>)</strong>}#1)&amp;({Template_OSSEC:OSSEC.<strong>str(</strong> | 2 | <strong>)</strong>}#1)&amp;({Template_OSSEC:OSSEC.<strong>str(</strong> | 3 | <strong>)</strong>}#1)</p>
<p>What this trigger does is requires all 4 conditions to be met (&amp;=&#8221;AND&#8221; between each item test).  The first is that there is new data within the last 10 minutes, the other 3 are requirements that the new data does not contain | 1 | or | 2 | or | 3 |, which would be OSSEC alert levels 1, 2 and 3.  If you use the longer ZMSG then the str values would be like: {Template_OSSEC:OSSEC.<strong>str(</strong> | Level: 3 | <strong>)</strong>}#1</p>
<p>Only 2 things left to do and the OSSEC/Zabbix integration is done.  These are to create actions for OSSEC events and to link the OSSEC template to the hosts you are monitoring with OSSEC.</p>
<p>In our local zabbix configuration I have created a &#8220;Security Administrator&#8221; group that receives IDS and other security events and will be using that to specify who receives the alerts.  You can modify these settings based on your local policy and zabbix configuration.</p>
<p>As you will also see in the following screenshot, I have modified the default message.  This allows me to receive the full data from the OSSEC event through {ITEM.LASTVALUE}.  I have also shortened the message so I can receive the details I want on my SMS alerts which have a smaller size than full emails.</p>
<p>I have tried to enable escalations for OSSEC alerts, however the way that zabbix handles items is that it will only look at the &#8220;active&#8221; triggers &amp; items, what this means is that when a new OSSEC alert comes in and is added to the items database, the trigger is alerted but after 10 minutes it will &#8220;go away&#8221;.  There is no way, currently, to have a trigger depend on it&#8217;s being &#8220;Ack&#8217;d&#8221; which would be preferred for security, log and other events that just shouldn&#8217;t go away until an admin acks what happened.  There is a currently active zabbix <a title="feature request" href="https://support.zabbix.com/browse/ZBXNEXT-104" target="_self">feature request</a> requesting this, so please go vote it up so we can see it added in the near future!</p>
<div id="attachment_103" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-create-action.png"><img class="size-full wp-image-103" title="Zabbix 1.6: Create OSSEC Action" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-create-action.png" alt="Zabbix Create OSSEC Action" width="525" height="355" /></a><p class="wp-caption-text">Zabbix 1.6: Create OSSEC Action</p></div>
<div id="attachment_148" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-action.png"><img class="size-full wp-image-148" title="Zabbix 1.8: Create OSSEC Action" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-create-action.png" alt="Zabbix 1.8: Create OSSEC Action" width="525" height="365" /></a><p class="wp-caption-text">Zabbix 1.8: Create OSSEC Action</p></div>
<p>All that is left is to link your hosts to the OSSEC template.  The OSSEC alert submits data to zabbix based on the host names defined in OSSEC.  So once again, please be sure the names used match in both systems.</p>
<p>If you do not know how to link the OSSEC template, simply go to &#8220;Configuration / Hosts&#8221; and edit the hosts that are monitored by OSSEC.  You need to link every host as the alerts will be coming in directly to each unique host.  The example below is for one of our ossec servers, but the configuration should be the same for all OSSEC monitored hosts.</p>
<div id="attachment_104" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-host-templatelink.png"><img class="size-full wp-image-104" title="Zabbix 1.6: Host OSSEC Template Link" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-host-templatelink.png" alt="Zabbix Host OSSEC Template Link" width="525" height="462" /></a><p class="wp-caption-text">Zabbix 1.6: Host OSSEC Template Link</p></div>
<div id="attachment_149" class="wp-caption alignnone" style="width: 535px"><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-ossec-template-link.png"><img class="size-large wp-image-149" title="Zabbix 1.8: Host OSSEC Template Link" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix1.8-ossec-template-link-1024x637.png" alt="Zabbix 1.8: Host OSSEC Template Link" width="525" height="326" /></a><p class="wp-caption-text">Zabbix 1.8: Host OSSEC Template Link</p></div>
<p>This should be it.  If you have already restarted OSSEC then you just need to create an event it will alert on (logging onto monitored host, creating &#8220;segfault&#8221; log messages: logger &#8220;segfault&#8221;, etc).  In my quick test, seen below, I did a failed logon (bad pw) and within a few seconds I had my jabber alert pop up and a sms message arrive on my phone!</p>
<p><a href="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-ossec-alert.png"><img class="alignnone size-full wp-image-122" title="Zabbix OSSEC Jabber Alert" src="http://www.zendzign.com/wp-content/uploads/2010/04/zabbix-ossec-alert.png" alt="Zabbix OSSEC Jabber Alert" width="332" height="340" /></a></p>
<p>If you have any problems, you can set DEBUG=true in the zabbix-alert.sh and it will log out what is being sent to zabbix into /tmp/zabbix-test.log.</p>
<p>If OSSEC is not running active-alerts, you may want to jump on #ossec on the openprojects IRC and get some assistance or search google.</p>
<p>Good luck!</p>
<p>David M. Zendzian | Managing Partner | <a title="ZZ Servers, LLC" href="http://www.zzservers.com" target="_self">ZZ Servers</a><br />
268 Bush St. #4127 | San Francisco, CA 94104</p>
<p>Business Hosting Solutions | PCI | HIPAA<br />
Managed Hosting Specialists</p>
<p><em> </em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2010/04/zabbix-ossec-open-source-compliance-and-security-monitoring/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Anti Virus and PCI Compliance</title>
		<link>http://www.zendzign.com/2009/12/anti-virus-and-pci-compliance/</link>
		<comments>http://www.zendzign.com/2009/12/anti-virus-and-pci-compliance/#comments</comments>
		<pubDate>Sun, 27 Dec 2009 18:14:00 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[anti virus]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[malicious software]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=92</guid>
		<description><![CDATA[Last year PCI DSS 1.2 was released changing the intent of the controls required for anti-virus software. In version 1.1 anti-virus software was only required for systems commonly affected by viruses and excluded UNIX based operating systems and mainframes. Version 1.2 now requires all operating system types commonly affected by malicious software be protected and [...]]]></description>
			<content:encoded><![CDATA[<p>Last year PCI DSS 1.2 was released changing the intent of the controls required for anti-virus software. In version 1.1 anti-virus software was only required for systems commonly affected by viruses and excluded UNIX based operating systems and mainframes. Version 1.2 now requires all operating system types commonly affected by malicious software be protected and removes the exclusion for UNIX and mainframes. These changes now open the requirement for protection from &#8220;malicious software&#8221; such as worms, trojans, adware, spyware or any &#8220;malicious software&#8221;.<span id="more-92"></span></p>
<p>In the past, it was though Linux servers were safe from viruses but recently hackers have been taking advantage of this false sense of security. Some researchers point out that 70% of attacks on Linux honeypots were infected with a 6 year old virus (RST-B)* and used as command and control points for botnets.</p>
<p>ZZ Servers now offers affordable F-Prot anti-virus software for Windows, Linux, Exchange, BSD and Solaris. Protect your servers, desktops and critical infrastructure today. Contact <a href="http://www.zzservers.com/">ZZ Servers</a> at 800-796-3574 or email support@zzservers.com to arrange for installation of anti-virus software today.</p>
<p>*RST-B is a backdoor malware runs on Linux/UNIX platforms and infects ELF files in the current and /bin directories. This Linux backdoor and virus compromises system security by allowing remote users to manipulate and access infected machines. If executed as root, it will start processes listening on two network interfaces which provide a remote root shell.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2009/12/anti-virus-and-pci-compliance/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Create an SSL certificate with strong, 2048 bit encryption</title>
		<link>http://www.zendzign.com/2009/10/create-an-ssl-certificate-with-strong-2048-bit-encryption/</link>
		<comments>http://www.zendzign.com/2009/10/create-an-ssl-certificate-with-strong-2048-bit-encryption/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 16:59:45 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Email]]></category>
		<category><![CDATA[Kerio Mail Server]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=68</guid>
		<description><![CDATA[When creating either a self signed certificate or a certificate request, Kerio MailServer uses 1024 bit encryption. You may however prefer stronger encryption, especially if you are using a signing authority such as GoDaddy, which requires 2048 bit encryption. In this case, you may use the free OpenSSL utility that is available with most Unix [...]]]></description>
			<content:encoded><![CDATA[<p>When creating either a self signed certificate or a certificate request, Kerio MailServer uses 1024 bit encryption. You may however prefer stronger encryption, especially if you are using a signing authority such as GoDaddy, which requires 2048 bit encryption. In this case, you may use the free OpenSSL utility that is available with most Unix or Linux based systems. There is also a version of the tool available for the Windows Operating system.<br />
<span id="more-68"></span> Self signed certificates generated by Kerio MailServer carry a default expiration of 1 year. The OpenSSL utility will also allow you to define your own expiration, for example 3 years. For specific instructions and usage of the OpenSSL utility, read the <a href="http://list.kerio.com/lt.php?id=K0oEAQhRAF4GTQcAVAJFVVcFAAtS">Knowledgebase article</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2009/10/create-an-ssl-certificate-with-strong-2048-bit-encryption/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Amazon confirms EC2/S3 does not meet PCI guidelines</title>
		<link>http://www.zendzign.com/2009/08/amazon-confirms-ec2s3-does-not-meet-pci-guidelines/</link>
		<comments>http://www.zendzign.com/2009/08/amazon-confirms-ec2s3-does-not-meet-pci-guidelines/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 14:35:38 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[amazon ec2]]></category>
		<category><![CDATA[cloud]]></category>
		<category><![CDATA[compliance]]></category>
		<category><![CDATA[compliant hosting]]></category>
		<category><![CDATA[pci compliance]]></category>
		<category><![CDATA[pci complliant hosting]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=58</guid>
		<description><![CDATA[If your business requires PCI compliant hosting services because you store, transmit or process cardholder data, hosting in the cloud may not be for you.  Most cloud providers do not have the controls or processes in place to protect sensitive cardholder data or the willingness to enter into required business arrangements with merchants.  Because of [...]]]></description>
			<content:encoded><![CDATA[<p>If your business requires PCI compliant hosting services because you store, transmit or process cardholder data, hosting in the cloud may not be for you.  Most cloud providers do not have the controls or processes in place to protect sensitive cardholder data or the willingness to enter into required business arrangements with merchants.  Because of this, it is impossible to meet several requirements found in current PCI standards, leaving your business at risk for heavy fines by not being compliant.</p>
<p><span id="more-58"></span></p>
<p>One such example would be Amazon EC2.  In a recent discussion at <a href="http://developer.amazonwebservices.com/connect/message.jspa?messageID=139547" target="_blank">amazonwebservices.com</a> forum and <a href="http://it.slashdot.org/story/09/08/17/0438207/Amazon-Confirms-EC2S3-Not-PCI-Level-1-Compliant">slashdot.org</a> users were discussing a desire to move to Amazon EC2 and maintain PCI compliance.  While not surprising, at least there was a concrete answer to were Amazon stands with regards to its role in its customer’s compliance.  In an email from Taimur Rashid, an account manager at Amazon Web Services, he states <em>“We do not and will not provide a written agreement attesting compliance and assuming responsibility for cardholder data.”</em><em> </em></p>
<p>PCI requires all merchants maintain a written agreement between the merchant and service provider that outlines responsibility for cardholder data.  “<em>Requirement 12.8.2 Maintain a written agreement that includes an acknowledgement that the service providers are responsible for the security of cardholder data the service providers possess.”</em><em> Without this simple agreement, you cannot be compliant.</em></p>
<p>In addition to not allowing a written agreement, Amazon also will not allow on site audits required for Level 1 and <a href="http://www.zendzign.com/2009/06/level-2-merchants-required-to-have-on-site-assessment-by-qsa/">now Level 2 merchants</a>.  Cindy S from Amazon Web Services states “<em>If you have a data breach, you automatically need to become level 1 compliant which requires on-site auditing; that is something we cannot extend to our customers.”</em></p>
<p>Based on the 2 statements above, Amazon EC2/S3 is currently not capable of providing the level of service required for PCI compliance on any level.  If you are a merchant and require PCI compliance, avoid the cloud and find a reputable service provider which specializes in PCI compliance such as <a href="http://www.gsihosting.com/">GSI</a>, <a href="http://www.rackspace.com">Rackspace</a> or <a href="http://www.zzservers.com/">ZZ Servers</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2009/08/amazon-confirms-ec2s3-does-not-meet-pci-guidelines/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Batteries.com Credit Card Data Stolen</title>
		<link>http://www.zendzign.com/2009/05/batteriescom-credit-card-data-stolen/</link>
		<comments>http://www.zendzign.com/2009/05/batteriescom-credit-card-data-stolen/#comments</comments>
		<pubDate>Thu, 28 May 2009 00:52:12 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[credit card]]></category>
		<category><![CDATA[data breach]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/?p=25</guid>
		<description><![CDATA[Yet another data breach involving theft of credit card data has been announced. On March 13th, Batteries.com received notice from a customer about potential unauthorized activity on their credit card. They later discovered the Batteries.com network had been breached from around February 25, 2009 to April 9, 2009. The breach involved theft of names, addresses, [...]]]></description>
			<content:encoded><![CDATA[<p>Yet another data breach involving theft of credit card data has been announced.<span> </span>On March 13th, Batteries.com received notice from a customer about potential unauthorized activity on their credit card.  They later discovered the Batteries.com network had been breached from around February 25, 2009 to April 9, 2009.  The breach involved theft of names, addresses, and credit card information.</p>
<p>This breech at Batteries.com shows that a merchant does not need to be large like Heartland to be targeted by hackers.</p>
<p>For more information regarding this breech, visit the Batteries.com <a href="http://batteries.com/security/fraud-prevention.asp">security and fraud prevention page</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2009/05/batteriescom-credit-card-data-stolen/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

