<?xml version="1.0"?>
<rss version="2.0"
     xmlns:dc="http://purl.org/dc/elements/1.1/"
     xmlns:dcterms="http://purl.org/dc/terms/" >
<channel>
<title>System administration</title>
<link>http://www.lunix.com.au/tags/sysadmin/</link>
<description>lunix</description>
<item>

	<title>Connecting a SIP Trunk to a Remote SIP Extension</title>


	<guid>http://www.lunix.com.au/blog/freepbx-sip-trunk-to-sip-extension/</guid>

	<link>http://www.lunix.com.au/blog/freepbx-sip-trunk-to-sip-extension/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>


	<pubDate>Sun, 04 Sep 2011 14:51:47 +1000</pubDate>
	<dcterms:modified>2011-09-16T13:32:02Z</dcterms:modified>

	<description>&lt;h1&gt;Connecting a SIP Trunk to a Remote SIP Extension&lt;/h1&gt;

&lt;p&gt;$WORK gives me a SIP extension on their Asterisk server for when I work from home. &lt;br /&gt;
I have an Asterisk + FreePBX box at home. &lt;br /&gt;
I wanted to be able to make/receive $WORK calls from home with my existing hard phones. &lt;br /&gt;
I didn&#39;t want to make any changes to $WORK&#39;s Asterisk server.  &lt;/p&gt;

&lt;p&gt;The SIP Extension at $WORK has the following settings:  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;          name&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;hl num&quot;&gt;1234&lt;/span&gt;
      callerid&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; Mick Pollard
   canreinvite&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; No
       context&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; default
      dtmfmode&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; rfc2833
          &lt;span class=&quot;hl kwc&quot;&gt;host&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; dynamic
      insecure&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; No
           nat&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; Yes
          port&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;hl num&quot;&gt;5060&lt;/span&gt;
       qualify&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;hl kwc&quot;&gt;yes&lt;/span&gt;
        secret&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;hl num&quot;&gt;1234&lt;/span&gt;
          &lt;span class=&quot;hl kwb&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; friend
      username&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;hl num&quot;&gt;1234&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;After some time researching it turns out this is not actually that hard. &lt;br /&gt;
The following is to be all done within FreePBX at home.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add a SIP trunk (use the details of your SIP extension on the office asterisk server)  &lt;/li&gt;
&lt;li&gt;Add an outbound route  &lt;/li&gt;
&lt;li&gt;add an inbound route  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Add a SIP Trunk&lt;/h2&gt;

&lt;p&gt;The main difference here is you should leave &quot;USER Context&quot; &amp;amp; &quot;USER Details&quot; blank.  &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/siptrunk1.jpg&quot;&gt;&lt;img src=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/siptrunk1.jpg&quot; width=&quot;594&quot; height=&quot;1043&quot; alt=&quot;SIP Trunk to remote SIP Extension&quot; class=&quot;imgleft&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Add an outbound route:&lt;/h2&gt;

&lt;p&gt;The dial rules used here should be tuned to match the extension prefixes in use at your $WORK. &lt;br /&gt;
We have 4 digit extensions starting with either a 12 or a 22. I have also add a special prefix of &lt;code&gt;9|.&lt;/code&gt; &lt;br /&gt;
which allows me to route a call via $WORK. This is important so that clients get $WORK&#39;s callerID and not my home number !  &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/outboundroute1.jpg&quot;&gt;&lt;img src=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/outboundroute1.jpg&quot; width=&quot;699&quot; height=&quot;510&quot; alt=&quot;Outbound Route for WORK calls&quot; class=&quot;imgleft&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;Add an Inbound Route (optional)&lt;/h2&gt;

&lt;p&gt;I currently have an inbound route that allows any calls to go straight to a queue but you may want to change this. &lt;br /&gt;
You just need to create an inbound route that will match your WORK extension.  &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/inboundroute1.jpg&quot;&gt;&lt;img src=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/inboundroute1.jpg&quot; width=&quot;477&quot; height=&quot;937&quot; alt=&quot;Inbound Route for WORK calls&quot; class=&quot;imgleft&quot; /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You should now be abe to make and receive work calls on your existing phones at home.  &lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/freepbx-sip-trunk-to-sip-extension/#comments</comments>

