<?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>tech notes &#187; other</title>
	<atom:link href="http://bsd.dischaos.com/category/other/feed/" rel="self" type="application/rss+xml" />
	<link>http://bsd.dischaos.com</link>
	<description>just some random notes on BSDs, linux and web development</description>
	<lastBuildDate>Fri, 07 May 2010 10:18:00 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dovecot MySQL stored procedures patch</title>
		<link>http://bsd.dischaos.com/2010/05/07/dovecot-mysql-stored-procedures-patch/</link>
		<comments>http://bsd.dischaos.com/2010/05/07/dovecot-mysql-stored-procedures-patch/#comments</comments>
		<pubDate>Fri, 07 May 2010 10:18:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[mysql]]></category>
		<category><![CDATA[other]]></category>
		<category><![CDATA[dovecot]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=184</guid>
		<description><![CDATA[With this patch it&#8217;s possible to use stored procedure calls in dovecot&#8217;s configuration.
It implements the correct logic of handling mysql multiple statements as described in this MySQL document. I&#8217;m not sure it&#8217;s the correct place to implement it in (dovecot&#8217;s design is very clean and this is a rather quick hack), but it&#8217;s been working [...]]]></description>
			<content:encoded><![CDATA[<p>With <a href="http://bsd.dischaos.com/files/dovecot-driver-mysql.c.patch">this patch</a> it&#8217;s possible to use stored procedure calls in dovecot&#8217;s configuration.</p>
<p>It implements the correct logic of handling mysql multiple statements as described <a href="http://dev.mysql.com/doc/refman/5.0/en/c-api-multiple-queries.html">in this MySQL document</a>. I&#8217;m not sure it&#8217;s the correct place to implement it in (dovecot&#8217;s design is very clean and this is a rather quick hack), but it&#8217;s been working fine in production for a couple of months now.</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2010/05/07/dovecot-mysql-stored-procedures-patch/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Munin plugin for dovecot logins</title>
		<link>http://bsd.dischaos.com/2010/05/07/munin-plugin-for-dovecot-logins/</link>
		<comments>http://bsd.dischaos.com/2010/05/07/munin-plugin-for-dovecot-logins/#comments</comments>
		<pubDate>Fri, 07 May 2010 10:03:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[dovecot]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=181</guid>
		<description><![CDATA[Graphs dovecot imap and pop3 logins based on entries in the log file. May require changing the location of the log file (hardcoded to /var/log/dovecot-info.log)
]]></description>
			<content:encoded><![CDATA[<p><a href="http://bsd.dischaos.com/files/dovecot_logins">Graphs dovecot imap and pop3 logins</a> based on entries in the log file. May require changing the location of the log file (hardcoded to /var/log/dovecot-info.log)</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2010/05/07/munin-plugin-for-dovecot-logins/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Munin plugin for Ironport</title>
		<link>http://bsd.dischaos.com/2010/01/31/munin-plugin-for-ironport/</link>
		<comments>http://bsd.dischaos.com/2010/01/31/munin-plugin-for-ironport/#comments</comments>
		<pubDate>Sun, 31 Jan 2010 00:28:10 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[ironport]]></category>
		<category><![CDATA[munin]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=173</guid>
		<description><![CDATA[A simple munin plugin for graphing Ironport statistics.  All it graphs is CPU, memory, disk IO and queue utilisation. It requires SNMP to be enabled on the Ironport (and assumes you&#8217;re using SNMP v3) and snmpwalk to be installed on the munin server. The plugin supports the following environment variables:
* snmp_community &#8211; by default [...]]]></description>
			<content:encoded><![CDATA[<p>A simple <a href="http://bsd.dischaos.com/files/ipstatus_">munin plugin for graphing Ironport statistics</a>.  All it graphs is CPU, memory, disk IO and queue utilisation. It requires SNMP to be enabled on the Ironport (and assumes you&#8217;re using SNMP v3) and snmpwalk to be installed on the munin server. The plugin supports the following environment variables:</p>
<p>* snmp_community &#8211; by default set to v3get (default Ironport setting)<br />
* snmp_password &#8211; you have to set it yourself<br />
* snmp_oidbase &#8211; set to 1.3.6.1.4.1.15497.1.1.1 which points at Ironport&#8217;s MIBS. </p>
<p>Save it as ipstatus_ and link to it via ipstatus_yourironporthostname</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2010/01/31/munin-plugin-for-ironport/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fixing corrupted Ironport Queue</title>
		<link>http://bsd.dischaos.com/2010/01/05/fixing-corrupted-ironport-queue/</link>
		<comments>http://bsd.dischaos.com/2010/01/05/fixing-corrupted-ironport-queue/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 16:35:09 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bsd]]></category>
		<category><![CDATA[other]]></category>
		<category><![CDATA[postgresql]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=160</guid>
		<description><![CDATA[Looks like there&#8217;s a hidden command you can use to fix queue problems similar to these:

Critical: Queue: Your queue has been corrupted; UNABLE TO REPAIR: unable to
mount queue: &#8216;(\&#8217;qstore/gcq.py get_time_sorted_gens&#124;919\&#8217;, &#8220;&#8220;, &#8220;[Errno 2] No such file or directory:
        \&#8217;/var/db/godspeed/gen/gen063.chk\&#8217;&#8221;, \&#8217;[qstore/gcq.py mount&#124;1387]
        [...]]]></description>
			<content:encoded><![CDATA[<p>Looks like there&#8217;s a hidden command you can use to fix queue problems similar to these:</p>
<blockquote><p>
Critical: Queue: Your queue has been corrupted; UNABLE TO REPAIR: unable to<br />
mount queue: &#8216;(\&#8217;qstore/gcq.py get_time_sorted_gens|919\&#8217;, &#8220;<type<br />
        \'exceptions.OSError\'>&#8220;, &#8220;[Errno 2] No such file or directory:<br />
        \&#8217;/var/db/godspeed/gen/gen063.chk\&#8217;&#8221;, \&#8217;[qstore/gcq.py mount|1387]<br />
        [qstore/gcq.py load|996] [qstore/gcq.py get_time_sorted_gens|919]\&#8217;)&#8217;
</p></blockquote>
<blockquote><p>Critical: Error while sending alert: Unable to send System/Critical alert to xxx@xxx.com with subject &#8220;Critical <System> ironport: Queue: Your queue has been corrupted; UNABLE TO REPAIR: unab&#8230;&#8221;.
</p></blockquote>
<p>What it means is basically that the workqueue is corrupted and the ironport is unable to accept/deliver emails. Rebooting doesn&#8217;t help (doesn&#8217;t really change anything). There&#8217;s however a way of recovering your ironport from this problem. The hidden command is:</p>
<div class="codesnip-container" >resetqueue</div>
<p>It deletes the broken queue, creates a new one, removes all messages in the system quarantines and reboots the ironport. After this clean up operation your ironport should be as new.</p>
<p>What&#8217;s interesting is that by looking at various error messages thrown by Ironports from time to time (especially when something breaks more seriously &#8211; doesn&#8217;t happen too often Ironports are quite solid) you can actually see what&#8217;s running under the hood. Other than it running on something derived from FreeBSD (can&#8217;t be that far off it as they actually contribute some code back to the OS) it looks like it&#8217;s mostly run by python scripts. That&#8217;s interesting from the performance perspective as even the queue management seems to be written in python. Also the database used internally seems to be some version of PostgreSQL. A very nice choice of software&#8230;</p>
<p>Haven&#8217;t seen anything yet that would suggest what MTA (if it&#8217;s not something created by Ironport) is used there. Sure the fact it can write qmail compatible log files doesn&#8217;t mean anything <img src='http://bsd.dischaos.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> )</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2010/01/05/fixing-corrupted-ironport-queue/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graphing Alteon configuration</title>
		<link>http://bsd.dischaos.com/2009/08/31/graphing-alteon-configuration/</link>
		<comments>http://bsd.dischaos.com/2009/08/31/graphing-alteon-configuration/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 22:15:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=126</guid>
		<description><![CDATA[If you happen to use Nortel&#8217;s Alteon load balancers and need something to help you visualise your configuration here&#8217;s a script that produces graphs of connections and dependencies between groups, virtual IPs, real IPs and services in the Alteon configuration. It&#8217;s not very useful, the code is ugly, but the graphs are cool to look [...]]]></description>
			<content:encoded><![CDATA[<p>If you happen to use Nortel&#8217;s Alteon load balancers and need something to help you visualise your configuration <a href="http://bsd.dischaos.com/files/graph_gen.py">here&#8217;s a script</a> that produces graphs of connections and dependencies between groups, virtual IPs, real IPs and services in the Alteon configuration. It&#8217;s not very useful, the code is ugly, but the graphs are cool to look at <img src='http://bsd.dischaos.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  Especially for huge config files with lots of services and VIPs. The script uses two great python libraries &#8211; <a href="http://code.google.com/p/python-graph/">pygraph</a> and <a href="http://www.graphviz.org/Resources.php">graphviz</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2009/08/31/graphing-alteon-configuration/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting all prefixes advertised by an AS</title>
		<link>http://bsd.dischaos.com/2009/07/22/getting-all-prefixes-advertised-by-an-as/</link>
		<comments>http://bsd.dischaos.com/2009/07/22/getting-all-prefixes-advertised-by-an-as/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 21:33:07 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[as]]></category>
		<category><![CDATA[ripe]]></category>
		<category><![CDATA[whois]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=116</guid>
		<description><![CDATA[This simple script displays all prefixes advertised by an AS. It uses RIPE&#8217;s looking glass to get their local BGP table and parses it for the given AS number.
For example, to get all the other networks advertised by the AS dischaos.com is in, first I need to get Layered tech&#8217;s AS number:
whois -h www.ris.ripe.net 216.32.74.94

% [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bsd.dischaos.com/files/getprefixes.py">This simple script</a> displays all prefixes advertised by an AS. It uses RIPE&#8217;s looking glass to get their local BGP table and parses it for the given AS number.</p>
<p>For example, to get all the other networks advertised by the AS dischaos.com is in, first I need to get Layered tech&#8217;s AS number:</p>
<p>whois -h www.ris.ripe.net 216.32.74.94</p>
<blockquote><p>
% This is RIPE NCC&#8217;s Routing Information Service<br />
% whois gateway to collected BGP Routing Tables<br />
% IPv4 or IPv6 address to origin prefix match<br />
%<br />
% For more information visit http://www.ripe.net/ris/riswhois.html</p>
<p>route:        216.0.0.0/8<br />
origin:       AS3303<br />
descr:        SWISSCOM Swisscom (Switzerland) Ltd<br />
lastupd-frst: 2009-06-08 11:31Z  192.65.185.243@rrc04<br />
lastupd-last: 2009-06-08 11:31Z  192.65.185.243@rrc04<br />
seen-at:      rrc04<br />
num-rispeers: 1<br />
source:       RISWHOIS</p>
<p>route:        216.32.0.0/14<br />
origin:       AS3561<br />
descr:        SAVVIS &#8211; Savvis<br />
lastupd-frst: 2009-06-08 12:56Z  198.32.160.22@rrc11<br />
lastupd-last: 2009-07-22 12:06Z  195.69.145.49@rrc03<br />
seen-at:      rrc00,rrc01,rrc03,rrc04,rrc06,rrc07,rrc10,rrc11,rrc12,rrc13,rrc15,rrc16<br />
num-rispeers: 86<br />
source:       RISWHOIS</p>
<p>route:        216.32.64.0/19<br />
origin:       AS22576<br />
descr:        LAYER3-ASN &#8211; Layered Technologies, Inc.<br />
lastupd-frst: 2009-06-08 12:56Z  198.32.160.22@rrc11<br />
lastupd-last: 2009-07-22 14:55Z  193.232.244.147@rrc13<br />
seen-at:      rrc00,rrc01,rrc03,rrc04,rrc06,rrc07,rrc10,rrc11,rrc12,rrc13,rrc15,rrc16<br />
num-rispeers: 85<br />
source:       RISWHOIS</p>
</blockquote>
<p>Their AS number is 22576. Now lets see what other networks they advertise:</p>
<blockquote><p>
$ ./getprefixes.py 22576<br />
networks advertised by AS22576:<br />
64.92.160.0/20<br />
72.21.32.0/19<br />
72.36.128.0/17<br />
72.232.0.0/17<br />
72.232.128.0/19<br />
72.232.160.0/21<br />
72.232.168.0/22<br />
72.232.172.0/23<br />
72.232.174.0/23<br />
72.232.176.0/20<br />
72.232.192.0/18<br />
72.233.0.0/19<br />
72.233.28.0/22<br />
72.233.32.0/19<br />
72.233.64.0/18<br />
72.233.64.0/20<br />
72.233.80.0/23<br />
72.233.82.0/23<br />
72.233.84.0/23<br />
72.233.86.0/23<br />
72.233.88.0/21<br />
72.233.96.0/22<br />
72.233.100.0/22<br />
72.233.104.0/21<br />
72.233.112.0/21<br />
72.233.120.0/21<br />
72.233.127.0/24<br />
208.95.152.0/22<br />
209.67.208.0/20<br />
216.32.64.0/19
</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2009/07/22/getting-all-prefixes-advertised-by-an-as/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS traceroute</title>
		<link>http://bsd.dischaos.com/2009/07/22/109/</link>
		<comments>http://bsd.dischaos.com/2009/07/22/109/#comments</comments>
		<pubDate>Wed, 22 Jul 2009 21:12:24 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[other]]></category>
		<category><![CDATA[dns]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=109</guid>
		<description><![CDATA[This helps tracking down bottlenecks in DNS response from recursive queries.
First you need a DNS query payload (contents of a valid udp DNS A type query).
$hostname = &#8220;www.google.com&#8221;;
$header = pack(&#8220;n C2 n4&#8243;, 6666, 1, 0, 1, 0, 0, 0);
for (split(/\./,$hostname)) {
      $lformat .= &#8220;C a* &#8220;;
     [...]]]></description>
			<content:encoded><![CDATA[<p>This helps tracking down bottlenecks in DNS response from recursive queries.</p>
<p>First you need a DNS query payload (contents of a valid udp DNS A type query).</p>
<div class="codesnip-container" >$hostname = &#8220;www.google.com&#8221;;<br />
$header = pack(&#8220;n C2 n4&#8243;, 6666, 1, 0, 1, 0, 0, 0);</p>
<p>for (split(/\./,$hostname)) {<br />
      $lformat .= &#8220;C a* &#8220;;<br />
        $labels[$count++]=length;<br />
          $labels[$count++]=$_;<br />
}</p>
<p>$question = pack($lformat.&#8221;C n2&#8243;, @labels, 0, 1, 1);</p>
<p>open(PACKET, &#8216;>>dns_packet.txt&#8217;);<br />
print PACKET $header.$question;<br />
close(PACKET);</p></div>
<p>and now use this payload with hping2 to send udp packets:</p>
<div class="codesnip-container" >hping -2 -p 53 -E dns_packet.txt -d 39 -T xxx.yyy.zzz.xyz</div>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2009/07/22/109/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>logging cisco ios messages to external freebsd syslog</title>
		<link>http://bsd.dischaos.com/2009/02/25/logging-cisco-ios-messages-to-external-freebsd-syslog/</link>
		<comments>http://bsd.dischaos.com/2009/02/25/logging-cisco-ios-messages-to-external-freebsd-syslog/#comments</comments>
		<pubDate>Wed, 25 Feb 2009 17:06:32 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[bsd]]></category>
		<category><![CDATA[other]]></category>
		<category><![CDATA[cisco]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[ios]]></category>
		<category><![CDATA[syslog]]></category>

		<guid isPermaLink="false">http://bsd.dischaos.com/?p=86</guid>
		<description><![CDATA[our cisco router is at 10.0.0.1 and our freebsd box is at 10.0.0.20.
first cisco configuration:
!adds router&#8217;s local time to messages
service timestamps log datetime localtime
!this works on ios 12.4, other versions might use different syntax
logging trap debugging
!our syslog server
logging 10.0.0.20
logging on
now on the freebsd box. first enable syslog to accept messages from external sources, in /etc/rc.conf:
syslogd_flags=&#8221;-a [...]]]></description>
			<content:encoded><![CDATA[<p>our cisco router is at 10.0.0.1 and our freebsd box is at 10.0.0.20.</p>
<p>first cisco configuration:</p>
<blockquote><p>!adds router&#8217;s local time to messages</p>
<p>service timestamps log datetime localtime</p>
<p>!this works on ios 12.4, other versions might use different syntax</p>
<p>logging trap debugging</p>
<p>!our syslog server</p>
<p>logging 10.0.0.20</p>
<p>logging on</p></blockquote>
<p>now on the freebsd box. first enable syslog to accept messages from external sources, in <em>/etc/rc.conf</em>:</p>
<blockquote><p>syslogd_flags=&#8221;-a 10.0.0.1/32:*&#8221;</p></blockquote>
<p>the &#8220;:*&#8221; at the end is quite important as it tells syslogd to accept all messages sent from 10.0.0.1 from any source port. Without it it only accepts messages sent from port 514 (syslog)</p>
<p>next create your log file: <em>touch /var/log/router.log</em> and add something similar to the top of your <em>/etc/syslog.conf</em>:</p>
<blockquote><p>#enter your router&#8217;s host name here:</p>
<p>+10.0.0.1</p>
<p>#in fact local7.* should be enough here, as it&#8217;s cisco&#8217;s default facility</p>
<p>*.*  /var/log/router.log</p>
<p>#this resets the previous +host definition</p>
<p>+*</p></blockquote>
<p>now restart syslogd:</p>
<blockquote><p># /etc/rc.d/syslogd restart</p></blockquote>
<p>if you can&#8217;t see anything in /var/log/router.log (and it&#8217;s not because your router has nothing to report), start your syslog in the debugging mode:</p>
<blockquote><p># /etc/rc.d/syslogd stop</p>
<p># syslogd -d -v -a &#8216;10.0.0.1/32:*&#8217;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://bsd.dischaos.com/2009/02/25/logging-cisco-ios-messages-to-external-freebsd-syslog/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
