<?xml version="1.0" encoding="utf-8"?>
        <?xml-stylesheet type="text/css" href="http://sysphere.org/~anrxc/j/styles/feed.css"?>
<rss version="2.0"
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:admin="http://webns.net/mvcb/"
 xmlns:atom="http://www.w3.org/2005/Atom"
>
<channel>
<title>Unknown and partly hidden</title>
<atom:link href="http://sysphere.org/~anrxc/j/rss.xml" rel="self" type="application/rss+xml" />
<link>http://sysphere.org/~anrxc/j</link>
<description>journal of Adrian C. (anrxc)</description>
<dc:language>en-us</dc:language>
<dc:creator>anrxc</dc:creator>
<dc:date>2011-11-06T00:17:11+01:00</dc:date>
<admin:generatorAgent rdf:resource="http://nanoblogger.sourceforge.net" />

<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/11/06/pulling_strings/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/11/06/pulling_strings/index.html</guid>
<title>Pulling strings</title>
<dc:date>2011-11-06T00:17:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work, code, books</dc:subject>
<description><![CDATA[<p>

After one year of managing a network
of <a href="http://sysphere.org/~anrxc/j/archives/2010/11/17/cfengine3_bootstrap/index.html">10
servers with Cfengine</a> I'm currently building two clusters of 50
servers with Puppet (which I'm using for the first time), and have
various notes to share. With my experience I had a feeling Cfengine
just isn't right for this project, and didn't consider it
seriously. These servers are all running <em>Debian GNU/Linux</em> and
Puppet felt natural because of the
good <a href="http://packages.debian.org/search?keywords=puppet">Debian
integration</a>, and the number of users whom also produced a lot of
resources. Chef was out of the picture soon because of
the <a href="http://wiki.opscode.com/display/chef/Architecture">scary
architecture</a>; <em>CouchDB</em>, <em>Solr</em>
and <em>RabbitMQ</em>... coming from Cfengine this seemed like a bad
joke. You probably need to hire a Ruby developer when it
breaks. Puppet is somewhat better in this regard. <br /><br />

Puppet master needs Ruby, and has a built-in file server using
<em>WEBrick</em>. My first disappointment with Puppet was
WEBrick. Though
<em>PuppetLabs</em> claim you can scale it up to 20 servers, that
proved way off, the built-in server has problems serving as little as
5 agents/servers, and you get to see many dropped connections and
failed catalog transfers. I was forced to switch to <em>Mongrel</em>
and <em>Nginx</em> as frontend very early in the project, on both
clusters. This method works much better (even
though <em>Apache+Passenger</em> is the recommended method now from
PuppetLabs), and it's not a huge complication compared to WEBrick (and
Cfengine which doesn't make you jump through any hoops). Part of the
reason for this failure is my pull interval, which is 5 minutes with a
random sleep time of up to 3 minutes to avoid harmonics (which is
still a high occurrence with these intervals and WEBrick fails
miserably). In production a customer can not wait on 30/45 minute pull
intervals to get his IP address whitelisted for a service, or some
other mundane task, it must happen within 10 minutes... but I'll come
to these kind of unrealistic ideas a little later. <br /><br />

Unlike the Cfengine article I have no bootstrapping notes, and no
code/modules to share. By default the fresh started puppet agent will
look for a host called "puppet" and pull in what ever you defined to
bootstrap servers in your <em>manifests</em>. As for modules, I wrote
a ton of code and though I'd like to share it, my employer owns
it. But unlike Cfengine v3 there's a lot
of <a href="http://docs.puppetlabs.com/">resources out there for
Puppet</a> which can teach you everything you need to know, so I don't
feel obligated to even ask. <br /><br />

Interesting enough, published modules would not help you get your job
done. You will have to write your own, and your team members will have
to learn how to use your modules, which also means writing a lot of
documentation. Maybe my biggest disappointment is getting
disillusioned by most Puppet advocates and DevOps prophets. I found
articles and modules most of them write, and experiences they share
have nothing to do with the real world. It's like they host servers in
a magical land where everything is done in one way and all servers are
identical. Hosting big websites and their apps is a much, much
different affair. <br /><br />

Every customer does things differently, and I had to write custom
modules for each of them. Just between these two clusters a module
managing Apache is different, and you can abstract your code a lot but
you reach a point where you simply can't push it any more. Or if you
can, you create a mess that is unusable by your team members, and I'm
trying to make their jobs better not make them miserable. One customer
uses an <em>Isilon NAS</em>, the other has a content distribution
network, one uses Nginx as a frontend, other has chrooted web servers,
one writes logs to a NFS, other to a Syslog cluster... Now imagine
this on a scale with 2,000 customers and 3 times the servers and most
of the published infrastructure design guidelines become
laughable. Instead you find your self implementing custom solutions,
and inventing your own rules, best that you can... <br /><br />

I'm ultimately here to tell you that the projects are in a better
state then they would be with the usual cluster management policy. My
best moment was an e-mail from a team member saying "<em>I read the
code, I now understand it</em> [Puppet]<em>. This is fucking
awesome!</em>". I knew at that moment I managed to build something
good (or good enough), despite the shortcomings I found, and with
nothing more than
using <a href="http://puppetlabs.com/">PuppetLabs</a>
resources. Actually, that is not completely honest. Because I did buy
and read the
book <a href="http://www.amazon.com/Pro-Puppet-James-Turnbull/dp/1430230576/">Pro
Puppet</a> which contains an excellent chapter on using <em>Git</em>
for collaboration on modules between sysadmins and developers, with
proper implementation of development, testing and production
(Puppet)environments.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/09/29/reamde/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/09/29/reamde/index.html</guid>
<title>Reamde</title>
<dc:date>2011-09-29T03:45:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> books</dc:subject>
<description><![CDATA[<p>

I received a copy
of <a href="http://www.amazon.com/Reamde-Novel-Neal-Stephenson/dp/0061977969/">REAMDE
by Neal Stepehenson</a>, his latest book, two weeks before publication
date and slowly worked my way through it. Having finished it I can say
I really liked it. A lot of reviewers are disappointed that it wasn't
nearly as complex as his earlier work, like <em>Cryptonomicon</em>
and <em>Anathem</em>. But it was still a 1200 pages volume of
Stephenson awesomeness. This is a thriller set in modern day, not an
SF book. <br /><br />

Reason I enjoyed it a lot are the characters, a lot of them were
(black or whitehat) hackers, sysadmins, programmers and
gamers. Perhaps I felt closer to them than some readers did, who might
have expected an epic historical novel or SF from
Stephenson. <br /><br />

Book opens up with Richard, a CEO of <em>Corporation 9592</em> that
produces a massive online role-playing game called T'Rain. Somewhat
like WoW but with a twist, the idea behind the world and how it was
built is one of the best chapters in the book. Some hackers found a
way to exploit a vulnerability shared by T'Rain players and wrote
malware that encrypts their data with PGP and holds them for
ransom. Payment is done in gold in the T'Rain world. At some point
they ransom data of some <em>carders</em>, and their handlers who are
very bad people and all hell breaks loose. Mobsters and terrorist
cells get involved and story jumps to multiple continents. Neal
Stephenson once said he likes making a good yarn, and he delivered on
it again.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/06/26/building_a_vdr_with_arch_linux/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/06/26/building_a_vdr_with_arch_linux/index.html</guid>
<title>Building a VDR with Arch Linux</title>
<dc:date>2011-06-26T01:10:29+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> dvb, media</dc:subject>
<description><![CDATA[<p>

Early in the last decade I had a so called <em>SatDSL</em>
subscription, it was very expensive but the only way to get decent
bandwidth. With the subscription I received a DVB-S PC tuner,
a <a href="http://images.google.com/images?q=Technisat+SkyStar2">Technisat
SkyStar2</a>. A few years later when the subscription ran out I was
left with the tuner and got interested in other ways of using the
hardware. Those were some dark times for content providers, encryption
systems
were <a href="http://en.wikipedia.org/wiki/Pirate_decryption">getting
hacked</a> left and right. The <em>Wired</em> magazine
ran <a href="http://www.wired.com/politics/security/news/2008/05/tarnovsky?currentPage=all">a
great piece</a> a few years ago about this period. Personally I was
more interested in <a href="http://dvbsnoop.sourceforge.net/">network
traffic</a> at the time, as a lot of it was not
encrypted. <br /><br />

I used <a href="http://www.tvdr.de/">VDR</a> software back then to
build an approximation of a commercial SAT receiver. A friend put
together an infra-red receiver for use
with <a href="http://www.lirc.org/">LIRC</a> and I was set. With the
rising popularity of HDTV and
the <a href="http://en.wikipedia.org/wiki/DVB-S2">DVB-S2 standard</a>
my current 'receiver' was getting outdated. It had a <em>Duron
1200</em> CPU, with 300MB of <em>SDRAM</em> and a 320GB of storage. I
was putting money on the side for several years to build a replacement
(and get an appropriate HD TV set), and finally did it this
year. These past few months I
used <a href="https://www.archlinux.org/">Arch Linux</a> with VDR, and
built it piece by piece as a hobby. On the hardware side I used:

<blockquote>
MBO: Asrock M3AUCC <br />
CPU: AthlonII X3 455 <br />
RAM: 4GB DDR3<br />
HDD: 1TB disks (RAID1) <br />
GFX: GeForce GT240 (VDPAU) <br />
DVB: SkyStar HD2 (DVB-S2 tuners) <br />
LCD: Philips 43" HDTV
</blockquote>

I didn't go with one of the <em>Ion</em> systems, because I don't
watch
<em>that</em> much TV, and the box will be put to many other uses
(<a href="http://sysphere.org/~anrxc/j/archives/2010/05/31/introducing_rybackup_again/index.html">backups</a>, <a href="http://sysphere.org/~anrxc/j/articles/tor/index.html">TOR
gateway</a>, media streaming, distributed compiling, etc.). Every
piece was carefully selected, and folks on the VDR mailing list helped
me choose a suitable graphics card for HDTV, with
good <a href="http://en.wikipedia.org/wiki/VDPAU">VDPAU
support</a>. As usual with Linux even that careful selection wasn't
enough to ensure a smooth ride. <br /><br />

The sound-card drivers were deadlocking the machine, and it took a few
days of experimentation to resolve it. The SkyStar HD2 cards work
great with the <strong>mantis</strong> driver, but support for their
infra-red receiver is missing. However experimental support is
available through
a <a href="http://www.mail-archive.com/linux-media@vger.kernel.org/msg31742.html">patch</a>
published on the Linux-media mailing list, earlier this
year. <br /><br />

All my previous VDRs were powered
by <a href="http://www.slackware.com/">Slackware Linux</a>, and I
developed some habits and preferences in running VDR. So I didn't use
the <a href="http://sourceforge.net/apps/trac/archvdr/">ArchVDR
project</a>, or <a href="https://wiki.archlinux.org/index.php/VDR">VDR
packages</a>, although they are good projects. I prefer to keep every
VDR installation under a single directory tree, with the one currently
in use always being symlinked to <em>/opt/VDR</em>. I swap them a lot,
always patching (<em>liemikuutio</em>, <em>ttxtsubs</em>...), and
testing a lot of plugins. <br /><br />

Instead of using <em>runvdr</em> and other popular scripts for
controlling VDR I wrote my own script long ago. I call
it <a href="http://sysphere.org/~anrxc/local/sources/vdrctl">vdrctl</a>,
it's much simpler but provides extensive control over loaded plugins
and their own options, and has support for passing commands directly
to a running VDR with <em>svdrpsend</em>. As the window manager I
used <a href="http://awesome.naquadah.org">awesome</a> this time,
opposed to <a href="http://www.fvwm.org/">FVWM</a> that can be seen in
this <a href="http://sysphere.org/gallery/VDR">old
gallery</a>. Awesome runs in a <em>fullscreen</em> layout, and with
some
useful <a href="http://git.sysphere.org/vicious/">widgets</a>. <br /><br />


For playing other media my long time favorite
is <a href="http://oxine.sourceforge.net/">Oxine</a>,
a <a href="http://www.xine-project.org/home">Xine</a> frontend well
suited for TV sets. But I don't use its VDR support as one might
expect (I use
the <a href="http://home.vr-web.de/~rnissl/">vdr-xine</a> plugin with
regular <em>xine-ui</em>), instead I connect VDR with Oxine through
the <a href="http://sourceforge.net/projects/externalplayer/">externalplayer-plugin</a>. It's
special in that it breaks the VDR connection to LIRC prior to
launching an external player allowing to seamlessly control both
applications. <br /><br />

Arch Linux makes it easy to build your own packages of all the media
software to include VDPAU
support. Official <a href="http://www.archlinux.org/packages/extra/i686/mplayer/">mplayer</a>
already has it, Xine is available in the <em>AUR</em>
as <a href="http://aur.archlinux.org/packages.php?ID=34570">xine-lib-vdpau</a>
and so on. But even more important, the good packaging infrastructure
and management makes it easy to build and <strong>maintain</strong>
custom kernels (for IR support ie.). It truly is the perfect VDR
platform.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/06/22/org-mode_and_the_cycle/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/06/22/org-mode_and_the_cycle/index.html</guid>
<title>org-mode and the cycle</title>
<dc:date>2011-06-22T03:57:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work, code, emacs</dc:subject>
<description><![CDATA[<p>

<a href="http://sysphere.org/temp/OrgTutorial/tutorial-11.png"><img class="left"
alt="Org-Mode Screenshot"
src="http://sysphere.org/~anrxc/j/images/orgmodethumb.png" /></a> I go
through 50 or so support tickets, and <em>Nagios</em> alerts that must
be acted on, in a given shift. There's also long term projects to
manage. That's a lot of work, and <strong>a lot of
distractions</strong> for a single work day. To keep it all under
control I turned to the book
"<a href="http://www.amazon.com/Management-System-Administrators-Thomas-Limoncelli/dp/0596007833/">Time
Management for Sysadmins</a>" after enjoying some other books of the
author. The book promotes a "cycle" system, with one TODO list/sheet
per day, where all unfinished items from the previous day are
transferred onto the next, and a few minutes invested in prioritizing
and planning the day. There's much more to the method, but that's the
gist of it, avoiding the "never ending TODO list of
DOOM". <br /><br />

Tools of choice for the author are pen and paper, or a <em>PDA</em> is
suggested as an alternative. I wouldn't carry a journal and don't own a
PDA, but I already depended
on <a href="http://orgmode.org/">org-mode</a> heavily for my personal
projects management and nothing could replace that, really. So while I
was planning how to apply this new found wisdom and pair it with
<em>org-mode</em> I came up with a system I wish to describe here. I
wanted to do that for a long time, even though it's very specific to
my needs, so most likely nobody can make use of it as is. But perhaps
it gives you ideas, and even that would be great <br /><br />

Org-mode is a top notch project management tool, inside a good
editor. Great tools for the job. Yet it's very easy to fall into the
"list of doom" trap. In the context of org-mode its gurus actually
recommend keeping big lists with a small number of files, because of
good agenda overview and unlimited possibilities of org-mode... but I
decided to avoid it and imitate the system the book promotes with one
list per day, and project in my case (author splits them into
sub-tasks, for day lists). If you're familliar with the cycle system
and thinking it doesn't make sense read on, org-mode agenda view is
the key. <br /><br />

I start my day with a terminal emulator, and I realized it would be
best to have a dedicated tool that can be used from the command
line. So I
wrote <a href="http://sysphere.org/~anrxc/local/sources/mkscratch.sh">mkscratch</a>,
a simple tool that sets me up with a scratchpad for the day, helps
managing the old pads, but also pads of long term projects. It's not
actually that specific to org-mode, yet it was written with it in mind
so headers and file extensions reflect that. But it is easily a
general purpose editor wrapper for creating scratchpads or project
pads. <br /><br />

This is how I tie it all together, day-to-day pads are
in <em>~/work/pads</em>, and once invoked <em>mkscratch</em> creates a
pad for the day, if one doesn't already exist, and
links <em>~/pad.org</em> to
<em>~/work/pads/MM-DD.org</em>. Then it starts Emacs if not already
running, and opens the pad for the day. I might have scheduled a task
days or months in advance and created a pad for that day, then only
linking of <em>~/pad.org</em> is performed and editor is opened. Long
term projects get their own directories below
<em>~/work/projects</em> (because projects have other files as
baggage), with some project identifier as the directory name, while
the main pad for every project is
called <strong>project.org</strong>. This is of some importance (see
the <em>.emacs</em> snippet below). <br /><br />

A good part of the author's cycle system is maintaining a calendar
with meetings and project deadlines meticulously marked.  From the
calendar items are copied onto the list for the day when their time is
up (during those few minutes of planning, before the day starts or at
the end of the previous day). While contemplating how to translate
that to org-mode I realized using the <em>Agenda View</em> as is will
do just fine, if only I could gather all scheduled items and
approaching deadlines from all the files (pads and projects) into this
single view. Even though it's not a very conventional usage pattern
for org-mode (remember, we have up to 300 files near the years end),
it can be done easily in <em>.emacs</em>:

<pre>
;; Files that are included in org-mode agenda
(setq org-agenda-files
  (cons "~/work/pads/"
    (file-expand-wildcards 
     "~/work/projects/*/project.org"))
)
</pre>

One of
my <a href="http://sysphere.org/~anrxc/j/archives/2009/05/04/awesome_and_org-mode/index.html">past
articles</a> described connecting my window manager with org-mode for
taking quick notes. I use the same method now for appending to pad
files, not always, but it's very useful to quickly store a task when
you're in the middle of something. <br /><br />

A few years ago I wrote
another <a href="http://sysphere.org/~anrxc/j/archives/2009/04/01/employing_org-mode/index.html">short
article</a> on org-mode, using it for project management while
freelancing, it describes a different method but a part of it focused
on
using <a href="http://sysphere.org/~anrxc/j/articles/gnupg/index.html">GPG</a>
to encrypt project files. The same can be applied
here. <strong>EasyPG</strong> is now a part of Emacs, and every pad
can be encrypted on the fly, and decrypted without any overhead in
usage (even more so when using the GPG agent). <br /><br />

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/04/05/lilo_to_syslinux_migration/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/04/05/lilo_to_syslinux_migration/index.html</guid>
<title>LILO to syslinux migration</title>
<dc:date>2011-04-05T03:12:38+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> main, desktop</dc:subject>
<description><![CDATA[<p>

I've been using <em>LILO</em> for a long time, from my first GNU/Linux
installation. Some people have the idea that it's a dead project, but
it's not, development
is <a href="https://alioth.debian.org/projects/lilo/">still
active</a>. It never failed to boot for me. Until last night, when it
failed to use an <em>XZ</em> compressed
Linux <strong>v2.6.38.2</strong>. I would never give up LILO
for <em>Grub</em>, but I was contemplating a switch
to <a href="http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project">syslinux</a>
after watching
the <a href="http://dieter.plaetinck.be/can_we_build_a_simple_cross-distribution_installation_framework.html">Fosdem
talk by Dieter Plaetinck</a> last month. <br /><br />

I had no more excuses to delay it any longer, so I switched. All my
machines have <em>/boot</em> as the first partition on the disk, they
are flagged bootable, and use the <em>ext2</em> file-system. Migrating
to syslinux was simple:

<blockquote>
# pacman -Syu syslinux <br />
# /usr/sbin/syslinux-install_update -i -a -m <br />
<br />
# cp -arp /etc/lilo.conf /etc/lilo.conf.bak <br />
# pacman -Rns lilo
</blockquote>

The <b>syslinux-install_update</b> options stand for installing it to
the <strong>MBR</strong>, where it replaces LILO. Then I wrote a
configuration file: <em>/boot/syslinux/syslinux.cfg</em>. Actually, I
wrote one in advance, because even though you might find it funny, it
was a big deal for me to continue using my boot prompt as is. I've
been using
the <a href="http://kde-look.org/content/show.php?content=29675">LILO
fingerprint menu</a> for years. Not being able to port it would be a
deal breaker. But it wasn't complex, actually. <br /><br />

If you want to use the <em>Fingerprint</em> theme, grab it
from <em>KDE-Look</em>, convert the <strong>BMP</strong> to
the <em>PNG</em> format and save it as <em>splash.png</em>. I'll
include my whole <em>syslinux.cfg</em> for reference, but the
important bits for the theme are menu and graphics sections. I didn't
bother to tweak the ANSI settings as I don't intend to use them, so I
copied them from
the <a href="http://projects.archlinux.org/svntogit/packages.git/tree/syslinux/repos/core-i686/">Arch
Linux menu</a>. Settings below will give you a pretty much identical
look and feel (shadows could use a bit more work), and also provide a
nice bonus over LILO when editing the boot options (by
pressing <strong>Tab</strong>, as in LILO):

<pre>
#
# /boot/syslinux/syslinux.cfg
#
# General settings
UI vesamenu.c32
DEFAULT linux
PROMPT 0
TIMEOUT 250

# Menu settings
MENU WIDTH 28
MENU MARGIN 4
MENU ROWS 3
MENU VSHIFT 16
MENU HSHIFT 11
MENU TIMEOUTROW 13
MENU TABMSGROW 11
MENU CMDLINEROW 11
MENU HELPMSGROW 16
MENU HELPMSGENDROW 29

# Graphical boot menu
#
# Fingerprint menu
#  http://kde-look.org/content/show.php/Fingerprint+Lilo-splash?content=29675
MENU BACKGROUND splash.png
#
#          element      ansi    f/ground  b/ground  shadow
MENU COLOR sel          7;37;40 #ffffffff #90000000 std
MENU COLOR unsel        37;44   #ff000000 #80000000 std
MENU COLOR timeout_msg  37;40   #00000000 #00000000 none
MENU COLOR timeout      1;37;40 #00000000 #00000000 none
MENU COLOR border       30;44   #00000000 #00000000 none
MENU COLOR title        1;36;44 #00000000 #00000000 none
MENU COLOR help         37;40   #00000000 #00000000 none
MENU COLOR msg07        37;40   #00000000 #00000000 none
MENU COLOR tabmsg       31;40   #00000000 #00000000 none

# Boot menu settings
LABEL linux
        MENU LABEL GNU/Linux
        LINUX ../vmlinuz26
        APPEND root=/dev/sda2 ro rootflags=data=ordered i915.modeset=1 video=VGA-1:1152x864 drm_kms_helper.poll=0
        INITRD ../kernel26.img

LABEL recovery
        MENU LABEL Recovery
        LINUX ../vmlinuz26
        APPEND root=/dev/sda2 ro rootflags=data=ordered
        INITRD ../kernel26-fallback.img
</pre>

You can find the documentation, and menu options explained on
the <a href="http://syslinux.zytor.com/wiki/index.php/Doc/menu">syslinux
wiki</a>. If you achieve an even more faithful copy send me an e-mail
with the new values. Thank you.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/04/02/introducing_play_a_fork_of_cplay/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/04/02/introducing_play_a_fork_of_cplay/index.html</guid>
<title>Introducing play, a fork of cplay</title>
<dc:date>2011-04-02T20:59:36+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> desktop, code, media</dc:subject>
<description><![CDATA[<p>

I've been using <strong>cplay</strong> for close to ten years now. It
is a curses front-end to various audio players/decoders, and written
in <em>Python</em>. Sure, I've been
an <a href="http://amarok.kde.org/">Amarok</a> fan for half that time,
but when I just want to hear some music I find my self opening a
terminal and starting cplay. I manage my music collection in Amarok, I
grab and listen new podcasts in Amarok. Sometimes I even use it to
play music, but not nearly as much as I do with cplay. I have 4
workstations at home, and they all do the same. Same thing with the
server connected to the best set of speakers. Sure, I have a remote
and <a href="http://oxine.sourceforge.net/">Oxine</a> there, but when
I just want to hear some music I don't want to spend 5 minutes messing
with the remote. <br /><br />

Through the years I added various small patches to my copy of
cplay. They accumulated over time, and except for my
<a href="http://sysphere.org/~anrxc/local/sources/cplay-1.50pre7-color.patch">color-support
patch</a> I didn't plan on sharing them. But in 2009 I found that the
project page of cplay disappeared. I spent a year thinking it will
pop-up, but it didn't. Then I noticed the <em>Arch Linux</em> package for cplay
pulls the source from the Debian repositories, and realized it's not
coming back. <br /><br />

I decided to publish my copy of cplay, so there exists yet another
place where it's preserved. But as I'm not acting in any official
role, nor do I consider my self a worthy coder to maintain cplay I
decided to fork it and publish under a new name. That also gives me
the excuse to drop anything I don't personally use,
like <em>gettext</em> support. My project is
called <strong>play</strong>, just <em>play</em> and the Git
repository is now public,
on <a href="http://git.sysphere.org/play/">git.sysphere.org</a>. The
first commit is an import of <strong>cplay-1.50pre7</strong>
from <em>Ulf Betlehem</em>, so if you're looking for that original
copy you can grab it there. <br /><br />

Beside various bug fixes some of the more interesting new features
are: color support, <em>mplayer</em>
support, <em>curses</em> <strong>v5.8</strong> support
and <em>pyid3lib</em> support. Someone on IRC told me this week that
they could never get cplay to work for them on Arch Linux, and they
expressed interest in play. I decided to package it
on <a href="http://aur.archlinux.org">AUR</a>, and it's now available
as <a href="http://aur.archlinux.org/packages.php?ID=47794">play-git</a>.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2011/03/29/securing_debian_repositories/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2011/03/29/securing_debian_repositories/index.html</guid>
<title>Securing Debian repositories</title>
<dc:date>2011-03-29T05:07:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> crypto, work</dc:subject>
<description><![CDATA[<p>

I had to build some <em>Debian</em> packages recently after a long
time. The experience really made me appreciate
the <a href="https://wiki.archlinux.org/index.php/Creating_Packages">simple
approach</a> taken by <em>Arch Linux</em>. When I finally built
something up to Debian standards I had to distribute it on the
network. Debian's <strong>APT</strong> can work over HTTP, FTP... but
also SSH, which is pretty good for creating a more secure
repository. There are a lot
of <a href="http://www.debian-administration.org/articles/513">articles</a>
covering this approach, but I didn't find any information on how to
make it work in a <strong>chroot</strong> environment, and got stuck
there for a while. <br /><br />

But to go back to the beginning, if you're setting up a repository the
<a href="http://mirrorer.alioth.debian.org/">reprepro</a> tool is
pretty good for repository management. Having SSH in mind for later,
some decisions have to be made where you'll store the repository and
who will own it. The "<em>reprepro</em>" user is as good as any, so we
can start by adding the user (and group) to the system and making its
home
<em>/srv/reprepro</em>. Then we can setup the bare repository layout,
in this example the repository will reside in the <em>debs</em>
directory:

<blockquote>
# su reprepro <br />
$ cd ~ <br />
$ mkdir -p debs/conf
</blockquote>

You'll need two files in the conf sub-directory, those being
"<em>distributions</em>" and "<em>options</em>". They are simple to
write, and all
the <a href="http://www.debian-administration.org/articles/286">other
articles</a> explain them. You don't have to worry about the rest of
the tree, once you import your first package, or <em>.changes</em>
file, reprepro will take care of it then. If you intend to
use <a href="http://sysphere.org/~anrxc/j/articles/gnupg/index.html">GPG</a>,
and sign your <em>Release</em> file, it's a good time to
<a href="http://sysphere.org/~anrxc/j/archives/2009/05/10/notes_on_the_gnu_privacy_guard/index.html">create
your signing key</a>. Then in the distributions file configure
the <strong>Sign</strong> option, and in the conf file
add <strong>ask-passphrase</strong>. <br ><br />

Now we can add another user, one for APT clients, its home can be the
same as our reprepro user has. User should be allowed to connect in
the SSH daemon configuration file, and properly chrooted using
the <strong>ChrootDirectory</strong> option. Here are the (only)
binaries you will need in
/srv/reprepro/bin: <strong>bash</strong>, <strong>find</strong>
and <strong>dd</strong>. I mentioned getting stuck, well this was it,
APT is using find and dd binaries internally,
which <strong>strace</strong> revealed. <br /><br />


You can now publish your repository in <em>/etc/apt/sources.list</em>,
for example:

<pre>
deb ssh://apt@192.168.50.1:/debs/ squeeze main
deb-src ssh://apt@192.168.50.1:/debs/ squeeze main
</pre>

That's the gist of it. User apt gets read-only access to the
repository, if coming from an approved host. You can control host
access with TCPWrappers, Iptables and even OpenSSH's own
whitelist. Each APT client should have its key white-listed for access
as well, but give some thought to key management, they don't have to
be keys without a passphrase. You can setup
the <a href="http://sysphere.org/~anrxc/j/archives/2009/05/30/application_of_the_gpg_passphrase_agent/index.html">SSH
agent</a> on a machine you trust, and unlock a key. Using
<em>agent forwarding</em> provided by the OpenSSH client you could
login to a machine and install packages without being prompted for the
passphrase, and without leaving your keys laying around. This alone
would not scale in production, but is a good start.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2010/11/17/cfengine3_bootstrap/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2010/11/17/cfengine3_bootstrap/index.html</guid>
<title>Cfengine3 bootstrap</title>
<dc:date>2010-11-17T00:47:52+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work, code</dc:subject>
<description><![CDATA[<p>

<a href="http://www.cfengine.org/">Cfengine</a> has been around for a
very long time. Its dependencies are minimal, its resources needs
minimal, its performance excellent. Version 2 of cfengine is well
documented, thoroughly discussed and described in numerous
tutorials. But v2 is also deprecated in favor of cfengine3. It so
happens v3 was a rewrite, and many things changed. There are a
few <a href="http://watson-wilson.ca/blog/cf3-tutorial.html">tutorials</a>
on
v3 <a href="http://prefetch.net/blog/index.php/category/cfengine/">worth
mentioning</a>, but they all describe deploying the policy host, and
little else. <br /><br />

I've been reading
"<a href="http://www.amazon.com/Automating-System-Administration-Second-Experts/dp/1430210591/">Automating
Linux and Unix System Administration</a>" recently and the book covers
cfengine2 extensively. Authors describe a complete, extremely modular,
cfengine setup. I had problems wrapping my brain around methods for
doing the same in v3. After spending some time with
the <a href="http://www.cfengine.org/manuals/cf3-reference.html">cfengine
reference manual</a> I finally had a solid basic policy for deploying
the policy host and clients. Which I want to share
here: 
<a href="http://sysphere.org/~anrxc/local/sources/cf3-bootstrap.tar.bz2">cf3-bootstrap.tar.bz2</a>.
<br /><br />

After installing cfengine with its workdir defined, let's say,
as <em>/srv/cfengine</em>, we can bootstrap the policy server:

<blockquote>
# /usr/sbin/cf-key <br />
# cd /srv/cfengine/ <br />
# tar -xvjf cf3-bootstrap.tar.bz2 ; rm -i $_ <br />
# cd masterfiles/ <br />
# cp /usr/share/doc/cfengine/cfengine_stdlib.cf cf-stdlib.cf <br />
# emacs update.cf <br />
# /usr/sbin/cf-agent --bootstrap <br />
# /usr/sbin/cf-execd -v -F
</blockquote>

The <em>cf-key</em> will create the basic cfengine directory tree, and
will generate the hosts public and private keys (cfengine functions
somewhat like SSH in this regard). We edit the <em>update.cf</em>. to
define our policy server, and its hostname. Other files will require
more edits for customization, but update bundle is all that is needed
for bootstrapping the policy host (and later pulling changes in
policy). <br /><br />

Method for bootstrapping a client is similar. We run <em>cf-key</em>,
and we copy the <em>failsafe.cf</em> and <em>update.cf</em> files from
the policy host to <em>/srv/cfengine/inputs</em>. Then
run <em>cf-agent</em> from that directory to bootstrap, and
finally <em>cf-execd</em>'s initial run (which BTW configures a
cronjob for <em>cf-execd</em> to be executed
periodically). <br /><br />

A few words about basic cfengine operation and policy. It is kept, and
modified in the <em>masterfiles</em> directory. Remember, the policy
host also manages it self, which means it too copies the policy to
its <em>inputs</em> directory, and it runs from there. Clients pull
the policy from the <em>masterfiles</em> directory on your policy host
to their <em>inputs</em> directory, from where they are acted
upon. The policy defines that our policy server runs
the <em>cf-serverd</em> daemon, which acts as a file server for our
clients. First time the client contacts the server their keys will be
exchanged. <br /><br />

Example bundles I provided propose to keep the service configuration
files, and any other data for distribution in the
<em>clientfiles</em> directory. I am a long way from templating in
cfengine3, but the authors of the book I mention are willing to argue
distributing complete files is the <em>right way</em> to do
things. <br /><br />

Now a few words about the policy I shared. I wanted a modular policy,
one that will easily scale from 3 servers to 23. Cfengine
configuration, and basic policy is in the <em>masterfiles</em>
directory, I make use of the cfengine community library (distributed
with cfengine package), and I also maintain a site
specific <em>library.cf</em> file. The <em>promises.cf</em> file is
the main cfengine policy file, it imports all needed policy files, and
defines policies that should run on <strong>all</strong> hosts. All
<strong>site specific</strong> policies are in the <em>site/</em>
sub-directory. The main file <em>site.cf</em> defines policies that
should run per host (or groups of hosts), and does nothing
else. Policies for daemons or anything else get their own file. I
included a few basic ones with examples. One with some example Apache
controls, one for editing
<em>resolv.conf</em> and one generic that pretends to run actions on
system users. <br /><br />

Where to take it from bootstrapping. First and foremost, policy should
be kept in revision control. <em>Git</em> will do nicely. With several
cfengine policy hosts, controlling clusters or groups of machines, we
can think about masters of master servers. In that scenario the policy
hosts can pull their complete policies with <em>Git</em> from the
master(s). Developing complex policies will take some time, but it's
worth investing your time. It will make your job better, but also be a
good prospect for the future. I don't remember seeing an ad for a
bigger shop that didn't require cfengine or <em>puppet</em>
experience.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2010/09/16/mobile_broadband_and_openvpn_on_gnulinux/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2010/09/16/mobile_broadband_and_openvpn_on_gnulinux/index.html</guid>
<title>Mobile broadband and OpenVPN on GNU/Linux</title>
<dc:date>2010-09-16T15:18:09+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> crypto, main</dc:subject>
<description><![CDATA[<p>

I wrote
a <a href="http://sysphere.org/~anrxc/j/archives/2009/04/14/gprs_on_gnulinux/index.html">short
article on GPRS</a> more than a year ago. Now I finally moved on
to <b>HSPA</b>, after GPRS failed me in an emergency. I was unable to
get <em>OpenVPN</em> working over it, and to make matters worse I found
my (extremely expensive) accumulated bandwidth disappeared from the
<em>T-Com</em> account. I decided to switch the provider, and
technology, and bought a <b>Huawei E180</b> mobile broadband modem
from <a href="http://www.tele2.hr">TELE2</a>. <br /><br />

With a fairly recent Linux kernel the modem will be recognized
correctly as storage (it has a MicroSD card slot), CD-ROM (read-only
part of the stick with MS Windows software/driver) and a
<b>modem</b>. So, <a href="http://www.draisberghof.de/usb_modeswitch/">usb_modeswitch</a>
is not needed. Modem can be plugged in and <b>usbserial</b>
and <b>ppp-generic</b> modules should be loaded. As a <em>PPP
dialer</em> I continue to
use <a href="http://alumnit.ca/wiki/index.php?page=WvDial">wvdial</a>,
configured like so: <br />
<pre>
; wvdial configuration
;   /etc/wvdial.conf
;
[Dialer tele2pin]
Modem = /dev/ttyUSB0
baud = 460800
Init1 = AT+CPIN=XYZW

[Dialer tele2]
Modem = /dev/ttyUSB0
baud = 460800
Stupid Mode = 1
Init2 = ATZ
Init3 = AT&F E1 V1 X1 &D2 &C1 S0=0
Init4 = AT+CGDCONT=1,"IP","data.tele2.hr"
Phone = *99#
Username = none
Password = none
</pre>

Under the <em>tele2pin</em> dialer a PIN must be provided in place of
"XYZW". Username and password in the <em>tele2</em> dialer are not
used, but must be provided. The APN "<em>mobileinternet.tele2.hr</em>"
always produced a "<b>No carrier detected</b>" message so I switched
to "<em>data.tele2.hr</em>". The <em>Stupid</em> mode is enabled so
there's no time wasted waiting on the prompt, and that's about all you
need to know. <br /><br />

To initiate a connection a PIN must be provided first, that's why
there's a special dial section for it. Afterwords a connection can be
established: <br />
<blockquote>
# wvdial tele2pin <br />
# wvdial tele2
</blockquote>

Unfortunately OpenVPN failed to work with this setup as well. Some
mobile providers block ports, some do double NAT or otherwise mess
with VPN connections... but not TELE2, and I eventually got it to
work. I found it was a routing problem, after seeing the following
<em>pppd</em> message in the syslog: <br />
<pre>
pppd: Could not determine remote IP address: defaulting to 10.64.64.64
</pre>

The routing table would look like this: <br />
<pre>
Kernel IP routing table
Destination     Gateway Genmask         Flags Metric Ref Use Iface
10.64.64.64     *       255.255.255.255 UH    0      0     0 ppp0
default         *       0.0.0.0         U     0      0     0 ppp0
</pre>

I determined the gateway by doing a simple <em>traceroute</em> to
google.com, and a quick fix was: <br />
<blockquote>
# route del default gw 0.0.0.0 <br />
# route add -host 130.244.219.90 dev ppp0 <br />
# route add default gw 130.244.219.90 <br />
# route del -host 10.64.64.64 <br />
# /etc/rc.d/openvpn start
</blockquote>

The packets will be properly routed now, but the DNS servers of the
mobile provider can no longer be reached. Change your DNS servers to
the ones provided by your (virtual)private network, or otherwise any
DNS servers you would normally use.

</p>]]></description>

</item>
<item>
<link>http://sysphere.org/~anrxc/j/archives/2010/08/04/books_on_systems_administration/index.html</link>
<guid isPermaLink="true">http://sysphere.org/~anrxc/j/archives/2010/08/04/books_on_systems_administration/index.html</guid>
<title>Books on systems administration</title>
<dc:date>2010-08-04T18:16:59+01:00</dc:date>
<dc:creator>anrxc</dc:creator>
<dc:subject> work, books</dc:subject>
<description><![CDATA[<p>

I had some money to spare recently, and I decided to buy some good
technical books. Actually I went out to find some great books, and not
so much with an agenda to learn from them but more to be used as
reference for years to come. <br /><br />

First book I settled on was
the <a href="http://www.bookdepository.co.uk/book/9780470868072/Principles-of-Network-and-System-Administration">Principles
of Network and System Administration</a> by <em>Mark
Burgess</em>. Last edition is from 2003 but this book is still
excellent and unique in many ways. It is one of the only (if not the
only) book approaching the topic of systems administration from a
scientific standpoint, treating it as a branch of engineering. Book on
principles, best practice, ethics, users and management of the
human-computer systems. At times it seems perhaps too academic in its
approach in respect to business environments where something is always
going wrong (Murphy is out to get you) and is often hard to maintain
levels of operation this book advocates. Still it's something every
good sysadmin should aspire to, I enjoyed re-reading it and it's just
the kind of book I had in mind. <br /><br />

It felt kind of karmic that the fourth, 20th year anniversary, edition
of
the <a href="http://www.bookdepository.co.uk/book/9780131480056/Unix-and-Linux-System-Administration-Handbook">Unix
and Linux System Administration Handbook</a> was released these
days. This series of books (previously UNIX and Linux treated
separately) by <em>Evi Nemeth</em> (and others) is well known, and I
just had to buy this edition. It is very much different than the book
above, a 1300 pages volume filled with practical matters including
real world experiences of its authors. The foreword says it is not one
of those "administration" books targeting users who run a UNIX system
in their garage. It's rather oriented towards running UNIX in the
enterprise. This revised edition covers <b>AIX, HP-UX, Solaris,
RedHat, SuSE</b> and <b>Ubuntu</b>, and as usual dedicates a large
part of the book to networking. It could be worth to you to know that
it also includes chapters on topics like <em>DNSSEC</em> and
virtualization (being that the 3rd edition was released back in 2000).

</p>]]></description>

</item>
</channel>
</rss>