</item>
<item>

	<title>Installing Graylog2 on Ubuntu Lucid</title>


	<guid>http://www.lunix.com.au/blog/graylog2/</guid>

	<link>http://www.lunix.com.au/blog/graylog2/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>


	<pubDate>Sat, 25 Jun 2011 23:56:19 +1000</pubDate>
	<dcterms:modified>2011-10-15T00:52:36Z</dcterms:modified>

	<description>&lt;h1&gt;Installing Graylog2 via Ubuntu Packages&lt;/h1&gt;

&lt;p&gt;These packages and docs are currently beta. &lt;br /&gt;
The deb&#39;s are built on Ubuntu Lucid amd64 however should work on both i386 &amp;amp; amd64.  &lt;/p&gt;

&lt;p&gt;Please report bugs in this HOWTO or the packaging to me at aussielunix &lt;em&gt;at&lt;/em&gt; gmail &lt;em&gt;dot&lt;/em&gt; com.  &lt;/p&gt;

&lt;h2&gt;graylog2-server&lt;/h2&gt;

&lt;p&gt;This installs graylog2-server and it&#39;s dependencies (mongodb-stable from 10gen) etc. &lt;br /&gt;
The graylog2-server will install all files to  /opt/graylog2-server &amp;amp; a config file at /etc/graylog2..conf. &lt;br /&gt;
Be prepared as the java stuff drags in a lot of deps on a clean minimal Lucid install. (176 packages for me)  &lt;/p&gt;

&lt;p&gt;1) add public key for the 10gen mongo repository  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;key adv &lt;span class=&quot;hl sym&quot;&gt;--&lt;/span&gt;keyserver keyserver.ubuntu.com &lt;span class=&quot;hl sym&quot;&gt;--&lt;/span&gt;recv &lt;span class=&quot;hl num&quot;&gt;7&lt;/span&gt;F0CEB10
&lt;/pre&gt;

&lt;p&gt;2) add public key for the aussielunix (Mick Pollard) PPA&lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;key adv &lt;span class=&quot;hl sym&quot;&gt;--&lt;/span&gt;keyserver keyserver.ubuntu.com &lt;span class=&quot;hl sym&quot;&gt;--&lt;/span&gt;recv D77A4DCC
&lt;/pre&gt;

&lt;p&gt;3) add the following four lines to /etc/apt/sources.list  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;&lt;span class=&quot;hl slc&quot;&gt;# 10-gen&#39;s mongodb repos&lt;/span&gt;
deb http&lt;span class=&quot;hl sym&quot;&gt;://&lt;/span&gt;downloads.mongodb.org&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;distros&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;ubuntu &lt;span class=&quot;hl num&quot;&gt;10.4 10&lt;/span&gt;gen
&lt;span class=&quot;hl slc&quot;&gt;# lunix&#39;s graylog2 debs&lt;/span&gt;
deb http&lt;span class=&quot;hl sym&quot;&gt;://&lt;/span&gt;ppa.lunix.com.au&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;ubuntu&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt; lucid main
&lt;/pre&gt;

&lt;p&gt;4) let apt see the new repositories  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;get update
&lt;/pre&gt;

&lt;p&gt;5) install graylog2-server plus its deps - including java and mongodb  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This will take a while - go make coffee  &lt;/li&gt;
&lt;/ul&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;get &lt;span class=&quot;hl kwc&quot;&gt;install&lt;/span&gt; mongodb&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;stable graylog2&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;server
&lt;/pre&gt;

&lt;p&gt;6) secure mongo - add authentication  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;add an admin user  &lt;/li&gt;
&lt;li&gt;add a user to mongo for collection &#39;graylog2&#39;  &lt;/li&gt;
&lt;/ul&gt;

&lt;pre class=&quot;hl&quot;&gt;lunix&amp;#64;ubuntu&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;dev01&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt;~&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;$ mongo
use admin
db.addUser&lt;span class=&quot;hl sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl str&quot;&gt;&#39;admin&#39;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl str&quot;&gt;&#39;admin-mongo-passwd&#39;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;)&lt;/span&gt;
db.auth&lt;span class=&quot;hl sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl str&quot;&gt;&#39;admin&#39;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl str&quot;&gt;&#39;admin-mongo-passwd&#39;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;)&lt;/span&gt;
use graylog2
db.addUser&lt;span class=&quot;hl sym&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;hl str&quot;&gt;&#39;grayloguser&#39;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;hl str&quot;&gt;&#39;grayloguser-mongo-passwd&#39;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;)&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;7) tell graylog2-server about the mongo auth  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;edit /etc/graylog2.conf&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class=&quot;hl&quot;&gt;mongodb_useauth &lt;span class=&quot;hl sym&quot;&gt;=&lt;/span&gt; true
mongodb_user &lt;span class=&quot;hl sym&quot;&gt;=&lt;/span&gt; grayloguser
mongodb_password &lt;span class=&quot;hl sym&quot;&gt;=&lt;/span&gt; p4ssw0rd
&lt;/pre&gt;

