<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>blog@insidesystems.net: Category Networking</title>
    <link>http://blog.insidesystems.net/articles/category/networking</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Kerberos and FreeBSD</title>
      <description>&lt;p&gt;I hit a bit of a stumper today.  I was configuring a new Kerberos realm on a bunch of servers (Solaris, OpenSolaris, FreeBSD and OpenBSD), and everything seemed to work perfectly.  I could use &lt;span class="caps"&gt;GSSAPI&lt;/span&gt; to auth into any of the machines from my &lt;span class="caps"&gt;OS X&lt;/span&gt; laptop.&lt;/p&gt;


	&lt;p&gt;Then I discovered something odd, I couldn&amp;#8217;t log into any of the OpenBSD machines from the FreeBSD machines.  After checking all the normal potential problems (DNS, rDNS, &lt;span class="caps"&gt;NTP&lt;/span&gt;, krb5.conf and keytabs), it was still broken.  So I ran sshd with it in debug mode, attached to the console, on a high port, and in the midst of the spew was the following message:&lt;/p&gt;


	&lt;p&gt;&lt;span class="caps"&gt;GSSAPI MIC&lt;/span&gt; check failed&lt;/p&gt;


	&lt;p&gt;After some research, it turns out that various versions of Heimdal do &lt;span class="caps"&gt;MIC&lt;/span&gt; checking in different and incompatible manners, and that FreeBSD 7.1 was still shipping with a quite old and incompatible default setting.&lt;/p&gt;


	&lt;p&gt;Fortunately the OpenBSD man pages gave me a hint, and the problem was  remedied by adding:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
