<?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>yurisk.info &#187; Linux</title>
	<atom:link href="http://yurisk.info/category/linux/feed/" rel="self" type="application/rss+xml" />
	<link>http://yurisk.info</link>
	<description>Technical Blog about IT Security and Networking</description>
	<lastBuildDate>Thu, 29 Jul 2010 11:25:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>MAC finder script</title>
		<link>http://yurisk.info/2010/07/02/mac-finder-script/</link>
		<comments>http://yurisk.info/2010/07/02/mac-finder-script/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 05:35:37 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[Esafe]]></category>
		<category><![CDATA[Fortigate]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Solaris]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=959</guid>
		<description><![CDATA[While I don&#8217;t like going down to Layer 2 , recently I had to do it &#8211; I didn&#8217;t know IP address of the Cisco router I wanted to connect to but I had access to the Cisco router sitting in the same network. That would be pretty easy to do #show arp on this [...]]]></description>
			<content:encoded><![CDATA[<p>While I don&#8217;t like going down to Layer 2 , recently I had to do it &#8211; I didn&#8217;t know IP address of the Cisco router I wanted to connect to but I had access to the Cisco router sitting in the same network. That would be pretty easy to do #show arp on this router and then search on Google to whom belongs each MAC  if it wasn&#8217;t the subnet mask of /26. Copy pasting each entry of the ARP table into Google didn&#8217;t look like a lot of fun. So I wrote a python script that reads MAC addresses in bulk from command line and using downloaded beforehand database of MAC-vendor translations prints vendor for each MAC address. It works for &#35;show arp on CIsco,&#35;show mac-address-table on CIsco switches, &#35;arp -en  on Linux (means including Checkpoint), &#35;arp -a on Freebsd ,&#35;show arp of Junos from Juniper, &#35;get sys arp on Fortigate.<br />
Below is the script.<br />
Here&#58;<br />
<strong>mac-database.txt</strong> &#8211; file containing MAC-vendor translation in format &lt;MAC 6 hex digits as a sequence&gt; &lt;VENDOR&gt;, I used <a href="http://standards.ieee.org/regauth/oui/oui.txt"> standards.ieee.org/regauth/oui/oui.txt </a> as the source with a bit of sed, but if you want ready to use file I recommend <strong>nmap-mac-prefixes</strong> from nmap source-code distribution <a href="http://nmap.org/svn/nmap-mac-prefixes">http://nmap.org/svn/nmap-mac-prefixes</a><br />
Download script (to make sure formatting is preserved, an important thing for Python)<br />
<a href="http://yurisk.info/scripts/mac-finder.py">http://yurisk.info/scripts/mac-finder.py</a><br />Script AND mac database from nmap project &#8211; <a href="http://yurisk.info/scripts/mac.tar.gz"> http://yurisk.info/scripts/mac.tar.gz</a></p>
<div class="cmdout">
<pre>
&#35;!/usr/bin/python
&#35;This script accepts MAC addresses from the command line and
&#35;prints vendor for each mac address
&#35; Author&#58;Yuri, yurisk@yurisk.info,06.2010
import sys
import re
&#35;This function removes from MACs colon or dot and returns MAC as a sequence of HEX chars
def dotreplace(matchobj):
&nbsp;&nbsp;       if matchobj.group(0) == &#39;.&#39;&#58;
&nbsp;&nbsp;&nbsp;&nbsp;            return &#39;&#39;
&nbsp;&nbsp;       elif  matchobj.group(0) == &#39;&#58;&#39;&#58;
&nbsp;&nbsp;&nbsp;&nbsp;            return &#39;&#39;
&#35;open file with MAC addresses and vendors database,it has form xxxx &lt;Vendor&gt;
macs=open(&#39;mac-database.txt&#39;,&#39;r&#39;)
macs_lines=macs.readlines()
&#35;Read from stdinput
data = sys.stdin.readlines()
for ppp in data:
       popa=re.search(&#39;.*([a-f0-9]{4}\.[a-f0-9]{4}\.[a-f0-9]{4}).*&#39;,ppp,re.IGNORECASE)
       if popa:
             newpopa=re.sub(&#39;\.&#39;, dotreplace,popa.group(1))[0:6]
             newpopa_re=re.compile(newpopa,re.IGNORECASE)
             for mac_db in macs_lines:
                 vendor=re.search(newpopa_re,mac_db)
                 if vendor:
                    print ppp.strip(),mac_db[7:]
       popalinux = re.search(&#39;.*([a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}&#58;[a-f0-9]{2}).*&#39;,ppp,re.IGNORECASE)
       if popalinux&#58;
             newpopalinux=re.sub(&#39;&#58;&#39;,dotreplace,popalinux.group(1))[0&#58;6]
             newpopalinux_re=re.compile(newpopalinux,re.IGNORECASE)
             for mac_db in macs_lines&#58;
                 vendor=re.search(newpopalinux_re,mac_db)
                 if vendor&#58;
                    print ppp.strip(),mac_db[7&#58;]

       popadash = re.search('.*([a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}-[a-f0-9]{2}).*',ppp,re.IGNORECASE)
       if popadash:
             newpopadash=re.sub('-',dotreplace,popadash.group(1))[0:6]
             newpopadash_re=re.compile(newpopadash,re.IGNORECASE)
             for mac_db in macs_lines:
                 vendor=re.search(newpopadash_re,mac_db)
                 if vendor:
                    print ppp.strip(),mac_db[7:]
</pre>
</div>
<p>Running it:</p>
<div class="cmd">
[root@darkstar ]# ./mac-finder.py</div>
<div class="cmdout">
&lt;now I copy paste output from arp -a in BSD&gt;<br />$ arp -a<br />
(10.99.99.150) at 00:50:56:95:74:72 on em0 [ethernet]<br />
 (10.99.99.254) at 00:09:0f:31:c8:24  on em0 [ethernet]<br /> &lt;Hit CTRL+D to signal the end of input&gt;<br />
 (10.99.99.150) at 00:50:56:95:74:72 on em0 [ethernet] VMware, Inc.<br />
 (10.99.99.254) at 00:09:0f:31:c8:24 on em0 [ethernet] Fortinet Inc.</div>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/07/02/mac-finder-script/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to choose the password that noone can guess and you cant remember</title>
		<link>http://yurisk.info/2010/06/09/how-to-choose-the-password-that-noone-can-guess-and-you-cant-remember/</link>
		<comments>http://yurisk.info/2010/06/09/how-to-choose-the-password-that-noone-can-guess-and-you-cant-remember/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 10:29:21 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=887</guid>
		<description><![CDATA[How to choose the password that noone can guess and you cant remember Of course you know what the good password should be &#8211; random letters including capitals, peppered with numbers and enhanced with printable control characters.
The only small but important detail these recommendations seem to forget is that there are may be few hundreds [...]]]></description>
			<content:encoded><![CDATA[<p>How to choose the password that noone can guess and you cant remember Of course you know what the good password should be &#8211; random letters including capitals, peppered with numbers and enhanced with printable control characters.<br />
The only small but important detail these recommendations seem to forget is that there are may be few hundreds in the world that can memorize such incomprehensible sequence of chars. So if someone does decide to follow it such passwords end up being written on the paper and stuck to the monitor (on its back).<br />
I never followed such recommendations but nevertheless found the way to come up with hard to break passwords. Here it is &#8211;  I just take easily memorizeable sentence from some verse/prose , take first letters of each word, capitalize first letter and then add some predefined number that doesn&#8217;t chnage from password to password .Example follows.<br />
This is how the 1st sentence from e.e. cummings turns into password:<br />
<strong>Anyone lived in a pretty how town -&gt; Aliapht7722</strong><br />
As I said previously these are passwords I use also for SSH user access and for the last year brute force efforts went down the drains (so far).<br />
The topic of passwords is actually a big one , and more of human psychology kind rather than crypto-randomness sort of things.<br />
For more about that look for example here&#58;<br />
<a href="http://www.schneier.com/blog/archives/2007/01/choosing_secure.html">www.schneier.com</a><br />
Another way to come up with random but easy to pronounce words for  passwords can be done with scientific approach&#58;<br />
<a href="http://www.multicians.org/thvv/gpw.html">www.multicians.org</a> </p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/06/09/how-to-choose-the-password-that-noone-can-guess-and-you-cant-remember/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top 10 usernames used in SSH brute force</title>
		<link>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/</link>
		<comments>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 09:08:23 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=874</guid>
		<description><![CDATA[In continuation to yesterday&#8217;s post I thought it would be interesting to know statistics of the usernames used in those bruteforce probes. I thought and I did . Find below awk/sed script to get usernames for failed ssh login attempts and sort it for statistics and also list of the usernames I got from my [...]]]></description>
			<content:encoded><![CDATA[<p>In continuation to yesterday&#8217;s post I thought it would be interesting to know statistics of the usernames used in those bruteforce probes. I thought and I did . Find below awk/sed script to get usernames for failed ssh login attempts and sort it for statistics and also list of the usernames I got from my server. The full list of usernames can be found at the end.<br />
The script&#58;</p>
<div class="cmd"> awk   &#39;/Failed password for/  &#39;  /var/log/secure*  | sed  &#39;s/.* \([[:print:]]\+\) from .*/  \1  /g &#39; | sort | uniq &#45;c | sort &#45;n &#45;k1</div>
<p>And the winners are&#58;</p>
<table summary="The table listing top 10 usernames used in real cracking attampts on SSH service">
<caption>The table listing top 10 usernames used in real cracking attampts on SSH service</caption>
<tr class="thcolor">
<th>Username</th>
<th>Number of times seen</th>
</tr>
<tr>
<td>mysql</td>
<td>232</td>
</tr>
<tr class="cellcolor">
<td>info</td>
<td>252</td>
</tr>
<tr>
<td>postgres</td>
<td>317</td>
</tr>
<tr class="cellcolor">
<td>guest</td>
<td>435</td>
</tr>
<tr>
<td>nagios</td>
<td>452</td>
</tr>
<tr class="cellcolor">
<td>user</td>
<td> 459</td>
</tr>
<tr>
<td>oracle</td>
<td>598</td>
</tr>
<tr class="cellcolor">
<td>admin</td>
<td> 884</td>
</tr>
<tr>
<td>test</td>
<td>1017</td>
</tr>
<tr class="cellcolor">
<td>root</td>
<td>22058</td>
</tr>
</table>
<p>Full list of the usernames <a href="http://yurisk.info/usernames.log">Usernames.log</a></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/06/04/top-10-usernames-used-in-ssh-brute-force/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>SSH brute force is on the rise</title>
		<link>http://yurisk.info/2010/06/03/ssh-brute-force-on-the-rise/</link>
		<comments>http://yurisk.info/2010/06/03/ssh-brute-force-on-the-rise/#comments</comments>
		<pubDate>Thu, 03 Jun 2010 19:31:43 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Awk weekly]]></category>
		<category><![CDATA[Linux]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=865</guid>
		<description><![CDATA[SSH brute forcing is still in high demand. I have , for my own testing and pleasure, virtual servers scattered around the world. All of them being of the Linux/BSD family  I manage by SSH. The other quirk of mine is that I have on purpose no static IP at home for various reasons [...]]]></description>
			<content:encoded><![CDATA[<p>SSH brute forcing is still in high demand. I have , for my own testing and pleasure, virtual servers scattered around the world. All of them being of the Linux/BSD family  I manage by SSH. The other quirk of mine is that I have on purpose no static IP at home for various reasons (saving  me money being one of them). And to manage those servers by SSH I implement a very simple security rule – from Any to SSH port allow. Port is left to be standard one – 22. After all that time my server was broken into just once , when I gave access by SSH to the colleague of mine and later he changed the password to something crackable in 5 secs. Since then I  &#8211; first don’t give ssh access to colleagues <img src='http://yurisk.info/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> , and second &#8211; look from time to time at ssh failed attempts logs for amusement.<br />	<br />
My observations so far are &#58;<br />
 &#8211; ssh brute forcing is still/yet/again extremely popular and increasing . On average after unfirewalled access to port 22 is discovered it goes to ~ 5000-6000 attempts per day .<br />
 &#8211; crackers do have some means of communicating between them (market economy ?) – my servers have static IPs and first days after its set up brute force login attempts are as low as 2-10 a day. But once the server IP has been discovered by determined crackers it goes up in numbers very quickly.<br />
 &#8211; origins of the attacks correlate pretty well with the known sources of Spam/Malware &#58; Brazil, China, US etc.<br />
If you’d like to look at your SSH logs and do some stats on failed attempts here is the awk one-liner I use. Enjoy.</p>
<div class="cmd">
awk &#45;&#45;re-interval &#39;/authentication failure/ {}<br />
/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]/ {match($0,/[0-9]+\.[0-9]+\.[0-9]+\.[0-9]/,IP);  IPS[IP[0]]++ } END { for (cracker_ips in IPS) print cracker_ips &#34;  &#34; IPS[cracker_ips]}&#39; /var/log/secure.1 | sort -n -k2 </div>
<div class="cmdout">
190.202.85.3  1<br />
194.192.14.7  1<br />
212.111.199.3  1<br />
222.124.195.1  1<br />
210.71.71.1  2<br />
89.138.195.1  5<br />
212.156.65.7  25<br />
202.117.51.2  32<br />
210.51.48.7  32<br />
115.146.138.5  47<br />
60.191.98.5  88<br />
174.120.208.5  107<br />
61.129.60.2  165<br />
202.103.180.4  175<br />
213.251.192.2  239<br />
91.82.101.4  242<br />
220.173.60.6  264<br />
12.11.210.3  271<br />
144.16.72.1  291<br />
212.118.5.1  360<br />
66.11.122.1  384<br />
211.160.160.1  703<br />
190.12.66.1  999<br />
83.19.184.3  1176<br />
67.213.8.2  4955<br />
199.187.120.2  5312<br />
95.0.180.2  6680<br />
85.131.163.5  7685
</div>
<p>NB Crackers IPs are not sanitized</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/06/03/ssh-brute-force-on-the-rise/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>IP Options are evil &#8211; drop them , drop them on Cisco Asa/IOS Microsoft ISA Juniper or Checkpoint</title>
		<link>http://yurisk.info/2010/01/23/ip-options-are-evil-%e2%80%93-drop-them-drop-them-on-cisco-asaios-microsoft-isa-juniper-or-checkpoint/</link>
		<comments>http://yurisk.info/2010/01/23/ip-options-are-evil-%e2%80%93-drop-them-drop-them-on-cisco-asaios-microsoft-isa-juniper-or-checkpoint/#comments</comments>
		<pubDate>Sat, 23 Jan 2010 19:51:22 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[ASA/PIX Cisco]]></category>
		<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[IOS Cisco]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=419</guid>
		<description><![CDATA[As you probably noticed IP header has variable length placeholder for the IP Options field. It has been there since the beginning , once a good idea for debug now turned into trouble. RFC 791 states that hosts/routers supporting IP protocol must implement Ip Options filed . It is up to the vendor to decide [...]]]></description>
			<content:encoded><![CDATA[<p>As you probably noticed IP header has variable length placeholder for the IP Options field. It has been there since the beginning , once a good idea for debug now turned into trouble. RFC 791 states that hosts/routers supporting IP protocol <strong>must</strong> implement Ip Options filed . It is up to the vendor to decide what to do with this optional field, but it must understand it.  Still, wouldn’t be a problem if not modern architecture of the routing equipment that was designed to do most efficiently Routing , i.e. pass from interface to interface gigabytes of traffic. Therefore routing functions are highly optimized and most of the time are implemented in hardware . All other types of traffic unfortunately are not, and in most of the cases processing , lets call it Control traffic, is being left to  poor router CPU and done in software. That brought the  troubles into the IP world – relatively small amounts of control traffic (including Ip Options packets) may bring down otherwise<br />
 powerful router in just minutes.<br />
To prevent this attack vendors implemented protection measures to drop entirely or selectively IP packets that has Ip Options filed set. Below is quick cheat sheet how to do it in some gear :<br />
<br />
<strong>Checkpoint firewall NG/NGX</strong>  &#8211; packets with Ip Options are dropped by default except for the &#8220;Router Alert&#8221; option (0&#215;94) for the IGMPv2 and PIM protocols [or so CP claim, will have to verify later] and not even logged.  To start logging dropped packets go to Policy -> Global Properties -> Log and Alerts -> check Ip dropped packets : Log<br />
<br />
There is a value related to it that is on by default : Global Properties -> SmartDashboard customization -> Advanced Configuration -> Configure -> Firewall 1 -> Stateful inspection -> enable_ip_options (check/uncheck) but unchecking it removes from firewall VM chain module that inspects these Options at all and all Ip Options packets are dropped  . So  all  packets bearing Ip Options are happily dropped even before security rules , here:</p>
<div class="cmd"> [Expert@splat60]# fw ctl chain<br />
in chain (9):<br />
        0: -7f800000 (9095dd60) (ffffffff) IP Options Strip (ipopt_strip)<br />
        1: &#8211; 1fffff6 (9095ee80) (00000001) Stateless verifications (asm)
</div>
<p>Also Checkpoint say you can decide which Ip Options will be allowed later BUT only when installing the firewall: “The set of permitted options must be configured during installation  … the enable_ip_options setting in SmartDashboard is then used to enable or disable this functionality. Contact Check Point support for instructions on configuring the set of allowed IP options.”<br />
</p>
<div><strong>Microsoft ISA 2000 server:</strong><br />
 &#8211; If Enable Packet Filtering is not checked then do it in IP Packet Filters -> Properties &#8211; > General tab. On the Packet Filters tab check Enable Filtering IP Options .<br />
<strong>Microsoft ISA 2004 Server:</strong><br />
-	IP options filtering is enabled by default<br />
-	Go to Configuration node of the server in question  in Management console -> General -> Additional Security Policy<br />
Define IP Preferences . Here you will have 3 options to deal with Ip Options packets:<br />
a)	Deny packets with any IP options;<br />
b)	Deny packets with selected IP options;<br />
c)	Deny packets with all except selected IP options<br />
The same options are available in <strong>ISA 2006 </strong>, click on Configure IP Protection link &#8211; > IP Preference settings
</div>
<div><strong>IOS Cisco router :</strong><br />
  see my other blog – to be filled later<br />
Cisco ASA :<br />
 see my other  blog &#8211; to be filled later
</div>
<div><strong>Juniper router:</strong><br />
 You just add <strong>ip-options</strong> term to the filter and apply it to the interface of interest. In the example below I block only Route Record type of Ip Options, if you use any then it will block any type:
<div class="cmd"> [edit firewall family inet filter NOICMP term 3]</div>
<pre>
firewall {
    family inet {
        filter NOICMP {
            term 1 {
                from {
                    address {
                        192.168.2.100/32;
                    }
                }
                then {
                    reject;
                }
            }
            term 2 {
                from {
                    ip-options route-record;
                }
                then {
                    reject;
                }
            }
            term 3 {
                from {
                    address {
                        192.168.2.0/24;
                    }
                }
                then accept;
            }
        }
    }
}</pre>
</div>
<p>Apply to the interface:</p>
<div class="coding">
<pre>
interfaces {
    em0 {
        unit 0 {
            enable;
            family inet {
                filter {
                    input NOICMP;
                }
                address 192.168.2.133/24;
            }
        }
    }</pre>
</div>
<p>Other possible arguments to ip-options clause:</p>
<div class="cmd">set term 3 from ip-options ? </div>
<p>Possible completions:</p>
<pre>&lt;range&gt;              Range of values
  [                    Open a set of values
  any                  Any IP option
  loose-source-route   Loose source route
  route-record         Route record
  router-alert         Router alert
  security             Security
  stream-id            Stream ID
  strict-source-route  Strict source route
  timestamp            Timestamp </pre>
</div>
<p></p>
<div><strong>Windows 2008.</strong><br />
By default it doesnt allow/forward packets with Source Routing set, and that's good. For completeness<br />
here is how to enable (or check whether it is enabled) source-routed forwarding:<br />
<span class="cmd">BillG&gt; netsh interface ipv4 set global sourceroutingbehavior=drop| forward| dontforward </span><br />- or-<br />
Registry:<br />
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameter<br />
Key: DisableIPSourceRouting<br />
DWORD value: 0
<div><strong>Verify:</strong><br />
In Security any measure/protection/method is as good as the proof you can present that it actually works.<br />Windows:<br />
- Ping with Record Route field set:<br />
<span class="cmd">BillG> ping –r 9 192.2.2.1</span><br />
- Ping with Strict Routing field set:<br />
<span class="cmd">BillG> ping –k &lt;1st_hop_router_IP&gt; &lt;2nd_hop_router_IP…&gt;  &lt;target&gt;</span><br />
- Ping with Loose Routing field set:<br />
<span class="cmd">BillG> ping  -j  &lt;1st_hop_router_IP&gt; &lt;2nd_hop_router_IP…&gt;  &lt;target&gt;</span><br />
-	Ping with Timestamp option set:<br />
<span class="cmd">BillG> ping –s 3 8.8.8.8</span><br />Linux:<br />
- Ping with Record Route field set:<br />
     <span class="cmd"> root@darktstar:~/nmap# ping -R 8.8.8.8 </span><br />
- Ping with Timestamp option set:<br />
       <span class="cmd">root@darkstar:~/nmap# ping -T tsonly 8.8.8.8</span><br />Linux,BSD,Unix :<br />
      This handy utility sends bunch of packets to the target to test what Ip Options the target supports:<br />
      <span class="cmd">freebsd# fragtest ip-opt 192.168.2.133</span><br />
      ip-opt: sec lsrr ts esec cipso satid ssrr <br /> I run fragroute above against Juniper (8.3) that was configured in the example earlier to block only Record Route option, as you can see it is indeed missing in the output list that enumerates what Ip Options the target supports [ see Reference for fragroute details]
</div>
<p>References for further details:<br />
Juniper: <a href="http://www.amazon.com/JUNOS-Enterprise-Routing-Practical-Certification/dp/0596514425/ref=sr_1_1?ie=UTF8&#038;s=books&#038;qid=1264336662&#038;sr=1-1" > JUNOS Enterprise Routing, 1st Edition, By Doug Marschke; Harry Reynolds, 2008</a><br />
Microsoft ISA : <a href="http://www.amazon.com/Microsoft-ISA-Server-2006-Unleashed/dp/0672329190" >Microsoft® ISA Server 2006 Unleashed ,By Michael Noel, 2007</a><br />
Fragroute <a href="http://monkey.org/~dugsong/fragroute/">http://monkey.org/~dugsong/fragroute/</a><br />
Windows 2008: <a href="http://www.microsoft.com/learning/en/us/book.aspx?ID=11630&#038;locale=en-us" >Windows® Server 2008 TCP/IP Protocols and Services,By  Joseph Davies, 2008 </a></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2010/01/23/ip-options-are-evil-%e2%80%93-drop-them-drop-them-on-cisco-asaios-microsoft-isa-juniper-or-checkpoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ARP table overflow in Checkpoint and Linux in general</title>
		<link>http://yurisk.info/2009/12/15/arp-table-overflow-in-checkpoint-nad-linux-in-general/</link>
		<comments>http://yurisk.info/2009/12/15/arp-table-overflow-in-checkpoint-nad-linux-in-general/#comments</comments>
		<pubDate>Tue, 15 Dec 2009 13:40:56 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=316</guid>
		<description><![CDATA[Not specific to the Checkpoint but rather any Linux-based system issue, still people often
forget  about that and look for the Checkpoint-specific solutions to that , so to help with  this search I wrote the note 
how  to fix it  below:
Problem  usually shows itself in randomly distributed inability of stations to pass the firewall, slowness and other network problems [...]]]></description>
			<content:encoded><![CDATA[<p>Not specific to the Checkpoint but rather any Linux-based system issue, still people often<br />
forget  about that and look for the Checkpoint-specific solutions to that , so to help with  this search I wrote the note <br />
how  to fix it  below:<br />
Problem  usually shows itself in randomly distributed inability of stations to pass the firewall, slowness and other network problems follow.<br />
In <strong>/var/log/message</strong> you see the following record:</p>
<p><em>kernel: Neighbour table overflow</em>.<br />
That means ARP table has reached its maximum allowed limit and no new ARP entries are being learnt.</p>
<p>You can either find reason for sudden ARP requests influx or adjust ARP table limts accordingly.<br />
You adjust ARP table limits either editing  this file (then change survives reboot):</p>
<p><strong>/etc/sysctl.conf</strong><br />
If not present add these lines at the end, and try not to delete by mistake anything:<br />
net.ipv4.neigh.default.gc_thresh1 = 1024<br />
net.ipv4.neigh.default.gc_thresh2 = 4096<br />
net.ipv4.neigh.default.gc_thresh3 = 16384</p>
<p> - Then issue command:<br />
  <strong># sysctl -p</strong><br />
- Or if you want to increase it temporarily until reboot:<br />
<strong>#echo 1024 &gt; /proc/sys/net/ipv4/neigh/default/gc_thresh1<br />
#echo 4096 &gt; /proc/sys/net/ipv4/neigh/default/gc_thresh2<br />
#echo 16384 &gt; /proc/sys/net/ipv4/neigh/default/gc_thresh3</strong></p>
<p>And the short explanation follows.<br />
gc in the above means Garbage Collector (GC).<br />
net.ipv4.neigh.default.gc_thresh1  &#8211; sets minimum number of ARP entries in the cache.<br />
Until this value is reached GC doesnt run at all.<br />
net.ipv4.neigh.default.gc_thresh2  &#8211; sets soft maximum number of ARP entries in the cache.<br />
GC allows ARP cache to pass this limit for 5 seconds and then starts cleaning.<br />
net.ipv4.neigh.default.gc_thresh3  -  sets hard limit of ARP entries in the cache.<br />
After it is reached no more ARP entries are being added.</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2009/12/15/arp-table-overflow-in-checkpoint-nad-linux-in-general/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>SSH login alert by mail Linux or Unix based systems</title>
		<link>http://yurisk.info/2009/09/18/ssh-login-alert-by-mail-linux-or-unix-based-systems/</link>
		<comments>http://yurisk.info/2009/09/18/ssh-login-alert-by-mail-linux-or-unix-based-systems/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 10:24:40 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Esafe]]></category>
		<category><![CDATA[Firewall]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=244</guid>
		<description><![CDATA[As you may have noticed many security-related software/appliances are based on Linux or Unix operating
systems in their variety. And as the logical consequence of that remote managing of such devices is done with OpenSSH
package  .  What is lacking in these applications built on Linux/Unix platforms is alerting in real–time on successful
SSH login to the system [...]]]></description>
			<content:encoded><![CDATA[<p>As you may have noticed many security-related software/appliances are based on Linux or Unix operating<br />
systems in their variety. And as the logical consequence of that remote managing of such devices is done with OpenSSH<br />
package  .  What is lacking in these applications built on Linux/Unix platforms is alerting in real–time on successful<br />
SSH login to the system . e.g eSafe can alert only on login to the software itself (i.e. econsole), the same goes for the Checkpoint firewall<br />
. On the other hand SSH login to the system ultimately means superuser/root access that gives control over the whole<br />
system. To fix it I wrote the following script. This script sends mail to predefined email address each time someone<br />
successfully logs in by SSH to the machine.<br />
I take advantage here of the built-in feature of the  OpenSSH daemon – if you create text file containing commands (as if you typed<br />
them on the command line), and name it either <strong>/etc./ssh/sshrc</strong> or <strong>&lt;user home dir&gt;/.ssh/rc</strong> , these commands in file will be run each time user logs in through SSH daemon to the system.<br />
The file has to be readable by the user logging in through SSH.<br />
<strong>Note 1:</strong><br />
file /etc/ssh/sshrc is applied globally to any user logging in, unless:<br />
<strong>Note 2:</strong><br />
 file &lt;user home dir&gt;/.ssh/rc   overrides action of /etc/ssh/sshrc . Caveat here – it is enough for a user to put in his home .ssh directory<br />
 empty file named rc and it will disable /etc/ssh/sshrc including mail alerts sent from it. Actually it is not that big of an issue as you may<br />
create rc file in the home directory of the user yourself, give it 644 permissions and while user will know what is going on when doing ssh login he/she won’t be able to do anything about that.</p>
<p>So to script itself.<br />
<span style="text-decoration:underline;">Here:</span><br />
 <a href="mailto:yurisk@yurisk.info">yurisk@yurisk.info</a>   –   mail to which I get mail alert<br />
 mail.yurisk.info   -   mail server that accepts mails destined for yurisk.info domain (its MX record)<br />
 SENDING_HOST   -  hostname of sending host, will be included in the subject so later I can create mail inbox rule to pay appropriate attention   to such mails<br />
 USER_ID     &#8211; output of the #id command so I will also be able to filter incoming messages on the user logged in</p>
<p>freeBSD# cat /etc/ssh/mail_alert.awk<br />
BEGIN {<br />
 # Set up some info to be included in the mail<br />
 # As you see I prefer to use absolute pathnames , but you don&#8217;t have to<br />
 # Find the hostname to which SSH login happened , to be included in the Subject<br />
 &#8221;/bin/hostname&#8221; | getline SENDING_HOST<br />
 # FInd ID of logged<br />
 &#8221;/usr/bin/id&#8221; | getline<br />
 USER_ID = $1<br />
 SMTP = &#8220;/inet/tcp/0/mail.yurisk.info/25&#8243;<br />
 RS = ORS = &#8220;\r\n&#8221;<br />
 print &#8220;helo yurisk.info&#8221;     |&amp; SMTP<br />
 SMTP                       |&amp; getline<br />
 print &#8220;mail from: &lt;<a href="mailto:yurisk@yurisk.info">yurisk@yurisk.info</a>&gt;&#8221; |&amp; SMTP<br />
 SMTP                       |&amp; getline<br />
 print  &#8220;rcpt to: &lt;<a href="mailto:yurisk@yurisk.info">yurisk@yurisk.info</a>&gt;&#8221;  |&amp; SMTP<br />
 SMTP                       |&amp; getline<br />
 print   &#8220;data&#8221;             |&amp; SMTP<br />
 SMTP                       |&amp; getline<br />
 print  &#8220;Subject:SSH login alert &#8211; user &#8221; USER_ID &#8220;logged in &#8221; SENDING_HOST  |&amp; SMTP<br />
print                       |&amp;  SMTP<br />
 &#8221;/usr/bin/w&#8221; | getline<br />
 print  $0                  |&amp; SMTP<br />
  print   &#8221; He is most free from danger, who, even when safe, is on his guard  &#8220;               |&amp; SMTP</p>
<p>print   &#8220;  &#8220;               |&amp; SMTP<br />
 print  &#8220;.&#8221;                 |&amp; SMTP<br />
 print                      |&amp; SMTP</p>
<p>print  &#8220;quit&#8221;              |&amp; SMTP</p>
<p> }<br />
- Now the file that is checked on each login for commands ( I put both files  in /etc/ssh/) :<br />
freeBSD# cat /etc/ssh/sshrc<br />
awk -f /etc/ssh/mail_alert.awk &gt; /dev/null<br />
<span style="text-decoration:underline;">Note for FreeBSD</span> (I guess any *BSD) users:  in *rc file above you will have to replace awk with gawk, as in *BSD systems awk behaves as the old-style Unix awk that has no bidirectional pipe to connect to mail server.</p>
<p> PS. You might be asking why awk here ? True, Linux/Unix have perfect tool for sending mails called #mail, but I did it with awk<br />
for  a reason &#8211; not on every (especially if hardened) system you will find mail/telnet/etc utilities with which sending mails is more simple and more reliable. The biggest one is Checkpoint firewall &#8211; it has NO mail or telnet clients, neither scripting language beyond AWK and Bash.</p>
<p>The downside of awk is that it is not perfect for more or less complex protocols. So script may stuck / send commands too fast/ etc and therefore be disconnected by the server.</p>
<p>Also if mail server uses greylisting &#8211; this script won&#8217;t understand it. So check it in interactive session before using. If time permits later I will polish it a bit to count for such cases.</p>
<p>BTW If you haven&#8217;t noticed eSafe has full-blown scripting languages installed &#8211; Perl and Python . With these you are limited by your imagination only.</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2009/09/18/ssh-login-alert-by-mail-linux-or-unix-based-systems/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ping &#8211; setting don&#039;t fragment bit in Linux/FreeBSD/Solaris/Cisco/Juniper</title>
		<link>http://yurisk.info/2009/09/01/ping-setting-dont-fragment-bit-in-linuxfreebsdsolarisciscojuniper/</link>
		<comments>http://yurisk.info/2009/09/01/ping-setting-dont-fragment-bit-in-linuxfreebsdsolarisciscojuniper/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 08:42:46 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networking]]></category>

		<guid isPermaLink="false">http://yurisk.info/?p=201</guid>
		<description><![CDATA[ Ping.
Many times while debugging network problems of various kinds you need to send some packets
of desirable size  and don’t fragment bit being set. Below I list how to do it for  the different
equipment/OSes.
Let’s start with the  most popular operating system among network folks – Linux:
Linux
By default ping in any Linux-based system (It also means any [...]]]></description>
			<content:encoded><![CDATA[<p> <strong>Ping.</strong></p>
<p>Many times while debugging network problems of various kinds you need to send some packets<br />
of desirable size  and don’t fragment bit being set. Below I list how to do it for  the different<br />
equipment/OSes.<br />
Let’s start with the  most popular operating system among network folks – Linux:</p>
<p><strong><span style="text-decoration:underline;">Linux</span></strong></p>
<p>By default ping in any Linux-based system (It also means any distribution – Slackware, Ubuntu, CentOS etc) is sent with<br />
Don’t fragment (df) bit set . You don’t need to add any command line switches for that.<br />
Here is what you get by default ping in Linux:<br />
Defaults:<br />
 Don’t fragment bit  (in echo request)  &#8211; set<br />
 Ip packet size – 84 bytes<br />
 Sending interval  &#8211; 1 second<br />
 </p>
<p>Some examples.<br />
- sending pings station:<br />
[root@lonestar ~]# ping 191.91.21.41<br />
 -   receiving station:<br />
[root@darkstar ~]# tcpdump -s 1500 -n -vv icmp<br />
21:23:51.598641 IP (tos 0&#215;0, ttl  61, id 20, offset 0, <span style="color:#0000ff;">flags [DF]</span>, proto: ICMP (1), length: <span style="color:#0000ff;">84</span>) 112.225.125.100 &gt; 10.99.99.150: ICMP echo request, id 5392, seq 20, length 64<br />
21:23:51.598817 IP (tos 0&#215;0, ttl  64, id 7135, offset 0, flags [none], proto: ICMP (1), length: 84) 10.99.99.150 &gt; 112.225.125.100: ICMP echo reply, id 5392, seq 20, length 64<br />
 To change sent packet size:<br />
<strong> -s  &lt;size&gt; , bytes</strong> (8 bytes of ICMP header will be added automatically).</p>
<p> Sending host:<br />
[root@darkstar ~]# ping 10.99.99.158 -s 1300<br />
PING 10.99.99.158 (10.99.99.158) 1300(1328) bytes of data.<br />
1308 bytes from 10.99.99.158: icmp_seq=1 ttl=64 time=1.65 ms</p>
<p>Receiving host:<br />
freeBSD# tcpdump -n -v -s 1500 icmp<br />
16:15:11.901787 IP (tos 0&#215;0, ttl 64, id 0, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto ICMP (1), length <span style="color:#0000ff;">1328</span>) 10.99.99.150 &gt; 10.99.99.158: ICMP echo request, id 44399, seq 63, length 1308<br />
To change sending interval (mostly used together with large packet size) :<br />
<strong>-i  &lt;secs&gt;</strong></p>
<p>Sending host:<br />
[root@darkstar ~]# ping -s 1300 -i 0.2 10.99.99.158</p>
<p>Receiving host:<br />
freeBSD# tcpdump -n -v -s 1500 icmp<br />
16:20:11.223481 IP (tos 0&#215;0, ttl 64, id 0, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto ICMP (1), length <span style="color:#0000ff;">1328</span>) 10.99.99.150 &gt; 10.99.99.158: ICMP echo request, id 1136, seq 396, length 1308<br />
16:20:11.223496 IP (tos 0&#215;0, ttl 64, id 805, offset 0, flags [DF], proto ICMP (1), length 1328) 10.99.99.158 &gt; 10.99.99.150: ICMP echo reply, id 1136, seq 396, length 1308</p>
<p>To force Linux to send pings with DF bit cleared (i.e. not set):<br />
<strong>ping –M don’t</strong></p>
<p>Sending host:</p>
<p>[root@darkstar ~]# ping -s 1300 -M dont  10.99.99.158<br />
PING 10.99.99.158 (10.99.99.158) 1300(1328) bytes of data.<br />
1308 bytes from 10.99.99.158: icmp_seq=1 ttl=64 time=0.560 ms</p>
<p>Receiving host:</p>
<p>freeBSD# tcpdump -n -v -s 1500 icmp<br />
16:28:33.111903 IP (tos 0&#215;0, ttl 64, id 41857, offset 0, <span style="color:#0000ff;">flags [none],</span> proto ICMP (1), length 1328) 10.99.99.150 &gt; 10.99.99.158: ICMP echo request, id 33136, seq 6, length 1308<br />
16:28:33.111920 IP (tos 0&#215;0, ttl 64, id 9425, offset 0, flags [none], proto ICMP (1), length 1328) 10.99.99.158 &gt; 10.99.99.150: ICMP echo reply, id 33136, seq 6, length 1308</p>
<p> </p>
<p><strong>SideNote:</strong>  FreeBSD ping has a nice add-on (see below) – sweeping size of the packets, while Linux doesn’t have such extra feature,<br />
Below is script to emulate it on Linux:<br />
awk  &#8216; BEGIN  {for (size=100;size&lt;1470;size++)  {<br />
cmd = (&#8221;ping –c 3 –I 0.5 –s  &#8221; size  &#8220;  &#8220;  &#8220;10.99.99.158&#8243;)<br />
print cmd | &#8220;/bin/bash&#8221;<br />
close(&#8221;/bin/bash&#8221;)  } } &#8216;</p>
<p>Here:<br />
<em> size</em> – size of data in ICMP packet (bytes);<br />
 <em>-I 0.5</em> – interval of 5 seconds (optional);<br />
 <em>-c 3</em>   &#8211; number of pings in each size session (NOT optional – or you will enter an endless loop which even Ctrl-C won’t be able<br />
            to stop )</p>
<p>See it in action:<br />
[root@darkstar ~]# awk  &#8216; BEGIN  {for (size=100;size&lt;1470;size++)  {<br />
cmd = (&#8221;ping -c 3 -i 0.5 -s  &#8221; size  &#8220;  &#8220;  &#8220;10.99.99.158&#8243;)<br />
print cmd | &#8220;/bin/bash&#8221;<br />
close(&#8221;/bin/bash&#8221;)  } } &#8216;<br />
PING 10.99.99.158 (10.99.99.158) 100(128) bytes of data.<br />
108 bytes from 10.99.99.158: icmp_seq=1 ttl=64 time=1.75 ms<br />
108 bytes from 10.99.99.158: icmp_seq=2 ttl=64 time=0.276 ms<br />
108 bytes from 10.99.99.158: icmp_seq=3 ttl=64 time=0.201 ms</p>
<p>&#8212; 10.99.99.158 ping statistics &#8212;<br />
3 packets transmitted, 3 received, 0% packet loss, time 1002ms<br />
rtt min/avg/max/mdev = 0.201/0.742/1.750/0.713 ms<br />
PING 10.99.99.158 (10.99.99.158) 101(129) bytes of data.<br />
109 bytes from 10.99.99.158: icmp_seq=1 ttl=64 time=0.185 ms<br />
109 bytes from 10.99.99.158: icmp_seq=2 ttl=64 time=0.253 ms<br />
109 bytes from 10.99.99.158: icmp_seq=3 ttl=64 time=0.230 ms</p>
<p>&#8212; 10.99.99.158 ping statistics &#8212;<br />
3 packets transmitted, 3 received, 0% packet loss, time 1000ms<br />
rtt min/avg/max/mdev = 0.185/0.222/0.253/0.033 ms<br />
PING 10.99.99.158 (10.99.99.158) 102(130) bytes of data.<br />
110 bytes from 10.99.99.158: icmp_seq=1 ttl=64 time=0.118 ms<br />
110 bytes from 10.99.99.158: icmp_seq=2 ttl=64 time=0.201 ms<br />
110 bytes from 10.99.99.158: icmp_seq=3 ttl=64 time=0.343 ms</p>
<p>&#8212; 10.99.99.158 ping statistics &#8212;<br />
3 packets transmitted, 3 received, 0% packet loss, time 1001ms<br />
rtt min/avg/max/mdev = 0.118/0.220/0.343/0.094 ms<br />
PING 10.99.99.158 (10.99.99.158) 103(131) bytes of data.<br />
111 bytes from 10.99.99.158: icmp_seq=1 ttl=64 time=0.565 ms<br />
111 bytes from 10.99.99.158: icmp_seq=2 ttl=64 time=0.182 ms<br />
111 bytes from 10.99.99.158: icmp_seq=3 ttl=64 time=0.329 ms<br />
<strong><span style="text-decoration:underline;">FreeBSD</span></strong></p>
<p>Defaults:<br />
 Don’t fragment bit &#8211; not set   ; use –D  option to set<br />
 IP Packet size:  84 bytes  ;  use –s option to change<br />
 Sending interval:  1 sec  ;   use  –I  &lt;secs&gt; to change<br />
e.g. Sending pings  of data size 1300 bytes with interval 0.2 seconds with df bit set:</p>
<p>Sending host[10.99.99.158]:<br />
freeBSD# ping -D -s 1300 -i 0.2 10.99.99.150</p>
<p>Receiving host[10.99.99.150]:<br />
[root@darkstar ~]# tcpdump -n -v -s 1500  host 10.99.99.158<br />
20:42:57.816697 IP (tos 0&#215;0, ttl  64, id 11630, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">1328</span>) 10.99.99.158 &gt; 10.99.99.150: ICMP echo request, id 10770, seq 23, length 1308<br />
20:42:57.816914 IP (tos 0&#215;0, ttl  64, id 33327, offset 0, flags [none], proto: ICMP (1), length: 1328) 10.99.99.150 &gt; 10.99.99.158: ICMP echo reply, id 10770, seq 23, length 1308<br />
 <br />
<strong>SideNote:</strong>  *BSD family  has  a nice additional option  not found in most other systems  – you can  order ping to sweep size of sent packets .<br />
Example follows:</p>
<p>Here sweep range is from 20 bytes up to 1400 bytes, increase step is 300 bytes.</p>
<p>Sending host[10.99.99.158]:<br />
freeBSD# ping -D <span style="color:#0000ff;">-<span style="color:#0000ff;">g 20 -G 1400</span></span><span style="color:#0000ff;"> -h 300</span> 10.99.99.150<br />
PING 10.99.99.150 (10.99.99.150): (20 &#8230; 1400) data bytes<br />
28 bytes from 10.99.99.150: icmp_seq=0 ttl=64 time=1.313 ms<br />
328 bytes from 10.99.99.150: icmp_seq=1 ttl=64 time=0.531 ms<br />
628 bytes from 10.99.99.150: icmp_seq=2 ttl=64 time=0.581 ms<br />
928 bytes from 10.99.99.150: icmp_seq=3 ttl=64 time=0.362 ms<br />
1228 bytes from 10.99.99.150: icmp_seq=4 ttl=64 time=0.223 ms</p>
<p>&#8212; 10.99.99.150 ping statistics &#8212;<br />
5 packets transmitted, 5 packets received, 0.0% packet loss<br />
round-trip min/avg/max/stddev = 0.223/0.602/1.313/0.377 ms<br />
Receiving host[10.99.99.150]:<br />
[root@darkstar ~]# tcpdump -n -v -s 1500  host 10.99.99.158<br />
21:50:06.942165 IP (tos 0&#215;0, ttl  10.99.99.150 64, id 12828, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">48</span>) 10.99.99.158 &gt; 10.99.99.150: ICMP echo request, id 50962, seq 0, length 28<br />
21:50:06.944098 IP (tos 0&#215;0, ttl  64, id 43255, offset 0, flags [none], proto: ICMP (1), length: 48) 10.99.99.150 &gt; 10.99.99.158: ICMP echo reply, id 50962, seq 0, length 28<br />
21:50:07.944761 IP (tos 0&#215;0, ttl  64, id 12831, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">348</span>) 10.99.99.158 &gt; 10.99.99.150: ICMP echo request, id 50962, seq 1, length 328<br />
21:50:07.944826 IP (tos 0&#215;0, ttl  64, id 43256, offset 0, flags [none], proto: ICMP (1), length: 348) 10.99.99.150 &gt; 10.99.99.158: ICMP echo reply, id 50962, seq 1, length 328<br />
21:50:08.945815 IP (tos 0&#215;0, ttl  64, id 12833, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">648</span>) 10.99.99.158 &gt; 10.99.99.150: ICMP echo request, id 50962, seq 2, length 628<br />
21:50:08.945890 IP (tos 0&#215;0, ttl  64, id 43257, offset 0, flags [none], proto: ICMP (1), length: 648) 10.99.99.150 &gt; 10.99.99.158: ICMP echo reply, id 50962, seq 2, length 628<br />
21:50:09.946724 IP (tos 0&#215;0, ttl  64, id 12835, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">948</span>) 10.99.99.158 &gt; 10.99.99.150: ICMP echo request, id 50962, seq 3, length 928<br />
21:50:09.946819 IP (tos 0&#215;0, ttl  64, id 43258, offset 0, flags [none], proto: ICMP (1), length: 948) 10.99.99.150 &gt; 10.99.99.158: ICMP echo reply, id 50962, seq 3, length 928<br />
 </p>
<p><strong><span style="text-decoration:underline;">SOLARIS</span></strong><br />
Defaults:<br />
Don’t fragment bit    - <span style="text-decoration:underline;"> not set</span> , and not changeable , yes , it sounds strange but Solaris doesn’t<br />
support  df bit in its ping utility. You may set df bit in their traceroute program , but it has no provision for changing size of the packet and therefore is of no value for our case.</p>
<p>Non-verbose ; use –s to override<br />
IP packet size:  84 bytes</p>
<p>Pinging with defaults:<br />
<a href="mailto:root@opensolaris">root@solaris</a>:~# ping -s 10.99.99.150<br />
PING 10.99.99.150: 56 data bytes<br />
64 bytes from 10.99.99.150: icmp_seq=0. time=0.759 ms</p>
<p>Receiving host:<br />
[root@darkstar ~]# tcpdump -n -v -s 1500  host 10.99.99.159<br />
20:50:08.084364 IP (tos 0&#215;0, ttl 255, id 8020, offset 0, <span style="color:#0000ff;">flags [none],</span> proto: ICMP (1), length: <span style="color:#0000ff;">84</span>) 10.99.99.159 &gt; 10.99.99.150: ICMP echo request, id 9096, seq 7, length 64<br />
20:50:08.084538 IP (tos 0&#215;0, ttl  64, id 52389, offset 0, flags [none], proto: ICMP (1), length: 84) 10.99.99.150 &gt; 10.99.99.159: ICMP echo reply, id 9096, seq 7, length 64</p>
<p> To change size of sent packet, to say 1300 bytes of data:</p>
<p><a href="mailto:root@opensolaris">root@solaris</a>:~# ping -s 10.99.99.150  <span style="color:#0000ff;">1320</span><br />
PING 10.99.99.150: 1320 data bytes<br />
1328 bytes from 10.99.99.150: icmp_seq=0. time=1.610 ms<br />
1328 bytes from 10.99.99.150: icmp_seq=1. time=0.335 ms<br />
<strong>SideNote:</strong>  There is no size sweeping capability built-in , so I wrote  this script to   emulate this feature  in Solaris as well:<br />
<a href="mailto:root@opensolaris">root@solaris</a>:~# awk  &#8216; BEGIN  {for (size=100;size&lt;1470;size=size+10)  {<br />
cmd = (&#8221;ping   -s &#8220;    &#8220;10.99.99.158 &#8221; size  &#8221; 3&#8243;)<br />
print cmd | &#8220;/bin/bash&#8221;<br />
close(&#8221;/bin/bash&#8221;)  } } &#8216;</p>
<p>Here :<br />
 <em>size </em>  -  size of date in ICMP packet , starts at 10 bytes ends at 170 bytes<br />
 <em>size+10</em> – size incrementing by 10 bytes each series of pings<br />
<em>3</em> - number of pings in each size set.</p>
<p>Results:<br />
 <a href="mailto:root@opensolaris">root@solaris</a>:~# awk  &#8216; BEGIN  {for (size=100;size&lt;1470;size=size+10)  {<br />
cmd = (&#8221;ping   -s &#8220;    &#8220;10.99.99.158 &#8221; size  &#8221; 3&#8243;)<br />
print cmd | &#8220;/bin/bash&#8221;<br />
close(&#8221;/bin/bash&#8221;)  } } &#8216;<br />
PING 10.99.99.158: 100 data bytes<br />
108 bytes from 10.99.99.158: icmp_seq=0. time=0.319 ms<br />
108 bytes from 10.99.99.158: icmp_seq=1. time=0.460 ms<br />
108 bytes from 10.99.99.158: icmp_seq=2. time=0.328 ms</p>
<p>&#8212;-10.99.99.158 PING Statistics&#8212;-<br />
3 packets transmitted, 3 packets received, 0% packet loss<br />
round-trip (ms)  min/avg/max/stddev = 0.319/0.369/0.460/0.079<br />
PING 10.99.99.158: 110 data bytes<br />
118 bytes from 10.99.99.158: icmp_seq=0. time=0.371 ms<br />
118 bytes from 10.99.99.158: icmp_seq=1. time=0.370 ms<br />
118 bytes from 10.99.99.158: icmp_seq=2. time=0.477 ms</p>
<p>&#8212;-10.99.99.158 PING Statistics&#8212;-<br />
3 packets transmitted, 3 packets received, 0% packet loss<br />
round-trip (ms)  min/avg/max/stddev = 0.370/0.406/0.477/0.061<br />
PING 10.99.99.158: 120 data bytes<br />
128 bytes from 10.99.99.158: icmp_seq=0. time=0.395 ms<br />
128 bytes from 10.99.99.158: icmp_seq=1. time=0.361 ms<br />
128 bytes from 10.99.99.158: icmp_seq=2. time=0.264 ms</p>
<p> </p>
<p><strong><span style="text-decoration:underline;"> CISCO routers (IOS)</span></strong></p>
<p>Defaults:<br />
IP packet size : 100 bytes ;  use <strong>size &lt;size&gt;</strong> to change<br />
Don’t fragment bit &#8211; not set  ;  use <strong>df-bit</strong> to set</p>
<p>Running with defaults:<br />
Tokyo#ping 191.91.21.41<br />
Type escape sequence to abort.<br />
Sending 5, 100-byte ICMP Echos to 191.91.21.41, timeout is 2 seconds:<br />
!!!!!<br />
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/4 ms</p>
<p>Receiving host:<br />
[root@darkstar ~]# tcpdump -n -v  -s 1500 icmp<br />
22:16:53.758056 IP (tos 0&#215;0, ttl 253, id 11, offset 0, <span style="color:#0000ff;">flags [none],</span> proto: ICMP (1), length: <span style="color:#0000ff;">100</span>) 174.93.31.134 &gt; 10.99.99.150: ICMP echo request, id 4, seq 0, length 80<br />
22:16:53.758246 IP (tos 0&#215;0, ttl  64, id 10923, offset 0, flags [none], proto: ICMP (1), length: 100) 10.99.99.150 &gt; 174.93.31.134 : ICMP echo reply, id 4, seq 0, length 80<br />
&lt; &#8212; Cut for brevity &#8211;&gt;<br />
Setting df bit and size of the packet size  (Note – here when you set size of the ping you set IP packet size and not ICMP data size as  in *Nix systems).<br />
Repeat count is set to 3 .<br />
Tokyo#ping 191.91.21.41 size 1300 df-bit rep 3<br />
Type escape sequence to abort.<br />
Sending 3, 1300-byte ICMP Echos to 191.91.21.41, timeout is 2 seconds:<br />
Packet sent with the DF bit set<br />
!!!<br />
Success rate is 100 percent (3/3), round-trip min/avg/max = 4/4/4 ms</p>
<p>Receiving host:<br />
[root@darkstar ~]# tcpdump -n -v  -s 1500 icmp<br />
22:18:16.657849 IP (tos 0&#215;0, ttl 253, id 21, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">1300)</span> 174.93.31.134  &gt; 10.99.99.150: ICMP echo request, id 6, seq 0, length 1280<br />
22:18:16.658028 IP (tos 0&#215;0, ttl  64, id 10933, offset 0, flags [none], proto: ICMP (1), length: 1300) 10.99.99.150 &gt; 174.93.31.134 : ICMP echo reply, id 6, seq 0, length 1280<br />
<span style="text-decoration:underline;">Sweeping ping size.</span><br />
This feature is available from extended ping menu:<br />
Rio#ping<br />
Protocol [ip]:<br />
Target IP address: 191.91.21.41<br />
Repeat count [5]:<br />
Datagram size [100]:<br />
Timeout in seconds [2]:<br />
Extended commands [n]: <span style="color:#0000ff;">y<br />
</span>Source address or interface:<br />
Type of service [0]:<br />
Set DF bit in IP header? [no]: y<br />
Validate reply data? [no]:<br />
Data pattern [0xABCD]:<br />
Loose, Strict, Record, Timestamp, Verbose[none]:<br />
<span style="color:#0000ff;">Sweep range of sizes [n]: y<br />
Sweep min size [36]:<br />
Sweep max size [18024]: 1700<br />
Sweep interval [1]: 100<br />
</span>Type escape sequence to abort.<br />
Sending 85, [36..1700]-byte ICMP Echos to 191.91.21.41, timeout is 2 seconds:<br />
Packet sent with the DF bit set<br />
!!!!!!!!!!!!!!<br />
Receiving host:<br />
10:35:22.563851 IP (tos 0&#215;0, ttl 253, id 179, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">36</span>) 174.93.31.134  &gt; 10.99.99.150: ICMP echo request, id 9, seq 0, length 16<br />
10:35:22.563891 IP (tos 0&#215;0, ttl  64, id 46861, offset 0, flags [none], proto: ICMP (1), length: 36) 10.99.99.150 &gt; 174.93.31.134 : ICMP echo reply, id 9, seq 0, length 16<br />
10:35:22.566205 IP (tos 0&#215;0, ttl 253, id 180, offset 0, <span style="color:#0000ff;">flags [DF],</span> proto: ICMP (1), length: <span style="color:#0000ff;">136</span>) 174.93.31.134  &gt; 10.99.99.150: ICMP echo request, id 9, seq 1, length 116<br />
10:35:22.566223 IP (tos 0&#215;0, ttl  64, id 46862, offset 0, flags [none], proto: ICMP (1), length: 136) 10.99.99.150 &gt; 174.93.31.134 : ICMP echo reply, id 9, seq 1, length 116</p>
<p> </p>
<p><strong><span style="text-decoration:underline;">Juniper routers (JunOS):</span></strong><br />
Defaults:<br />
Ip packet size : 84 bytes<br />
Don’t fragment bit – not set; use <strong>do-not-fragment</strong> to set<br />
Interval  &#8211; 1 sec;  use <strong>interval &lt;secs&gt;</strong> to change<br />
Sending pings with df bit set and size 1470 bytes<br />
<a href="mailto:root@Juniper">root@Juniper</a>&gt; ping 192.168.37.29 do-not-fragment size 1470<br />
ping 192.168.37.29 do-not-fragment size 1470<br />
PING 192.168.37.29 (192.168.37.29): 1470 data bytes<br />
1478 bytes from 192.168.37.29: icmp_seq=0 ttl=64 time=1.434 ms<br />
1478 bytes from 192.168.37.29: icmp_seq=1 ttl=64 time=0.210 ms</p>
<p>&#8212; 192.168.37.29 ping statistics &#8212;<br />
4 packets transmitted, 4 packets received, 0% packet loss<br />
round-trip min/avg/max/stddev = 0.203/0.513/1.434/0.532 ms</p>
<p>IF packet size too large and df is set you get this:</p>
<p><a href="mailto:root@Juniper">root@Juniper</a>&gt; ping 192.168.37.29 do-not-fragment size 13000<br />
ping 192.168.37.29 do-not-fragment size 13000<br />
PING 192.168.37.29 (192.168.37.29): 13000 data bytes<br />
ping: sendto: Message too long</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2009/09/01/ping-setting-dont-fragment-bit-in-linuxfreebsdsolarisciscojuniper/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Clear ARP table in Checkpoint</title>
		<link>http://yurisk.info/2008/10/25/clear-arp-table-in-checkpoint/</link>
		<comments>http://yurisk.info/2008/10/25/clear-arp-table-in-checkpoint/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 10:36:25 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Checkpoint NG/NGX]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Checkpoint]]></category>

		<guid isPermaLink="false">http://yurisk.wordpress.com/?p=46</guid>
		<description><![CDATA[Yesterday my colleague asked how to clear all entries in the ARP table of the
NGX in question (Splat). I thought the arp command of the Linux would include some switch for that case too &#8211; but it didn&#8217;t. To delete ARP entry from the ARP  cache you use #arp -d &#60;IP address to be deleted&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Yesterday my colleague asked how to clear all entries in the ARP table of the<br />
NGX in question (Splat). I thought the <strong>arp </strong>command of the Linux would include some switch for that case too &#8211; but it didn&#8217;t. To delete ARP entry from the ARP  cache you use #arp -d &lt;IP address to be deleted&gt; , and it has no provision for deleting multiple entries in one go. So here is the one-liner<br />
that does just that &#8211; clears all entries in ARP cache. I found it in Google and<br />
slightly rearranged for brevity (note- it is one line of text) :</p>
<p><strong>for ip in $(awk &#39;/([[:digit:]]\.)+/ {print $1}&#39; /proc/net/arp) ; do  arp -d $ip ; done</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2008/10/25/clear-arp-table-in-checkpoint/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Autologin Expect scripts for telnet/ssh</title>
		<link>http://yurisk.info/2008/09/21/autologin-expect-scripts-for-telnetssh/</link>
		<comments>http://yurisk.info/2008/09/21/autologin-expect-scripts-for-telnetssh/#comments</comments>
		<pubDate>Sun, 21 Sep 2008 17:28:02 +0000</pubDate>
		<dc:creator>Yuri</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Expect]]></category>

		<guid isPermaLink="false">http://yurisk.wordpress.com/?p=25</guid>
		<description><![CDATA[Tired of typing over and over  your username/password when using
telnet/ssh ? Here are Expect http://expect.nist.gov/ scripts to autologin by Telnet and ssh
Notes:
- Yes, it is not secure to keep you username/password saved somewhere, so know
what you do . In my opinion  as long as this
is a dedicated for remote logins server, that has no access [...]]]></description>
			<content:encoded><![CDATA[<p>Tired of typing over and over  your username/password when using<br />
telnet/ssh ? Here are Expect <a href="http://expect.nist.gov/">http://expect.nist.gov/</a> scripts to autologin by Telnet and ssh<br />
Notes:<br />
- Yes, it is not secure to keep you username/password saved somewhere, so know<br />
what you do . In my opinion  as long as this<br />
is a dedicated for remote logins server, that has no access from outside, and hardened accordingly<br />
(pertinent to the scripts &#8211; only owner/root can read user&#8217;s home folder, etc.,) the risk is acceptable.</p>
<p>Note 2: password is saved in a file named &#8220;sword&#8221;</p>
<p>cat tel<br />
#!/usr/local/bin/expect   Change to the location of your Expect package<br />
 <br />
proc Usage {} {<br />
  puts &#8220;\n tel &lt;equipment to enter&gt; \n&#8221;<br />
  return<br />
            }<br />
 </p>
<p>set  argnumber  [llength $argv]<br />
 <br />
if {$argnumber==0} {<br />
      puts &#8220;You need to specify at least one piece of equipment to log into\n&#8221;<br />
      Usage<br />
      exit<br />
 <br />
   }  elseif {$argnumber&gt;1}  {<br />
       puts &#8220;You specified too many arguments, only one please\n&#8221;<br />
 <br />
      Usage<br />
       exit<br />
                  }<br />
 <br />
set hostName [lindex $argv 0]<br />
 <br />
 puts &#8220;Entering $hostName&#8221;<br />
 set username &#8220;myusername&#8221;<br />
 set HANDL [open "sword"]<br />
 set password [gets $HANDL]<br />
 close $HANDL<br />
 spawn telnet $hostName<br />
 expect {[Uu]sername*} {<br />
  send &#8220;$username\r&#8221;<br />
 }<br />
 <br />
 expect {[Pp]assword:} {<br />
 send &#8220;$password\r&#8221;<br />
 }<br />
 </p>
<p>#Cisco specific block &#8211; to enter enable level, you may remove this block if not needed<br />
 expect {*#}  {<br />
 send &#8220;enable\r&#8221;  }<br />
 <br />
 expect {[Pp]assword:} {<br />
 send &#8220;$password\r&#8221;<br />
 }<br />
 #End of Cisco specific block</p>
<p> interact<br />
 </p>
<p>Now SSH login script<br />
&gt; cat essh<br />
#!/usr/local/bin/expect   Change to the location of your Expect package<br />
 <br />
proc Usage {} {<br />
  puts &#8220;\n essh  &lt;equipment to enter&gt; \n&#8221;<br />
  return<br />
            }<br />
 </p>
<p>set  argnumber  [llength $argv]<br />
 <br />
if {$argnumber==0} {<br />
      puts &#8220;You need to specify at least one piece of equipment to log into\n&#8221;<br />
      Usage<br />
      exit<br />
 <br />
   }  elseif {$argnumber&gt;1}  {<br />
       puts &#8220;You specified too many arguments, only one please\n&#8221;<br />
 <br />
      Usage<br />
       exit<br />
                  }<br />
 <br />
set hostName [lindex $argv 0]<br />
 <br />
 puts &#8220;Entering $hostName&#8221;<br />
 set username &#8220;myusername&#8221;<br />
 set HANDL [open "sword"]<br />
 set password [gets $HANDL]<br />
 spawn ssh $hostName<br />
 <br />
 expect {[Pp]assword:} {<br />
 send &#8220;$password\r&#8221;<br />
 }</p>
<p>#Again goes Cisco &#8211; specific block , remove if not needed<br />
 expect {*#}  {<br />
 send &#8220;enable\r&#8221;  }<br />
 <br />
 expect {[Pp]assword:} {<br />
 send &#8220;$password\r&#8221;<br />
 }<br />
 #End of Cisco &#8211; specific block</p>
<p> interact</p>
]]></content:encoded>
			<wfw:commentRss>http://yurisk.info/2008/09/21/autologin-expect-scripts-for-telnetssh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