&lt;p&gt;8) turn mongo security on - it&#39;s off by default  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;edit &lt;em&gt;/etc/mongodb.conf&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;pre class=&quot;hl&quot;&gt;auth &lt;span class=&quot;hl sym&quot;&gt;=&lt;/span&gt; true
&lt;/pre&gt;

&lt;p&gt;9) restart mongo&lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo service mongodb restart
&lt;/pre&gt;

&lt;p&gt;10)  start graylog2-server  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo service graylog2&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;server start
&lt;/pre&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;You should now have a working graylog2-server. &lt;br /&gt;
You can check the process tree for a mongodb instance and a java instance and that port UDP/514 is open. &lt;br /&gt;
You can now modify the syslog config on the graylog2-server host to send its data to 127.0.0.1:514 &lt;br /&gt;
Move on to graylog2-web install/configure now.  &lt;/p&gt;

&lt;h2&gt;graylog2-web&lt;/h2&gt;

&lt;p&gt;This installs graylog2-web and some of it&#39;s dependencies. &lt;br /&gt;
The graylog2-web package will install all of it&#39;s files to /opt/graylog2-web. &lt;br /&gt;
All of the gem dependencies have been vendored in. &lt;br /&gt;
The version of rubygems is too old in the Lucid repositories so I make use of a thirdparty PPA. &lt;br /&gt;
This PPA is from Mackenzie Morgan - a Ubuntu Developer - https://launchpad.net/~maco.m/+archive/ruby  &lt;/p&gt;

&lt;p&gt;1) add Mackenzie&#39;s PPA  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;get &lt;span class=&quot;hl kwc&quot;&gt;install&lt;/span&gt; python&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;software&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;properties
sudo add&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;repository ppa&lt;span class=&quot;hl sym&quot;&gt;:&lt;/span&gt;maco.m&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;ruby
&lt;/pre&gt;

&lt;p&gt;2) let apt see the new repositories  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;get update
&lt;/pre&gt;

&lt;p&gt;3) install graylog2-web  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo apt&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;get &lt;span class=&quot;hl kwc&quot;&gt;install&lt;/span&gt; graylog2&lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;web
&lt;/pre&gt;

&lt;p&gt;4) install budler  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;sudo gem &lt;span class=&quot;hl kwc&quot;&gt;install&lt;/span&gt; bundler
&lt;/pre&gt;

&lt;p&gt;5) review/edit some rails configs:  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;config&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;mongoid.yml
confg&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;email.yml
config&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;general.yml
&lt;/pre&gt;

&lt;p&gt;6) start graylog2-web as a daemon  &lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;&lt;span class=&quot;hl kwc&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;/&lt;/span&gt;rails server &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;eproduction &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;d &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;p3000
&lt;/pre&gt;

&lt;h3&gt;Conclusion&lt;/h3&gt;

&lt;p&gt;You should now have a working graylog2 server &amp;amp; web.  &lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/graylog2/#comments</comments>

</item>
<item>

	<title>A sane Varnish version for Ubuntu Hardy</title>


	<guid>http://www.lunix.com.au/blog/sane_varnish_on_hardy/</guid>

	<link>http://www.lunix.com.au/blog/sane_varnish_on_hardy/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>


	<pubDate>Sat, 18 Sep 2010 10:51:10 +1000</pubDate>
	<dcterms:modified>2010-09-18T00:51:10Z</dcterms:modified>

	<description>&lt;p&gt;With Hardy getting a bit long in the tooth so are the versions of software. &lt;br /&gt;
Recently a client has tasked me to add varnish to their existing wordpress cluster. &lt;br /&gt;
The servers they are using are all Ubuntu Hardy and the version of Varnish in the repos is ancient (1.0.3-2) &lt;br /&gt;
It turns out it&#39;s not that hard to build a .deb of a more modern version of Varnish. &lt;br /&gt;
The following GIST shows the simple steps I used to build a Ubuntu package of Varnish 2.0.6.  &lt;/p&gt;

