<?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; HIPPA</title>
	<atom:link href="http://www.zendzign.com/category/security/hippa/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>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>Zabbix &amp; OSSEC: Open-Source compliance and security monitoring</title>
		<link>http://www.zendzign.com/2010/04/zabbix-ossec-open-source-compliance-and-security-monitoring/</link>
		<comments>http://www.zendzign.com/2010/04/zabbix-ossec-open-source-compliance-and-security-monitoring/#comments</comments>
		<pubDate>Fri, 09 Apr 2010 14:11:53 +0000</pubDate>
		<dc:creator>David M. Zendzian</dc:creator>
				<category><![CDATA[HIPPA]]></category>
		<category><![CDATA[PCI]]></category>
		<category><![CDATA[Security]]></category>
		<category><![CDATA[Sysadmin]]></category>

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

		<guid isPermaLink="false">http://zendzign.com/?p=4</guid>
		<description><![CDATA[&#8220;HIPAA&#8221; is an acronym for the Health Insurance Portability &#38; Accountability Act of 1996 (August 21), Public Law 104-191, which amended the Internal Revenue Service Code of 1986. Also known as the Kennedy-Kassebaum Act, the Act includes a section, Title II, entitled Administrative Simplification, requiring: Improved efficiency in health care delivery by standardizing electronic data [...]]]></description>
			<content:encoded><![CDATA[<p>&#8220;HIPAA&#8221; is an acronym for the Health Insurance Portability &amp; Accountability Act of 1996 (August 21), Public Law 104-191, which amended the Internal Revenue Service Code of 1986. Also known as the Kennedy-Kassebaum Act, the Act includes a section, Title II, entitled Administrative Simplification, requiring:</p>
<ol>
<li>Improved efficiency in health care delivery by standardizing electronic data interchange, and</li>
<li>Protection of confidentiality and security of health data through setting and enforcing standards.</li>
</ol>
<p><span id="more-4"></span>More specifically, HIPAA called upon the Department of Health and Human Services (HHS) to publish new rules that will ensure:</p>
<ol>
<li>Standardization of electronic patient health, administrative and financial data</li>
<li>Unique health identifiers for individuals, employers, health plans and health care providers</li>
<li>Security standards protecting the confidentiality and integrity of &#8220;individually identifiable health information,&#8221; past, present or future.</li>
</ol>
<p>Compliance requirements include:</p>
<ul>
<li>Building initial organizational awareness of HIPAA</li>
<li>Comprehensive assessment of the organization&#8217;s privacy practices, information security systems and procedures, and use of electronic transactions</li>
<li>Developing an action plan for compliance with each rule</li>
<li>Developing a technical and management infrastructure to implement the plans</li>
<li>Implementing a comprehensive implementation action plan, including</li>
<li>Developing new policies, processes, and procedures to ensure privacy, security and patients&#8217; rights</li>
<li>Building business associate agreements with business partners to support HIPAA objectives</li>
<li>Developing a secure technical and physical information infrastructure</li>
<li>Updating information systems to safeguard protected health information (PHI) and enable use of standard claims and related transactions</li>
<li>Training of all workforce members</li>
<li>Developing and maintaining an internal privacy and security management and enforcement infrastructure, including providing a Privacy Officer and a Security Officer</li>
</ul>
<p>All of these requirements apply to not only the company which owns the PHI, but also any company or contractor they work with who has access to this information. The details on how to meet the HIPAA requirements is up to the individual company, allowing the &#8220;market to dictate&#8221; the terms and conditions.</p>
<p>Most companies I have worked with spend a considerable amount of time generating the paper documentation they feel will meet the above requirements. That is the most important part of any security policy or plan, knowing what is important (PHI/Card Data/Financial/etc) and defining how the business will properly control that information.</p>
<p>Data-centers, managed service providers and other contracted service providers come into this picture when companies outsource their data-center operations or when you are partnering with a company for data-center services. If you look at the HIPAA requirements, they all can be applied in some form or another to the outsourced provider, but the validation is left up to the contracting business and there is no guidance other than &#8220;best practices&#8221;.</p>
<p>So what should you look for in a business partner to have that can meet these HIPAA requirements? Before I answer that, I would like to discuss a similar security standard. As you may know from regular occurrence in the news, credit card data is lost and stolen on an increasingly regular basis. To help fight this, the Payment Card Industry has created the PCI Security Standards Council whose charter is to create and maintain specific industry standards and to train qualified assessors on how to validate against those standards. Any business that stores, transmits or processes credit card data is required to abide by these standards. This means even the person with a cellular card swipe machine at the flea market has to meet the same standards as Walmart, Amazon.com, PayPal or other multi-national merchants and banks. Below is a list of 12 sections in the PCI Security Audit Procedure which which you should look for from any service provider or partner you are considering. These sections break down in detail the steps which must be taken to comply with the PCI standard. To get more information, you can download the PCI details here <a href="https://www.pcisecuritystandards.org/pdfs/pci_qsa_list.pdf">https://www.pcisecuritystandards.org/pdfs/pci_qsa_list.pdf</a> and here <a href="https://www.pcisecuritystandards.org/pdfs/pci_audit_procedures_v1-1.pdf">https://www.pcisecuritystandards.org/pdfs/pci_audit_procedures_v1-1.pdf</a></p>
<ol>
<li>Firewalls &amp; Routers</li>
<li>Service configuration (note service includes servers/applications/databases/firewalls/etc)</li>
<li>Storage of Card data (what is/is not allowed, encryption, secure deletion), Data retention policy</li>
<li>Transmission of card data (SSL, VPN, 802.11, etc)</li>
<li>Anti-virus</li>
<li>Secure Development &#8212; ** Change Management **</li>
<li>Need-to-know</li>
<li>Unique ID for _everyone_ &#8211; no shared root, enable, administrator &amp; password requirements</li>
<li>Physical Security</li>
<li>Logging &amp; Time sync</li>
<li>Security Testing (security scanning, pen testing)</li>
<li>Policies, Contracts, Security Training, Risk Assessment, Incident Response Policies, Connected Entities (partner connection) management</li>
</ol>
<p>Additionally, depending on which services you plan on using from a contracted provider or partner, different sections will apply for example:</p>
<ul>
<li>If they are going to provide router or firewall services, section 1</li>
<li>If they are going to provide any servers (virtual or real) then sections 2, 5, 7, 8, 9, 10, 11 &amp; 12 (yes most of it:)</li>
<li>If they are going to provide development support sections 3, 4 &amp; 6</li>
<li>If they are going to provide system management support, 2, 3, 4, 5, 7, 8, 10</li>
</ul>
<p>I mention PCI because unlike the HIPAA requirements, the PCI Standards and process is very clearly defined. While PCI is not perfect, since it was based on ISO17799 it covers a wide range of security issues. If you take the PCI standards and replace PCI with HIPAA or Financial (SOX), then you have a great guideline and audit procedure to work with for your own and your partners security.</p>
<p>So back to the question for this thread. How can you determine if a data-center/service provider meets your needs for the various compliance requirements. To answer this, you need to determine the role the service provider has with relation to your business and your specific data-set requirements.</p>
<p>If you are looking for somewhere to host your entire &#8220;business&#8221; and then VPN back into your company network, then you have physical, network, policy, procedure and contractual security needs.</p>
<p>If you are looking to have someone provide a more hands-on role then the same requirements are met, but then the providers mechanisms for providing support will then need to be evaluated. This would bring the assessment into the way they store passwords, monitor systems, provide support, troubleshoot, maintain change management, key-management, security monitoring, image management, upgrades, etc.</p>
<p>Giving all of these considerations, as a business you need to determine how you wish to handle the requirements. If you are a large merchant or service provider, you typically get ISO or SAS70 audits. Any data-center should be able to provide that assessment as you are trying to determine who you wish to work with. Keep in mind that with these assessments, the company has hired the auditor to validate a &#8220;specific&#8221; item, so the audit report will be focused only on that and may not take into consideration other processes or areas within the facility.</p>
<p>If the company has been through a PCI or other audit they should be able to provide some documentation regarding the audit and the controls they have in place that they used to go through the audit.</p>
<p>If they are a service provider (providing services to PCI organizations) and have been through a level 1 audit then they will be listed here: <a href="http://usa.visa.com/download/merchants/cisp_list_of_cisp_compliant_service_providers.pdf">http://usa.visa.com/download/merchants/cisp_list_of_cisp_compliant_service_providers.pdf</a></p>
<p>Not many ISPs or Data-Centers have been through a level 1 PCI audit as they are usually very costly and if you read through the SAP you will find time consuming in the details that need to be met.</p>
<p>So what can you hope to find in a service partner you are looking to host with:</p>
<ul>
<li>A physical location that has good security controls</li>
<li>24&#215;7 guard &amp; locked doors</li>
<li>Sign-in required and only authorized visitors</li>
<li>at least 3 months camera data (90 days) on all entrances &amp; exits to data-center facility</li>
<li>Security for the physical servers (do not use shared cages)</li>
<li>Policies</li>
<li>Standard configuration documentation for all services you are getting services for (servers, firewalls, load balancers, certificates, etc)</li>
<li>Network &amp; server security &#8211; IDS / IPS / Host IDS / Log Monitoring / Internal &amp; External Scanning / ASV Scanning</li>
<li>Change Management that includes</li>
<li>Documentation of impact</li>
<li>Management sign off &#8211; colo should notify of customers of changes (good communication, as it was mentioned in a previous post, most providers that provide HIPAA or other services tend to have more communication with their customers)</li>
<li>Back out plan / procedure</li>
<li>Functional testing</li>
</ul>
<p>If you are looking for more advanced services to ensure that not only is the machine physically secure, but also have you deployed your application architecture properly, then you may want to also be sure the service provider can also provide:</p>
<ul>
<li>Firewalls</li>
<li>Private Networks</li>
<li>VPN</li>
<li>Load balancers</li>
<li>2 factor authentication</li>
<li>IDS</li>
<li>Log Monitoring</li>
<li>Centralized logging</li>
<li>Monitoring (Security &amp; Availability)</li>
<li>Development services</li>
<li>Code review</li>
<li>Time services (NTP)</li>
<li>Senior Security &amp; Architectural staff as well as Sr systems staff</li>
</ul>
<p>Many of the people I have worked with have needed just about all of the above services when they are either building, expanding or migrating their applications into data-center facilities.</p>
<p>I know I did not stick specifically with the HIPAA question, but hopefully this information will help those are looking for new hosting facilities.</p>
<p>Now for those who are wondering, well do you provide those services? The short answer is yes. However not all are immediately activated &#8220;web dashboard&#8221; ready services and require a direct relationship with our senior architects and systems folks.</p>
<p>Our San Francisco data-center is through a partnership with ColoServe who provides the physical security and raw bandwidth to our secure cabinets. While the physical center has not been through any Level 1 PCI audits, ZZ servers has been through 2 bi-annual security audits by American Express for one of our customers and the facility has a SAS70 certificate and has the added security of also hosting the 911 systems for the city of San Francisco so our structural, power and data systems are a step above par.</p>
<p>I myself consult with a QSA out of San Meto (<a href="http://www.drgsf.com/">http://www.drgsf.com</a>) and perform Level 1 audits and Security Assessment for payment applications as specified by the Payment Applications Best Practices following the PA-DSS (<a href="https://www.pcisecuritystandards.org/tech/pa-dss.htm">https://www.pcisecuritystandards.org/tech/pa-dss.htm</a></p>
<p>After spending 20 years building and working with small to large companies and founding 3 previous ISP services I wanted to bring a level of business service to the hosting community. So in founding ZZ Servers with my brother, Peter &#8211; a 20 year Navy vet currently spending his last year in the service stationed in Bagdad), we specifically created the infrastructure to be able to provide many if not all of the requirements mentioned above.</p>
<p>We are focused on providing services that are priced to compete with the largest players (rack-space, one and one, etc) but to also have the value added services I discussed in the requirements listings above.</p>
<p>We currently have customers utilizing the following services:</p>
<ul>
<li>Co-located servers</li>
<li>Leased Servers</li>
<li>Virtual Private Servers</li>
<li>Private Networks</li>
<li>Multiple firewalls (internal &amp; external)</li>
<li>Load Balancers</li>
<li>Managed monitoring &amp; support</li>
<li>Centralized Logging &amp; monitoring</li>
<li>IDS</li>
<li>VPN</li>
<li>2 Factor Authentication with CryptoCard</li>
<li>Time services (NTP)</li>
<li>Senior Security &amp; Architectural staff as well as senior systems staff</li>
</ul>
<p>And we are in the midst of deploying a full change-management system that will be available to any customer using any service which will fully integrated into all hosted services (schedule changes for firewalls or clusters of servers, and track status of each individual change).</p>
<p>We have also just signed an agreement with DRG to provide integrated ASV scanning which will be integrated into our order wizard allowing customers to sign-up and manage their PCI compliant scans and automatically send results to your merchant bank. This service will also include an on line form for creating and submitting the Self Assessment Questionnaire.</p>
<p>We are a small family-run business focused on slow growth and providing tools for both the smaller &amp; larger customers to grow into whatever their business has potential for.</p>
<p>For more details about HIPPA, please visit  <span style="color: #000000;"><span style="font-size: small;">(</span></span><a href="http://www.hipaadvisory.com/regs/HIPAAprimer.htm">http://www.hipaadvisory.com/regs/HIPAAprimer.htm</a><span style="color: #000000;"><span style="font-size: small;">)</span></span></p>
<p>Regards,</p>
<p>David</p>
]]></content:encoded>
			<wfw:commentRss>http://www.zendzign.com/2008/05/health-insurance-portability-accountability-act-hippa-and-web-hosting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