[gssapi]
    correct_des3_mic = host/*@MYREALM
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;to krb5.conf on the FreeBSD machines, and now they all seem to be playing nicely once more.&lt;/p&gt;</description>
      <pubDate>Thu, 11 Dec 2008 19:17:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:1073deee-0f43-404f-9d76-50dd2fe1343b</guid>
      <author>Kevin Way</author>
      <link>http://blog.insidesystems.net/articles/2008/12/11/kerberos-and-freebsd</link>
      <category>FreeBSD</category>
      <category>Networking</category>
      <category>OpenBSD</category>
      <category>Security</category>
      <category>kerberos</category>
      <category>gssapi</category>
      <category>ssh</category>
      <category>freebsd</category>
      <category>openbsd</category>
      <category>heimdal</category>
    </item>
    <item>
      <title>Improving Network Reliability on FreeBSD</title>
      <description>&lt;p&gt;If you didn&amp;#8217;t notice it during the FreeBSD 7.0/6.3 release, FreeBSD got a great new tool from OpenBSD.  The &lt;a href="http://www.freebsd.org/doc/en/books/handbook/network-aggregation.html"&gt;lagg&lt;/a&gt; device.&lt;/p&gt;


	&lt;p&gt;This device allows you to setup links with failover, or to combine them using &lt;span class="caps"&gt;LACP&lt;/span&gt;, and the operation is dead simple.  Here&amp;#8217;s an example rc.conf, that just does a basic link failover:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
cloned_interfaces="lagg0" 
ifconfig_bge0="up" 
ifconfig_bge1="up" 
ifconfig_lagg0="laggproto failover laggport bge1 laggport bge0 192.168.1.5 netmask 255.255.255.0" 
&lt;/code&gt;
&lt;/pre&gt;

Or if you use 802.1q trunks
&lt;pre&gt;
&lt;code&gt;
cloned_interfaces="lagg0 vlan0" 
ifconfig_em0="up" 
ifconfig_em1="up" 
ifconfig_lagg0="laggproto failover laggport em0 laggport em1" 
ifconfig_vlan0="vlan 22 vlandev lagg0 192.168.1.5 netmask 255.255.255.0" 
&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;The only downside of this, at all, is you need to write a quick nagios plugin to check for dead links, but fortunately, that&amp;#8217;s easy enough to do as well.&lt;/p&gt;


	&lt;p&gt;Note: We don&amp;#8217;t currently use &lt;span class="caps"&gt;LACP&lt;/span&gt;, because we&amp;#8217;ve had some issues with it losing connectivity altogether, after alternating link failures.&lt;/p&gt;Example ifconfig output from a successful lagg setup:
&lt;pre&gt;
&lt;code&gt;
em0: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
    options=19b&amp;lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4&amp;gt;
    ether 00:15:17:73:61:f4
    media: Ethernet 100baseTX &amp;lt;full-duplex&amp;gt;
    status: active
    lagg: laggdev lagg0
em4: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
    options=19b&amp;lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4&amp;gt;
    ether 00:15:17:73:61:f4
    media: Ethernet 100baseTX &amp;lt;full-duplex&amp;gt;
    status: active
    lagg: laggdev lagg0
lagg0: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
    options=19b&amp;lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM,TSO4&amp;gt;
    ether 00:15:17:73:61:f4
    inet 192.168.1.52 netmask 0xffffff00 broadcast 192.168.1.255
    media: Ethernet autoselect
    status: active
    laggproto failover
    laggport: em4 flags=0&amp;lt;&amp;gt;
    laggport: em0 flags=5&amp;lt;MASTER,ACTIVE&amp;gt;

&lt;/code&gt;
&lt;/pre&gt;

	&lt;p&gt;Example ifconfig output from a successful vlan and lagg combination:&lt;/p&gt;


&lt;pre&gt;
&lt;code&gt;
bge0: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
    options=9b&amp;lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM&amp;gt;
    ether 00:11:0a:30:21:04
    media: Ethernet autoselect (1000baseTX &amp;lt;full-duplex&amp;gt;)
    status: active
    lagg: laggdev lagg0
bge1: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
    options=9b&amp;lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM&amp;gt;
    ether 00:11:0a:30:21:04
    media: Ethernet autoselect (1000baseTX &amp;lt;full-duplex&amp;gt;)
    status: active
    lagg: laggdev lagg0
lagg0: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
    options=9b&amp;lt;RXCSUM,TXCSUM,VLAN_MTU,VLAN_HWTAGGING,VLAN_HWCSUM&amp;gt;
    ether 00:11:0a:30:21:04
    media: Ethernet autoselect
    status: active
    laggproto failover
    laggport: bge0 flags=0&amp;lt;&amp;gt;
    laggport: bge1 flags=5&amp;lt;MASTER,ACTIVE&amp;gt;
vlan0: flags=8843&amp;lt;UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST&amp;gt; metric 0 mtu 1500
    options=3&amp;lt;RXCSUM,TXCSUM&amp;gt;
    ether 00:11:0a:30:21:04
    inet 192.168.1.145 netmask 0xffffff00 broadcast 192.168.1.255
    media: Ethernet autoselect
    status: active
    vlan: 22 parent interface: lagg0
&lt;/code&gt;
&lt;/pre&gt;</description>
      <pubDate>Fri, 27 Jun 2008 16:05:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:4b5f53ed-3dc4-454e-b9db-b8977ef9f80e</guid>
      <author>Kevin Way</author>
      <link>http://blog.insidesystems.net/articles/2008/06/27/improving-network-reliability-on-freebsd</link>
      <category>FreeBSD</category>
      <category>Networking</category>
      <category>freebsd</category>
      <category>lagg</category>
      <category>lacp</category>
      <category>link</category>
      <category>aggregation</category>
      <category>vlan</category>
      <category>network</category>
    </item>
    <item>
      <title>Shutting Apache Up in a FreeBSD Jail</title>
      <description>If you&amp;#8217;ve run Apache in a FreeBSD jail, you&amp;#8217;ve probably seen the following error messages in your error log:
&lt;pre&gt;
     (61)Connection refused: connect to listener on 0.0.0.0:80
     (61)Connection refused: connect to listener on 0.0.0.0:80
&lt;/pre&gt;
It turns out that if you specify the &lt;code&gt;Listen&lt;/code&gt; directive in one of the following ways:
&lt;pre&gt;
     Listen 80
     Listen *:80
     Listen 0.0.0.0:80
&lt;/pre&gt;
it complains about connecting to the listener as previously mentioned. To make these errors disappear from the logs, all you have to do is specify the  IP address of the jail like so:
&lt;pre&gt;
     Listen jail.ip.address.here:80
&lt;/pre&gt;
and it goes away. No more error messages filling the logs.</description>
      <pubDate>Mon, 12 Feb 2007 22:08:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:a9c5fb03-0fd8-4329-8652-259768c7afc5</guid>
      <author>Kelley Reynolds</author>
      <link>http://blog.insidesystems.net/articles/2007/02/12/shutting-apache-up-in-a-freebsd-jail</link>
      <category>FreeBSD</category>
      <category>Networking</category>
      <category>System Administration</category>
    </item>
    <item>
      <title>Stupid Bridge Tricks #1 - How to add more bandwidth</title>
      <description>&lt;p style="text-indent: 5em;"&gt;Ever been in a situation where you had one, maybe two T1 lines and it just wasn&amp;#8217;t quite enough bandwidth? Ever thought it would it be &lt;strong&gt;really&lt;/strong&gt; nice if you could just get a cheap &lt;span class="caps"&gt;DSL&lt;/span&gt; or cable account (or two) to offload some of the unexciting web and mail traffic and not have to go through the hassle of restructuring the network or even rebooting a running machine? Through the magic of &lt;a href="http://www.openbsd.org"&gt;OpenBSD&lt;/a&gt; and &lt;a href="http://www.benzedrine.cx/pf.html"&gt;PF&lt;/a&gt;, it&amp;#8217;s pretty easy.&lt;/p&gt;&lt;h2&gt;Tools&lt;/h2&gt;


	&lt;p&gt;For this exercise, we will be using &lt;a href="http://www.openbsd.org"&gt;OpenBSD 3.7&lt;/a&gt; and &lt;a href="http://www.benzedrine.cx/pf.html"&gt;PF&lt;/a&gt;. You will also need a machine with a minimum of 3 NICs (2 for the slicing and 1 per extra connection you are adding)&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Why OpenBSD 3.7? That&amp;#8217;s really old man.&lt;/strong&gt; Yah, I know, but that is what is already installed and in production for this example. As far as I know, everything is the same with 3.9 (the current release).&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;What is it with you and PF?&lt;/strong&gt; PF is ridiculously powerful and flexible .. you have to use it for a while to really understand how magical it is compared to most other tools, but that&amp;#8217;s part of what these articles are for.&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;What about (ipf|iptables|whatever)?&lt;/strong&gt; This might be possible in those systems, I don&amp;#8217;t know. I&amp;#8217;ve never had to explore them as PF accomplished everything I&amp;#8217;ve needed it to thus far.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h2&gt;Proof of Concept&lt;/h2&gt;


	&lt;h4&gt;Phase One &amp;#8211; Slicing into the existing network&lt;/h4&gt;


	&lt;p&gt;The goal here is to make a transparent bridge that slides in between your existing network and the internet. In our case, this was between a ProCurve 4000m and a Cisco 2600 series. For physical cabling you will want to be careful .. you may need a crossover cable depending on the NICs you&amp;#8217;ve chosen and your particular equipment. Bridge setup is pretty straightforward and right out of the &lt;a href="http://www.openbsd.org/faq/faq6.html#Bridge"&gt;OpenBSD &lt;span class="caps"&gt;FAQ&lt;/span&gt;&lt;/a&gt; but I&amp;#8217;ll reproduce the steps here just for fun.&lt;/p&gt;


	&lt;p&gt;1. The interface going to the Cisco is fxp0 and we want it to have an IP so we can get to it remotely so we execute:&lt;/p&gt;


&lt;pre&gt;echo "inet 216.123.123.123 255.255.252.0 NONE" &amp;gt; /etc/hostname.fxp0&lt;/pre&gt;

	&lt;p&gt;(You will obviously want to change this to a valid IP/netmask on your local network.)&lt;/p&gt;


	&lt;p&gt;2. The interface going to the ProCurve is em1 and it needs to be up to be part of the bridge so we execute:&lt;/p&gt;


&lt;pre&gt;echo "up media auto" &amp;gt; /etc/hostname.em1&lt;/pre&gt;

	&lt;p&gt;(Again, you should pick whichever interface is going to the other device, not the one in the example)&lt;/p&gt;


	&lt;p&gt;3. Set up the bridge device for the two by editing the file &lt;code&gt;/etc/bridgename.bridge0&lt;/code&gt; with the contents:&lt;/p&gt;


&lt;pre&gt;add em1
add fxp0
up&lt;/pre&gt;

	&lt;p&gt;(The order of the first two don&amp;#8217;t matter, but up must be last as the startup scripts execute each line in turn.)&lt;/p&gt;


	&lt;p&gt;4. Enable forwarding of packets by uncommenting the following line in &lt;code&gt;/etc/sysctl.conf&lt;/code&gt;:&lt;/p&gt;


&lt;pre&gt;net.inet.ip.forwarding=1&lt;/pre&gt;

	&lt;p&gt;(You should look through some of these just for fun, you can encrypt swap pages and everything)&lt;/p&gt;


	&lt;p&gt;5. At this point, you should reboot the machine (to make sure that the settings come up properly on reboot) and test it between a workstation and the switch to make sure that the bridging is in fact working as advertised (outgoing interface now goes to the switch and the bridged interface goes to the workstation). Once you are certain that it is functioning properly, the additional internet connection can be added.&lt;/p&gt;


	&lt;h4&gt;Phase Two &amp;#8211; Adding another internet connection&lt;/h4&gt;


	&lt;p&gt;To add another connection, we basically repeat some of the steps above but for the new interface (in our case a &lt;span class="caps"&gt;DSL&lt;/span&gt; modem and em0)&lt;/p&gt;


	&lt;p&gt;1. Set the interface in /etc/rc.conf&lt;/p&gt;


&lt;pre&gt;echo "inet 192.168.1.64 255.255.0.0 NONE" &amp;gt; /etc/hostname.em0&lt;/pre&gt;

	&lt;p&gt;(You will need to alter this line depending on what type of configuration comes from your extra connection. In our case it&amp;#8217;s a broken Speedstream modem that can&amp;#8217;t really issue &lt;span class="caps"&gt;DHCP&lt;/span&gt; so we pick would would&amp;#8217;ve been discovered as a &lt;span class="caps"&gt;DHCP&lt;/span&gt; address as a static address.)&lt;/p&gt;


	&lt;p&gt;2. Reboot and try to ping the new device by IP. If you can&amp;#8217;t, don&amp;#8217;t bother moving on until you can otherwise you will simply destroy your network.&lt;/p&gt;


	&lt;h4&gt;Phase Three &amp;#8211; Configuring PF to &lt;span class="caps"&gt;NAT&lt;/span&gt; sometimes&lt;/h4&gt;


	&lt;p&gt;This step can be a little tricky because not all protocols can really be sliced out this way. &lt;span class="caps"&gt;FTP&lt;/span&gt; is a great example of this type of annoyance, but many other common ones such as &lt;span class="caps"&gt;SSH&lt;/span&gt;, HTTP, &lt;span class="caps"&gt;SMTP&lt;/span&gt;, IMAP have no issues at all. For the sake of clarity, I will just copy an entire example &lt;code&gt;pf.conf&lt;/code&gt; and explain it after the fact.&lt;/p&gt;


&lt;pre&gt;
#### Configuration for basic functions
# Specify our interfaces
ext_if1="fxp0" 
ext_if2="em0" 
ext_gw2="192.168.0.1" 
int_if="em1" 

# This contains localnet traffic that does not go out a T (shouldn't be state tracked (for this application anyway))
table &amp;lt;localnet&amp;gt; persist { 216.28.123.0/24 216.28.124.0/24 216.28.125.0/24 216.29.126.0/24 }

# Make this a # sign to disable the dsl routing
dsl_enable = "#" 

# A list of all ports to send through the dsl connection
dslports="{ 22 80 110 143 443 }" 
# Table of ips to use the dsl modem for outgoing traffic
dslnet = "{ 216.28.123.34/32 216.28.123.175/32 216.28.123.176/32 216.28.123.99/32 216.28.123.10/32 }" 

# Network address translations
$dsl_enable nat on $ext_if2 from $dslnet to any port $dslports -&amp;gt; ($ext_if2)

# Pass quick all of our local traffic without further ado
pass quick on { $ext_if1 $int_if } from &amp;lt;localnet&amp;gt; to &amp;lt;localnet&amp;gt;

# Run our load-balancer here
# pass our dsl ports first
$dsl_enable pass in quick on $int_if route-to ($ext_if2 $ext_gw2) proto { tcp udp } from $dslnet to !&amp;lt;localnet&amp;gt;  port $dslports modulate state label "DSL-1 $srcaddr:$dstport" 
$dsl_enable pass out quick on $ext_if1 route-to ($ext_if2 $ext_gw2) proto { tcp udp } from $ext_if2 to any port $dslports modulate state label "DSL-2 $srcaddr:$dstport" 

# Modulate state on all connections
pass on $ext_if1 modulate state
&lt;/pre&gt;

	&lt;p&gt;You can of course add filtering and optimizing rules here but for the purposes of this article, we&amp;#8217;ll stick to the salient points.&lt;/p&gt;


	&lt;p&gt;1. The definitions at the top define which interfaces and IPs go where. 192.168.0.1 is the IP address of our &lt;span class="caps"&gt;DSL&lt;/span&gt; gateway, you should use whatever the equivalent is.&lt;/p&gt;


	&lt;p&gt;2. The &lt;code&gt;&amp;lt;localnet&amp;gt;&lt;/code&gt; table helps to make sure that local traffic that normally bounces off of the router doesn&amp;#8217;t go out the &lt;span class="caps"&gt;DSL&lt;/span&gt; modem (and is right handy for queueing).&lt;/p&gt;


	&lt;p&gt;3. The $dsl_enable macro just lets is quickly and efficiently disable the &lt;span class="caps"&gt;DSL&lt;/span&gt; routing if there is a suspected problem.&lt;/p&gt;


	&lt;p&gt;4. The $dsl_ports macro lets us specify explicitly which outgoing connections should go through the &lt;span class="caps"&gt;DSL&lt;/span&gt; modem by destination port. Specifying which ones &lt;strong&gt;not&lt;/strong&gt; to go through will only frustrate you (yes, that is the voice of experience).&lt;/p&gt;


	&lt;p&gt;5. The $dsl_net macro lets us specify which internal machines are supposed to go through the &lt;span class="caps"&gt;DSL&lt;/span&gt;. Might be one of them, might be all of them, it&amp;#8217;s up to you.&lt;/p&gt;


	&lt;p&gt;6. The &lt;span class="caps"&gt;NAT&lt;/span&gt; line mangles the packets so they get routed/returned properly.&lt;/p&gt;


	&lt;p&gt;7. Pass all of the local traffic without mangling of any sort.&lt;/p&gt;


	&lt;p&gt;8. Route the &lt;span class="caps"&gt;DSL&lt;/span&gt; traffic appropriately. These are somewhat dense rules but I&amp;#8217;ll attempt to convert them to english:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Pass in any traffic coming into the internally bridged interface and route it to the &lt;span class="caps"&gt;DSL&lt;/span&gt; modem (udp and tcp only) from machines that are in the DSLnet that are making non-local connections on the dsl_ports.&lt;/li&gt;
		&lt;li&gt;Pass out traffic on the original external interface and route it to the &lt;span class="caps"&gt;DSL&lt;/span&gt; modem if it&amp;#8217;s from a machine in the DSLnet to a non-local dsl_port.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;9. Modulate state just for fun. Never hurts to have a clean &lt;span class="caps"&gt;TCP&lt;/span&gt; stream.&lt;/p&gt;


	&lt;p&gt;As an addendum, you&amp;#8217;ll notice that there are labels on the two lines that pass &lt;span class="caps"&gt;DSL&lt;/span&gt; traffic .. this is so that you can run &lt;code&gt;pfctl -vvsl&lt;/code&gt; and see whether or not and by how much it&amp;#8217;s working. For more information on what all those numbers mean, read the &lt;a href="http://www.openbsd.org/cgi-bin/man.cgi?query=pf.conf&amp;#38;apropos=0&amp;#38;sektion=0&amp;#38;manpath=OpenBSD+3.9&amp;#38;arch=i386&amp;#38;format=html"&gt;pf.conf&lt;/a&gt; man page.&lt;/p&gt;


	&lt;p&gt;Now it is time to enable pf:&lt;/p&gt;


&lt;pre&gt;
# pfctl -e
pf enabled
#
&lt;/pre&gt;

	&lt;p&gt;For it to be enabled on startup, edit the appropriate line in &lt;code&gt;/etc/rc.conf&lt;/code&gt;.&lt;/p&gt;


&lt;pre&gt;
pf=YES                  # Packet filter / NAT
&lt;/pre&gt;

	&lt;p&gt;Load in the ruleset:&lt;/p&gt;


&lt;pre&gt;
# pfctl -f /etc/pf.conf
#
&lt;/pre&gt;

	&lt;p&gt;At this point, if there are any errors in &lt;code&gt;pf.conf&lt;/code&gt;, the &lt;code&gt;pfctl&lt;/code&gt; should let you know where.&lt;/p&gt;


	&lt;p&gt;As an example, a line from &lt;code&gt;pfctl -vvsl&lt;/code&gt; on my setup now looks like:&lt;/p&gt;


&lt;pre&gt;DSL-1 216.28.123.99:80 17 702 377264&lt;/pre&gt;

	&lt;p&gt;Which means that the ip &lt;code&gt;216.28.123.99&lt;/code&gt; has sent transferred 702 packets for a total of 377264 bytes. Now, that doesn&amp;#8217;t mean much now, but after that snapshot I installed &lt;a href="http://www.freebsd.org"&gt;FreeBSD&lt;/a&gt; and used portsnap to download 41M at an average of 467K/s. For those of you who&amp;#8217;ve saturated a T1 line, you know that&amp;#8217;s about 2.5 times as fast as a T1. Yep, I&amp;#8217;d say it&amp;#8217;s working ;)&lt;/p&gt;


	&lt;h2&gt;Conclusion&lt;/h2&gt;


	&lt;p&gt;Having run this in a production environment for a small shop for a year and a half, it&amp;#8217;s certainly stable and reliable even though it likely breaks more RFCs than you can shake a stick at.  That said, let&amp;#8217;s sum up what this gives us:&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;Lots of extra bandwidth with &lt;strong&gt;zero&lt;/strong&gt; configuration other than swapping some cables and tweaking the bridge machine itself. This makes it &lt;strong&gt;really&lt;/strong&gt; nice to put into a legacy network where making alterations to the router or replacing it entirely are out of the question.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;Though fodder for another article, you can have more than one external connection and you can round-robin between them. You want 6Mbps*2? Get two &lt;span class="caps"&gt;DSL&lt;/span&gt; accounts. Or two cable modems. Or ten. You are really only limited here by the number of NICs you can force into the machine.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;If you are running servers on your network, this will not disrupt any of those connections since they are coming from external sources.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;ul&gt;
	&lt;li&gt;Having an OpenBSD bridge in the network is a good thing anyway because you can queue traffic, &lt;a href="http://blog.insidesystems.net/articles/2006/06/06/OS-Fingerprinting-Email"&gt;passively OS fingerprint&lt;/a&gt;, log/graph, run intrusion detection, whatever you want to do (and yes, you can run two failover bridges if you are paranoid that this crazy blackbox might eat your whole network if it goes down, but that&amp;#8217;s another article)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Also, if this saves you lots of money and time and effort, consider &lt;a href="http://www.openbsd.org/donations.html"&gt;donating some of it back to OpenBSD&lt;/a&gt;, they&amp;#8217;ve earned it.&lt;/p&gt;</description>
      <pubDate>Fri, 16 Jun 2006 15:15:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:fac2e6c5086b4db0dddd1a0099b3bda1</guid>
      <author>Kelley Reynolds</author>
      <link>http://blog.insidesystems.net/articles/2006/06/16/Stupid-Bridge-Tricks-1-How-to-add-more-bandwidth</link>
      <category>Networking</category>
      <category>OpenBSD</category>
      <category>System Administration</category>
      <trackback:ping>http://blog.insidesystems.net/articles/trackback/3</trackback:ping>
    </item>
    <item>
      <title>Passively OS Fingerprinting Email with PF</title>
      <description>&lt;p style="text-indent:5em;"&gt;Ever want more fodder for those &lt;a href="http://www.spamassassin.org"&gt;Spam Assassin&lt;/a&gt; rules or &lt;a href="http://www.nuclearelephant.com/projects/dspam"&gt;Bayes&lt;/a&gt; &lt;a href="http://spambayes.sourceforge.net/"&gt;statistics&lt;/a&gt;? The normal assumption is that our spam and viruses come from networks of infected zombie Windows machines, but is that really true? With passive OS fingerprinting, you can answer this question instantly and with minimal resource usage.&lt;/p&gt;&lt;h2&gt;Tools&lt;/h2&gt;


	&lt;p&gt;For this exercise, we will be using &lt;a href="http://www.freebsd.org"&gt;FreeBSD 5.4&lt;/a&gt;, &lt;a href="http://www.benzedrine.cx/pf.html"&gt;PF&lt;/a&gt;, &lt;a href="http://www.exim.org"&gt;Exim&lt;/a&gt;, and some basic shell scripting.&lt;/p&gt;


	&lt;ul&gt;
	&lt;li&gt;&lt;strong&gt;Why FreeBSD and not &lt;a href="http://www.openbsd.org"&gt;OpenBSD&lt;/a&gt;?&lt;/strong&gt; Jails, but that&amp;#8217;s another article entirely. &lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;What&amp;#8217;s so special about PF?&lt;/strong&gt; PF just happens to have integrated passive OS fingerprinting so a simple &lt;code&gt;keep state&lt;/code&gt; rule for each fingerprint allows us to use &lt;code&gt;pfctl&lt;/code&gt; to see which source IP matches which fingerprint.&lt;/li&gt;
		&lt;li&gt;&lt;strong&gt;What about (Postfix|Sendmail|Qmail|Exchange)?&lt;/strong&gt; This will work with those too, but we happen to like Exim. Yes, you can do it with Exchange too, but again that&amp;#8217;s another article.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h2&gt;Proof of Concept&lt;/h2&gt;


	&lt;h4&gt;Phase One &amp;#8211; Get &lt;span class="caps"&gt;PF &lt;/span&gt;Fingerprinting&lt;/h4&gt;


	&lt;p&gt;In order to use PF on FreeBSD 5.4, the pf kernel module must first be loaded and pf enabled:&lt;/p&gt;


&lt;pre&gt;
  server# kldload pf
  server# pfctl -e
  No ALTQ support in kernel
  ALTQ related functions disabled
  pf enabled
  server#
&lt;/pre&gt;

You can disregard anything about &lt;span class="caps"&gt;ALTQ&lt;/span&gt;, that&amp;#8217;s another article. Now that pf is loaded and enabled, we need some actual rules in order to do the matching. First let&amp;#8217;s create a minimal &lt;code&gt;/etc/pf.conf&lt;/code&gt;:
&lt;pre&gt;
ext_if="bge0" 
set fingerprints "/etc/pf.os" 
&lt;/pre&gt;

	&lt;p&gt;(&lt;em&gt;Note: You&amp;#8217;ll want to change &lt;code&gt;bge0&lt;/code&gt; to your actual ethernet interface found by running  &lt;code&gt;ifconfig -a&lt;/code&gt;.&lt;/em&gt;)&lt;/p&gt;


With a minimal pf.conf created, the rules used for fingerprinting are next. To accomplish this, we&amp;#8217;ll run a command that gets the list of supported fingerprints, strips off the first two lines, removes extraneous spaces, reverses the input, and adds it all to pf.conf (it&amp;#8217;s all one command so you can cut and paste the four lines at once into a shell and it should work):
&lt;pre&gt;&lt;code&gt;
/sbin/pfctl -qso | sed 's,[[:space:]], ,g' | \
egrep -v '^(-----|Class)' | \
sed 's,\(.*\)[[:space:]],pass in quick proto tcp from any os "\1" to \$ext_if keep state label "\1",' | \
tail -r &amp;gt;&amp;gt; /etc/pf.conf
&lt;/code&gt;&lt;/pre&gt;

Now that &lt;code&gt;pf.conf&lt;/code&gt; has rules, they can be loaded with &lt;code&gt;pfctl -f /etc/pf.conf&lt;/code&gt; and we can start to see some of the information we need (to reload pf.conf on reboot, consult the &lt;a href="http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/"&gt;FreeBSD Handbook&lt;/a&gt;):
	&lt;ul&gt;
	&lt;li&gt;&lt;code&gt;pfctl -vvsl&lt;/code&gt; shows the traffic and packet count per rule &lt;/li&gt;
		&lt;li&gt;&lt;code&gt;pfctl -vvsr&lt;/code&gt; shows lists the actual rule and current state matches (contains the rule number which is part of the formula)&lt;/li&gt;
		&lt;li&gt;&lt;code&gt;pfctl -vvss&lt;/code&gt; shows the current states tracked (the other part of the formula)&lt;/li&gt;
	&lt;/ul&gt;


	&lt;h4&gt;Phase Two &amp;#8211; Fingerprint Fetching Script&lt;/h4&gt;


	&lt;p&gt;Information is nice but we still need access to it from inside the &lt;span class="caps"&gt;MTA&lt;/span&gt;. For that we will create a shell script (called get_os.sh in my case, and don&amp;#8217;t forget &lt;code&gt;chmod +x&lt;/code&gt;) that returns the OS or &amp;#8216;Unknown&amp;#8217;:&lt;/p&gt;


&lt;pre&gt;
#!/bin/sh
tempvar=`pfctl -qvss | grep -A 2 $1 | egrep -m 1 -o 'rule[[:space:]][[:digit:]]*' | sed 's,rule ,,'`
if [ -z $tempvar ]; then
        echo "Unknown";
        exit;
else
        pfctl -qvvsr | egrep -m 1 "^@$tempvar" | egrep -m 1 -o '"[^"]*"' | uniq | sed 's,",,g'
fi
&lt;/pre&gt;

	&lt;p&gt;Go on, try it out. &lt;span class="caps"&gt;SSH&lt;/span&gt; back into the server from somewhere (to reset the state in PF) and try it with your source &lt;span class="caps"&gt;IP &lt;/span&gt;(replacing the x&amp;#8217;s with your IP of course):&lt;/p&gt;


&lt;pre&gt;
/usr/local/etc/exim/get_os.sh xxx.xxx.xxx.xxx
&lt;/pre&gt;

	&lt;p&gt;Last thing to note, the permissions on &lt;code&gt;/dev/pf&lt;/code&gt; will need to be changed from 600 to 644 because this script will run as mailnull:mail which has permission to do nearly nothing:&lt;/p&gt;


&lt;pre&gt;
chmod 644 /dev/pf
&lt;/pre&gt;

	&lt;p&gt;(&lt;em&gt;Note: Yes, this is an enormous security problem, but we&amp;#8217;ll address this later. Remember, it&amp;#8217;s a proof of concept not a space shuttle.&lt;/em&gt;)&lt;/p&gt;


	&lt;h4&gt;Phase Three &amp;#8211; Putting it in Exim&lt;/h4&gt;


	&lt;p&gt;There are lots of different ways to put this in exim but to keep things simple, we&amp;#8217;ll put this in the acl_smtp_data &lt;span class="caps"&gt;ACL&lt;/span&gt; in order to just add a header for later:&lt;/p&gt;


&lt;pre&gt;
warn message = X-OS-Fingerprint: ${run {/usr/local/etc/exim/get_os.sh $sender_host_address}{$value}{Unknown}} ($sender_host_address)
&lt;/pre&gt;

	&lt;p&gt;(&lt;em&gt;Note: Make sure that your get_os.sh script is in a place where the exim server can see it and has permission to execute it. This usually means in &lt;code&gt;/usr/local/etc/exim&lt;/code&gt; and &lt;code&gt;chown mailnull:mail&lt;/code&gt;&lt;/em&gt;)&lt;/p&gt;


	&lt;p&gt;All that&amp;#8217;s left is a reload of exim with the new &lt;span class="caps"&gt;ACL&lt;/span&gt; line:&lt;/p&gt;


&lt;pre&gt;
kill -HUP `cat /var/run/exim.pid`
&lt;/pre&gt;

	&lt;p&gt;Each message that goes through should now have the header specifying the OS that was scanned with PF.&lt;/p&gt;


	&lt;h2&gt;Results&lt;/h2&gt;


	&lt;p&gt;To determine some results, we tracked the accepted/rejected status of each e-mail in addition to it&amp;#8217;s fingerprint for about one week. Combining all OS variants into single groups, the results were somewhat interesting:&lt;/p&gt;


	&lt;table style="border:1px solid black;"&gt;
		&lt;tr&gt;
			&lt;th&gt;Operating System&lt;/th&gt;
			&lt;th&gt;Accepted&lt;/th&gt;
			&lt;th&gt;Rejected&lt;/th&gt;
			&lt;th&gt;Ratio&lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Unknown   &lt;/td&gt;
			&lt;td&gt; 83052 &lt;/td&gt;
			&lt;td&gt; 300356 &lt;/td&gt;
			&lt;td&gt; 78.34%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;span class="caps"&gt;AIX       &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;  2716 &lt;/td&gt;
			&lt;td&gt; 100601 &lt;/td&gt;
			&lt;td&gt; 97.37%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; OpenBSD   &lt;/td&gt;
			&lt;td&gt;  4111 &lt;/td&gt;
			&lt;td&gt;  22719 &lt;/td&gt;
			&lt;td&gt; 84.68%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Windows   &lt;/td&gt;
			&lt;td&gt;  2827 &lt;/td&gt;
			&lt;td&gt;   2823 &lt;/td&gt;
			&lt;td&gt; 49.96%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Linux     &lt;/td&gt;
			&lt;td&gt;  2946 &lt;/td&gt;
			&lt;td&gt;    706 &lt;/td&gt;
			&lt;td&gt; 19.33%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; FreeBSD   &lt;/td&gt;
			&lt;td&gt;   801 &lt;/td&gt;
			&lt;td&gt;   2056 &lt;/td&gt;
			&lt;td&gt; 71.96%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;span class="caps"&gt;AOL       &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;     4 &lt;/td&gt;
			&lt;td&gt;    772 &lt;/td&gt;
			&lt;td&gt; 99.48%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; NetApp    &lt;/td&gt;
			&lt;td&gt;   622 &lt;/td&gt;
			&lt;td&gt;    109 &lt;/td&gt;
			&lt;td&gt; 14.91%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; PocketPC  &lt;/td&gt;
			&lt;td&gt;    84 &lt;/td&gt;
			&lt;td&gt;    565 &lt;/td&gt;
			&lt;td&gt; 87.06%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; MacOS     &lt;/td&gt;
			&lt;td&gt;    80 &lt;/td&gt;
			&lt;td&gt;    135 &lt;/td&gt;
			&lt;td&gt; 62.79%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;span class="caps"&gt;ULTRIX    &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;    89 &lt;/td&gt;
			&lt;td&gt;     28 &lt;/td&gt;
			&lt;td&gt; 23.93%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; OpenVMS   &lt;/td&gt;
			&lt;td&gt;     3 &lt;/td&gt;
			&lt;td&gt;     91 &lt;/td&gt;
			&lt;td&gt; 96.81%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;span class="caps"&gt;AXIS      &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;     0 &lt;/td&gt;
			&lt;td&gt;     85 &lt;/td&gt;
			&lt;td&gt; 100.00%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; OS/400    &lt;/td&gt;
			&lt;td&gt;     1 &lt;/td&gt;
			&lt;td&gt;     43 &lt;/td&gt;
			&lt;td&gt; 97.73%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Alteon    &lt;/td&gt;
			&lt;td&gt;     0 &lt;/td&gt;
			&lt;td&gt;     37 &lt;/td&gt;
			&lt;td&gt; 100.00%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Tru64     &lt;/td&gt;
			&lt;td&gt;     2 &lt;/td&gt;
			&lt;td&gt;     27 &lt;/td&gt;
			&lt;td&gt; 93.10%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; NewtonOS  &lt;/td&gt;
			&lt;td&gt;    19 &lt;/td&gt;
			&lt;td&gt;      2 &lt;/td&gt;
			&lt;td&gt; 9.52%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;span class="caps"&gt;IRIX      &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;     7 &lt;/td&gt;
			&lt;td&gt;     14 &lt;/td&gt;
			&lt;td&gt; 66.67%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Clavister &lt;/td&gt;
			&lt;td&gt;     7 &lt;/td&gt;
			&lt;td&gt;      1 &lt;/td&gt;
			&lt;td&gt; 12.50%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;span class="caps"&gt;SCO       &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;     0 &lt;/td&gt;
			&lt;td&gt;      8 &lt;/td&gt;
			&lt;td&gt; 100.00%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; BeOS      &lt;/td&gt;
			&lt;td&gt;     0 &lt;/td&gt;
			&lt;td&gt;      6 &lt;/td&gt;
			&lt;td&gt; 100.00%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Contiki   &lt;/td&gt;
			&lt;td&gt;     1 &lt;/td&gt;
			&lt;td&gt;      3 &lt;/td&gt;
			&lt;td&gt; 75.00%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; HP-UX     &lt;/td&gt;
			&lt;td&gt;     0 &lt;/td&gt;
			&lt;td&gt;      3 &lt;/td&gt;
			&lt;td&gt; 100.00%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; Dell      &lt;/td&gt;
			&lt;td&gt;     0 &lt;/td&gt;
			&lt;td&gt;      3 &lt;/td&gt;
			&lt;td&gt; 100.00%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt; &lt;span class="caps"&gt;BSD&lt;/span&gt;/OS    &lt;/td&gt;
			&lt;td&gt;     0 &lt;/td&gt;
			&lt;td&gt;      1 &lt;/td&gt;
			&lt;td&gt; 100.00%&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;&lt;br/&gt;
Why isn&amp;#8217;t Windows at the top? Why is &lt;span class="caps"&gt;AIX&lt;/span&gt; at the top? Contiki is an OS? Doesn&amp;#8217;t Alteon run switches? These are all fine questions. The answer to many of them is that passive OS fingerprinting is not as accurate as active OS fingerprinting&amp;#8212;the same passive fingerprint might actually hit several different kinds of Operating Systems. My PowerBook shows up as NetApp 5.2.1 even though it&amp;#8217;s much too shiny to be one of those, for instance.&lt;/p&gt;


	&lt;p&gt;So what&amp;#8217;s the point if it&amp;#8217;s not accurate? Well, here is the fun part about statistics. It doesn&amp;#8217;t actually matter how &lt;strong&gt;correct&lt;/strong&gt; the information is as long as it&amp;#8217;s &lt;strong&gt;consistent&lt;/strong&gt;. Simply based on the fingerprint,  correct or not, the data shows that we can be &gt;97% certain that an e-mail is spam if it comes from something passively identified as &lt;span class="caps"&gt;AIX &lt;/span&gt;(assuming the rest of the anti-spam system is accurate and the test sample is large enough.)&lt;/p&gt;


	&lt;p&gt;And since I know you are all wondering, let&amp;#8217;s run a breakdown for Windows:&lt;/p&gt;


	&lt;table style="border:1px solid black;"&gt;
		&lt;tr&gt;
			&lt;th&gt;Operating System&lt;/th&gt;
			&lt;th&gt;Accepted&lt;/th&gt;
			&lt;th&gt;Rejected&lt;/th&gt;
			&lt;th&gt;Ratio&lt;/th&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Windows 2000 &lt;span class="caps"&gt;RFC1323 &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;     1134 &lt;/td&gt;
			&lt;td&gt;      584 &lt;/td&gt;
			&lt;td&gt;    33.99%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Windows 98 noSACK    &lt;/td&gt;
			&lt;td&gt;     1684 &lt;/td&gt;
			&lt;td&gt;     2113 &lt;/td&gt;
			&lt;td&gt;    55.65%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Windows 2000 &lt;span class="caps"&gt;SP3     &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;       16 &lt;/td&gt;
			&lt;td&gt;       91 &lt;/td&gt;
			&lt;td&gt;    85.05%&lt;/td&gt;
		&lt;/tr&gt;
		&lt;tr&gt;
			&lt;td&gt;Windows &lt;span class="caps"&gt;NT           &lt;/span&gt;&lt;/td&gt;
			&lt;td&gt;        0 &lt;/td&gt;
			&lt;td&gt;       41 &lt;/td&gt;
			&lt;td&gt;   100.00%&lt;/td&gt;
		&lt;/tr&gt;
	&lt;/table&gt;




	&lt;p&gt;&lt;br/&gt;
It&amp;#8217;s much less exciting than it should be, I know.[1]&lt;/p&gt;


	&lt;h2&gt;Conclusion&lt;/h2&gt;


	&lt;p&gt;Is it massively useful? Is it utterly pointless? Who&amp;#8217;d have thought &lt;span class="caps"&gt;SCO&lt;/span&gt; only sent spam? Since when does &lt;span class="caps"&gt;AOL&lt;/span&gt; only send legitimate mail? Such questions are not for me, but for e-mail administrators and armchair statisticians. What I do know is that when it comes to classification of e-mail, the more tools the merrier.&lt;/p&gt;


	&lt;h4&gt;Scalability&lt;/h4&gt;


	&lt;p&gt;You might be saying to yourself, &amp;#8220;This gets executed for &lt;strong&gt;every single e-mail&lt;/strong&gt; that comes through? You don&amp;#8217;t seriously expect me to bog down my already overloaded server with more slow shell scripts do you? You said &lt;strong&gt;minimal resource usage&lt;/strong&gt; in the abstract!&amp;#8221; Well, that&amp;#8217;s true, I did. So just how long does it take to run that thing (on a xeon 2.8)?&lt;/p&gt;


&lt;pre&gt;
server# time ./fingerprinter.sh 69.2.123.45
OpenBSD 3.4 opera
0.014u 0.033s 0:00.05 80.0%     178+263k 0+0io 0pf+0w
server# 
&lt;/pre&gt;

	&lt;p&gt;That&amp;#8217;s plenty fast for most servers compared to the usual gauntlet of scanning and classification. There are even some optimizations left in the shell script for the shell-programming savvy. Of course, it&amp;#8217;s not great for enormously large volumes of email, but that&amp;#8217;s why it&amp;#8217;s only a &lt;em&gt;proof of concept&lt;/em&gt;. Run it as a daemon using &lt;span class="caps"&gt;UNIX&lt;/span&gt; sockets and cache the lookups for the interval that makes you and your load average the happiest &amp;#8211; the fingerprint is unlikely to change that often given an IP.&lt;/p&gt;


	&lt;h4&gt;Security&lt;/h4&gt;


	&lt;p&gt;We all know that changing the permissions on &lt;code&gt;/dev/pf&lt;/code&gt; is a cardinal sin, so let&amp;#8217;s address that issue. This particular problem can be tackled in a number of ways, the most common is to use &amp;#8220;sudo&amp;#8221;http://www.courtesan.com/sudo/ to allow the mail user to execute it. If you don&amp;#8217;t like sudo, you could use a client/server type setup as either a &lt;span class="caps"&gt;UNIX&lt;/span&gt; socket or &lt;span class="caps"&gt;TCP&lt;/span&gt; server. Details on both of these are fodder for another article though.&lt;/p&gt;


	&lt;h4&gt;Difficulty&lt;/h4&gt;


	&lt;p&gt;Setting up the proof of concept isn&amp;#8217;t immensely difficult, though some minimal script programming knowledge is required as well as some minimal Exim and FreeBSD knowledge. For that, I give it a &lt;strong&gt;5/10&lt;/strong&gt; on the difficulty scale. The difficulty level rises when addressing some of the security concerns or further optimizations.&lt;/p&gt;


	&lt;h4&gt;For Crazy People&lt;/h4&gt;


	&lt;p&gt;You could set up a dnsrbl that uses occasional active OS fingerprinting and timeouts to distribute aggregate IP/fingerprint mappings to a wider audience for analysis, or you could write a plugin for your favorite &lt;span class="caps"&gt;MTA&lt;/span&gt; that communicates directly with the kernel to retrieve pf information to absolutely minimize latency, or ignoring the fingerprinting aspect altogether you could use PF tables to dynamically limit the number of &lt;span class="caps"&gt;TCP&lt;/span&gt; states a spamming server is able to make or prevent it from connecting entirely thereby reducing the load on the &lt;span class="caps"&gt;MTA&lt;/span&gt;. And no, those are not recommendations (though that last one might make a decent article.)&lt;/p&gt;


	&lt;p&gt;Enjoy!&lt;/p&gt;


	&lt;p&gt;&lt;br/&gt;&lt;br/&gt;&lt;/p&gt;


	&lt;p id="fn1"&gt;&lt;sup&gt;1&lt;/sup&gt; Okay, so the numbers don&amp;#8217;t actually add up to the above report. This information was taken from a live &lt;span class="caps"&gt;SQL&lt;/span&gt; database at slightly different times.&lt;/p&gt;</description>
      <pubDate>Tue, 06 Jun 2006 20:32:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:bd9b08a5b1ad58446a666f2f600a79cd</guid>
      <author>Kelley Reynolds</author>
      <link>http://blog.insidesystems.net/articles/2006/06/06/OS-Fingerprinting-Email</link>
      <category>E-Mail</category>
      <category>FreeBSD</category>
      <category>Networking</category>
      <category>System Administration</category>
      <trackback:ping>http://blog.insidesystems.net/articles/trackback/1</trackback:ping>
    </item>
  </channel>
</rss>