&lt;script src=&quot;http://gist.github.com/585194.js&quot;&gt;&lt;/script&gt;
</description>


	<comments>http://www.lunix.com.au/blog/sane_varnish_on_hardy/#comments</comments>

</item>
<item>

	<title>Funny tech support email No.1</title>


	<guid>http://www.lunix.com.au/blog/Funny_tech_support_email_No.1/</guid>

	<link>http://www.lunix.com.au/blog/Funny_tech_support_email_No.1/</link>


	<category>tags/general</category>

	<category>tags/humour</category>

	<category>tags/sysadmin</category>


	<pubDate>Fri, 30 Jul 2010 08:34:15 +1000</pubDate>
	<dcterms:modified>2010-07-29T23:37:27Z</dcterms:modified>

	<description>&lt;h2&gt;Funny Tech Support Email Number 1&lt;/h2&gt;

&lt;p&gt;In the late 1990&#39;s we purchased a few small ISP&#39;s and whilst auditing their old servers (terrible mess) I come across this beauty. &lt;br /&gt;
I thought I&#39;d share this, plus &lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../blog/Funny_tech_support_email_No.2/&quot;&gt;one&lt;/a&gt; other, from another ISP, I found for this years System Administrator&#39;s Appreciation Day. &lt;br /&gt;
They both made me laugh back then and still make me laugh today. Oh how I miss the days of ISP land.  &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/dear_root.jpg&quot;&gt;&lt;img src=&quot;http://www.lunix.com.au/tags/sysadmin/../../blog/Funny_tech_support_email_No.1/800x600-dear_root.jpg&quot; width=&quot;612&quot; height=&quot;600&quot; alt=&quot;dear root&quot; class=&quot;imgleft&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/Funny_tech_support_email_No.1/#comments</comments>

</item>
<item>

	<title>Funny tech support email No.2</title>


	<guid>http://www.lunix.com.au/blog/Funny_tech_support_email_No.2/</guid>

	<link>http://www.lunix.com.au/blog/Funny_tech_support_email_No.2/</link>


	<category>tags/general</category>

	<category>tags/humour</category>

	<category>tags/sysadmin</category>


	<pubDate>Fri, 30 Jul 2010 08:34:15 +1000</pubDate>
	<dcterms:modified>2010-07-29T23:34:52Z</dcterms:modified>

	<description>&lt;h2&gt;Funny Tech Support Email Number 2&lt;/h2&gt;

&lt;p&gt;In the mid 2000&#39;s whilst working at an ISP the following email arrived. &lt;br /&gt;
It gave us all a good laugh at the time and today I share with you all for System&#39;s Administrator Appreciation Day.  &lt;/p&gt;

&lt;p&gt;&lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../images/dear_hackers.jpg&quot;&gt;&lt;img src=&quot;http://www.lunix.com.au/tags/sysadmin/../../blog/Funny_tech_support_email_No.2/800x600-dear_hackers.jpg&quot; width=&quot;446&quot; height=&quot;600&quot; alt=&quot;dear hacker&quot; class=&quot;imgleft&quot; /&gt;&lt;/a&gt;&lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/Funny_tech_support_email_No.2/#comments</comments>

</item>
<item>

	<title>Self Serve Dev Environment</title>


	<guid>http://www.lunix.com.au/blog/SelfServeDevEnvironment/</guid>

	<link>http://www.lunix.com.au/blog/SelfServeDevEnvironment/</link>


	<category>tags/devops</category>

	<category>tags/general</category>

	<category>tags/sysadmin</category>


	<pubDate>Sat, 24 Jul 2010 17:12:11 +1000</pubDate>
	<dcterms:modified>2010-07-24T07:37:30Z</dcterms:modified>

	<description>&lt;h1&gt;Introduction&lt;/h1&gt;

