<?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>Arrdino</title>
	<atom:link href="http://oliver.net.au/?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://oliver.net.au</link>
	<description>Linux, life and programming</description>
	<lastBuildDate>Tue, 31 Jul 2012 05:25:11 +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>chkconfig-ify an exising init script.</title>
		<link>http://oliver.net.au/?p=256</link>
		<comments>http://oliver.net.au/?p=256#comments</comments>
		<pubDate>Tue, 31 Jul 2012 05:25:11 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[centos]]></category>
		<category><![CDATA[chkconfig]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[init]]></category>
		<category><![CDATA[init script]]></category>
		<category><![CDATA[init.d]]></category>
		<category><![CDATA[redhat]]></category>
		<category><![CDATA[runlevels]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=256</guid>
		<description><![CDATA[If you are using a 3rd party application / package installer to install a service onto a system that using chkconfig to manage your run-levels, or writing your own which are incompatible with chkconfig. That is to say when trying to add them you get the following error:

# chkconfig &#60;service&#62;  on
service &#60;service&#62; does not [...]]]></description>
			<content:encoded><![CDATA[<p>If you are using a 3rd party application / package installer to install a service onto a system that using chkconfig to manage your run-levels, or writing your own which are incompatible with chkconfig. That is to say when trying to add them you get the following error:<br />
<code><br />
# chkconfig &lt;service&gt;  on<br />
service &lt;service&gt; does not support chkconfig<br />
</code></p>
<p>Then it needs to be converted to support chkconfig. Don&#8217;t worry, it isn&#8217;t a rewrite, its just adding some meta-data to the init script.<br />
Just edit the config and add the following lines just below the sha-bang (#!/bin/bash or #!/bin/sh).<br />
<code><br />
# chkconfig: 2345 95 05<br />
# description:<br />
# processname:<br />
</code><br />
<strong>NOTE:</strong> The numbers on the chkconfig line mean:</p>
<blockquote><p>That on runlevels 2,3,4 and 5, this subsystem will be activated with priority 95 (one of the lasts), and deactivated with priority 05 (one of the firsts).</p></blockquote>
<p>The above quote comes from <a href="http://blog.tuxforge.com/service-does-not-support-chkconfig/">this post</a> where I found this solution, so I am passing it on.</p>
<p>For those playing along at home, chkconfig is the Redhat/Centos/Fedora way of managing your run-levels.</p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=256</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Centos 4 / RHEL 4 Bind 9.7.3-8 RPMs.</title>
		<link>http://oliver.net.au/?p=252</link>
		<comments>http://oliver.net.au/?p=252#comments</comments>
		<pubDate>Fri, 08 Jun 2012 14:19:05 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[Centos 4]]></category>
		<category><![CDATA[CVE-2012-1667]]></category>
		<category><![CDATA[DNS]]></category>
		<category><![CDATA[i386]]></category>
		<category><![CDATA[RHEL 4]]></category>
		<category><![CDATA[RPM]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=252</guid>
		<description><![CDATA[In case anyone out there in internet land happen to have a BIND DNS server still running RHEL 4 or Centos 4 and require a version that has been back ported from the Centos 6.2 source, one that has the CVE-2012-1667 fix. Then you can download the RPMs I build from here.
NOTE: I&#8217;ve only just [...]]]></description>
			<content:encoded><![CDATA[<p>In case anyone out there in internet land happen to have a BIND DNS server still running RHEL 4 or Centos 4 and require a version that has been back ported from the Centos 6.2 source, one that has the <a href="www.isc.org/software/bind/advisories/cve-2012-1667">CVE-2012-1667</a> fix. Then you can download the RPMs I build from <a title="Centos 4 BIND RPMs" href="https://www.box.com/s/fc078050d66c386995e4">here</a>.</p>
<p><strong>NOTE:</strong> I&#8217;ve only just built them, so haven&#8217;t tested them yet, but thought it&#8217;ll be better to share. Also they aren&#8217;t x86_64, if you need them, let me know and I&#8217;ll build some.</p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=252</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Simple Squid access log reporting.</title>
		<link>http://oliver.net.au/?p=236</link>
		<comments>http://oliver.net.au/?p=236#comments</comments>
		<pubDate>Thu, 09 Feb 2012 23:35:05 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[access.log]]></category>
		<category><![CDATA[awk]]></category>
		<category><![CDATA[cron]]></category>
		<category><![CDATA[gawk]]></category>
		<category><![CDATA[log anaylsis]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[sort]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[stats]]></category>
		<category><![CDATA[user report]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=236</guid>
		<description><![CDATA[Squid is one of the biggest and most used proxies on the interwebs. And generating reports from the access logs is already a done deal, there are many commercial and OSS apps that support the squid log format. But I found my self in a situation where I wanted stats but didn&#8217;t want to install [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.squid-cache.org/">Squid</a> is one of the biggest and most used proxies on the interwebs. And generating reports from the access logs is already a done deal, there are many commercial and OSS apps that support the squid log format. But I found my self in a situation where I wanted stats but didn&#8217;t want to install a web server on my proxy or use syslog to push my logs to a centralised server which was running such software, and also wasn&#8217;t in a position to go buy one of those off the shelf amazing wiz bang Squid reporting and graphing tools.</p>
<p>As a Linux geek I surfed the web to see what others have done. I came across a <a href="http://www.squid-cache.org/Scripts/">list provided by the Squid website</a>. Following a couple of links, I came across a awk script called &#8216;proxy_stats.gawk&#8217; written by Richard Huveneers.</p>
<p>I downloaded it and tried it out&#8230; unfortunately it didn&#8217;t work, looking at the code.. which he nicely commented showed that he had it set up for access logs  from version 1.* of squid. Now the <a href="http://wiki.squid-cache.org/Features/LogFormat">squid access log format from squid 2.6+</a> hasn&#8217;t changed too much from version 1.1. all they have really done is add a &#8220;content type&#8221; entry at the end of each line.</p>
<p>So as a good Linux geek does, he upgrades the script, my changes include:</p>
<ul>
<li>Support for squid 2.6+</li>
<li>Removed the use a deprecated switches that now isn&#8217;t supported in the sort command.</li>
<li>Now that there is a an actual content type &#8220;column&#8221; lets use it to improve the &#8216;Object type report&#8221;.</li>
<li>Add a users section, as this was an important report I required which was missing.</li>
<li>And in a further hacked version, an auto generated size of the first &#8220;name&#8221; column.</li>
</ul>
<p>Now with the explanation out of the way, let me show you it!</p>
<p>For those who are new to awk, this is how I&#8217;ve been running it:<br />
<code><br />
zcat &lt;access log file&gt; | awk -f proxy_stats.gawk &gt; &lt;report-filename&gt;<br />
</code></p>
<p><strong>NOTE:</strong> I&#8217;ve been using it for some historical analysis, so I&#8217;m running it on old rotated files, which are compressed thus the zcat.</p>
<p>You can pass more then one file at a time and it order doesn&#8217;t matter, as each line of an access log contains the date in epoch time:<br />
<code><br />
zcat `find /var/log/squid/ -name "access.log*"` |awk -f proxy_stats.gawk<br />
</code></p>
<p>The script produces an ascii report (See end of blog entry for example), which could be generated and emailed via cron. If you want it to look nice in any email client using html the I suggest wrapping it in &lt;pre&gt; tags.:</p>
<p><code>&lt;html&gt;<br />
&lt;head&gt;&lt;title&gt;Report Title&lt;/title&gt;&lt;/head&gt;<br />
Report title&lt;body&gt;<br />
&lt;pre&gt;<br />
... Report goes here ...<br />
&lt;/pre&gt;<br />
&lt;/body&gt;<br />
&lt;/html&gt;<br />
</code></p>
<p>For those experienced Linux sys admins out there using cron + &#8216;find -mtime&#8217; would be a very simple way of having an automated daily, weekly or even monthly report.<br />
But like I said earlier I was working on historic data, hundreds of files in a single report, hundreds because for business reasons we have been rotating the squid logs every hour&#8230; so I did what I do best, write a quick bash script to find all the files I needed to cat into the report:</p>
<pre name="code" class="bash">
#!/bin/bash

ACCESS_LOG_DIR="/var/log/squid/access.log*"
MONTH="$1"

function getFirstLine() {
	if [ -n  "`echo $1 |grep "gz$"`" ]
	then
		zcat $1 |head -n 1
	else
		head -n 1 $1
	fi
}

function getLastLine() {
	if [ -n  "`echo $1 |grep "gz$"`" ]
	then
		zcat $1 |tail -n 1
	else
		tail -n 1 $1
	fi
}

for log in `ls $ACCESS_LOG_DIR`
do
	firstLine="`getFirstLine $log`"
	epochStr="`echo $firstLine |awk '{print $1}'`"
	month=`date -d @$epochStr +%m`

	if [ "$month" -eq "$MONTH" ]
	then
		echo $log
		continue
	fi

	#Check the last line
	lastLine="`getLastLine $log`"
	epochStr="`echo $lastLine |awk '{print $1}'`"
        month=`date -d @$epochStr +%m`

        if [ "$month" -eq "$MONTH" ]
        then
                echo $log
        fi

done
</pre>
<p>So there you go, thanks to the work of Richard Huveneers there is a script that I think generates a pretty good acsii report, which can be automated or integrated easily into any Linux/Unix work flow.</p>
<p>If you interested in getting hold of the most up to date version of the script you can get it from my sysadmin github repo <a href="https://github.com/matthewoliver/Sysadmin/tree/master/proxy_stats">here</a>.</p>
<p>As promised earlier here is an example report:</p>
<pre>
Parsed lines  : 32960
Bad lines     : 0

First request : Mon 30 Jan 2012 12:06:43 EST
Last request  : Thu 09 Feb 2012 09:05:01 EST
Number of days: 9.9

Top 10 sites by xfers           reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
213.174.155.216                   20   0.1% 100.0%   0.0%        0.0   0.0%   0.0%       1.7       2.5
30.media.tumblr.com                1   0.0% 100.0%   0.0%        0.0   0.0%   0.0%      48.3      77.4
28.media.tumblr.com                1   0.0% 100.0%   0.0%        0.1   0.0%   0.0%      87.1       1.4
26.media.tumblr.com                1   0.0%   0.0%      -        0.0   0.0%      -         -         -
25.media.tumblr.com                2   0.0% 100.0%   0.0%        0.1   0.0%   0.0%      49.2      47.0
24.media.tumblr.com                1   0.0% 100.0%   0.0%        0.1   0.0%   0.0%     106.4     181.0
10.1.10.217                      198   0.6% 100.0%   0.0%       16.9   0.9%   0.0%      87.2    3332.8
3.s3.envato.com                   11   0.0% 100.0%   0.0%        0.1   0.0%   0.0%       7.6      18.3
2.s3.envato.com                   15   0.0% 100.0%   0.0%        0.1   0.0%   0.0%       7.5      27.1
2.media.dorkly.cvcdn.com           8   0.0% 100.0%  25.0%        3.2   0.2%   0.3%     414.1     120.5

Top 10 sites by MB              reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
zulu.tweetmeme.com                 2   0.0% 100.0% 100.0%        0.0   0.0% 100.0%       3.1     289.6
ubuntu.unix.com                    8   0.0% 100.0% 100.0%        0.1   0.0% 100.0%       7.5     320.0
static02.linkedin.com              1   0.0% 100.0% 100.0%        0.0   0.0% 100.0%      36.0     901.0
solaris.unix.com                   2   0.0% 100.0% 100.0%        0.0   0.0% 100.0%       3.8     223.6
platform.tumblr.com                2   0.0% 100.0% 100.0%        0.0   0.0% 100.0%       1.1     441.4
i.techrepublic.com.com             5   0.0%  60.0% 100.0%        0.0   0.0% 100.0%       6.8    2539.3
i4.zdnetstatic.com                 2   0.0% 100.0% 100.0%        0.0   0.0% 100.0%      15.3     886.4
i4.spstatic.com                    1   0.0% 100.0% 100.0%        0.0   0.0% 100.0%       4.7     520.2
i2.zdnetstatic.com                 2   0.0% 100.0% 100.0%        0.0   0.0% 100.0%       7.8    2920.9
i2.trstatic.com                    9   0.0% 100.0% 100.0%        0.0   0.0% 100.0%       1.5     794.5

Top 10 neighbor report          reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
www.viddler.com                    4   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.turktrust.com.tr              16   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.trendmicro.com                 5   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.reddit.com                     2   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.linkedin.com                   2   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.google-analytics.com           2   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.facebook.com                   2   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.dynamicdrive.com               1   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
www.benq.com.au                    1   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
wd-edge.sharethis.com              1   0.0% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0

Local code                      reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
TCP_CLIENT_REFRESH_MISS         2160   6.6% 100.0%   0.0%        7.2   0.4%   0.0%       3.4      12.9
TCP_HIT                          256   0.8% 100.0%  83.2%       14.0   0.8% 100.0%      56.0    1289.3
TCP_IMS_HIT                      467   1.4% 100.0% 100.0%       16.9   0.9% 100.0%      37.2    1747.4
TCP_MEM_HIT                      426   1.3% 100.0% 100.0%       96.5   5.3% 100.0%     232.0    3680.9
TCP_MISS                       27745  84.2%  97.4%   0.0%     1561.7  85.7%   0.3%      59.2      18.2
TCP_REFRESH_FAIL                  16   0.0% 100.0%   0.0%        0.2   0.0%   0.0%      10.7       0.1
TCP_REFRESH_MODIFIED             477   1.4%  99.8%   0.0%       35.0   1.9%   0.0%      75.3    1399.4
TCP_REFRESH_UNMODIFIED          1413   4.3% 100.0%   0.0%       91.0   5.0%   0.0%      66.0     183.5

Status code                     reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
000                              620   1.9% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
200                            29409  89.2% 100.0%   2.9%     1709.7  93.8%   7.7%      59.5     137.1
204                              407   1.2% 100.0%   0.0%        0.2   0.0%   0.0%       0.4       1.4
206                              489   1.5% 100.0%   0.0%      112.1   6.1%   0.0%     234.7     193.0
301                               82   0.2% 100.0%   0.0%        0.1   0.0%   0.0%       0.7       1.5
302                              356   1.1% 100.0%   0.0%        0.3   0.0%   0.0%       0.8       2.7
303                                5   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       0.7       1.5
304                              862   2.6% 100.0%  31.2%        0.4   0.0%  30.9%       0.4      34.2
400                                1   0.0%   0.0%      -        0.0   0.0%      -         -         -
401                                1   0.0%   0.0%      -        0.0   0.0%      -         -         -
403                               47   0.1%   0.0%      -        0.0   0.0%      -         -         -
404                              273   0.8%   0.0%      -        0.0   0.0%      -         -         -
500                                2   0.0%   0.0%      -        0.0   0.0%      -         -         -
502                               12   0.0%   0.0%      -        0.0   0.0%      -         -         -
503                               50   0.2%   0.0%      -        0.0   0.0%      -         -         -
504                              344   1.0%   0.0%      -        0.0   0.0%      -         -         -

Hierarchie code                 reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
DIRECT                         31843  96.6%  97.7%   0.0%     1691.0  92.8%   0.0%      55.7      44.3
NONE                            1117   3.4% 100.0% 100.0%      131.6   7.2% 100.0%     120.7    2488.2

Method report                   reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
CONNECT                         5485  16.6%  99.2%   0.0%      132.8   7.3%   0.0%      25.0       0.3
GET                            23190  70.4%  97.7%   4.9%     1686.3  92.5%   7.8%      76.2     183.2
HEAD                            2130   6.5%  93.7%   0.0%        0.7   0.0%   0.0%       0.3       1.1
POST                            2155   6.5%  99.4%   0.0%        2.9   0.2%   0.0%       1.4       2.0

Object type report              reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
*/*                                1   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       1.6       3.2
application/cache-digest         396   1.2% 100.0%  50.0%       33.7   1.8%  50.0%      87.1    3655.1
application/gzip                   1   0.0% 100.0%   0.0%        0.1   0.0%   0.0%      61.0      30.8
application/javascript           227   0.7% 100.0%  12.3%        2.2   0.1%   7.7%       9.9      91.9
application/json                 409   1.2% 100.0%   0.0%        1.6   0.1%   0.0%       4.1       6.0
application/ocsp-response        105   0.3% 100.0%   0.0%        0.2   0.0%   0.0%       1.9       2.0
application/octet-stream         353   1.1% 100.0%   6.8%       81.4   4.5%   9.3%     236.1     406.9
application/pdf                    5   0.0% 100.0%   0.0%       13.5   0.7%   0.0%    2763.3      75.9
application/pkix-crl              96   0.3% 100.0%  13.5%        1.0   0.1%   1.7%      10.6       7.0
application/vnd.google.sa       1146   3.5% 100.0%   0.0%        1.3   0.1%   0.0%       1.1       2.4
application/vnd.google.sa       4733  14.4% 100.0%   0.0%       18.8   1.0%   0.0%       4.1      13.4
application/x-bzip2               19   0.1% 100.0%   0.0%       78.5   4.3%   0.0%    4232.9     225.5
application/x-gzip               316   1.0% 100.0%  59.8%      133.4   7.3%  59.3%     432.4    3398.1
application/x-javascript        1036   3.1% 100.0%   5.8%        9.8   0.5%   3.4%       9.7      52.1
application/xml                   46   0.1% 100.0%  34.8%        0.2   0.0%  35.1%       3.5     219.7
application/x-msdos-progr        187   0.6% 100.0%   0.0%       24.4   1.3%   0.0%     133.7     149.6
application/x-pkcs7-crl           83   0.3% 100.0%   7.2%        1.6   0.1%   0.4%      19.8      10.8
application/x-redhat-pack         13   0.0% 100.0%   0.0%       57.6   3.2%   0.0%    4540.7     156.7
application/x-rpm                507   1.5% 100.0%   6.3%      545.7  29.9%   1.5%    1102.2     842.8
application/x-sdlc                 1   0.0% 100.0%   0.0%        0.9   0.0%   0.0%     888.3     135.9
application/x-shockwave-f        109   0.3% 100.0%  11.9%        5.4   0.3%  44.5%      50.6     524.1
application/x-tar                  9   0.0% 100.0%   0.0%        1.5   0.1%   0.0%     165.3      36.4
application/x-www-form-ur         11   0.0% 100.0%   0.0%        0.1   0.0%   0.0%       9.9      15.4
application/x-xpinstall            2   0.0% 100.0%   0.0%        2.5   0.1%   0.0%    1300.6     174.7
application/zip                 1802   5.5% 100.0%   0.0%      104.0   5.7%   0.0%      59.1       2.5
Archive                           89   0.3% 100.0%   0.0%        0.0   0.0%      -       0.0       0.0
audio/mpeg                         2   0.0% 100.0%   0.0%        5.8   0.3%   0.0%    2958.2      49.3
binary/octet-stream                2   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       5.5      14.7
font/ttf                           2   0.0% 100.0%   0.0%        0.0   0.0%   0.0%      15.5      12.5
font/woff                          1   0.0% 100.0% 100.0%        0.0   0.0% 100.0%      42.5    3539.6
Graphics                         126   0.4% 100.0%   0.0%        0.1   0.0%   0.0%       0.6       2.5
HTML                              14   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       0.1       0.1
image/bmp                          1   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       1.3       3.9
image/gif                       5095  15.5% 100.0%   2.4%       35.9   2.0%   0.7%       7.2       9.5
image/jpeg                      1984   6.0% 100.0%   4.3%       52.4   2.9%   0.6%      27.0      62.9
image/png                       1684   5.1% 100.0%  10.3%       28.6   1.6%   1.9%      17.4     122.2
image/vnd.microsoft.icon          10   0.0% 100.0%  30.0%        0.0   0.0%  12.8%       1.0       3.3
image/x-icon                      72   0.2% 100.0%  16.7%        0.2   0.0%   6.0%       3.2      15.0
multipart/bag                      6   0.0% 100.0%   0.0%        0.1   0.0%   0.0%      25.2      32.9
multipart/byteranges              93   0.3% 100.0%   0.0%       16.5   0.9%   0.0%     182.0     178.4
text/cache-manifest                1   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       0.7       3.1
text/css                         470   1.4% 100.0%   7.9%        3.4   0.2%   5.8%       7.4      59.7
text/html                       2308   7.0%  70.7%   0.4%        9.6   0.5%   0.6%       6.0      14.7
text/javascript                 1243   3.8% 100.0%   2.7%       11.1   0.6%   5.2%       9.1      43.3
text/json                          1   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       0.5       0.7
text/plain                      1445   4.4%  99.4%   1.5%       68.8   3.8%   5.5%      49.0      41.9
text/x-cross-domain-polic         24   0.1% 100.0%   0.0%        0.0   0.0%   0.0%       0.7       1.7
text/x-js                          2   0.0% 100.0%   0.0%        0.0   0.0%   0.0%      10.1       6.4
text/x-json                        9   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       3.0       8.5
text/xml                         309   0.9% 100.0%  12.9%       12.9   0.7%  87.5%      42.8     672.3
unknown/unknown                 6230  18.9%  99.3%   0.0%      132.9   7.3%   0.0%      22.0       0.4
video/mp4                          5   0.0% 100.0%   0.0%        3.2   0.2%   0.0%     660.8      62.7
video/x-flv                      117   0.4% 100.0%   0.0%      321.6  17.6%   0.0%    2814.9     308.3
video/x-ms-asf                     2   0.0% 100.0%   0.0%        0.0   0.0%   0.0%       1.1       4.7

Ident (User) Report             reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
-                              32960 100.0%  97.8%   3.5%     1822.6 100.0%   7.2%      57.9     129.0

Weekly report                   reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
2012/01/26                     14963  45.4%  97.6%   3.6%      959.8  52.7%   1.8%      67.3     104.5
2012/02/02                     17997  54.6%  98.0%   3.4%      862.8  47.3%  13.2%      50.1     149.4

Total report                    reqs   %all %xfers   %hit         MB   %all   %hit     kB/xf      kB/s
------------------------- ------------------------------- ------------------------ -------------------
All requests                   32960 100.0%  97.8%   3.5%     1822.6 100.0%   7.2%      57.9     129.0

Produced by : Mollie's hacked access-flow 0.5
Running time: 2 seconds
</pre>
<p>Happy squid reporting!</p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=236</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Identically partition disks.. the easy way!</title>
		<link>http://oliver.net.au/?p=230</link>
		<comments>http://oliver.net.au/?p=230#comments</comments>
		<pubDate>Mon, 24 Oct 2011 23:32:48 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[fdisk]]></category>
		<category><![CDATA[RAID]]></category>
		<category><![CDATA[sfdisk]]></category>
		<category><![CDATA[software RAID]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=230</guid>
		<description><![CDATA[Was just looking into a software RAID howto.. for no reason really, but kinda glad I did! When you set up software raid you want to make sure all disks are partitioned the same, right. so check this out:
3. Create partitions on /dev/sda identical to the partitions on /dev/sdb:
sfdisk -d /dev/sdb &#124; sfdisk /dev/sda
That&#8217;s a [...]]]></description>
			<content:encoded><![CDATA[<p>Was just looking into a software RAID howto.. for no reason really, but kinda glad I did! When you set up software raid you want to make sure all disks are partitioned the same, right. so check this out:</p>
<blockquote><p>3. Create partitions on /dev/sda identical to the partitions on /dev/sdb:</p>
<p>sfdisk -d /dev/sdb | sfdisk /dev/sda</p></blockquote>
<p>That&#8217;s a much easier way <img src='http://oliver.net.au/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>This gem is thanks to: <a href="http://www.howtoforge.com/how-to-create-a-raid1-setup-on-an-existing-centos-redhat-6.0-system">http://www.howtoforge.com/how-to-create-a-raid1-setup-on-an-existing-centos-redhat-6.0-system</a></p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=230</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NTLM Authentication in Squid using Winbind.</title>
		<link>http://oliver.net.au/?p=225</link>
		<comments>http://oliver.net.au/?p=225#comments</comments>
		<pubDate>Mon, 24 Oct 2011 23:26:48 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[active directory]]></category>
		<category><![CDATA[AD]]></category>
		<category><![CDATA[authantication]]></category>
		<category><![CDATA[authconfig]]></category>
		<category><![CDATA[DC]]></category>
		<category><![CDATA[Domain controller]]></category>
		<category><![CDATA[iptables]]></category>
		<category><![CDATA[kerberos]]></category>
		<category><![CDATA[krb5]]></category>
		<category><![CDATA[ntlm]]></category>
		<category><![CDATA[ntp]]></category>
		<category><![CDATA[samba]]></category>
		<category><![CDATA[Squid]]></category>
		<category><![CDATA[windbind]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=225</guid>
		<description><![CDATA[Some old windows servers require authentication through the old NTLM protocol, luckily with the help from squid, samba and winbind we can do this under Linux.
Some URLs a much of this information was gathered from are:

 http://wiki.squid-cache.org/ConfigExamples/Authenticate/NtlmCentOS5
http://wiki.squid-cache.org/ConfigExamples/Authenticate/Ntlm

HOW TO
In order to authenticate through winbind we will be using that and samba to connect to a windows [...]]]></description>
			<content:encoded><![CDATA[<p>Some old windows servers require authentication through the old NTLM protocol, luckily with the help from squid, samba and winbind we can do this under Linux.</p>
<p>Some URLs a much of this information was gathered from are:</p>
<ul>
<li> http://wiki.squid-cache.org/ConfigExamples/Authenticate/NtlmCentOS5</li>
<li>http://wiki.squid-cache.org/ConfigExamples/Authenticate/Ntlm</li>
</ul>
<p><strong>HOW TO</strong></p>
<p>In order to authenticate through winbind we will be using that and samba to connect to a windows domain, so you will need to have a domain and the details for it or all this will be for naught. I&#8217;ll use some fake credentials for this post.</p>
<p><strong>Required Packages</strong><br />
Let&#8217;s install all the required packages:<br />
<code><br />
yum install squid krb5-workstation samba-common ntp samba-winbind authconfig<br />
</code></p>
<p><strong>NTP (Network Time Protocol)</strong><br />
Kerberos and windbind can be a little thingy about date and time, so its a good idea to use NTP for your network, I&#8217;ll assume your domain controller (DC) will be also your NTP server in which case lets set it up.</p>
<p>Comment out any lines that begin with server and create only one that points to your Active Directory PDC.<br />
<code><br />
# vim /etc/ntp.conf<br />
server pdc.test.lan<br />
</code></p>
<p>Now add it to the default runlevels and start it.<br />
<code><br />
chkconfig ntpd on<br />
/etc/init.d/ntpd start<br />
</code></p>
<p><strong>Samba, Winbind and Kerberos</strong><br />
We will the use the authconfig package/command we installed earlier to configure Samba, Winbind and perform the join in one step, this makes things _SO_ much<br />
easier!!!</p>
<p><strong>NOTE:</strong> If you don&#8217;t have DNS set up then you will need to add the DC to your hosts file, and it is important to use the name the DC machine knows itself as in AD.</p>
<p><code><br />
authconfig --enableshadow --enablemd5 --passalgo=md5 --krb5kdc=pdc.test.lan \<br />
--krb5realm=TEST.LAN --smbservers=pdc.test.lan --smbworkgroup=TESTLAN \<br />
--enablewinbind --enablewinbindauth --smbsecurity=ads --smbrealm=TEST.LAN \<br />
--smbidmapuid="16777216-33554431" --smbidmapgid="16777216-33554431" --winbindseparator="+" \<br />
--winbindtemplateshell="/bin/false" --enablewinbindusedefaultdomain --disablewinbindoffline \<br />
--winbindjoin=administrator --disablewins --disablecache --enablelocauthorize --updateall<br />
</code></p>
<p><strong>NOTE:</strong> Replace pdc.test.lan with that of your FQDN of your DC server, TESTLAN with your domain, TEST.LAN with the full name of the domain/realm, and make sure you set &#8216;&#8211;winbindjoin&#8217; with a domain admin.</p>
<p>If that succeeds lets test it:<br />
<code><br />
# wbinfo -u<br />
# wbinfo -g<br />
</code><br />
If you are able to enumerate your Active Directory Groups and Users, everything is working.</p>
<p>Next lets test that we can authenticate with winbind:<br />
<code><br />
# wbinfo -a<br />
</code><br />
E.G:<br />
<code><br />
# wbinfo -a testuser<br />
Enter testuser's password:<br />
plaintext password authentication succeeded<br />
Enter testuser's password:<br />
challenge/response password authentication succeeded<br />
</code></p>
<p>Great, we have been added to the domain, so now we can setup squid for NTLM authentication.</p>
<p><strong>SQUID Configuration</strong><br />
Squid comes with its own ntlm authentication binary (/usr/lib64/squid/ntlm_smb_lm_auth) which uses winbind, but as of Samba 3.x, samba bundle their own which is the recommended binary to use (according to the squid and samba projects). So the binary we use comes from the samba-winbind package we installed earlier:<br />
<code><br />
/usr/bin/ntlm_auth<br />
</code></p>
<p>Add the following configuration elements to the squid.conf to enable NTLM authentication:<br />
<code><br />
#NTLM<br />
auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp<br />
auth_param ntlm children 5<br />
auth_param ntlm keep_alive on</code></p>
<p>acl ntlm proxy_auth REQUIRED<br />
http_access allow ntlm<br />
</code><br />
<strong>NOTE:</strong> The above is allowing anyone access as long as they authenticate themselves via NTLM, you could use further acl's to restrict this more.</p>
<p>The ntlm_auth binary has other switches that might be of use, such as restricting users by group membership:<br />
<code><br />
auth_param ntlm program /usr/bin/ntlm_auth --helper-protocol=squid-2.5-ntlmssp --require-membership-of=EXAMPLE+ADGROUP<br />
</code></p>
<p>Before we are complete there is one more thing we need to do, for squid to be allowed to use winbind, the squid user (which was created when the squid package was installed) needs to be a member of a wbpriv group:<br />
<code><br />
gpasswd -a squid wbpriv<br />
</code></p>
<p><strong>IMPORTANT!</strong><br />
NTLM authentication <strong>WILL FAIL</strong> if you have "cache_effective_group squid" set, if you do then remove it! As this overrides the effective group and squid then isn't seen as part of the 'wbpriv' group which breaks authentication!!!<br />
<strong>/IMPORTANT!</strong></p>
<p>Add squid to the runlevels and start it:<br />
<code><br />
# chkconfig squid on<br />
# /etc/init.d/squid start<br />
</code></p>
<p><strong>Trouble shooting</strong><br />
Make sure you open the port in iptables, if squid is listening on 3128 then:<br />
<code><br />
# iptables -I INPUT 1 -p tcp --dport 3128 -j ACCEPT<br />
# /etc/init.d/iptables save<br />
</code></p>
<p><strong>NOTE:</strong> The '/etc/init.d/iptables save' command saves the current running configuration so the new rule will be applied on reboot.</p>
<p>Happy squid-ing.</p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=225</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reverse proxy using squid + Redirection</title>
		<link>http://oliver.net.au/?p=215</link>
		<comments>http://oliver.net.au/?p=215#comments</comments>
		<pubDate>Wed, 19 Oct 2011 22:51:48 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[acl]]></category>
		<category><![CDATA[cache_peer]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[proxy]]></category>
		<category><![CDATA[redirection]]></category>
		<category><![CDATA[reverse proxy]]></category>
		<category><![CDATA[sql injection]]></category>
		<category><![CDATA[Squid]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=215</guid>
		<description><![CDATA[Squid &#8211; Reverse Proxy
In computer networks, a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client as though it originated from the reverse proxy itself. While a forward proxy is usually situated between the client [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Squid &#8211; Reverse Proxy</strong></p>
<p>In computer networks, a reverse proxy is a type of proxy server that retrieves resources on behalf of a client from one or more servers. These resources are then returned to the client as though it originated from the reverse proxy itself. While a forward proxy is usually situated between the client application (such as a web browser) and the server(s) hosting the desired resources, a reverse proxy is usually situated closer to the server(s) and will only return a configured set of resources.</p>
<p>See: http://en.wikipedia.org/wiki/Reverse_proxy</p>
<p><strong>Configuration</strong></p>
<p>Squid should already be installed, if not then install it:<br />
<code><br />
yum install squid<br />
</code></p>
<p>Then we edit squid config:</p>
<p><code><br />
vim /etc/squid/squid.conf<br />
</code></p>
<p>Add we add the following to the top of the file:<br />
<code><br />
http_port 80 vhost<br />
https_port 443 cert=/etc/squid/localhost.crt key=/etc/squid/localhost.key vhost</p>
<p>cache_effective_user squid<br />
cache_effective_group squid</p>
<p>cache_peer 1.2.3.4 parent 80 0 no-query originserver login=PASS name=site1-http<br />
cache_peer 1.2.3.5 parent 443 0 no-query originserver login=PASS ssl sslflags=DONT_VERIFY_PEER name=site2-ssl<br />
cache_peer_domain site1-http site1.example.lan<br />
cache_peer_domain site2-ssl site2.anotherexample.lan</p>
<p>acl bad_requests urlpath_regex -i cmd.exe \/bin\/sh \/bin\/bash default\.ida?XXX insert update delete select<br />
http_access deny bad_requests<br />
</code></p>
<p>Now I&#8217;ll walk us through the above configuration.<br />
<code><br />
http_port 80 vhost<br />
https_port 443 cert=/etc/squid/localhost.crt key=/etc/squid/localhost.key vhost<br />
</code></p>
<p>This sets the http and https ports squid is listening on. Note the cert options for https, we can get squid to use https up to the proxy and unencrytped link to the last hop if we want.. which is cool. If for some reason the server doesn&#8217;t support https.</p>
<p><code><br />
cache_effective_user squid<br />
cache_effective_group squid<br />
</code><br />
Set the effective user and group for squid.. this may not be required, but doesn&#8217;t hurt.</p>
<p><code><br />
cache_peer 1.2.3.4 parent 80 0 no-query originserver name=site1-http<br />
cache_peer 1.2.3.5 parent 443 0 no-query originserver ssl sslflags=DONT_VERIFY_PEER name=site2-ssl<br />
cache_peer_domain site1-http site1.example.lan<br />
cache_peer_domain site2-ssl site2.anotherexample.lan<br />
</code></p>
<p>This is the magic, the first two lines, tell squid which peer to reverse proxy for and what port to use. Note if you use ssl the &#8217;sslflags=DONT_VERIFY_PEER&#8217; is useful otherwise if your using a self signed cert you&#8217;ll have certificate errors.</p>
<p><strong>IMPORTANT:</strong> If you want to allow http authentication (auth handled by the web server, such as htaccess) then you need to add &#8216;login=PASS&#8217; otherwise squid will try and authenticate to squid rather than the http server.</p>
<p>The last two lines, reference the first two and tell squid the domains to listen to, so if someone connects to squid looking for that domain it knows where to go/cache.</p>
<p><code><br />
acl bad_requests urlpath_regex -i cmd.exe \/bin\/sh \/bin\/bash default\.ida?XXX insert update delete select<br />
http_access deny bad_requests<br />
</code><br />
<strong>NOTE:</strong> The acl line has been cut over two lines, this should be on one. There should be the ACL line and the http_access line. </br><br />
These lines set up some bad requests to which we deny access to, this is to help prevent SQL injection, and other hack attempts, etc.</p>
<p>That&#8217;s it, after a (re)start to squid you it will be reverse proxying the domains.</p>
<p><strong>Redirect to SSL</strong></p>
<p>We had a requirement to automatically redirect to https if someone came in on http. Squid allows redirecting through a variety of ways, you can write a redirect script at get squid to use it, but there is a simpler way, using all squid internals and acls.</p>
<p>Add the following to the entries added in the last section:</p>
<p><code><br />
acl port80 myport 80<br />
acl site1 dstdomain site1.example.lan<br />
http_access deny port80 site1<br />
deny_info https://site1.example.lan/ site1</code></p>
<p>acl site2 dstdomain site2.anotherexample.lan<br />
http_access deny port80 site2<br />
deny_info https://site2.anotherexample.lan/ site2<br />
</code></p>
<p>We create an acl for the squids port 80 and then one for the domain we want to redirect. We then use "http_access deny" to cause squid to deny access to that domain coming in on port 80 (http). This causes a deny which is caught by the deny_info which redirects it to https.</p>
<p>The order used of the acl's in the http_access and the deny_info is important. Squid only remembers the last acl used by a http_access command and will look for a corresponding deny_info matched to that acl. So make sure the last acl matches the acl used in the deny_info statement!</p>
<p><strong>NOTE:</strong> See http://www.squid-cache.org/Doc/config/deny_info/</p>
<p><strong>Appendix</strong></p>
<p>The following is the configuration all put together now.</p>
<p>Reverse proxy + redirection:<br />
<code><br />
http_port 80 vhost<br />
https_port 443 cert=/etc/squid/localhost.crt key=/etc/squid/localhost.key vhost</p>
<p>cache_effective_user squid<br />
cache_effective_group squid</p>
<p>cache_peer 1.2.3.4 parent 80 0 no-query originserver login=PASS name=site1-http<br />
cache_peer 1.2.3.5 parent 443 0 no-query originserver login=PASS ssl sslflags=DONT_VERIFY_PEER name=site2-ssl<br />
cache_peer_domain site1-http site1.example.lan<br />
cache_peer_domain site2-ssl site2.anotherexample.lan</p>
<p>acl bad_requests urlpath_regex -i cmd.exe \/bin\/sh \/bin\/bash default\.ida?XXX insert update delete select<br />
http_access deny bad_requests</p>
<p>acl port80 myport 80<br />
acl site1 dstdomain site1.example.lan<br />
http_access deny port80 site1<br />
deny_info https://site1.example.lan/ site1</p>
<p>acl site2 dstdomain site2.anotherexample.lan<br />
http_access deny port80 site2<br />
deny_info https://site2.anotherexample.lan/ site2<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=215</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Posfix &#8211; Making sense of delays in mail</title>
		<link>http://oliver.net.au/?p=211</link>
		<comments>http://oliver.net.au/?p=211#comments</comments>
		<pubDate>Wed, 19 Oct 2011 01:38:42 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[deferred]]></category>
		<category><![CDATA[delay]]></category>
		<category><![CDATA[delays]]></category>
		<category><![CDATA[maillog]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[relay]]></category>
		<category><![CDATA[smtp]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=211</guid>
		<description><![CDATA[The maillog

The maillog is easy enough to follow, but when you understand what all the delay and delays numbers mean then this may help really understand what is going on!
A standard email entry in postfix looks like:

Jan 10 10:00:00 testmtr postfix/smtp[20123]: 34A1B160852B: to=, relay=mx1.example.lan[1.2.3.4]:25, delay=0.49, delays=0.2/0/0.04/0.25, dsn=2.0.0, status=sent

Pretty straight forward: date, email identifier in the [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The maillog<br />
</strong></p>
<p>The maillog is easy enough to follow, but when you understand what all the delay and delays numbers mean then this may help really understand what is going on!<br />
A standard email entry in postfix looks like:<br />
<code><br />
Jan 10 10:00:00 testmtr postfix/smtp[20123]: 34A1B160852B: to=, relay=mx1.example.lan[1.2.3.4]:25, delay=0.49, delays=0.2/0/0.04/0.25, dsn=2.0.0, status=sent<br />
</code></p>
<p>Pretty straight forward: date, email identifier in the mailq (34A1B160852B), recipient, which server the email is being sent to (relay). It is the delay and delays I&#8217;d like to talk about.</p>
<p><strong>Delay and Delays</strong><br />
If we take a look at the example email from above:<br />
<code><br />
Jan 10 10:00:00 testmtr postfix/smtp[20123]: 34A1B160852B: to=, relay=mx1.example.lan[1.2.3.4]:25, delay=0.49, delays=0.2/0/0.04/0.25, dsn=2.0.0, status=sent<br />
</code></p>
<p>The delay parameter (delay=0.49) is fairly self explanatory, it is the total amount of time this email (34A1B160852B) has been on this server. But what is the delays parameter all about?<br />
<code><br />
delays=0.2/0/0.04/0.25<br />
</code><br />
<strong>NOTE:</strong> Numbers smaller than 0.01 seconds are truncated to 0, to reduce the noise level in the logfile.</p>
<p>You might have guessed it is a break down of the total delay, but what do each number represent?</p>
<p>Well from the release notes we get:<br />
<code><br />
delays=a/b/c/d:<br />
a=time before queue manager, including message transmission;<br />
b=time in queue manager;<br />
c=connection setup time including DNS, HELO and TLS;<br />
d=message transmission time.<br />
</code></p>
<p>There for looking at our example:</p>
<ul>
<li> a (0.2): The time before getting to the queue manager, so the time it took to be transmitted onto the mail server and into postfix.</li>
<li> b (0): The time in queue manager, so this email didn&#8217;t hit the queues, so it was emailed straight away.</li>
<li> c (0.04): The time it took to set up a connection with the destination mail relay.</li>
<li> d (0.25): The time it took to transmit the email to the destination mail relay.</li>
</ul>
<p>However if the email is deferred, then when the email is attempted to be sent again:<br />
<code><br />
Jan 10 10:00:00 testmtr postfix/smtp[20123]: 34A1B160852B: to=, relay=mx1.example.lan[1.2.3.4]:25, delay=82, delays=0.25/0/0.5/81, dsn=4.4.2, status=deferred (lost connection with mx1.example.lan[1.2.3.4] while sending end of data -- message may be sent more than once)</code></p>
<p><code> </code></p>
<p><code>Jan 10  testmtr postfix/smtp[20123]: 34A1B160852B: to=, relay=mx1.example.lan[1.2.3.4]:25, delay=1092, delays=1091/0.2/0.8/0.25, dsn=2.0.0, status=sent<br />
</code></p>
<p>This time the first entry shows how long it took before the destination mail relay took to time out and close the connection:<br />
<code><br />
delays=0.25/0/0.5/81<br />
Therefore: 81 seconds.<br />
</code></p>
<p>The email was deferred then about 15 minutes later (1009 seconds [delays - &lt;total delay from last attempt&gt; ]) another attempt is made.<br />
This time the delay is a lot larger, as the total time this email has spent on the server is a lot longer.</p>
<p><code>delay=1092, delays=1091/0.2/0.8/0.25<br />
</code><br />
What is interesting though is the value of &#8216;a&#8217; is now 1091, which means when an email is resent the &#8216;a&#8217; value in the breakdown also includes the amount of time this email has currently spend on the system (before this attempt).</p>
<p>So there you go, those delays values are rather interesting and can really help solve where bottlenecks lie on your system. In the above case we obviously had some problem communicating to the destination mail relay, but worked the second time, so isn&#8217;t a problem with our system&#8230; or so I&#8217;d like to think.</p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=211</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use xmllint and vim to format xml documents</title>
		<link>http://oliver.net.au/?p=204</link>
		<comments>http://oliver.net.au/?p=204#comments</comments>
		<pubDate>Wed, 16 Feb 2011 05:05:30 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[format]]></category>
		<category><![CDATA[vim]]></category>
		<category><![CDATA[xena]]></category>
		<category><![CDATA[xml]]></category>
		<category><![CDATA[xmllint vimrc]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=204</guid>
		<description><![CDATA[If you want vim to nicely format an XML file (and a xena file in this example, 2nd line) then add this to your ~/.vimrc file:
" Format *.xml and *.xena files by sending them to xmllint
au FileType xml exe ":silent 1,$!xmllint --format --recover - 2>/dev/null"
au FileType xena exe ":silent 1,$!xmllint --format --recover - 2>/dev/null"

This uses [...]]]></description>
			<content:encoded><![CDATA[<p>If you want vim to nicely format an XML file (and a xena file in this example, 2nd line) then add this to your ~/.vimrc file:<br />
<code>" Format *.xml and *.xena files by sending them to xmllint<br />
au FileType xml exe ":silent 1,$!xmllint --format --recover - 2>/dev/null"<br />
au FileType xena exe ":silent 1,$!xmllint --format --recover - 2>/dev/null"<br />
</code><br />
This uses the xmllint command to format the xml file.. useful on xml docs that aren&#8217;t formatted in the file. </p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=204</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debian 6 GNU/KFreeBSD Grub problems on VirtualBox</title>
		<link>http://oliver.net.au/?p=195</link>
		<comments>http://oliver.net.au/?p=195#comments</comments>
		<pubDate>Thu, 10 Feb 2011 06:10:30 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[freebsd]]></category>
		<category><![CDATA[grub2]]></category>
		<category><![CDATA[kernel]]></category>
		<category><![CDATA[kfreebsd]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[update-grub]]></category>
		<category><![CDATA[usf]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=195</guid>
		<description><![CDATA[Debian 6 was released the other day, with this release they not only released a Linux kernel version but they now support a FreeBSD version as well!
So I decided to install it under VirtualBox and check it out&#8230;
The install process went smoothly until I got to the end when it was installing and setting up [...]]]></description>
			<content:encoded><![CDATA[<p>Debian 6 was released the other day, with this release they not only released a Linux kernel version but they now support a FreeBSD version as well!<br />
So I decided to install it under VirtualBox and check it out&#8230;</p>
<p>The install process went smoothly until I got to the end when it was installing and setting up grub2. It installed ok on the MBR but got an error in the installer while trying to set it up. I jumped into the console to take a look around.</p>
<p>I started off trying to run the update-grub command which fails silently (checking $? shows the return code of 1). On closer inspection I noticed the command created an incomplete grub config named /boot/grub/grub.cfg.new</p>
<p>So all we need to do is finish off this config file. So jump back into the installer and select continue without boot loader, this will pop up a message about what you must set the root partition as when you do set up a boot loader, so take note of it.. mine was /dev/ad0s5.</p>
<p>OK, with that info we can finish off our config file. Firstly lets rename the incomplete one:<br />
<code> cp /boot/grub/grub.cfg.new /boot/grub/grub.cfg<br />
</code></p>
<p>Now my /boot/grub/grub.cfg ended like:<br />
<code> ### BEGIN /etc/grub.d/10_kfreebsd ###<br />
menuentry 'Debian GNU/kFreeBSD, with kFreeBSD 8.1-1-amd64' --class debian --class gnu-kfreebsd --class gnu --class os {<br />
insmod part_msdos<br />
insmod ext2</code><br />
<code><br />
set root='(hd0,1)'<br />
search --no-floppy --fs-uuid --set dac05f8a-2746-4feb-a29d-31baea1ce751<br />
echo                    'Loading kernel of FreeBSD 8.1-1-amd64 ...'<br />
kfreebsd                /kfreebsd-8.1-1-amd64.gz</code></p>
<p>So I needed to add the following to finish it off (note this I&#8217;ll repeat that last part):<br />
<code> ### BEGIN /etc/grub.d/10_kfreebsd ###<br />
menuentry 'Debian GNU/kFreeBSD, with kFreeBSD 8.1-1-amd64' --class debian --class gnu-kfreebsd --class gnu --class os {<br />
insmod part_msdos<br />
insmod ext2<br />
insmod ufs2</code><br />
<code><br />
set root='(hd0,1)'<br />
search --no-floppy --fs-uuid --set dac05f8a-2746-4feb-a29d-31baea1ce751<br />
echo                    'Loading kernel of FreeBSD 8.1-1-amd64 ...'<br />
kfreebsd                /kfreebsd-8.1-1-amd64.gz<br />
set kFreeBSD.vfs.root.mountfrom=ufs:/dev/ad0s5<br />
set kFreeBSD.vfs.root.mountfrom.options=rw<br />
}</code></p>
<p><strong>Note:</strong> My root filesytem was UFS, thus the &#8216;ufs:/dev/ad0s5&#8242; in the mountfrom option.</p>
<p>That&#8217;s it, you Debian GNU/kFreeBSD should now boot successfully <img src='http://oliver.net.au/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=195</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fedora preupgrade from local mirror</title>
		<link>http://oliver.net.au/?p=188</link>
		<comments>http://oliver.net.au/?p=188#comments</comments>
		<pubDate>Wed, 05 Jan 2011 04:41:25 +0000</pubDate>
		<dc:creator>matt</dc:creator>
				<category><![CDATA[IT]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Fedora]]></category>
		<category><![CDATA[local mirror]]></category>
		<category><![CDATA[mirror]]></category>
		<category><![CDATA[preupgrade]]></category>
		<category><![CDATA[preupgrade-cli]]></category>
		<category><![CDATA[releases.txt]]></category>
		<category><![CDATA[upgrade]]></category>

		<guid isPermaLink="false">http://oliver.net.au/?p=188</guid>
		<description><![CDATA[If you have a local mirror and want to use it as the mirror for preupgrade then follow the these normal steps EXCEPT do the following BEFORE you run the preupgrade(-cli) command:

Download the releases.txt file used:
wget ﻿http://mirrors.fedoraproject.org/releases.txt
Modify the releases.txt file, I changed the Fedora 14 (what I&#8217;m upgrading to) options to:
[Fedora 14 (Laughlin)]
stable=True
preupgrade-ok=True
version=14
baseurl=http://localmirror/fedora/linux/releases/14/Fedora/$basearch/os/
installurl=http://localmirror/fedora/linux/releases/14/Fedora/$basearch/os/
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-14&#38;arch=$basearch
#installmirrorlist=
Note: I commented [...]]]></description>
			<content:encoded><![CDATA[<p>If you have a local mirror and want to use it as the mirror for preupgrade then follow the <a href="http://fedoraproject.org/wiki/PreUpgrade?">these normal steps</a> EXCEPT do the following BEFORE you run the preupgrade(-cli) command:</p>
<ol>
<li>Download the releases.txt file used:<br />
<code>wget ﻿http://mirrors.fedoraproject.org/releases.txt</code></li>
<li>Modify the releases.txt file, I changed the Fedora 14 (what I&#8217;m upgrading to) options to:<br />
<code>[Fedora 14 (Laughlin)]<br />
stable=True<br />
preupgrade-ok=True<br />
version=14<br />
baseurl=http://localmirror/fedora/linux/releases/14/Fedora/$basearch/os/<br />
installurl=http://localmirror/fedora/linux/releases/14/Fedora/$basearch/os/<br />
#mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=fedora-14&amp;arch=$basearch<br />
#installmirrorlist=</code><br />
<strong>Note:</strong> I commented out the &#8216;mirrorlist&#8217; and &#8216;installmirrorlist&#8217; options and added the &#8216;baseurl&#8217; and &#8216;installurl&#8217; options.</li>
<li>Finally run the preupgrade command from this directory, as one of the locations it looks for the releases.txt file is ./ (current directory).</li>
</ol>
<p>For more places you can put the releases.txt see <a href="https://fedorahosted.org/preupgrade/browser/README">here</a> or see the same info at the end of this post.</p>
<p>Happy upgrading.</p>
<p><code>preupgrade - tool to help you update a fedora system from one distro to the<br />
             next. Pre-resolves dependencies and sets up the system to be<br />
             upgraded via anaconda<br />
License: GPLv2 or above<br />
URL: https://fedorahosted.org/preupgrade/</p>
<p>= NOTES =</p>
<p>== Cleanup ==<br />
preupgrade modifies data in ~3 places:<br />
  /var/cache/yum/preupgrade*<br />
  /boot/upgrade<br />
  /etc/grub.conf</p>
<p>If you want to clean up manually, you can do:<br />
  preupgrade --clean<br />
Or, if you really want to be sure, do it by hand:<br />
  grubby --remove-kernel=/boot/upgrade/vmlinuz<br />
  rm -rf /var/cache/yum/preupgrade* /boot/upgrade</p>
<p>== Remote Headless Upgrades ==<br />
Use preupgrade-cli --vnc=VNCPASSWORD.<br />
See preupgrade-cli --help for more info.<br />
The upgrade will start a VNC server on port 5901, requiring the given password.<br />
The upgrade will proceed whether you connect the VNC client or not.</p>
<p>--> IMPORTANT NOTE ABOUT VNC INSTALLS <--<br />
If something goes wrong or the installer needs more info, it will hang forever,<br />
waiting for you to tell it what to do. So you should probably connect a VNC<br />
client and monitor its progress.</p>
<p>== Adding Custom Distributions ==<br />
preupgrade searches the following locations for release data, in order:<br />
  ./releases.txt<br />
  ./data/releases.txt</p>
<p>http://mirrors.fedoraproject.org/releases.txt</p>
<p>If you want to add your own distribution to preupgrade: download releases.txt,<br />
edit it to your liking, then run preupgrade from that dir - or save it to<br />
~/releases.txt to make it work when preupgrade is run normally.</p>
<p>Please note that /usr/share/preupgrade/releases.list is ignored and is only<br />
being shipped for compatibility reasons. Use ~/releases.txt for customization.</code></p>
]]></content:encoded>
			<wfw:commentRss>http://oliver.net.au/?feed=rss2&amp;p=188</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
