<?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>Lazy clouds &#187; Linux related</title>
	<atom:link href="http://www.danielbond.org/archives/category/linux/feed" rel="self" type="application/rss+xml" />
	<link>http://www.danielbond.org</link>
	<description>Just another grumpy admin</description>
	<lastBuildDate>Sat, 31 Oct 2009 19:10:04 +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>Creating a secure debian repository</title>
		<link>http://www.danielbond.org/archives/114</link>
		<comments>http://www.danielbond.org/archives/114#comments</comments>
		<pubDate>Mon, 19 Oct 2009 21:55:38 +0000</pubDate>
		<dc:creator>Daniel Bond</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://www.danielbond.org/?p=114</guid>
		<description><![CDATA[Debian apt repositories can be made in so many ways, but they are really easy to set up, really. To demonstrate it, we will be creating a simple meta-package, so we have something to put in the repository. This will also demonstrate how easy it is to build meta-packages in Debian.
Creating a meta-package
We will be [...]]]></description>
			<content:encoded><![CDATA[<p>Debian apt repositories can be made in so many ways, but they are really easy to set up, really. To demonstrate it, we will be creating a simple meta-package, so we have something to put in the repository. This will also demonstrate how easy it is to build meta-packages in Debian.</p>
<h2>Creating a meta-package</h2>
<p>We will be creating a meta-package today, because this is one of simplest kind of packages to create, and can be extremely useful for installing a bunch of other packages. I want to create a package I can install, that will let me communicate in the modern world. I think I&#8217;ll call it &#8220;danny-talkfoo&#8221;.</p>
<p>I create my packages in <strong><em>~/packages/sources</em><span style="font-weight: normal;">, so I will create a new folder in there for my new meta-package. Package directories have a folder that contain information, and customization to the package, this folder is named </span><em>DEBIAN</em><span style="font-weight: normal;">. For our talkfoo-danny package, we only need a single file, </span><em>~/packages/sources/danny-talkfoo/DEBIAN/control</em><span style="font-weight: normal;">. This is the contents of my control file:</span></strong></p>
<p><strong><span style="font-weight: normal;"> </span></strong></p>
<p><strong> </strong></p>
<p><strong> </strong></p>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Package: mailnode-nsn</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Version: 0.1</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Section: main</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Priority: optional</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Architecture: all</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Depends: postfix, ssh, ntp</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Maintainer: NSN ASA</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">Description: A metapackage for a NSN Mailserver node</div>
<div id="_mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow-x: hidden; overflow-y: hidden;">This package includes mailserver, antispam software, configuration, and other packages required for running on our mailcluster., and other packages required for running on our mailcluster., and other packages required for running on our mailcluster., and other packages required for running on our mailcluster.</div>
<blockquote>
<pre>Package: danny-talkfoo
Version: 0.1
Section: main
Priority: optional
Architecture: all
Depends: irssi, irssi-fish, mutt, mutt-patched, muttprint, gnupg
Maintainer: Daniel Bond
Description: A metapackage for Dannys usual communication tools (irc, mail)
 This package includes the mailclient mutt with some addons, gnupg for
email encryption, and irssi for Internet Relay Chat</pre>
</blockquote>
<p>And thats it. The important points here are:</p>
<ul>
<li><strong>Depends</strong> &#8211; Describes what packages this package are required. This is what makes our meta-package do anything when installed.</li>
<li><strong>Long description</strong> &#8211; Note how the last line is prefixed with a single space, it means it&#8217;s the start of the long package description.</li>
<li><strong>Version</strong> &#8211; If you change the package, increase the version, so people using it will see the updates.</li>
</ul>
<p>To create the package, simply type the following commands:</p>
<blockquote>
<pre># cd ~/packages/sources
# dpkg -b danny-talkfoo
# dpkg-deb: building package `danny-talkfoo' in `danny-talkfoo.deb'.</pre>
</blockquote>
<p>Cool, that was easy! Let&#8217;s continue to creating our own repository.</p>
<h2>Creating a repository</h2>
<p>I presume that you are familiar with Gnu Privacy Guard (GnuPG/GPG). Apt-repositories are normally signed with GnuPG, to verify the package provider. Strictly speaking, it is not necessary to sign your repository with GPG, but it is very good practice &#8211; and apt will complain if you don&#8217;t.</p>
<p>The GnuPG commands you need to know are:</p>
<ul>
<li><a title="Create your own GPG Key" href="http://www.cyberciti.biz/tips/linux-how-to-create-our-own-gnupg-privatepublic-key.html" target="_blank">gpg &#8211;gen-key</a></li>
<li>gpg &#8211;export -a</li>
</ul>
<p>Once you have created the key you want to sign packages as, you will need the following packages, to create the repository:</p>
<ul>
<li>lighttpd</li>
<li><strong>reprepro</strong></li>
</ul>
<p>In your <em><strong>~/packages</strong><span style="font-style: normal;"> directory, create the following folders:</span></em></p>
<blockquote>
<pre><em><span style="font-style: normal;"># mkdir repo
# cd repo
# mkdir conf incoming</span></em></pre>
</blockquote>
<p>Ok, you are doing well! Good job! <img src='http://www.danielbond.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  We need to configure reprepro, to understand our setup. Create the following configuration file in <em><strong>~/packages/repo/conf/distributions</strong><span style="font-style: normal;">:</span></em></p>
<blockquote>
<pre>Origin: http://www.danielbond.org
Label: Bond's apt repository
Suite: stable
Codename: lenny
Architectures: amd64 i386
Components: main
Description: A selection of meta-packages, free to use, without charge!
SignWith: your-gpg-identity@yourdomain.org</pre>
</blockquote>
<p>If you want to host several Debian releases, copy-paste this entry in the distributions-file, and change &#8220;codename&#8221; for each entry, to the appropriate value.</p>
<h2>Populating the repository</h2>
<p>For now we will just be adding the simple package we created earlier. Reprepro maintains database files over what it&#8217;s indexed in the repository, make sure to use the reprepro interface to maintain your repository (removing or replacing files, ie), to keep your repository healthy. To add the package, type:</p>
<blockquote>
<pre># cd ~/packages
# reprepro -b ./repo includedeb lenny ./sources/danny-talkfoo.deb
 exporting indicies...
#</pre>
</blockquote>
<p>Reprepro has no populated <em><strong>~/packages/repo/dists</strong><span style="font-style: normal;"> and <strong><em>~/packages/repo/poo</em></strong>l with files for us to publish in our repository. We can now create a network apt-mirror, using FTP or HTTP, etc. I will just be using a simple webserver, lighttpd, but any old webserver would do. </span></em></p>
<h2><em><span style="font-style: normal;">Publishing the repository with Lighty</span></em></h2>
<blockquote>
<pre><em><span style="font-style: normal;"># cd /var/www &amp;&amp; rm /var/www/index.lighttpd.html
# ln -s /home/db/packages/repo/dists/
# ln -s /home/db/packages/repo/pool/
# if ! grep dir-listing.show-header /etc/lighttpd/lighttpd.conf
    then echo "dir-listing.show-header = \"enable\"" &gt;&gt; /etc/lighttpd/lighttpd.conf
 fi
# /etc/inet.d/lighttpd reload
# cat &lt;&lt; EOF &gt; /var/www/HEADER.txt</span></em></pre>
<pre><em><span style="font-style: normal;">&gt; Danny debian packages
&gt; =====================
&gt;
&gt; The GPG key can be imported from http://keys.yourdomain.com/mainrepo.gpg.
&gt; EOF 
# gpg --export -a "your-gpg-identity@yourdomain.org" &gt; /var/www/mainrepo.gpg</span></em></pre>
</blockquote>
<p><em><span style="font-style: normal;">Now you can add your repository to apt! </span></em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.danielbond.org/archives/114/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Irssi-FiSH on 64bit version of Debian 5.0 (lenny)</title>
		<link>http://www.danielbond.org/archives/99</link>
		<comments>http://www.danielbond.org/archives/99#comments</comments>
		<pubDate>Sun, 07 Jun 2009 20:15:20 +0000</pubDate>
		<dc:creator>Daniel Bond</dc:creator>
				<category><![CDATA[Debian]]></category>

		<guid isPermaLink="false">http://www.danielbond.org/?p=99</guid>
		<description><![CDATA[My old laptop running FreeBSD7.2 (which I used for IRC), had heat-related issues &#8211; so I moved it to a lenny domU (Running on my NetBSD5 Xen dom0). I quickly noticed there was no package for irssi-fish, and decided to create one. It involved a bit of fiddeling, but compiled fine in the end.
Apparently, Irssi-FiSH [...]]]></description>
			<content:encoded><![CDATA[<p>My old laptop running FreeBSD7.2 (which I used for IRC), had heat-related issues &#8211; so I moved it to a lenny domU (Running on my NetBSD5 Xen dom0). I quickly noticed there was no package for irssi-fish, and decided to create one. It involved a bit of fiddeling, but compiled fine in the end.</p>
<p>Apparently, Irssi-FiSH version 1.x works better on amd64 platform. Therefor I went with the 1-RC5 (release candidate 5) version of it instead.</p>
<p>To make FiSH compile, you need to build MIRACL first, then copy miracl.a to the directory with FiSH source in it. You will have to tweak MIRACL and irssi&#8217;s Makefile&#8217;s, to make sure everything is being built with GCC-flag &#8220;-fPIC&#8221;, so the shared libraries will succeed.</p>
<p>When writing this article, I learned how to make a &#8220;secure apt repository&#8221;. I&#8217;ll try to keep it up to date, with the latest irssi-fish.</p>
<h2>Binary package</h2>
<p>If you are lazy like me, and just want something that works, do the following:</p>
<blockquote><p># wget http://www.danielbond.org/DB-GPG.asc<br />
# apt-key add DB-GPG.asc<br />
# gpg &#8211;import DB-GPG.asc<br />
# rm DB-GPG.asc<br />
# echo &#8216;deb http://www.danielbond.org/debian/ lenny main&#8217; &gt;&gt; /etc/apt/sources.list<br />
# aptitude update &amp;&amp; aptitude install irssi-fish</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.danielbond.org/archives/99/feed</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>LDAP group support for lighttpd</title>
		<link>http://www.danielbond.org/archives/19</link>
		<comments>http://www.danielbond.org/archives/19#comments</comments>
		<pubDate>Mon, 18 May 2009 20:34:40 +0000</pubDate>
		<dc:creator>Daniel Bond</dc:creator>
				<category><![CDATA[Linux related]]></category>
		<category><![CDATA[Unix related]]></category>

		<guid isPermaLink="false">http://danielbond.org/wordpress/?p=19</guid>
		<description><![CDATA[I wrote a patch a while back, for lighttpd to support group-authentication. I&#8217;m just importing the entries from my old site, into this new one.
The way I use it, is by storing a groupOfNames-object in directory, which includes the DN&#8217;s I want to give access to. Here is an example object:
dn: cn=apacheadmins,ou=groups,dc=danielbond,dc=org
cn: apacheadmins
objectClass: groupOfNames
member: uid=danielb,ou=admins,ou=people,dc=danielbond,dc=org
member: [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a patch a while back, for lighttpd to support group-authentication. I&#8217;m just importing the entries from my old site, into this new one.</p>
<p>The way I use it, is by storing a groupOfNames-object in directory, which includes the DN&#8217;s I want to give access to. Here is an example object:</p>
<blockquote><p>dn: cn=apacheadmins,ou=groups,dc=danielbond,dc=org<br />
cn: apacheadmins<br />
objectClass: groupOfNames<br />
member: uid=danielb,ou=admins,ou=people,dc=danielbond,dc=org<br />
member: uid=agent007,ou=outsourced,ou=people,dc=danielbond,dc=org</p></blockquote>
<p>Then in my lighttpd configuration, I would include this group, in the list of allowed contexts:</p>
<blockquote><p>auth.require = {<br />
  &#8221;/&#8221; =&gt; {<br />
    &#8221;method&#8221; =&gt; &#8220;basic&#8221;,<br />
    &#8221;realm&#8221; =&gt; &#8220;MI6 Agent login&#8221;,<br />
    &#8221;require&#8221; =&gt; &#8220;group=cn=apacheadmins,ou=groups,dc=danielbond,dc=org|user=coolguy|cn=awesome people,ou=groups,dc=danielbond,dc=org&#8221;<br />
  } <br />
}</p></blockquote>
<p> The patch can be downloaded here: <a title="lighttpd-http_auth.c-ldap_group.diff" href="/patches/lighttpd-http_auth.c-ldap_group.diff">lighttpd-http_auth.c-ldap_group.diff</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.danielbond.org/archives/19/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