&lt;p&gt;I am currently working in a web development shop. We develop and maintain a range of websites/webapps for customers. &lt;br /&gt;
At $WORK we have many varied customers each with their own unique Production Environments (&lt;em&gt;PE from here on in&lt;/em&gt;). &lt;br /&gt;
Our $DEVs are also free to run any *nix based OS on their workstations. &lt;br /&gt;
One of the challeges we have had in the past is making a copy of a customer&#39;s PE easily available to our $DEVS. &lt;br /&gt;
This used to require lodging a task in Redmine and waiting for a Systems Admin to build you a VM on a central VM server. &lt;br /&gt;
This post will show how we are now using common FOSS tools to give enable to $DEVS to have VM&#39;s on their own workstations that mimick a customer&#39;s PE.  &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Whilst I make mention of some specific tools in this post they can be swapped out in most places for alternates however I have not tested the &lt;br /&gt;
alternatives yet. ie: puppet/chef, mercurial/git, centos/ubuntu.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;Notes on the Challenge&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;needs to be simple not an obsticle - if it&#39;s slower than just getting a sysadmin to build it for you then its a fail  &lt;/li&gt;
&lt;li&gt;simplicity generally means easy to fix when something goes wrong in the wheel.&lt;/li&gt;
&lt;li&gt;self-serve - no waiting for sysadmins &lt;/li&gt;
&lt;li&gt;visability - everything in DVCS and &lt;a href=&quot;http://redmine.org&quot;&gt;Redmine&lt;/a&gt; (project managent software)  &lt;/li&gt;
&lt;li&gt;needed to be repeatable - $DEVs needed to easily be able to build, destroy and build again  &lt;/li&gt;
&lt;li&gt;relatively self documenting - read the kickstart or puppet manifests  &lt;/li&gt;
&lt;li&gt;I hate OS images - They&#39;re big, cumbersome and pain in my..err..storage  &lt;a href=&quot;http://madstop.com/2009/02/04/golden-image-or-foil-ball/&quot; title=&quot;Luke Kanies&quot;&gt;See - Golden Image or Foil Ball?&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;After spending a fair amount of time on this and looking at many of the VM/cloud management solutions out there I have decided that while some are very nice and useful I do not believe they are suiteable for our situation. Most VM/cloud management tools are built around the &quot;OS Image&quot; and require each workstation to &#39;register&#39; as a &lt;em&gt;node&lt;/em&gt;.    &lt;/p&gt;

&lt;h1&gt;Current solution&lt;/h1&gt;

&lt;p&gt;After doing the full circle of research we are now using a simple collection of existing tools. &lt;br /&gt;
It was all there staring me in the face all along. &lt;em&gt;Libvirt, virt-install kickstart puppet, mercurial and a wiki entry.&lt;/em&gt; 
A $DEV just needs to make sure he/she has libvirt, virt-install, virt-viewer installed. &lt;br /&gt;
We are using KVM to provide the virtualisation layer but through the use of libvirt you should be able to use any libvirt compatible virtualisation provider.(virtual box etc)  &lt;/p&gt;

&lt;h2&gt;Technologies used&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;a httpd server (nginx, apache etc) - to serve kickstart + yum repos/mirror  &lt;/li&gt;
&lt;li&gt;Own yum repos + centos mirror ( again ubuntu mirror etc )  &lt;/li&gt;
&lt;li&gt;puppetmasterd ( or other CF tool ie: chef etc )  with autosign turned on (we have a separate puppetmaser for the $DEVS)  &lt;/li&gt;
&lt;li&gt;some kickstart files - I use one per customer and bootstrap puppet from the %POST section  &lt;/li&gt;
&lt;li&gt;libvirtd + KVM/qemu - could be any supported virtualisation software supported by libvirt  &lt;/li&gt;
&lt;li&gt;python-virtinst + virt-viewer&lt;/li&gt;
&lt;li&gt;dhcpd  &lt;/li&gt;
&lt;li&gt;forward and reverse dns - puppet will fail to work as expected without it  ( I use powerdns-recursor for demos as it exports /etc/hosts )&lt;/li&gt;
&lt;li&gt;redmine - we make use of Redmine&#39;s ACL&#39;s to visualize the repos for puppet and kickstart files per customer&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;Devs&lt;/h2&gt;

&lt;p&gt;The following is the steps needed for a $DEV to deploy a customer&#39;s &lt;em&gt;PE&lt;/em&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Check &lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../SelfServeDevEnvironment/network/&quot;&gt;network&lt;/a&gt; page and grab an available network &lt;em&gt;mac&lt;/em&gt; to use (this is used for dhcp &amp;amp; dns so puppet works properly) &lt;br /&gt;
and the name of the customers kickstart file.  &lt;/li&gt;
&lt;li&gt;update wiki page to say that &lt;em&gt;network mac&lt;/em&gt; is in use.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;deploy a VM on their workstation. - See &lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../SelfServeDevEnvironment/libvirt/&quot;&gt;Libvirt tips&lt;/a&gt;  &lt;/p&gt;

