<?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>StoneBlog.stonesoft.com &#187; Scripts</title>
	<atom:link href="http://stoneblog.stonesoft.com/category/tech-dives/scripts/feed/" rel="self" type="application/rss+xml" />
	<link>http://stoneblog.stonesoft.com</link>
	<description>Share knowledge about StoneGate</description>
	<lastBuildDate>Fri, 20 Jan 2012 11:06:13 +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>Importing DROP-list from Spamhaus.org</title>
		<link>http://stoneblog.stonesoft.com/2009/12/importing-drop-list-from-spamhaus-org/</link>
		<comments>http://stoneblog.stonesoft.com/2009/12/importing-drop-list-from-spamhaus-org/#comments</comments>
		<pubDate>Mon, 07 Dec 2009 07:42:10 +0000</pubDate>
		<dc:creator>olli</dc:creator>
				<category><![CDATA[Hints and Tips]]></category>
		<category><![CDATA[Live from Field]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[DROP-list]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[Spamhaus]]></category>

		<guid isPermaLink="false">http://stoneblog.stonesoft.com/?p=1906</guid>
		<description><![CDATA[Finnish CERT (CERT-FI) recommends to pay special attention to certain address blocks.  They mention the DROP-list by the Spamhaus project as the most up-to-date list of malicious addresses. It is always boring and time consuming to type long lists of addresses, so I made a quick-and-dirty script, which converts the DROP-list into StoneGate elements, and [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://stoneblog.stonesoft.com/wp-content/uploads/2009/12/spamhaus_to_smc.png" alt="spamhaus_to_smc" title="spamhaus_to_smc" width="500" height="130" class="alignnone size-full wp-image-1918" /></p>
<p><a href="http://cert.fi/" target="_blank">Finnish CERT (CERT-FI)</a> recommends to <a href="http://cert.fi/tietoturvanyt/2009/11/ttn200911261440.html" target="_blank">pay special attention to certain address blocks</a>.  They mention the <a href="http://www.spamhaus.org/drop/" target="_blank">DROP-list</a> by the <a href="http://www.spamhaus.org/" target="_blank">Spamhaus project</a> as the most up-to-date list of malicious addresses.</p>
<p>It is always boring and time consuming to type long lists of addresses, so I made a quick-and-dirty script, which converts the DROP-list into StoneGate elements, and creates a group of them.  You can feed the DROP-list to this script, zip the result and import it into SMC.</p>
<p>Being an oldtimer, I wrote this with an ancient tool called awk, which you can find in most unix-based systems, including linux.  The most common variant is the GNU awk, gawk.  Someone would probably write this in 2 lines of Perl&#8230;</p>
<p>I provide this script as is, with no expressed or implied guarantees of any kind.  Use this at your own risk.  If you manage to break something with this, you have been warned and you assume full responsibility.  I have tested this on one system (Fedora Core 9) with one input, today&#8217;s DROP list from Spamhaus.org.</p>
<p>So, take a look at the <a href="/wp-filez/scripts/DROP2XML.awk" target="_blank">code</a> and decide yourself if you trust this.  Especially see the comment in the beginning.  Change the element naming convention to suit your needs and enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://stoneblog.stonesoft.com/2009/12/importing-drop-list-from-spamhaus-org/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMC Batch Interaction &#8211; Checking Element Status</title>
		<link>http://stoneblog.stonesoft.com/2009/07/smc-batch-interaction-checking-element-status/</link>
		<comments>http://stoneblog.stonesoft.com/2009/07/smc-batch-interaction-checking-element-status/#comments</comments>
		<pubDate>Tue, 07 Jul 2009 05:15:00 +0000</pubDate>
		<dc:creator>RoarinPenguin</dc:creator>
				<category><![CDATA[Hints and Tips]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[SMC]]></category>
		<category><![CDATA[batch interaction]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[sgElementStatus]]></category>

		<guid isPermaLink="false">http://stoneblog.stonesoft.com/2009/07/smc-batch-interaction-checking-element-status/</guid>
		<description><![CDATA[This post adds another bit to the series of articles about SMC interaction through batch scripts. Today scenario is similar to the following. Suppose you have an installed base composed of several StoneGate Engines (IPS, Firewalls) plus few 3rd party devices that you monitor thanks to new cool feature of SMC 5.0. You would like [...]]]></description>
			<content:encoded><![CDATA[<p>This post adds another bit to the series of articles about SMC interaction through batch scripts.</p>
<p>Today scenario is similar to the following.    <br />Suppose you have an installed base composed of several StoneGate Engines (IPS, Firewalls) plus few 3rd party devices that you monitor thanks to new cool feature of SMC 5.0.</p>
<p>You would like to allow batch scripting monitoring of such devices to have data from SMC to populate other processes or software you might use.</p>
<p> <span id="more-1595"></span>
<p>&#160;</p>
<p>sgElementStatus script allows you to check the status of a given element in StoneGate Management Center. Syntax is reported below, but please note that output changes depending on element type. Some examples:</p>
<p><font face="Courier New">C:\Stonesoft\StoneGate\bin&gt;sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element=&quot;FW-310-test&quot;      <br /><em>(this is a Firewall)</em></font>    <br /><font color="#0080ff">Connect to Management Server: root@192.168.1.101      <br />[1] FW-310-test: OK       <br /></font></p>
<p><font face="Courier New">C:\Stonesoft\StoneGate\bin&gt;sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element=&quot;DefGW&quot;      <br /><em>(this is a Router, monitored with <a href="http://stoneblog.stonesoft.com/2009/02/stonegate-50-third-party-monitoring/" target="_blank">3rd Party monitoring</a>)</em>      <br /></font><font color="#0080ff">Connect to Management Server: </font><a href="mailto:root@192.168.1.101"><font color="#0080ff">root@192.168.1.101</font></a>    <br /><font color="#0080ff">[1] DefGW: Online      <br /></font></p>
<p> <font face="Courier New">C:\Stonesoft\StoneGate\bin&gt;sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element=&quot;My-Network”   <br /></font>
<p><em><font face="Courier New">(this is a Network Element, silent output means element exist)</font></em>    <br /><font color="#0080ff">Connect to Management Server: <a href="mailto:root@192.168.1.101">root@192.168.1.101</a></font>    </p>
<p><font face="Courier New">C:\Stonesoft\StoneGate\bin&gt;sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element=&quot;Test Apache Web&quot;      <br /><em>(this is a Web Server, monitored but unreachable)</em></font>    <br /><font color="#0080ff">Connect to Management Server: root@192.168.1.101     <br />[1] Test Apache Web: Unreachable</font>     </p>
<p><font face="Courier New">C:\Stonesoft\StoneGate\bin&gt;sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element=&quot;My-non-existing-element&quot;      <br /><em>(this is a fake name, not existing in SMC configuration)</em>      <br /></font><font color="#0080ff">Connect to Management Server: root@192.168.1.101     <br />Script Failed       <br />Not found: My-non-existing-element</font>    </p>
<p> <font face="Courier New">C:\Stonesoft\StoneGate\bin&gt;sgElementStatus.bat host=192.168.1.101 login=root pass=mypass element=&quot;DefGW-notmon&quot;    <br /><em>(this is a Router, not monitored)</em>    <br /></font><font color="#0080ff">Connect to Management Server: </font><a href="mailto:root@192.168.1.101"><font color="#0080ff">root@192.168.1.101</font></a>  <br /> 
<p><font color="#0080ff">[1] DefGW-notmon: Not Monitored </font></p>
<p>Scripts are available in <a href="http://stoneblog.stonesoft.com/stoneblog-community/files/#Scripts" target="_blank"><u><font color="#0066cc">Files area</font></u></a> of StoneBlog Community <a href="http://stoneblog.stonesoft.com/wp-filez/stonefiles/sgElementStatus.bat" target="_blank">for Windows</a><u><font color="#0066cc"></font></u> and <a href="http://stoneblog.stonesoft.com/wp-filez/stonefiles/sgElementStatus.sh" target="_blank">for Linux</a><u><font color="#0066cc"></font></u>. </p>
]]></content:encoded>
			<wfw:commentRss>http://stoneblog.stonesoft.com/2009/07/smc-batch-interaction-checking-element-status/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMC Batch Interaction – Check the policy on your engine</title>
		<link>http://stoneblog.stonesoft.com/2009/07/smc-batch-interaction-%e2%80%93-check-the-policy-on-your-engine/</link>
		<comments>http://stoneblog.stonesoft.com/2009/07/smc-batch-interaction-%e2%80%93-check-the-policy-on-your-engine/#comments</comments>
		<pubDate>Thu, 02 Jul 2009 10:30:21 +0000</pubDate>
		<dc:creator>RoarinPenguin</dc:creator>
				<category><![CDATA[Hints and Tips]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[SMC]]></category>
		<category><![CDATA[batch interaction]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://stoneblog.stonesoft.com/?p=1572</guid>
		<description><![CDATA[Following the SMC scripting galore trend here’s another tool for you, hoping you find it useful. The scenario is when you need to verify/validate from command line is a given policy has issues if installed on a particular engine (but naturally without installing it). The command sgPolicyCheck.[bat&#124;sh] can be issued with the following parameters and [...]]]></description>
			<content:encoded><![CDATA[<p>Following the SMC scripting galore trend <img src='http://stoneblog.stonesoft.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  here’s another tool for you, hoping you find it useful.</p>
<p>The scenario is when you need to verify/validate from command line is a given policy has issues if installed on a particular engine (but naturally without installing it).</p>
<p>The command sgPolicyCheck.[bat|sh] can be issued with the following parameters and options.</p>
<p> <font face="Courier New" size="2"><font face="Courier New" size="2">
<p dir="ltr"><strong>Parameters</strong>:        <br /><b>host</b>=&lt;Mgtserver address&gt; (default: 127.0.0.1)<b>login</b>=&lt;loginname&gt; (default: root)        <br /><b>pass</b>=&lt;password&gt; (default: password)        <br /><b>cluster</b>=&lt;cluster name&gt; (default: &quot;&quot;)        <br /><b>policy</b>=&lt;policy name&gt; (default: &quot;&quot;)        <br /><b>all_clusters</b>=&lt;use all clusters&gt; (default: false)</p>
<p dir="ltr"><strong>Options</strong>:        <br /><b>-help</b> (Show help)</p>
<p>   </font></font>
<p>An example could be:</p>
<p><font face="Courier New" color="#0080ff">C:\Stonesoft\StoneGate\bin&gt;sgPolicyCheck.bat host=192.168.1.101 login=root pass=mypass cluster=FW-5000 policy=&quot;verify-this-policy&quot;     <br /><font face="Arial" color="#333333">…and the output is similar to the one reported below:</font></font></p>
<p><font face="Courier New" color="#0080ff">Connect to Management Server: </font><a href="mailto:root@191.168.1.101"><font face="Courier New" color="#0080ff">root@191.168.1.101</font></a>    <br /><font face="Courier New" color="#0080ff">Validation of Firewall Policy verify-this-policy on Single Firewall FW-5000:</font></p>
<p><font face="Courier New" color="#0080ff">6 issues found.     <br />&#160; 6 warnings found:      <br />&#160;&#160;&#160; 2 Missing Definitions found.      <br />&#160;&#160;&#160;&#160;&#160; Rule @2.0      <br />&#160;&#160;&#160;&#160;&#160; Rule @3.0      <br />&#160;&#160;&#160; 2 Unreachable Rules found.      <br />&#160;&#160;&#160;&#160;&#160; Rule @1006.0      <br />&#160;&#160;&#160;&#160;&#160; Rule @981.0      <br />&#160;&#160;&#160; 2 NAT and Routing Definitions found.      <br />&#160;&#160;&#160;&#160;&#160; Rule @1274.5      <br />&#160;&#160;&#160;&#160;&#160; Rule @1157.0</font></p>
<p>As usual, <a href="http://stoneblog.stonesoft.com/stoneblog-community/files/#Scripts" target="_blank">Files area</a> of StoneBlog Community contains the script <a href="http://stoneblog.stonesoft.com/wp-filez/stonefiles/sgPolicyCheck.bat" target="_blank">for Windows</a> and <a href="http://stoneblog.stonesoft.com/wp-filez/stonefiles/sgPolicyCheck.sh" target="_blank">for Linux</a>. </p>
]]></content:encoded>
			<wfw:commentRss>http://stoneblog.stonesoft.com/2009/07/smc-batch-interaction-%e2%80%93-check-the-policy-on-your-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMC Batch Interaction – Pushing Policy to Firewall Engine</title>
		<link>http://stoneblog.stonesoft.com/2009/06/smc-batch-interaction-%e2%80%93-pushing-policy-to-firewall-engine/</link>
		<comments>http://stoneblog.stonesoft.com/2009/06/smc-batch-interaction-%e2%80%93-pushing-policy-to-firewall-engine/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 15:06:48 +0000</pubDate>
		<dc:creator>RoarinPenguin</dc:creator>
				<category><![CDATA[Hints and Tips]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[SMC]]></category>
		<category><![CDATA[batch interaction]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[upload policy]]></category>

		<guid isPermaLink="false">http://stoneblog.stonesoft.com/?p=1535</guid>
		<description><![CDATA[Here we go with a second article to enable batch interaction with a StoneGate Management Center: this one is about publishing a ready made policy to a StoneGate Firewall/VPN Engine. Scenario could be, for instance, that you receive an alert raising the DefCon level and you want to react by activating a more restrictive policy. [...]]]></description>
			<content:encoded><![CDATA[<p>Here we go with a second article to enable batch interaction with a StoneGate Management Center: this one is about publishing a ready made policy to a StoneGate Firewall/VPN Engine.</p>
<p>Scenario could be, for instance, that you receive an alert raising the <a href="http://en.wikipedia.org/wiki/Defcon" target="_blank"><em>DefCon</em></a> level and you want to react by activating a more restrictive policy.</p>
<p>The script for you today is called sgUploadFw.[sh|bat] and the syntax is:</p>
<p><span style="font-size: small;"><span style="font-family: Courier New;">sgUploadFw.[bat|sh] [host=hostname] [login=loginname] [pass=password] cluster=clustername [cluster=otherclustername] policy=policyname </span></span></p>
<p><em>host </em>==&gt; SMC host where you want this script to be executed.<br />
<em>login</em> ==&gt; login of an Administrator Profile, who has rights to operate on given elements<br />
<em>pass </em>==&gt; password (yes, in cleartext. It’s up to you to decide about security level you want to implement <img src='http://stoneblog.stonesoft.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )<br />
<em>cluster </em>==&gt; could be a single node or a cluster of engines<br />
<em>policy </em>==&gt; the name of the policy you want to upload</p>
<p>Example and output:</p>
<p><span style="font-family: Courier New; color: #0080ff;">C:\Stonesoft\StoneGate\bin&gt;sgUploadFw.bat host=192.168.1.101 login=root pass=mypassword cluster=&#8221;FW-5000&#8243; policy=&#8221;DefCon 1&#8243;<br />
Finding cluster(s)<br />
Found FW-5000<br />
Found policy: DefCon 1<br />
Accepted a compatible cluster: FW-5000<br />
Starting upload<br />
Waiting 900 seconds&#8230;</span></p>
<p><span style="font-family: Courier New; color: #0080ff;">Contacting nodes of FW-5000<br />
Connection ok on firewall FW-5000<br />
Preparing configuration for FW-5000<br />
Policy snapshot started<br />
Policy snapshot created.<br />
Uploading configuration on FW-5000<br />
New configuration generated for firewall FW-5000<br />
New configuration uploaded to firewall FW-5000<br />
Rule @1279.6 has Source NAT translated to ipaddresses that corresponds to an int<br />
erface address<br />
Applying configuration on FW-5000<br />
New configuration activated on firewall FW-5000<br />
Checking connectivity on FW-5000<br />
Contact with firewall FW-5000 confirmed<br />
Policy installation successful for FW-5000</span></p>
<p><span style="font-family: Courier New; color: #0080ff;">upload finished</span></p>
<p>To download the script for Windows click <a href="/wp-filez/stonefiles/sgUploadFw.bat">here</a>, while the version for Linux is available <a href="/wp-filez/stonefiles/sgUploadFw.sh">here</a>.</p>
<p>Both scripts will remain available in StoneBlog Community, <a href="http://stoneblog.stonesoft.com/stoneblog-community/files/#Scripts">Files</a> area.</p>
]]></content:encoded>
			<wfw:commentRss>http://stoneblog.stonesoft.com/2009/06/smc-batch-interaction-%e2%80%93-pushing-policy-to-firewall-engine/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SMC Batch Interaction &#8211; Sending Commands to Nodes</title>
		<link>http://stoneblog.stonesoft.com/2009/06/smc-batch-interaction-sending-commands-to-nodes/</link>
		<comments>http://stoneblog.stonesoft.com/2009/06/smc-batch-interaction-sending-commands-to-nodes/#comments</comments>
		<pubDate>Fri, 19 Jun 2009 15:21:03 +0000</pubDate>
		<dc:creator>RoarinPenguin</dc:creator>
				<category><![CDATA[Hints and Tips]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[SMC]]></category>
		<category><![CDATA[automation]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://stoneblog.stonesoft.com/2009/06/smc-batch-interaction-sending-commands-to-nodes/</guid>
		<description><![CDATA[Thinking about oxymoron? Nope… this is first of a series of posts to show how it is possible to interact within a batch script with SMC, to automate tasks. Scripts linked to this posts will remain available in StoneBlog Community under StoneFiles repository for free download. Useless to remind that these are unsupported scripts, although [...]]]></description>
			<content:encoded><![CDATA[<p>Thinking about oxymoron? Nope… this is first of a series of posts to show how it is possible to interact within a batch script with SMC, to automate tasks.</p>
<p>Scripts linked to this posts will remain available in StoneBlog Community under <a href="http://stoneblog.stonesoft.com/stoneblog-community/stonefiles/" target="_blank">StoneFiles</a> repository for free download.</p>
<p>Useless to remind that these are unsupported scripts, although I’ve tested them up to latest release and they work nicely <img src='http://stoneblog.stonesoft.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>First script I’d like to share is about automating some commands to StoneGate Firewall/VPN or IPS Engine.</p>
<p> <span id="more-1408"></span>
<p>They all require to have at least the GUI (not WebStart) on the executing client.</p>
<p>Syntax is<font face="Helv" size="2"></font><font face="Helv" size="2"> </font></p>
<p><strong><font face="Courier New" size="2">sgOnOff.[bat|sh] [-host hostname] [-login loginname] [-pass password] -node cluster-node-name -cmd commandname</font></strong></p>
</p>
<p>-host ==&gt; SMC host where you want this script to be executed.</p>
<p>-login ==&gt; login of an Administrator Profile, who has rights to operate on given elements</p>
<p>-pass ==&gt; password (yes, in cleartext. It’s up to you to decide about security level you want to implement <img src='http://stoneblog.stonesoft.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  )</p>
<p>-node ==&gt; this is the single node name. In a cluster it is <u>a cluster node name</u> as appears in SMC.</p>
<p>-cmd ==&gt; the command you want to send, for example <em>online</em> or <em>offline</em></p>
<p>For example:</p>
<p><font face="Courier New" size="2">sgOnOff.bat –host 10.1.1.10 –login superuser –pass mypassword –node “FW-310-test Single Node” –cmd offline</font></p>
<p dir="ltr">
</p>
<p>The batch files are available for both <a title="Download the script" href="/wp-filez/stonefiles/sgOnOff.bat" target="_blank">Windows</a> and <a title="Download the script" href="/wp-filez/stonefiles/sgOnOff.sh" target="_blank">Linux</a> platforms.</p>
]]></content:encoded>
			<wfw:commentRss>http://stoneblog.stonesoft.com/2009/06/smc-batch-interaction-sending-commands-to-nodes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>My firewall sees this info, I want it in logs</title>
		<link>http://stoneblog.stonesoft.com/2009/06/my-firewall-sees-this-info-i-want-it-in-logs/</link>
		<comments>http://stoneblog.stonesoft.com/2009/06/my-firewall-sees-this-info-i-want-it-in-logs/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 07:17:00 +0000</pubDate>
		<dc:creator>RoarinPenguin</dc:creator>
				<category><![CDATA[Hints and Tips]]></category>
		<category><![CDATA[Scripts]]></category>
		<category><![CDATA[information retrieval]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[script]]></category>

		<guid isPermaLink="false">http://stoneblog.stonesoft.com/2009/06/my-firewall-sees-this-info-i-want-it-in-logs/</guid>
		<description><![CDATA[It is common for distributed organizations to have multiple engines in different locations as main gateways for protecting the perimeter of the local network. Sometimes the firewall sees information that are unrelated specifically to network security; still, these information could be very useful to be centrally collected. This post shows how it is possible to [...]]]></description>
			<content:encoded><![CDATA[<p>It is common for distributed organizations to have multiple engines in different locations as main gateways for protecting the perimeter of the local network.</p>
<p>Sometimes the firewall sees information that are unrelated specifically to network security; still, these information could be very useful to be centrally collected.</p>
<p>This post shows how it is possible to use StoneGate Central Log Processing to collect this information centrally.</p>
<p> <span id="more-1348"></span>
<p>Let’s set a need to be taken as a sample: collect information about network clients at remote location using their MAC address.</p>
<p>The base assumption is that the firewall has the information we’re looking for since it maintains an ARP table, whose content can be queried using CLI command <font face="Courier New" color="#0080ff">ip n <font face="Arial" color="#333333">on StoneGate engine</font></font>.    <br />Sample output from this command would be:    <br /><font face="courier new">192.168.1.1 dev eth1 lladdr 00:0c:ee:93:11:e5 STALE     <br />192.168.34.80 dev eth0 lladdr 00:21:70:18:9f:cf REACHABLE      <br />192.168.34.100 dev eth0 lladdr 00:0c:ee:b8:1f:56 REACHABLE      <br />192.168.34.210 dev eth0 lladdr 00:0c:ee:b8:1f:56 REACHABLE      <br />1192.168.1.40 dev eth1 lladdr 00:50:56:a9:66:25 REACHABLE</font></p>
<p>By using some shell scripting,    <br /><font face="Courier New" color="#0080ff">ip n | awk &#8216;{print $1 &quot; &#8211; &quot; $5 &quot;;&quot;}&#8217;</font></p>
<p>we could easily retrieve a better formatted information, like:   <br /><font face="courier new">192.168.1.1 &#8211; 00:0c:ee:93:11:e5;     <br />192.168.34.80 &#8211; 00:21:70:18:9f:cf;      <br />192.168.34.100 &#8211; 00:0c:ee:b8:1f:56;      <br />192.168..34.210 &#8211; 00:0c:ee:b8:1f:56;      <br />10.1.1.140 &#8211; 00:50:56:a9:66:25;</font></p>
<p>Done this, we could use command <font face="Courier New" color="#0080ff">sg-logger</font> on StoneGate engine to forward the information to Log Server using the same channel used for standard logs.    <br />The syntax is:    <br /><font face="Courier New" color="#0080ff">sg-logger &#8211; Sends log message</font></p>
<p><font face="Courier New" color="#0080ff">Usage:     <br />&#160; sg-logger -f facility_number -t type_number [-e event_number] [-i &quot;info_string&quot;] [-s] [-h]</font></p>
<p><font face="Courier New" color="#0080ff">Options:     <br />&#160; -f Set facility      <br />&#160; -t Set type      <br />&#160; -e Set event (Default: 0 (H2A_LOG_EVENT_UNDEFINED))      <br />&#160; -i Set info string for log message (Default: &quot;&quot;)      <br />&#160; -s Dump information on option numbers to stdout      <br />&#160; -h Show this help message      <br /></font></p>
<p>Let’s now bundle everything in a script that considers only information on eth0:   <br /><font face="Courier New" color="#0080ff">#!/bin/bash     <br />#Script to send arp table to StoneGate log server      <br />IP_ARP=&quot;`ip n | grep eth0 | awk &#8216;{print $1 &quot; &#8211; &quot; $5 &quot;;&quot;}&#8217;`&quot;      <br />N=0      <br />STRING_A=&quot;&quot;      <br />for i in&#160; $IP_ARP; do      <br />STRING_A=&quot;$STRING_A $i&quot;      <br />if [ $N -ge 50 ]; then      <br /> echo &quot;IN&quot;      <br /> sg-logger -f 8 -t 6 -i &quot;ARP from $HOSTNAME: $STRING_A&quot;      <br />N=0      <br /> STRING_A=&quot;&quot;      <br />else      <br />let N=$N+1;      <br />fi      <br />done      <br />sg-logger -f 8 -t 6 -i &quot;$ARP from $HOSTNAME: $STRING_A&quot;      <br />exit 0</font></p>
<p>Launching this script (remember to set execute permissions) will generate an entry in Log Browser with the information needed in info field.</p>
<p>Should you need to run this regularly, you can set it as a script in <em>Tester</em> tab in StoneGate Engine’s properties.</p>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://stoneblog.stonesoft.com/2009/06/my-firewall-sees-this-info-i-want-it-in-logs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

