<?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>syslog</title>
	<atom:link href="http://syslog.tv/feed/" rel="self" type="application/rss+xml" />
	<link>http://syslog.tv</link>
	<description>ramblings of an administrator</description>
	<lastBuildDate>Tue, 21 Feb 2012 17:29:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Automatic/Unattended updates on Debian 6 (Squeeze)</title>
		<link>http://syslog.tv/2012/01/28/automaticunattended-updates-on-debian-6-squeeze/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=automaticunattended-updates-on-debian-6-squeeze</link>
		<comments>http://syslog.tv/2012/01/28/automaticunattended-updates-on-debian-6-squeeze/#comments</comments>
		<pubDate>Sat, 28 Jan 2012 17:41:59 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[automatic update]]></category>
		<category><![CDATA[unattended-upgrades]]></category>
		<category><![CDATA[update]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=809</guid>
		<description><![CDATA[All commands prefixed with a # need to be run as sudo or root
The unattended-upgrades package used on Debian is based on the one from Ubuntu. It is generally pretty safe in my opinion but I only ever enable it for security upgrades.
Installation
# apt-get install unattended-upgrades  [...]]]></description>
			<content:encoded><![CDATA[<p><strong>All commands prefixed with a # need to be run as sudo or root</strong></p>
<p>The unattended-upgrades package used on Debian is based on the one from Ubuntu. It is generally pretty safe in my opinion but I only ever enable it for security upgrades.</p>
<h2>Installation</h2>
<blockquote><p># apt-get install unattended-upgrades apitcron</p></blockquote>
<p><em>unattended-upgrades</em> handles the actual updates, <em>apticron</em> is used for emailing you of available updates - it is not required but I like it.</p>
<h2>Configuring unattended-upgrades</h2>
<p>Open up <strong>/etc/apt/apt.conf.d/50unattended-upgrades</strong> and change it to the content below.</p>
<blockquote><p>APT::Periodic::Enable "1";<br />
APT::Periodic::Update-Package-Lists "1";<br />
APT::Periodic::AutocleanInterval "7";<br />
APT::Periodic::Unattended-Upgrade "1";<br />
Unattended-Upgrade::Mail "<strong>YOUR_EMAIL_HERE</strong>";</p>
<p>// Automatically upgrade packages from these (origin, archive) pairs<br />
Unattended-Upgrade::Allowed-Origins {</p>
<p style="padding-left: 30px;">
"${distro_id} stable";<br />
"${distro_id} ${distro_codename}-security";
</p>
<p>};</p>
<p>// Automatically reboot *WITHOUT CONFIRMATION* if a<br />
// the file /var/run/reboot-required is found after the upgrade<br />
Unattended-Upgrade::Automatic-Reboot "false";</p></blockquote>
<p>So lets explain the above. As you can see we enable periodic updates, enable update package lists (triggers an apt-get update), enable autoclean to clean out the local package repository every 7 days, enable the actual unattended update and finally you can set your email address so that you will get an email when an update has happened.<br />
Next up we configure the origins to update from, as you can see we've only enabled security and as a very final step we make sure we've disabled automatic reboots - you probably don't want your server randomly rebooting to update the running kernel, this means you will have to reboot when convenient after a kernel update.</p>
<p>Your unattended update will happen every day, triggered by <strong>cron.daily</strong>. Next time your cron.daily has triggered, look inside <strong>/var/log/unattended-upgrades/unattended-upgrades.log</strong>, you should see something like this</p>
<blockquote><p>2012-01-28 06:54:04,730 INFO Initial blacklisted packages:<br />
2012-01-28 06:54:04,730 INFO Starting unattended upgrades script<br />
2012-01-28 06:54:04,731 INFO Allowed origins are: ["('Debian', 'squeeze-security')"]<br />
2012-01-28 06:54:05,952 INFO No packages found that can be upgraded unattended</p></blockquote>
<p>If you installed apticron in the above step and want to configure it and use it then continue reading, if not then congratulations everything is done.</p>
<h2>Configuring apticron</h2>
<p>Open up <strong>/etc/apticron/apticron.conf</strong>, all you need to change is the <strong>EMAIL</strong> option.</p>
<blockquote><p>EMAIL="<strong>YOUR_EMAIL_HERE</strong>"</p></blockquote>
<p>Now each day you will receive an email when <strong>cron.daily</strong> runs with all available package updates.</p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2012/01/28/automaticunattended-updates-on-debian-6-squeeze/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>syslog.tv is now HTTPS enabled</title>
		<link>http://syslog.tv/2011/12/24/syslog-tv-is-now-https-enabled/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=syslog-tv-is-now-https-enabled</link>
		<comments>http://syslog.tv/2011/12/24/syslog-tv-is-now-https-enabled/#comments</comments>
		<pubDate>Sat, 24 Dec 2011 01:01:38 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=789</guid>
		<description><![CDATA[https://syslog.tv/
&#160;
I finally stopped being lazy and decided to create an HTTPS version of this blog. I know it's not at all required but I decided it could/would be a good thing to do anyway.
For now due to the blog software being crappy it's showing an invalid certificate due to including  [...]]]></description>
			<content:encoded><![CDATA[<h3 style="text-align: center;"><a href="https://syslog.tv/">https://syslog.tv/</a></h3>
<p>&nbsp;</p>
<p>I finally stopped being lazy and decided to create an HTTPS version of this blog. I know it's not at all required but I decided it could/would be a good thing to do anyway.</p>
<p>For now due to the blog software being crappy it's showing an invalid certificate due to including resources that are not secured - I'll work on fixing that.</p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/12/24/syslog-tv-is-now-https-enabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>syslog.tv is now IPv6 enabled</title>
		<link>http://syslog.tv/2011/12/19/syslog-tv-is-now-ipv6-enabled/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=syslog-tv-is-now-ipv6-enabled</link>
		<comments>http://syslog.tv/2011/12/19/syslog-tv-is-now-ipv6-enabled/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 22:35:34 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=783</guid>
		<description><![CDATA[Wanted to do this back in June for World IPv6 Day but Linode didn't support IPv6 in it's London data centre.
It's IPv6 address is: 2a01:7e00::f03c:91ff:fe93:505a

]]></description>
			<content:encoded><![CDATA[<p>Wanted to do this back in June for World IPv6 Day but Linode didn't support IPv6 in it's London data centre.</p>
<p>It's IPv6 address is: <strong>2a01:7e00::f03c:91ff:fe93:505a</strong></p>
<p><a href="https://syslog.tv/files/2011/12/ipv6.png"><img class="aligncenter size-full wp-image-784" title="IPv6" src="https://syslog.tv/files/2011/12/ipv6.png" alt="IPv6" width="742" height="613" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/12/19/syslog-tv-is-now-ipv6-enabled/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Running your own PGP keyserver with SKS on Debian 6/Ubuntu 10.04</title>
		<link>http://syslog.tv/2011/12/17/running-your-own-pgp-keyserver-with-sks-on-debian-6ubuntu-10-04/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=running-your-own-pgp-keyserver-with-sks-on-debian-6ubuntu-10-04</link>
		<comments>http://syslog.tv/2011/12/17/running-your-own-pgp-keyserver-with-sks-on-debian-6ubuntu-10-04/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 15:58:59 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[keyserver]]></category>
		<category><![CDATA[pgp]]></category>
		<category><![CDATA[sks]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=771</guid>
		<description><![CDATA[Commands prefixed with # need to be run as a sudo or root.
Installation
To install we need to run the following command:
# apt-get install -y sks
Now we build the key database:
# sks build
And change the permissions for the sks user:
# chown -R debian-sks:debian-sks /var/lib/sks/DB
Next we need to  [...]]]></description>
			<content:encoded><![CDATA[<p><em><strong>Commands prefixed with # need to be run as a sudo or root.</strong></em></p>
<h2>Installation</h2>
<p>To install we need to run the following command:</p>
<blockquote><p># apt-get install -y sks</p></blockquote>
<p>Now we build the key database:</p>
<blockquote><p># sks build</p></blockquote>
<p>And change the permissions for the sks user:</p>
<blockquote><p># chown -R debian-sks:debian-sks /var/lib/sks/DB</p></blockquote>
<p>Next we need to make sks start from init, open up <strong>/etc/default/sks</strong> in your favourite editor and <em><strong>initstart</strong></em> to look like below:</p>
<blockquote><p>initstart=yes</p></blockquote>
<p>Now we can start the service with:</p>
<blockquote><p># /etc/init.d/sks start</p></blockquote>
<p>Your keyserver will now be up and running on port 11371.</p>
<h2>Web interface</h2>
<p>We'll need to create a web folder within sks with the following command:</p>
<blockquote><p># mkdir -p /var/lib/sks/www/</p></blockquote>
<p>Change it's permissions so the sks user can access it.</p>
<blockquote><p># chown -R debian-sks:debian-sks /var/lib/sks/www</p></blockquote>
<p>And finally we need create a single HTML file for the interface, I have provided that too.</p>
<blockquote><p># wget http://syslog.tv/downloads/sks-index.html -O /var/lib/sks/www/index.html</p></blockquote>
<p>Now your PGP server should be accessible from a web browser at <a title="http://YOUR_SERVER:11371/" href="http://YOUR_SERVER:11371/" target="_blank">http://YOUR_SERVER:11371/</a> and it should look like mine <a title="http://syslog.tv:11371/" href="http://syslog.tv:11371/" target="_blank">http://syslog.tv:11371/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/12/17/running-your-own-pgp-keyserver-with-sks-on-debian-6ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Host git repositories with git, gitosis and gitweb on Debian 6/Ubuntu 10.04</title>
		<link>http://syslog.tv/2011/12/17/host-git-repositories-with-git-gitosis-and-gitweb-on-debian-6ubuntu-10-04/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=host-git-repositories-with-git-gitosis-and-gitweb-on-debian-6ubuntu-10-04</link>
		<comments>http://syslog.tv/2011/12/17/host-git-repositories-with-git-gitosis-and-gitweb-on-debian-6ubuntu-10-04/#comments</comments>
		<pubDate>Sat, 17 Dec 2011 15:40:01 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[gitosis]]></category>
		<category><![CDATA[gitweb]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=765</guid>
		<description><![CDATA[Installation
First up we'll need to install git and some Python tools to get Gitosis installed.
Where # is used it means you need to either run the command as a superuser with sudo or as root.
# apt-get install -y git-core gitweb python-setuptools
Next we have to clone gitosis from it's git  [...]]]></description>
			<content:encoded><![CDATA[<h2>Installation</h2>
<p>First up we'll need to install git and some Python tools to get Gitosis installed.</p>
<p>Where # is used it means you need to either run the command as a superuser with sudo or as root.</p>
<blockquote><p># apt-get install -y git-core gitweb python-setuptools</p></blockquote>
<p>Next we have to clone gitosis from it's git repository and install it.</p>
<blockquote><p>cd /tmp</p>
<p>git clone git://eagain.net/gitosis.git</p>
<p>cd gitosis</p>
<p># python setup.py install</p></blockquote>
<h2>Adding your git user</h2>
<blockquote><p># adduser --system --shell /bin/sh --gecos 'git version control' --group --disabled-password --home /home/git git</p></blockquote>
<p>The above command creates a new system user with <strong>/bin/sh</strong> as it's shell with <strong>no password</strong> and a homedir of <strong>/home/git/</strong> and also creates a group with the same name.</p>
<h2>Initialising gitosis</h2>
<p>You'll need an SSH key for this, if you have one simply copy the contents of it to your new git server, if you do not have one then you can generate one on your machine using</p>
<blockquote><p>ssh-keygen</p></blockquote>
<p>And then copy the contents to your server.</p>
<p>My file was copied to <strong>/tmp/kura.pub</strong> so to initialise I used</p>
<blockquote><p>sudo -H -u git gitosis-init &lt; /tmp/kura.pub</p></blockquote>
<p><em><strong>This command MUST be run as sudo.</strong></em></p>
<p>You need to do the same but replacing <strong>kura.pub</strong> with your own key, it has to end in .pub</p>
<h3>A note on key format</h3>
<p>One of my users (<a href="https://syslog.tv/2011/12/17/host-git-repositories-with-git-gitosis-and-gitweb-on-debian-6ubuntu-10-04/#comment-374">@gump</a>) had an issue where Gitosis would complain about his username having invalid characters</p>
<blockquote><p>gitosis.init.InsecureSSHKeyUsername: Username contains not allowed characters</p></blockquote>
<p>This is because Gitosis expects your key to have a username and host at the end of the base64 string like below</p>
<blockquote><p>ssh-rsa AAAAB3NzaC1yc2EA ... NOHgpPwEBzpnw== kura@odin</p></blockquote>
<h2>Configuring and controlling gitosis</h2>
<p>Now that git and gitosis are working on your server, from your local machine you now need to clone your gitosis admin and do all your changes locally, pushing them back to the git server where gitosis will automatically pick them up.</p>
<p>So you need to run</p>
<blockquote><p>git clone git@YOUR_SERVER:gitosis-admin.git</p></blockquote>
<p>If everything worked correctly you should have a copy on your local machine now, if you run <strong>ls</strong> you'll see 1 file and a directory.</p>
<ol>
<li><span style="line-height: 18px;">gitosis.conf</span></li>
<li><span style="line-height: 18px;">keydir</span></li>
</ol>
<p>Unsurprisingly gitosis.conf is where gitosis is configured and keydir contains public keys for your users. Each user needs their own public key and it must end in <em>.pub</em>.</p>
<p>So open up <strong>gitosis.conf</strong> in your favourite editor and add the following:</p>
<blockquote><p>[gitosis]<br />
gitweb = yes</p>
<p>[group admins]<br />
writable = gitosis-admin test1<br />
members = kura</p>
<p>[repo gitosis-admin]<br />
description = Gitosis admin repository<br />
gitweb = yes</p></blockquote>
<p>So lets separate that in to parts.</p>
<p><strong>Part 1</strong> - we simply tell gitosis to enable gitweb support.</p>
<p><strong>Part 2</strong> - we configure a group called <em><strong>admins</strong></em>, the admins group has write permissions to 2 repositories; <em><strong>gitosis-admin</strong></em> and <em><strong>test</strong></em>. The test repository will automatically become available once we push this configuration back to gitosis later. We also define a user called <strong>kura</strong> which you should replace with your own username, <strong>each user must have a public key in the keydir with the same name as the user with .pub suffix. E.g. the kura user has a key called kura.pub</strong></p>
<p><strong>Part 3</strong> - We create a repository section which is only really used for gitweb to tell it to display that repository publicly via a browser.</p>
<p><strong>If you do not want your repositories to be public then I advice you skip the parts with gitweb = yes above and also uninstall gitweb and skip the gitweb section below. Or you could lock your gitweb via HTAUTH.</strong></p>
<p>Now the changes have been made you need to commit them to git.</p>
<blockquote><p>git add *</p>
<p>git commit -m "Initial configuration"</p></blockquote>
<p>And push them back to the server</p>
<blockquote><p>git push origin master</p></blockquote>
<p>Now that is done you can test your access to the test repository created earlier.</p>
<blockquote><p>git clone git@YOUR_SERVER:test.git</p>
<p>cd test</p>
<p>echo "Hello world" &gt; hello</p>
<p>git add hello</p>
<p>git commit -m "Test"</p>
<p>git push origin master</p></blockquote>
<p>If the above works then congratulations, everything is good.</p>
<h2>Adding users and repositories</h2>
<h3>Users</h3>
<p>To add a user to gitosis you need to add them to a group and put a public key with username.pub as the naming format in to keydir.</p>
<h3>Repositories</h3>
<p>You simply need to name it in a writable section of a group and it'll instantly be accessible. If you want to make it public in gitweb then you'll need to a [repo] section as shown above.</p>
<h2>Configure gitweb</h2>
<p>Open up <strong>/etc/gitweb.conf</strong> in your favourite editor and change <em><strong>$projectroot</strong></em> to</p>
<blockquote><p>$projectroot = "/home/git/repositories/"</p></blockquote>
<p>You will also need to add the Apache user to the git group</p>
<blockquote><p>usermod -G www-data,git www-data</p></blockquote>
<p>By default Debian and Ubuntu will symlink in an Apache2 config to <strong>/etc/apache2/conf.d/gitweb</strong> which is accessible from a browser on <a title="http://YOUR_SERVER/gitweb" href="http://YOUR_SERVER/gitweb" target="_blank">http://YOUR_SERVER/gitweb</a></p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/12/17/host-git-repositories-with-git-gitosis-and-gitweb-on-debian-6ubuntu-10-04/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Rebooting on OOM</title>
		<link>http://syslog.tv/2011/10/25/rebooting-on-oom/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=rebooting-on-oom</link>
		<comments>http://syslog.tv/2011/10/25/rebooting-on-oom/#comments</comments>
		<pubDate>Tue, 25 Oct 2011 10:26:34 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[kernel panic]]></category>
		<category><![CDATA[oom]]></category>
		<category><![CDATA[reboot]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=735</guid>
		<description><![CDATA[I would generally not advise using this unless you have skill at debugging why OOM has spawned and also debugging kernel panics after they happen, from logs.
It is possible to configure your kernel to panic when OOM is spawned, which in itself is not useful but, coupled with a kernel option for  [...]]]></description>
			<content:encoded><![CDATA[<p><span style="text-decoration: underline;"><em><strong>I would generally not advise using this unless you have skill at debugging why OOM has spawned and also debugging kernel panics after they happen, from logs.</strong></em></span></p>
<p>It is possible to configure your kernel to panic when OOM is spawned, which in itself is not useful but, coupled with a kernel option for auto-rebooting a system when the kernel panics it can be a very useful tool.</p>
<p>Think before implementing this and use at your own risk, I take zero responsibility for you using this.</p>
<blockquote><p>sysctl vm.panic_on_oom=1</p></blockquote>
<blockquote><p>sysctl kernel.panic=X # X is the amount of seconds to wait before rebooting</p></blockquote>
<p><span style="text-decoration: underline;"><em><strong>DO NOT FORGET TO CHANGE X</strong></em></span></p>
<p>This will inject the changes in to a system that is currently running but will be forgotten on reboot so use the lines below to save permanently.</p>
<blockquote><p>echo "vm.panic_on_oom=1" >> /etc/sysctl.conf</p></blockquote>
<blockquote><p>echo "kernel.panic=X" >> /etc/sysctl.conf</p></blockquote>
<p><strong><em><span style="text-decoration: underline;">X is the amount of seconds to wait before rebooting. DO NOT FORGET TO CHANGE X</span></em></strong></p>
<h2>Testing</h2>
<p>You can test the changes with a simple C program. <strong>Please note if you run this you do so at your own risk</strong>.</p>
<blockquote><p>#include <stdio.h><br />
#include <stdlib.h><br />
#include <string.h></p>
<p>#define MB 10485760</p>
<p>int main(int argc, char *argv[]) {</p>
<p style="padding-left: 30px;">void *b = NULL;<br />
int c = 0;</p>
<p style="padding-left: 30px;">while(1) {</p>
<p style="padding-left: 60px;">b = (void *) malloc(MB);</p>
<p style="padding-left: 60px;">if (!b) {</p>
<p style="padding-left: 90px;">break;</p>
<p style="padding-left: 60px;">}</p>
<p style="padding-left: 60px;">memset(b, 10, MB);<br />
printf("Allocating %d MB\n", (++c * 10));</p>
<p style="padding-left: 30px;">}</p>
<p style="padding-left: 30px;">exit(0);</p>
<p>}</p></blockquote>
<h2>Compilation</h2>
<p>You can download the source from <a title="oom.c" href="http://syslog.tv/downloads/oom.c" target="_blank">here</a>.</p>
<p>To compile run the command below</p>
<blockquote><p>gcc -O2 oom.c -o oom</p></blockquote>
<p>Or download a pre-compiled version <a title="oom" href="http://syslog.tv/downloads/oom" target="_blank">here</a>.</p>
<h2>Usage</h2>
<p>And simply run it using</p>
<blockquote><p>./oom</p></blockquote>
<p>After a short period of time allocating and using 10MB chunks of memory your system should run out and restart.</p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/10/25/rebooting-on-oom/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Nagios3 + MK Livestatus + xinetd on Debian 6/Ubuntu</title>
		<link>http://syslog.tv/2011/10/13/nagios3-mk-livestatus-xinetd/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nagios3-mk-livestatus-xinetd</link>
		<comments>http://syslog.tv/2011/10/13/nagios3-mk-livestatus-xinetd/#comments</comments>
		<pubDate>Thu, 13 Oct 2011 23:17:10 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[nagios]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[mk livestatus]]></category>
		<category><![CDATA[nagios 3]]></category>
		<category><![CDATA[nagios broker]]></category>
		<category><![CDATA[xinetd]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=711</guid>
		<description><![CDATA[Preparation
First we need to make sure we have all the stuff we need to compile mk livestatus and run it
apt-get install make build-essential xinetd ucspi-unix
MK Livestatus
Grab the mk livestatus source from here, currently it's version 1.1.10p3 but update the commands below to match your  [...]]]></description>
			<content:encoded><![CDATA[<h2>Preparation</h2>
<p>First we need to make sure we have all the stuff we need to compile mk livestatus and run it</p>
<blockquote><p>apt-get install make build-essential xinetd ucspi-unix</p></blockquote>
<h2>MK Livestatus</h2>
<p>Grab the mk livestatus source from <a href="http://mathias-kettner.de/check_mk_download.html" target="_blank">here</a>, currently it's version 1.1.10p3 but update the commands below to match your version.</p>
<blockquote><p>wget http://mathias-kettner.de/download/mk-livestatus-1.1.10p3.tar.gz</p>
<p>tar -xvzf mk-livestatus-1.1.10p3.tar.gz</p>
<p>cd mk-livestatus-1.1.10p3</p>
<p>./configure</p>
<p>make &amp;&amp; make install</p></blockquote>
<h2>Xinetd</h2>
<p>Now that it's compiled we need to write a xinetd config for it, create a new file called <strong>/etc/xinetd.d/livestatus</strong> and put the following in it</p>
<blockquote><p>service livestatus<br />
{</p>
<p style="padding-left: 30px;">type = UNLISTED<br />
port = 6557<br />
socket_type = stream<br />
protocol = tcp<br />
wait = no<br />
cps = 100 3<br />
instances = 500<br />
per_source = 250<br />
flags = NODELAY<br />
user = nagios<br />
server = /usr/bin/unixcat<br />
server_args = /var/lib/nagios3/rw/live<br />
only_from = 127.0.0.1 # modify this to only allow specific hosts to connect, currenly localhost only<br />
disable = no</p>
<p>}</p></blockquote>
<p>Now we restart xinetd using</p>
<blockquote><p>/etc/init.d/xinetd restart</p></blockquote>
<h2>Nagios3</h2>
<p>Now we need to open up <strong>/etc/nagios3/nagios.cfg</strong> and add the following 2 lines</p>
<blockquote><p>event_broker_options=-1<br />
broker_module=/usr/local/lib/mk-livestatus/livestatus.o /var/lib/nagios3/rw/live</p></blockquote>
<p>Now we need to restart Nagios</p>
<blockquote><p>/etc/init.d/nagios3 restart</p></blockquote>
<p>If you take a look in <strong>/var/log/nagios3/nagios.log</strong></p>
<blockquote><p>tail -n 100 /var/log/nagios3/nagios.log</p></blockquote>
<p>you should see something like below</p>
<blockquote><p>[1318547328] livestatus: Livestatus 1.1.10p3 by Mathias Kettner. Socket: '/var/lib/nagios3/rw/live'<br />
[1318547328] livestatus: Please visit us at http://mathias-kettner.de/<br />
[1318547328] livestatus: Hint: please try out OMD - the Open Monitoring Distribution<br />
[1318547328] livestatus: Please visit OMD at http://omdistro.org<br />
[1318547328] Event broker module '/usr/local/lib/mk-livestatus/livestatus.o' initialized successfully.</p></blockquote>
<p>Also, we can ls the newly created socket</p>
<blockquote><p>ls -lah /var/lib/nagios3/rw/live</p></blockquote>
<blockquote><p>srw-rw---- 1 nagios www-data 0 2011-10-14 00:08 /var/lib/nagios3/rw/live</p></blockquote>
<p>We can test is by creating a test file called host_query with the following content</p>
<blockquote><p>GET hosts</p></blockquote>
<p>And run the following command</p>
<blockquote><p>unixcat &lt; host_query /var/lib/nagios3/rw/live</p></blockquote>
<p>If all worked you should see output.</p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/10/13/nagios3-mk-livestatus-xinetd/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nginx config for reverse proxying WordPress &amp; WP Super Cache and keeping the load off Apache2</title>
		<link>http://syslog.tv/2011/09/30/nginx-config-for-reverse-proxying-wordpress-wp-super-cache-and-keeping-the-load-off-apache2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=nginx-config-for-reverse-proxying-wordpress-wp-super-cache-and-keeping-the-load-off-apache2</link>
		<comments>http://syslog.tv/2011/09/30/nginx-config-for-reverse-proxying-wordpress-wp-super-cache-and-keeping-the-load-off-apache2/#comments</comments>
		<pubDate>Fri, 30 Sep 2011 23:21:22 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[apache]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[apache2]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[wp-super-cache]]></category>

		<guid isPermaLink="false">http://syslog.tv/2011/09/30/nginx-config-for-reverse-proxying-wordpress-wp-super-cache-and-keeping-the-load-off-apache2/</guid>
		<description><![CDATA[The point
The whole point of this is to get as much load off of Apache as possible to keep the server running nice and smoothly.
Configuration
The configuration below will mean that nginx will serve basically everything;

static files
uploaded files and
cached content

simply replace the VARIABLES  [...]]]></description>
			<content:encoded><![CDATA[<h2>The point</h2>
<p>The whole point of this is to get as much load off of Apache as possible to keep the server running nice and smoothly.</p>
<h2>Configuration</h2>
<p>The configuration below will mean that nginx will serve basically everything;</p>
<ul>
<li><span style="line-height: 18px;">static files</span></li>
<li><span style="line-height: 18px;">uploaded files and</span></li>
<li><span style="line-height: 18px;">cached content</span></li>
</ul>
<div><span style="line-height: 18px;">simply replace the <span style="text-decoration: underline;"><strong>VARIABLES</strong></span> below and everything should be good to go, if copy-pasting from below isn't working properly you can download a full copy from <a href="http://syslog.tv/files/2011/09/server.txt">here</a>.</span></div>
<blockquote><p>server {</p>
<div style="padding-left: 30px;">listen 80;<br />
server_name <span style="text-decoration: underline;"><strong>DOMAIN_HERE</strong></span>;access_log /var/log/nginx/access.<span style="text-decoration: underline;"><strong>DOMAIN_HERE</strong></span>.log;</p>
<p>gzip on;<br />
gzip_disable msie6; # disable gzip for IE6<br />
gzip_static on;<br />
gzip_comp_level 9; # highest level of compression<br />
gzip_proxied any;<br />
gzip_types text/plain text/css application/x-javascript text/xml application/xml application/xml+rss text/javascript;</p>
<p>proxy_redirect off;<br />
proxy_set_header Host $host;<br />
proxy_set_header X-Real-IP $remote_addr;<br />
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;<br />
proxy_pass_header Set-Cookie;root <span style="text-decoration: underline;"><strong>/PATH/TO/WORDPRESS</strong></span>;</p>
<p># default location, used for the basic proxying<br />
location / {</p>
<div style="padding-left: 30px;"># if we're requesting a file and it exists, return it and bail out<br />
if (-f $request_filename) {</p>
<div style="padding-left: 30px;">break;</div>
<p>}</p>
<p>client_max_body_size 2m; # increase this to increase file upload size<br />
proxy_pass http://localhost:<span style="text-decoration: underline;"><strong>APACHE_PORT</strong></span>;</p>
</div>
<p>}</p>
<p># handle uploaded files<br />
location ~* files/ {</p>
<div style="padding-left: 30px;">root <span style="text-decoration: underline;"><strong>/PATH/TO/WORDPRESS</strong></span>/blogs.dir/<span style="text-decoration: underline;"><strong>BLOG_ID</strong></span>/;</div>
<p>}</p>
<p># handle static files<br />
location ~* \.(jpg|png|gif|jpeg|js|css|mp3|wav|swf|mov|doc|pdf|xls|ppt|docx|pptx|xlsx|txt|htm|html)$ {</p>
<div style="padding-left: 30px;"># if the static file doesn't exist, handle it with Apache<br />
if (!-f $request_filename) {</p>
<div style="padding-left: 30px;">break;<br />
proxy_pass http://localhost:<span style="text-decoration: underline;"><strong>APACHE_PORT</strong></span>;</div>
<p>}</p>
</div>
<p>}</p>
<p>set $supercache_file "";<br />
set $supercache_uri $request_uri;</p>
<p># reset cache URI if POSTing - bypass cache<br />
if ($request_method = POST) {</p>
<div style="padding-left: 30px;">set $supercache_uri "";</div>
<p>}</p>
<p># bypass cache if there's a query string<br />
if ($query_string) {</p>
<div style="padding-left: 30px;">set $supercache_uri "";</div>
<p>}</p>
<p># bypass cache if one of the cookies below is set<br />
if ($http_cookie ~* "comment_author_|wordpress|wp-postpass_") {</p>
<div style="padding-left: 30px;">set $supercache_uri "";</div>
<p>}</p>
<p># if the URI is still set (rules above don't trigger) then set our file location!<br />
if ($supercache_uri ~ ^(.+)$) {</p>
<div style="padding-left: 30px;">set $supercache_file /wp-content/cache/supercache/$http_host$1index.html;</div>
<p>}</p>
<p># rewrite the request to the cached HTML file<br />
if (-f $document_root$supercache_file) {</p>
<div style="padding-left: 30px;">rewrite ^(.*)$ $supercache_file break;</div>
<p>}</p>
<p># if file exists, return it - will bypass back to Apache if not<br />
if (-f $request_filename) {</p>
<div style="padding-left: 30px;">break;</div>
<p>}</p>
</div>
<p>}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/09/30/nginx-config-for-reverse-proxying-wordpress-wp-super-cache-and-keeping-the-load-off-apache2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Load balancing HTTP/HTTPS with Pound on Debian 6/Ubuntu</title>
		<link>http://syslog.tv/2011/09/29/load-balancing-httphttps-with-pound-on-debian-6ubuntu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=load-balancing-httphttps-with-pound-on-debian-6ubuntu</link>
		<comments>http://syslog.tv/2011/09/29/load-balancing-httphttps-with-pound-on-debian-6ubuntu/#comments</comments>
		<pubDate>Thu, 29 Sep 2011 23:15:49 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[pound]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[https]]></category>
		<category><![CDATA[load]]></category>
		<category><![CDATA[load balancing]]></category>
		<category><![CDATA[ssl]]></category>
		<category><![CDATA[ssl offloading]]></category>
		<category><![CDATA[ssl termination]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=661</guid>
		<description><![CDATA[Pound is a great little load balancer, it's fast, opensource and supports SSL termination, which is great!
Install
apt-get install pound
Configuration
The default configuration should be pretty good for most purposes, but feel free to tweak as you require.
HTTP
We'll first look at load balancing  [...]]]></description>
			<content:encoded><![CDATA[<p>Pound is a great little load balancer, it's fast, opensource and supports SSL termination, which is great!</p>
<h2>Install</h2>
<blockquote><p>apt-get install pound</p></blockquote>
<h2>Configuration</h2>
<p>The default configuration should be pretty good for most purposes, but feel free to tweak as you require.</p>
<h3>HTTP</h3>
<p>We'll first look at load balancing HTTP, in case you don't want or need HTTPS load balancing.</p>
<p>We'll need delete all the content within <em>ListenHTTP</em>  block, once done it should look like this</p>
<blockquote><p>ListenHTTP</p>
<p>End</p></blockquote>
<p>Now we add an address and port to listen on and finally a line to remove an HTTP header</p>
<blockquote><p>ListenHTTP</p>
<p style="padding-left: 30px;">Address 0.0.0.0 # all interfaces<br />
Port 80<br />
HeadRemove "X-Forwarded-For"</p>
<p>End</p></blockquote>
<p>This is a basic configuration, for each backend we want to load balance we'll need to add a service within that listener.</p>
<p>You'll notice we're removing incoming headers called <em>X-Forwarded-For</em>, this is to make sure someone doesn't try to craft them in to a request and abuse them.</p>
<blockquote><p>ListenHTTP</p>
<p style="padding-left: 30px;">Address 0.0.0.0 # all interfaces<br />
Port 80<br />
HeadRemove "X-Forwarded-For"</p>
<p style="padding-left: 30px;">Service</p>
<p style="padding-left: 60px;">BackEnd</p>
<p style="padding-left: 90px;">Address 10.0.0.1<br />
Port 80<br />
Priority 1</p>
<p style="padding-left: 60px;">End<br />
BackEnd</p>
<p style="padding-left: 90px;">Address 10.0.0.2<br />
Port 80<br />
Priority 1</p>
<p style="padding-left: 60px;">End</p>
<p style="padding-left: 30px;">End</p>
<p>End</p></blockquote>
<p>Here I've added 2 BackEnds that connect to port 80, it's all pretty simple. Add as many as you want/need.</p>
<p>Pound will pass correct HTTP headers through to the backends so you configure those just like you normally would.</p>
<h3>HTTPS</h3>
<p>HTTPS is basically exactly the same as HTTP except for one fantastic option - SSL termination! Which means we can do the SSL decryption within Pound and talk to our backend servers over standard unencrypted HTTP - <strong>this should only be done on a private network.</strong></p>
<p>So, we'll create an HTTPS listened like the one above but with extra options.</p>
<blockquote><p>ListenHTTPS</p>
<p style="padding-left: 30px;">Address 0.0.0.0 # all interfaces<br />
Port 443<br />
AddHeader "X-Forwarded-Proto: https"<br />
HeadRemove "X-Forwarded-Proto"<br />
HeadRemove "X-Forwarded-For"<br />
Cert "/path/to/certificate.pem</p>
<p style="padding-left: 30px;">Service</p>
<p style="padding-left: 60px;">BackEnd</p>
<p style="padding-left: 90px;">Address 10.0.0.1<br />
Port 80<br />
Priority 1</p>
<p style="padding-left: 60px;">End<br />
BackEnd</p>
<p style="padding-left: 90px;">Address 10.0.0.2<br />
Port 80<br />
Priority 1</p>
<p style="padding-left: 60px;">End</p>
<p style="padding-left: 30px;">End</p>
<p>End</p></blockquote>
<p>You'll notice a few changes here, first we tell the HTTPS listener to listen on port 443 - SSL port.</p>
<p>We add a header to pass back to our backend servers called <em>X-Forwarded-Proto</em>, this is so that on our backend we can inspect this header and use it if required to know we're secure.</p>
<p>We also remove incoming headers called <em>X-Forwarded-Proto</em> and <em>X-Forwarded-For</em>, this is to make sure someone doesn't try to craft them in to a request and abuse them.</p>
<p>Finally is the certificate which needs to be a PEM file with all certificates and keys within it and without passphrases.</p>
<h2>Done</h2>
<p>Once configured, reload Pound.</p>
<blockquote><p>/etc/init.d/pound reload</p></blockquote>
<p>That really was simple.</p>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/09/29/load-balancing-httphttps-with-pound-on-debian-6ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Postfix spam protection with greylisting using Postgrey on Debian 6/Ubuntu</title>
		<link>http://syslog.tv/2011/09/24/postfix-spam-protection-with-greylisting-using-postgrey-on-debian-6ubuntu/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postfix-spam-protection-with-greylisting-using-postgrey-on-debian-6ubuntu</link>
		<comments>http://syslog.tv/2011/09/24/postfix-spam-protection-with-greylisting-using-postgrey-on-debian-6ubuntu/#comments</comments>
		<pubDate>Sat, 24 Sep 2011 21:29:41 +0000</pubDate>
		<dc:creator>Kura</dc:creator>
				<category><![CDATA[debian]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[mail]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[greylist]]></category>
		<category><![CDATA[postfix]]></category>
		<category><![CDATA[postgrey]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://syslog.tv/?p=632</guid>
		<description><![CDATA[A simple yet effective method for protecting your mail server from spam is to use greylisting. In simple terms, when an email is received the server will temporarily reject it with a 450 response code claiming that the server is busy, the sending server should then attempt to try to deliver at a  [...]]]></description>
			<content:encoded><![CDATA[<p>A simple yet effective method for protecting your mail server from spam is to use greylisting. In simple terms, when an email is received the server will temporarily reject it with a 450 response code claiming that the server is busy, the sending server should then attempt to try to deliver at a later point in time, if enough time has passed the recipient server will then accept the incoming mail and whitelist the send address for a period of time.</p>
<p>This is effective because most spam servers are configured not to retry the send whereas real mail servers generally will retry. This sadly does not protect against spam coming from comprised mail servers or accounts like on Hotmail.com.</p>
<h2>Installation</h2>
<blockquote><p>apt-get install postgrey</p></blockquote>
<h2>Configuring Postgrey</h2>
<p>By default Postgrey runs on <em>127.0.0.1:60000</em>, which is the local loopback interface so it is not exposed to the outside world.</p>
<p>If you open up <strong>/etc/default/postgrey</strong> and modify the <em>POSTGREY_OPTS</em> line you can configure how long to grey list for.</p>
<blockquote><p>--delay=60</p></blockquote>
<p>would greylist the sending server for 60 seconds (the default value is 300 second, 5 minutes), if a retry was attempted after 60 seconds the sender would automatically become whitelisted, by default this sender is whitelisted for 35 days but can be changed using the <em>--max-age</em> option</p>
<blockquote><p>--max-age=10</p></blockquote>
<p>would whitelist for 10 days.</p>
<p>They can be combined as below.</p>
<blockquote><p>POSTGREY_OPTS="--inet=127.0.0.1:60000 --delay=60 --max-age=10"</p></blockquote>
<p>Once you're satisfied save and closed and restart Postgrey.</p>
<blockquote><p>/etc/init.d/postgrey restart</p></blockquote>
<h2>Configuring Postfix</h2>
<p>Open up <strong>/etc/postfix/main.cf</strong> and add the following within <em>smtpd_receipient_restrictions</em></p>
<blockquote><p>check_policy_service inet:127.0.0.1:60000</p></blockquote>
<p>This is best added after your <acronym title="Simple Authentication and Security Layer">SASL</acronym> and sender domain checks but before <acronym title="Sender Policy Framework">SPF</acronym> and blacklists, see below for an example</p>
<blockquote><p>smtpd_recipient_restrictions = permit_mynetworks,</p>
<p style="padding-left: 30px;">permit_sasl_authenticated,<br />
reject_unauth_destination,<br />
reject_unknown_sender_domain,<br />
check_policy_service inet:127.0.0.1:60000</p>
</blockquote>
<p>Now reload Postfix</p>
<blockquote><p>/etc/init.d/postfix reload</p></blockquote>
<h2>Testing</h2>
<p>Now if you tail your mail.log you will see your Postgrey instance rejecting incoming email like below.</p>
<blockquote><p>Sept 24 22:26:18 heimdall postfix/smtpd[4256]: NOQUEUE: reject: RCPT from example.com[xxx.xxx.xxx.xxx]: 450: Recipient address rejected: Greylisted for 300 seconds (see http://isg.ee.ethz.ch/tools/postgrey/help/spammed.com.html); from=to=proto=ESMTP helo=&lt;example.com&gt;</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://syslog.tv/2011/09/24/postfix-spam-protection-with-greylisting-using-postgrey-on-debian-6ubuntu/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