&lt;p&gt;virt-install --connect qemu:///system --accelerate -n  virt01 -m 54:52:00:37:2E:B9 -r 1024 --vcpus=1 --disk pool=lvm,bus=virtio,size=20 --vnc --os-type linux --os-variant=rhel5 --network=network:default -l http://192.168.1.250/os/CentOS/5.5/os/x86_64/ -x &quot;ks=http://192.168.1.250/ks/project_customer1.ks&quot;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;This will take advantage of the fact that both CentOS and Ubuntu have the necessary PXE files stored in their mirrors for booting the installer.&lt;/em&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;wait approx 10 or so minutes and they have a clone of the customer&#39;s &lt;em&gt;PE&lt;/em&gt; on their workstation ready to deploy to and hack on.  &lt;em&gt;see notes in conclusion below&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;New customers&lt;/h2&gt;

&lt;p&gt;The following is what&#39;s involved in preparing for a new customer:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A new customer has a VM/server provisioned in a DC by a hosting company.&lt;/li&gt;
&lt;li&gt;I grab the current package list and make a &lt;a href=&quot;http://www.lunix.com.au/tags/sysadmin/../../SelfServeDevEnvironment/ExampleKickstartFile/&quot;&gt;kickstart&lt;/a&gt; file to replicate the install locally&lt;/li&gt;
&lt;li&gt;Create a new &lt;code&gt;project_customer3&lt;/code&gt; in puppet and add details to bottom of the new kickstart file.&lt;/li&gt;
&lt;li&gt;publish new kickstart file and update wiki entry&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;Conclusion&lt;/h1&gt;

&lt;p&gt;I have reduced the time it takes for a dev to get a copy of a customers &lt;em&gt;PE&lt;/em&gt; down from days to minutes and its now a self serve solution. &lt;br /&gt;
There is still more to refine in this but it&#39;s already full of win as I now get to do more of &#39;stuff that matters&#39;  &lt;/p&gt;

