<?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; Linux</title>
	<atom:link href="http://www.zendzign.com/category/linux/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>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>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>CentOS 5.1 Now Available for all VPS packages</title>
		<link>http://www.zendzign.com/2008/05/centos-51-now-available-for-all-vps-packages/</link>
		<comments>http://www.zendzign.com/2008/05/centos-51-now-available-for-all-vps-packages/#comments</comments>
		<pubDate>Tue, 27 May 2008 09:03:06 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[CentOs]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[VPS Servers]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/2008/05/centos-51-now-available-for-all-vps-packages/</guid>
		<description><![CDATA[I am pleased to announce that ZZ Servers now has CentOS 5.1 available as an option for VPS installation.&#160; CentOS or Community Enterprise Operating System is a Linux distribution Enterprise-class Linux Distribution derived from Red Hat Enterprise Linux (RHEL).&#160; CentOS conforms fully with the upstream vendors redistribution policy and aims to be 100% binary compatible. [...]]]></description>
			<content:encoded><![CDATA[<p>I am pleased to announce that ZZ Servers now has CentOS 5.1 available as an option for VPS installation.&#160; <b>CentOS</b> or Community Enterprise Operating System is a Linux distribution Enterprise-class Linux Distribution derived from <a href="http://en.wikipedia.org/wiki/Red_Hat_Enterprise_Linux">Red Hat Enterprise Linux</a> (RHEL).&#160; CentOS conforms fully with the upstream vendors redistribution policy and aims to be 100% binary compatible. CentOS mainly changes packages to remove upstream vendor branding and artwork while retaining the same functionality of Red Hat Enterprise Linux.&#160; </p>
<p><span id="more-16"></span></p>
<p>CentOS has numerous advantages over some of the other clone projects including an active and growing user community, quickly rebuilt, tested, and QA&#8217;ed errata packages, an extensive <a href="http://www.centos.org/modules/tinycontent/index.php?id=15">mirror network</a>, developers who are contactable and responsive, multiple free support avenues including <a href="http://www.centos.org/modules/tinycontent/index.php?id=8">IRC Chat</a>, <a href="http://www.centos.org/modules/tinycontent/index.php?id=16">Mailing Lists</a>, <a href="http://www.centos.org/modules/newbb/">Forums</a>, a dynamic <a href="http://www.centos.org/modules/smartfaq/">FAQ</a>.</p>
<p>The following operating systems are now available for all VPS hosting packages:</p>
<ul>
<li>Debian 4.0 (Etch)</li>
<li>Debian 5.0 (Lenny)</li>
<li>Ubuntu 7.04 (Feisty Fawn)</li>
<li>Ubuntu 8.04 LTS (Hardy Heron)</li>
<li>CentOS 5.1</li>
</ul>
<p>Currently all of our operating system versions come as a bare install.&#160; What that means is we do not pre-install anything other than what it takes to get your server up and running.&#160; Not is this method more secure, it allows you to configure the server exactly how you need it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/centos-51-now-available-for-all-vps-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>OpenSSL Vulnerability</title>
		<link>http://www.zendzign.com/2008/05/openssh-vulnerability/</link>
		<comments>http://www.zendzign.com/2008/05/openssh-vulnerability/#comments</comments>
		<pubDate>Fri, 23 May 2008 19:18:37 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Debian]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Ubuntu]]></category>
		<category><![CDATA[openssl]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/2008/05/openssh-vulnerability/</guid>
		<description><![CDATA[A weakness has been discovered in the random number generator used by OpenSSL on Debian and Ubuntu systems. As a result of this weakness, certain encryption keys are much more common than they should be, such that an attacker could guess the key through a brute-force attack given minimal knowledge of the system. This particularly [...]]]></description>
			<content:encoded><![CDATA[<p>A weakness has been discovered in the random number generator used by OpenSSL on Debian and Ubuntu systems. As a result of this weakness, certain encryption keys are much more common than they should be, such that an attacker could guess the key through a brute-force attack given minimal knowledge of the system. This particularly affects the use of encryption keys in OpenSSH. </p>
<p><span id="more-14"></span></p>
<p>This vulnerability only affects operating systems which (like Ubuntu) are based on Debian. However, other systems can be indirectly affected if weak keys are imported into them. We consider this an extremely serious vulnerability, and urge all users to act immediately to secure their systems. </p>
<p>The following Ubuntu releases are affected: </p>
<ul>
<li>Ubuntu 7.04 </li>
<li>Ubuntu 7.10 </li>
<li>Ubuntu 8.04 LTS</li>
<li>Debian Etch 4.0</li>
<li>Debian Lenny 5.0</li>
</ul>
<p>For more details visit these links:</p>
<ul>
<li>Ubuntu: <a title="http://www.ubuntu.com/usn/usn-612-2" href="http://www.ubuntu.com/usn/usn-612-2">http://www.ubuntu.com/usn/usn-612-2</a></li>
<li>Debian: <a title="http://www.debian.org/security/2008/dsa-1571" href="http://www.debian.org/security/2008/dsa-1571">http://www.debian.org/security/2008/dsa-1571</a></li>
</ul>
<p>We consider this an extremely serious vulnerability, and urge all users to act immediately to secure their systems.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/openssh-vulnerability/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Important Concepts For Linux Beginners &#8211; Permissions And Groups</title>
		<link>http://www.zendzign.com/2008/05/important-concepts-for-linux-beginners-permissions-and-groups-2/</link>
		<comments>http://www.zendzign.com/2008/05/important-concepts-for-linux-beginners-permissions-and-groups-2/#comments</comments>
		<pubDate>Tue, 13 May 2008 05:38:52 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[permissions]]></category>

		<guid isPermaLink="false">http://www.zendzign.com/2008/05/important-concepts-for-linux-beginners-permissions-and-groups-2/</guid>
		<description><![CDATA[The easiest way to learn Linux permissions is from an example. The ls -l command generates a list of contents, such as files along with their permissions. Let&#8217;s take a look at the default values for a file called Filename. We are adding spaces to make the output more legible. - rw- r&#8211; r&#8211; other [...]]]></description>
			<content:encoded><![CDATA[<p>The easiest way to learn Linux permissions is from an example. The ls -l command generates a list of contents, such as files along with their permissions. Let&#8217;s take a look at the default values for a file called Filename. We are adding spaces to make the output more legible.</p>
<p><span id="more-11"></span></p>
<p>- rw- r&#8211; r&#8211; other information about the file Filename</p>
<p>The initial &#8211; signifies that this is a file (not a directory). The next three characters refer to the file permissions for the file owner, in many cases the person who created the file. The values rw- signify that the owner has read and write (modify) permission but not execute permission. Had these values been r-x the owner would be able to read and execute the file (program) but not modify it. The second set of values r&#8211; signify that the members of the group associated with this file have read but not write or execute permission. The third set of values also r&#8211; signify that other users have read but not write or execute permission.</p>
<p>Permissions are often handled numerically. The r has a value of 4, the w has a value of 2, and the x has a value of 1. In all cases the lack of permission has the value 0. So rw- has the value 6 and r&#8211; has the value 4. In the above example the permissions may be expressed as 644. The full set of permissions for everyone is expressed as 777 (not usually a good idea).</p>
<p>Note that the root user&#8217;s permissions aren&#8217;t listed. This shouldn&#8217;t be surprising because root has essentially complete permissions. But even root&#8217;s doesn&#8217;t have execute permissions for a file it creates. This permission must be added in a separate step. Why? This two-step procedure has important security implications. Let&#8217;s say that someone, perhaps root, has received an email that contains a virus-infested executable program. The program cannot be executed without the explicit permission of root or the recipient. If the user doesn&#8217;t know what to do the virus won&#8217;t be launched.</p>
<p>Linux defines permissions for directories that are similar to but not exactly the same as the file permissions. A read permission on a directory means that its contents may be listed. A write permission on a directory means that the user can modify its contents, by adding, deleting, or renaming files. An execute permission on a directory means that it may be accessed, in other words made the current working directory.</p>
<p>Permissions may be changed via the chmod command as in the example chmod 770 Junque which gives read, write, and execute permissions to the file owner and members of the ownership group but no permissions to anyone else. Not everyone likes working with these numbers. The symbolic mode uses letters and the plus and minus signs to change permissions.</p>
<p>The following command removes the write permission from the user (owner) of the Perm file chmod u-w Perm. To add the execute permission for others, people who do not belong to the group that owns the file apply the command chmod o+x Perm This command only makes sense if the Perm file is executable. Furthermore, under most circumstances the file owner and his or her group will have more permissions that the others. Linux doesn&#8217;t always check to see that your command really makes sense. Do you think that Windows is more intelligent in this respect?</p>
<p>The chown command is used to change the ownership of a file or a directory. The chgrp command is used to change the group ownership of files and directories. These commands might be used when a project passes from the development to the testing stage. Needless to say only the system administrator can execute these commands.</p>
<p>Of course there is more to Linux permissions and groups but we have covered the basics. The next article in this series discusses inodes, a topic that is sorely missing from the Windows bag of tricks.</p>
<p>Levi Reiss has authored or co-authored ten books on computers and the Internet. He loves the occasional glass of wine as exemplified by his wine websites including <a href="http://www.theworldwidewine.com">http://www.theworldwidewine.com</a>. He teaches Linux and Windows operating systems plus other computer courses at an Ontario French-language community college. Visit his new website <a href="http://www.linux4windows.com">http://www.linux4windows.com</a> which teaches you how to download and run Damn Small Linux on Windows computers, even if they are &quot;obsolete.&quot;</p>
<p>Article Source: <a href="http://EzineArticles.com">http://EzineArticles.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/important-concepts-for-linux-beginners-permissions-and-groups-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Commands For The Linux Command Line</title>
		<link>http://www.zendzign.com/2008/05/useful-commands-for-the-linux-command-line/</link>
		<comments>http://www.zendzign.com/2008/05/useful-commands-for-the-linux-command-line/#comments</comments>
		<pubDate>Fri, 09 May 2008 18:13:43 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[command line]]></category>

		<guid isPermaLink="false">http://zendzign.com/?p=6</guid>
		<description><![CDATA[This short guide shows some important commands for your daily work on the Linux command line. arch Outputs the processor architecture. $ arch i686 cat Outputs the contents of a file. $ cat lorem.txt Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim [...]]]></description>
			<content:encoded><![CDATA[<p>This short guide shows some important commands for your daily work on the Linux command line.</p>
<p><span id="more-6"></span></p>
<h3>arch</h3>
<p>Outputs the processor architecture.</p>
<p>$ arch</p>
<p>i686</p>
<h3>cat</h3>
<p>Outputs the contents of a file.</p>
<p>$ cat lorem.txt</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
<h3>cd</h3>
<p>Change the working directory.</p>
<p>$ cd /bin</p>
<h3>chgrp</h3>
<p>Change group ownership of files.</p>
<p>$ chgrp games moo.txt</p>
<h3>chmod</h3>
<p>Change access permissions of files.</p>
<p>$ chmod +x helloworld</p>
<h3>chown</h3>
<p>Change file owner and group.</p>
<p># chown root lorem.txt</p>
<h3>cksum</h3>
<p>Print CRC checksum and byte counts of each file.</p>
<p>$ cksum lorem.txt moo.txt</p>
<p>3570240675 453 lorem.txt</p>
<p>4294967295 0 moo.txt</p>
<h3>cp</h3>
<p>Copies a file.</p>
<p>$ cp lorem.txt copy_of_lorem.txt</p>
<h3>date</h3>
<p>Outputs the current date and time.</p>
<p>$ date</p>
<p>Sat Mar 3 12:07:09 GMT 2007</p>
<h3>df</h3>
<p>Reports the amount of disk space used and available on filesystems.</p>
<p>$ df</p>
<p>Filesystem 1K-blocks Used Available Use% Mounted on&lt;br&gt;</p>
<p>/dev/simfs 39845888 218048 39627840 1% /</p>
<h3>dir</h3>
<p>List directory contents.</p>
<p>$ dir</p>
<p>copy_of_lorem.txt lorem.txt moo.txt www</p>
<h3>du</h3>
<p>Estimate file space usage.</p>
<p>$ du -h /bin</p>
<p>7.8M /bin</p>
<h3>echo</h3>
<p>Display a line of text.</p>
<p>$ echo foobar</p>
<p>foobar</p>
<h3>exit</h3>
<p>Cause the shell to exit.</p>
<p>$ exit</p>
<h3>fgrep</h3>
<p>Print lines matching a pattern in a file.</p>
<p>$ fgrep &#8220;irure dolor&#8221; lorem.txt</p>
<p>commodo consequat. Duis aute irure dolor in reprehenderit in voluptate</p>
<h3>find</h3>
<p>Search for files in a directory hierarchy.</p>
<p>$ find hello*</p>
<p>hello_world</p>
<p>hello_world.c</p>
<h3>free</h3>
<p>Display amount of free and used memory in the system.</p>
<p>$ free</p>
<p>total used free shared buffers cached</p>
<p>Mem: 8299892 8287708 12184 0 2641772 1731236</p>
<p>Low: 3581300 3572764 8536</p>
<p>High: 4718592 4714944 3648</p>
<p>-/+ buffers/cache: 3914700 4385192</p>
<p>Swap: 8193140 2335664 5857476</p>
<h3>grep</h3>
<p>Print lines matching a pattern.</p>
<p>$ grep -i apple fruitlist.txt</p>
<p>apple</p>
<h3>groups</h3>
<p>Outputs the user groups of which your account belongs to.</p>
<p>$ groups</p>
<p>games users</p>
<h3>head</h3>
<p>Output the first part of files.</p>
<p>$ head -2 lorem.txt</p>
<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod</p>
<p>tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim</p>
<h3>hostname</h3>
<p>Outputs the machines hostname on the network.</p>
<p>$ hostname</p>
<p>anapnea.net</p>
<h3>id</h3>
<p>Outputs user id, group id, and groups of your account.</p>
<p>$ id</p>
<p>uid=1478(smallfoot) gid=100(users) groups=35(games),100(users)</p>
<h3>kill</h3>
<p>End a process.</p>
<p>$ kill -9 18298</p>
<p>-bash: kill: (18298) &#8211; Operation not permitted</p>
<h3>killall</h3>
<p>Kill processes by name.</p>
<p>$ killall irssi</p>
<p>irssi(18298): Operation not permitted</p>
<p>irssi(13372): Operation not permitted</p>
<p>irssi(22048): Operation not permitted</p>
<p>irssi: no process killed</p>
<h3>last</h3>
<p>Show listing of last logged in users.</p>
<p>$ last -n 3</p>
<p>alice pts/6 192.0.34.166 Fri May 18 16:17 still logged in</p>
<p>bob pts/2 64.233.183.103 Fri May 18 16:17 still logged in</p>
<p>clare pts/6 72.5.124.61 Fri May 18 15:54 &#8211; 15:55 (00:01)</p>
<h3>ldd</h3>
<p>Print shared library dependencies.</p>
<p>$ ldd /bin/bash</p>
<p>libncurses.so.5 =&gt; /lib/libncurses.so.5 (0&#215;40023000)</p>
<p>libdl.so.2 =&gt; /lib/libdl.so.2 (0&#215;40065000)</p>
<p>libc.so.6 =&gt; /lib/libc.so.6 (0&#215;40069000)</p>
<p>/lib/ld-linux.so.2 (0&#215;40000000)</p>
<h3>ln</h3>
<p>Make links between files.</p>
<p>$ ln -s data.txt symlink.txt</p>
<h3>logname</h3>
<p>Print user&#8217;s login name.</p>
<p>$ logname</p>
<p>smallfoot</p>
<h3>ls</h3>
<p>List directory contents.</p>
<p>$ ls</p>
<p>copy_of_lorem.txt lorem.txt moo.txt www</p>
<h3>man</h3>
<p>Opens the manual page for a software or function.</p>
<p>$ man bash</p>
<h3>md5sum</h3>
<p>Outputs the MD5 hash sum of a file.</p>
<p>$ md5sum lorem.txt</p>
<p>56da9e37259af34345895883e6fd1a27 lorem.txt</p>
<h3>mkdir</h3>
<p>Makes a directory.</p>
<p>$ mkdir foobar</p>
<h3>mv</h3>
<p>Moves a file.</p>
<p>$ mv lorem.txt ipsum.txt</p>
<h3>nl</h3>
<p>Number lines of files.</p>
<p>$ nl lorem.txt</p>
<p>1 Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod</p>
<p>2 tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim</p>
<p>3 veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea</p>
<p>4 commodo consequat. Duis aute irure dolor in reprehenderit in voluptate</p>
<p>5 velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint</p>
<p>6 occaecat cupidatat non proident, sunt in culpa qui officia deserunt</p>
<p>7 mollit anim id est laborum.</p>
<h3>nm</h3>
<p>List symbols from object files.</p>
<p>$ nm hello_world</p>
<p>080494a0 D _DYNAMIC</p>
<p>0804956c D _GLOBAL_OFFSET_TABLE_</p>
<p>08048474 R _IO_stdin_used</p>
<p>w _Jv_RegisterClasses</p>
<p>08049490 d __CTOR_END__</p>
<p>0804948c d __CTOR_LIST__</p>
<p>08049498 d __DTOR_END__</p>
<p>&#8230;</p>
<h3>od</h3>
<p>Dump files in octal and other formats.</p>
<p>$ od -t x /bin/sh</p>
<p>2376640 00098020 000054d4 00000000 00000000</p>
<p>2376660 00000020 00000000 000000c7 00000008</p>
<p>2376700 00000003 080e6500 0009d4f4 00004ae8</p>
<p>&#8230;</p>
<h3>pidof</h3>
<p>Find the process ID of a running program.</p>
<p>$ pidof fetchmail</p>
<p>22392</p>
<h3>ping</h3>
<p>Pings a host.</p>
<p>$ ping -c 2 127.0.0.1</p>
<p>PING 127.0.0.1 (127.0.0.1) 56(84) bytes of data.</p>
<p>64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.048 ms</p>
<p>64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.052 ms</p>
<p>&#8212; 127.0.0.1 ping statistics &#8212;</p>
<p>2 packets transmitted, 2 received, 0% packet loss, time 999ms</p>
<p>rtt min/avg/max/mdev = 0.048/0.050/0.052/0.002 ms</p>
<h3>ps</h3>
<p>Outputs running processes.</p>
<p>$ ps</p>
<p>PID TTY TIME CMD</p>
<p>21542 pts/12 00:00:00 bash</p>
<p>27706 pts/12 00:00:00 ps</p>
<h3>pstree</h3>
<p>Display a tree of processes.</p>
<p>$ pstree</p>
<p>init-+-2*[BitchX]</p>
<p>|-3*[bash---sleep]</p>
<p>|-fetchmail</p>
<p>|-screen-+-bash&#8212;irssi</p>
<p>| `-bash&#8212;ctorrent</p>
<p>|-screen-+-bash&#8212;lisp.run</p>
<p>| |-bash&#8212;vi</p>
<p>| |-2*[bash]</p>
<p>| `-bash&#8212;lynx</p>
<p>|-2*[screen---bash---irssi]</p>
<p>|-screen&#8212;irssi</p>
<p>|-screen&#8212;bash</p>
<p>|-screen-+-bash</p>
<p>| `-irssi</p>
<p>|-skjerm&#8212;irssi</p>
<p>|-sshd-+-5*[sshd---sshd---bash---irssi]</p>
<p>| |-8*[sshd---sshd---bash]</p>
<p>| |-sshd&#8212;sshd&#8212;bash&#8212;screen</p>
<p>| |-sshd&#8212;sshd</p>
<p>| `-sshd&#8212;sshd&#8212;bash&#8212;pstree</p>
<p>`-syslog-ng</p>
<h3>pwd</h3>
<p>Outputs the name of current working directory.</p>
<p>$ pwd</p>
<p>/home/smallfoot</p>
<h3>rm</h3>
<p>Removes a file or directory.</p>
<p>$ rm lorem.txt</p>
<h3>rmdir</h3>
<p>Removes a directory.</p>
<p>$ rmdir foobar</p>
<h3>sed</h3>
<p>Stream editor for filtering and transforming text.</p>
<p>$ echo &#8220;My cat&#8217;s name is Bob&#8221; | sed -e &#8216;s/Bob/Mittens/g&#8217;</p>
<p>My cat&#8217;s name is Mittens</p>
<h3>sha1sum</h3>
<p>Outputs the SHA1 hash sum of a file.</p>
<p>$ sha1sum lorem.txt</p>
<p>c942ddebd142ec8bacac9213d48096e74bab4957 lorem.txt</p>
<h3>shutdown</h3>
<p>Bring the system down in a secure way. All logged-in users are notified that the system is going down.</p>
<p>$ shutdown now</p>
<h3>size</h3>
<p>List section sizes and total size.</p>
<p>$ size /bin/bash</p>
<p>text data bss dec hex filename</p>
<p>621233 22712 19176 663121 a1e51 /bin/bash</p>
<h3>stat</h3>
<p>Outputs file status.</p>
<p>$ stat lorem.txt</p>
<p>File: `lorem.txt&#8217;</p>
<p>Size: 453 Blocks: 8 IO Block: 4096 regular file</p>
<p>Device: 77h/119d Inode: 27312217 Links: 1</p>
<p>Access: (0644/-rw-r&#8211;r&#8211;) Uid: ( 1478/smallfoot) Gid: ( 100/ users)</p>
<p>Access: 2007-03-03 12:24:39.000000000 +0000</p>
<p>Modify: 2007-03-03 12:24:39.000000000 +0000</p>
<p>Change: 2007-03-03 12:24:39.000000000 +0000</p>
<h3>strings</h3>
<p>Print the strings of printable characters in files.</p>
<p>$ strings hello_world</p>
<p>/lib/ld-linux.so.2</p>
<p>_Jv_RegisterClasses</p>
<p>__gmon_start__</p>
<p>libc.so.6</p>
<p>puts</p>
<p>_IO_stdin_used</p>
<p>__libc_start_main</p>
<p>GLIBC_2.0</p>
<p>PTRh%</p>
<p>[^_]</p>
<p>Hello World!</p>
<h3>tail</h3>
<p>Output the last part of files.</p>
<p>$ tail -2 lorem.txt</p>
<p>occaecat cupidatat non proident, sunt in culpa qui officia deserunt</p>
<p>mollit anim id est laborum.</p>
<h3>talk</h3>
<p>Talk to another user.</p>
<p>$ talk bob Lookout for the dopefish!</p>
<h3>touch</h3>
<p>Change a file&#8217;s access and modification timestamps. If file does not exist, create it.</p>
<p>$ touch lorem.txt</p>
<h3>tty</h3>
<p>Outputs the name of the current terminal.</p>
<p>$ tty</p>
<p>/dev/pts/16</p>
<h3>uname</h3>
<p>Outputs operating system, hostname, kernel version, date and timp, and processor.</p>
<p>$ uname -a</p>
<p>Linux anapnea.net 2.6.9 #1 SMP Wed Jul 19 16:24:18 MSD 2006 i686 Intel(R) Xeon(TM) CPU 2.80GHz GenuineIntel GNU/Linux</p>
<h3>uptime</h3>
<p>Outputs the system uptime.</p>
<p>$ uptime</p>
<p>14:50:26 up 7 days, 17:52, 18 users, load average: 0.08, 0.02, 0.01</p>
<h3>users</h3>
<p>Print the user names of users currently logged in to the current host.</p>
<p>$ users</p>
<p>alice bob charlie eve</p>
<h3>vdir</h3>
<p>List directory contents.</p>
<p>$ vdir</p>
<p>total 8</p>
<p>-rw-r&#8211;r&#8211; 1 smallfoot users 453 Mar 3 12:32 copy_of_lorem.txt</p>
<p>-rw-r&#8211;r&#8211; 1 smallfoot users 453 Mar 3 12:24 lorem.txt</p>
<p>-rw-r&#8211;r&#8211; 1 smallfoot users 0 Mar 3 12:32 moo.txt</p>
<p>lrwxr-xr-x 1 root root 18 Feb 27 19:33 www -&gt; /var/www/smallfoot</p>
<h3>w</h3>
<p>Show who is logged on and what they are doing.</p>
<p>$ w</p>
<p>12:14:30 up 5 days, 15:16, 19 users, load average: 0.00, 0.00, 0.00</p>
<p>USER TTY LOGIN@ IDLE JCPU PCPU WHAT</p>
<p>charlie pts/0 Fri21 3:26m 2.52s 2.52s irssi</p>
<p>alice pts/2 Wed17 30:21m 0.00s 0.00s -bash</p>
<p>emma pts/4 11:37 36:57 0.00s 0.00s -bash</p>
<p>frank pts/5 11:48 11:03 0.00s 0.00s -bash</p>
<p>smallfoo pts/12 12:01 0.00s 0.04s 0.01s w</p>
<h3>wall</h3>
<p>Send a message to everybody&#8217;s terminal.</p>
<p>$ wall next week we change the server for a new one</p>
<h3>wc</h3>
<p>Counts lines in a file.</p>
<p>$ wc -l lorem.txt</p>
<p>7 lorem.txt</p>
<h3>whatis</h3>
<p>Search the whatis database for complete words.</p>
<p>$ whatis bash</p>
<p>bash (1) &#8211; GNU Bourne-Again SHell</p>
<p>bash [builtins] (1) &#8211; bash built-in commands, see bash(1)</p>
<h3>who</h3>
<p>Outputs who is currently logged into the system.</p>
<p>$ who</p>
<p>charlie pts/0 Mar 2 21:37 (xtreme-11-65.acme.com)</p>
<p>alice pts/2 Feb 28 17:48 (147.21.16.3)</p>
<p>emma pts/4 Mar 3 11:37 (32.84-48-181.uac.com)</p>
<p>frank pts/5 Mar 3 11:48 (port-212-202-233-2.foobar.org)</p>
<p>smallfoot pts/12 Mar 3 12:01 (c-12776f4.cust.example.net)</p>
<h3>whereis</h3>
<p>Locate the binary, source, and manual page files for a command.</p>
<p>$ whereis bash</p>
<p>bash: /bin/bash /etc/bash /usr/share/man/man1/bash.1.gz</p>
<h3>whoami</h3>
<p>Outputs your username / the name of your account.</p>
<p>$ whoami</p>
<p>smallfoot</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/useful-commands-for-the-linux-command-line/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to search files for specific content</title>
		<link>http://www.zendzign.com/2008/05/how-to-search-files-for-specific-content/</link>
		<comments>http://www.zendzign.com/2008/05/how-to-search-files-for-specific-content/#comments</comments>
		<pubDate>Fri, 09 May 2008 18:06:58 +0000</pubDate>
		<dc:creator>Peter Zendzian</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sysadmin]]></category>
		<category><![CDATA[cli]]></category>
		<category><![CDATA[search]]></category>

		<guid isPermaLink="false">http://zendzign.com/?p=5</guid>
		<description><![CDATA[Simple linux command to search all files in a given path and display the line in the file which matches defined content. find &#60;PATH&#62; -print &#124; xargs grep &#34;&#60;CONTENT&#62;&#34; or find &#60;PATH&#62; -type f -exec grep -H &#34;&#60;CONTENT&#62;&#34; \;]]></description>
			<content:encoded><![CDATA[<p>Simple linux command to search all files in a given path and display the line in the file which matches defined content.</p>
<p>find &lt;PATH&gt; -print | xargs grep &quot;&lt;CONTENT&gt;&quot;</p>
<p>or</p>
<p>find &lt;PATH&gt; -type f -exec grep -H &quot;&lt;CONTENT&gt;&quot; \;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/how-to-search-files-for-specific-content/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