&lt;p&gt;It&#39;s early days for us using this new setup and I am yet to work out an easy, effective way of notifying a $DEV when puppet has finished the buildout. Suggestions welcome.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;cucumber tests ?&lt;/li&gt;
&lt;li&gt;using libnotify via Dbus ? ( suggestion made at a recent &lt;a href=&quot;http://groups.google.com/group/devops-aus&quot; title=&quot;DevOps Sydney&quot;&gt;DevOps Sydney&lt;/a&gt; meetup )&lt;/li&gt;
&lt;li&gt;??&lt;/li&gt;
&lt;/ul&gt;
</description>


	<comments>http://www.lunix.com.au/blog/SelfServeDevEnvironment/#comments</comments>

</item>
<item>

	<title>openssh and X11 forwarding</title>


	<guid>http://www.lunix.com.au/blog/openssh-and-x11-forwarding/</guid>

	<link>http://www.lunix.com.au/blog/openssh-and-x11-forwarding/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>

	<category>tags/tips</category>


	<pubDate>Thu, 29 Jan 2009 22:17:00 +1100</pubDate>
	<dcterms:modified>2009-01-29T11:17:00Z</dcterms:modified>

	<description>&lt;p&gt;Occasionally you may come across times where you need to run an X application on a remote, headless server. &lt;br /&gt;
Today was one of those occasions for me. &lt;br /&gt;
Installing xorg etc to add X to the server is a reasonable amount of work and not really a choice. &lt;br /&gt;
openssh has an option to tunnel X11 connections and auto setup the $DISPLAY environment variable on the remote host. &lt;br /&gt;
This can be done either on the fly with a switch to the ssh client or a permenant setup by changing the config file for openssh.  &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[lunix@godzilla ~]&amp;#036; ssh -Y admin@10.20.1.254
admin@10.20.1.254&#39;s password:
Last login: Fri Jan 30 00:22:23 2009 from dynamic-20.home.lunix.com.au
/usr/bin/xauth:  creating new authority file /home/admin/.Xauthority
[admin@gateway01 ~]&amp;#036; echo &amp;#036;DISPLAY
localhost:10.0
[admin@gateway01 ~]&amp;#036;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This extract of ~/.ssh/config shows how to make the X11 forwarding more permenant.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Host remotehost
ForwardX11 yes
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Once this has been done and the $DISPLAY env. variable is set you should be able to fire up an application that displays its output via X.  &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[lunix@godzilla ~]&amp;#036; wireshark
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;This will then fire up wireshark sending its output to X via localhost:10.0 which will tunnel it across ssh to your local screen. &lt;br /&gt;
Remeber this may be a bit slower than running it locally but it works.&lt;/p&gt;

&lt;p&gt;I ran into problems this morning the first time I logged in with ssh -Y with the $DISPLAY env variable not being set. &lt;br /&gt;
To diagnose this I retried the ssh command with the extra options of -vv. Here is a snippet of the output.  &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;[lunix@godzilla ~]&amp;#036; ssh -vv -Y admin@10.20.1.254
admin@10.20.1.254&#39;s password:
...
debug2: x11_get_proto: /usr/bin/xauth  list :0 2&amp;gt;/dev/null
debug1: Requesting X11 forwarding with authentication spoofing.
..
..
debug1: Remote: No xauth program; cannot forward with spoofing.
..
Last login: Fri Jan 30 06:48:28 2009 from dynamic-20.home.lunix.com.au
[admin@gateway01 ~]&amp;#036; echo &amp;#036;DISPLAY

[admin@gateway01 ~]&amp;#036;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;$DISPLAY wasn&#39;t set. In my case the debug1: line mentioning a missing xauth program was the problem. &lt;br /&gt;
A simple &lt;em&gt;yum install xorg-x11-xauth&lt;/em&gt; fixed this. ( centos 5 )&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/openssh-and-x11-forwarding/#comments</comments>

</item>
<item>

	<title>Usefull strace primer</title>


	<guid>http://www.lunix.com.au/blog/usefull-strace-primer/</guid>

	<link>http://www.lunix.com.au/blog/usefull-strace-primer/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>

	<category>tags/tips</category>


	<pubDate>Fri, 09 Jan 2009 15:09:00 +1100</pubDate>
	<dcterms:modified>2009-01-09T04:09:00Z</dcterms:modified>

	<description>&lt;p&gt;&lt;em&gt;I&#39;m posting this here for both future use by myself and in the hope it&#39;s usefull to anyone else.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Have you ever racked your brain to find that bug? You know, the bug that you can&#39;t find in the source code, &lt;br /&gt;
but which appears with deliberate consistency when your code is compiled and run. &lt;br /&gt;
Hacker, meet &lt;strong&gt;strace&lt;/strong&gt;. &lt;br /&gt;
strace is a utility that allows you to trace system calls and signals for a given command and its arguments. &lt;/p&gt;

&lt;p&gt;Full article is over at the &lt;a href=&quot;http://www.redhat.com/magazine/010aug05/features/strace/&quot;&gt;Redhat Magazine&lt;/a&gt;&lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/usefull-strace-primer/#comments</comments>

</item>
<item>

	<title>Simple portscanning with bash and netcat</title>


	<guid>http://www.lunix.com.au/blog/simple-portscanning-with-bash-and-netcat/</guid>

	<link>http://www.lunix.com.au/blog/simple-portscanning-with-bash-and-netcat/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>

	<category>tags/tips</category>


	<pubDate>Wed, 31 Dec 2008 12:05:00 +1100</pubDate>
	<dcterms:modified>2008-12-31T01:05:00Z</dcterms:modified>

	<description>&lt;p&gt;Today I was presented with the need to find all the machines on a network that have port 22 open. &lt;br /&gt;
This can easily be achieved with nmap.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;sudo nmap -sS -p22 192.168.1.0/24
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;However the only box I had was a &#39;linux router&#39; with a minimalistic linux install and no access to install extra packages. &lt;br /&gt;
What I ended up using was a very simple shell script with nothing more than a for loop and netcat.&lt;/p&gt;

&lt;pre class=&quot;hl&quot;&gt;    &lt;span class=&quot;hl slc&quot;&gt;#!/bin/bash&lt;/span&gt;
    &lt;span class=&quot;hl kwa&quot;&gt;for&lt;/span&gt; h &lt;span class=&quot;hl kwa&quot;&gt;in&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;hl num&quot;&gt;2&lt;/span&gt;.&lt;span class=&quot;hl num&quot;&gt;.254&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;};&lt;/span&gt;
    &lt;span class=&quot;hl kwa&quot;&gt;do&lt;/span&gt;
            nc &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;z &lt;span class=&quot;hl num&quot;&gt;192.168.111&lt;/span&gt;.&lt;span class=&quot;hl kwb&quot;&gt;$h&lt;/span&gt; &lt;span class=&quot;hl num&quot;&gt;22&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;hl kwa&quot;&gt;if&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;[&lt;/span&gt; $? &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;eq &lt;span class=&quot;hl num&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;];&lt;/span&gt; &lt;span class=&quot;hl kwa&quot;&gt;then&lt;/span&gt;
                    &lt;span class=&quot;hl kwb&quot;&gt;echo&lt;/span&gt; &lt;span class=&quot;hl sym&quot;&gt;-&lt;/span&gt;e &lt;span class=&quot;hl str&quot;&gt;&amp;quot;192.168.111.$h&lt;/span&gt;&lt;span class=&quot;hl esc&quot;&gt;\n&lt;/span&gt;&lt;span class=&quot;hl str&quot;&gt;&amp;quot;&lt;/span&gt;&lt;span class=&quot;hl sym&quot;&gt;;&lt;/span&gt;
            &lt;span class=&quot;hl kwa&quot;&gt;fi&lt;/span&gt;
    &lt;span class=&quot;hl kwa&quot;&gt;done&lt;/span&gt;
&lt;/pre&gt;

&lt;p&gt;The -z flag to nc ( netcat ) tells it &#39;no io&#39; then I just test for the exit code it gives. &lt;br /&gt;
Simple. &lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/simple-portscanning-with-bash-and-netcat/#comments</comments>

</item>
<item>

	<title>Postfix, UCE and helo_checks</title>


	<guid>http://www.lunix.com.au/blog/helo_checks/</guid>

	<link>http://www.lunix.com.au/blog/helo_checks/</link>


	<category>tags/general</category>

	<category>tags/sysadmin</category>


	<pubDate>Mon, 10 Mar 2008 14:16:00 +1100</pubDate>
	<dcterms:modified>2008-03-10T03:16:00Z</dcterms:modified>

	<description>&lt;p&gt;As anyone that uses email will know, UCE/junk mail is coming in thick and fast.&lt;/p&gt;

&lt;p&gt;One quick setting in postfix ( presumably you can do this with other smtpd servers but I will only show postfix ) &lt;br /&gt;
that cut down the amount of UCE arriving at my inbox was the postfix main.cf entry:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;smtpd_recipient_restrictions =....&amp;lt;snip&amp;gt;check_helo_access hash:/etc/postfix/helo_checks  
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Add that entry to your main.cf file then create an ASCII (text) file called helo_check with content similiar to below.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;localhost                       REJECT You are not me
123.123.123.123                 REJECT You are not me
host.example.com                REJECT You are not me
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Don&#39;t forget to issue a postmap on the helo_checks file. &lt;br /&gt;
Any mail server helo&#39;ing to your server now with your ip, hostname or localhost will be rejected before its even allowed to send you mail/UCE.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;Mar  9 04:50:20 scrappy postfix/smtpd[28556]: connect from 122-124-139-172.dynamic.hinet.net[122.124.139.172]
Mar  9 04:50:22 scrappy postfix/smtpd[28556]: NOQUEUE: reject: RCPT from 122-124-139-172.dynamic.hinet.net[122.124.139.172]: 554 5.7.1 &amp;lt;123.123.123.123&amp;gt;:
........................Helo command rejected: You are not me; from=&amp;lt;hi7188s.pp5975@msa.hinet.net&amp;gt; to=&amp;lt;zz@mail2000.com.tw&amp;gt; proto=SMTP helo=&amp;lt;123.123.123.123&amp;gt;
Mar  9 04:50:22 scrappy postfix/smtpd[28556]: lost connection after RCPT from 122-124-139-172.dynamic.hinet.net[122.124.139.172]
Mar  9 04:50:22 scrappy postfix/smtpd[28556]: disconnect from 122-124-139-172.dynamic.hinet.net[122.124.139.172]
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Whilst I have no exact figures as to how much UCE this has stopped I can say it has made a noticeable difference.  &lt;/p&gt;
</description>


	<comments>http://www.lunix.com.au/blog/helo_checks/#comments</comments>

</item>

</channel>
</rss>

