debian
General posts that involve the Debian operating system. This’ll range from configuration, installing programs, and much more
Postfix + DK (DomainKeys) + DKIM + SPF on Debian 6/Ubuntu
51This is part 3 of my guide to getting a mail server configured with all the sexy bits to improve deliverability, spam and virus protection.
Part 1 can be found here and part 2 here.
The key pairWe need to create a key pair to sign emails with
openssl genrsa -out private.key 1024
openssl rsa -in private.key -out public.key -pubout -outform PEM
mkdir /etc/dk/
cp private.key /etc/dk/dk.key
Now we can move on to DK and DKIM signing, make sure you keep the public key for later.
DKIMFirst we'll need to install an application to sign our emails.
apt-get install dkim-filter
Once installed we need More >
Postfix + SpamAssassin + ClamAV + Procmail on Debian 6/Ubuntu
11This is part 2 of my series on mail servers on Debian 6/Ubuntu 10.04, it should work on other versions of each though. For part 1, go here.
SpamAssassinFirst off we'll get SpamAssassin installed and configured.
apt-get install spamassassin
We'll be configuring SpamAssassin as a daemon that Postfix interfaces with using spamc.
SpamAssassin on Debian and Ubuntu runs as root which is NOT a good thing so we'll need to make some changes.
We'll add a group called spamd with GID 5001.
groupadd -g 5001 spamd
Next we add a user spamd with UID 5001 and add it to the spamd group, as well as set it's More >
Postfix + Dovecot (IMAP/IMAPS) + SASL + Maildir on Debian 6/Ubuntu
2This guide is part 1 of what I plan will be a couple of guides that take you through installing a base mail system, SpamAssassin, DKIM and much more. Stay tuned.
This guide was written for Debian 6 but should be the same or similar for Debian 5 and Ubuntu 10.04 and above.
The installationapt-get install dovecot-imapd postfix sasl2-bin libsasl2-2 libsasl2-modules
Choose "Internet site" when prompted and enter the fully qualified name of your server.
Once all this is done installing we'll need to make some changes, first off will be Postfix.
PostfixOpen up /etc/postfix/main.cf and add the More >
Installing kernel headers for current kernel version with ease on Debian/Ubuntu
0This is a simple one but I found out that there are people out there that don't know about it, so here we go.
apt-get install linux-headers-$(uname -r)
This will install kernel headers for your current active kernel on Debian/Ubuntu.
nginx log real IP from Pound
2Recently I started using Pound as a load balancer to a cluster of nginx servers and found my access logs were filled with the IP address of the load balancer. I did some digging and found the correct way to "fix" this.
First thing you need to do is make sure you remove X-Forwarded-For from Pound
ListenHTTP
... snip ...
... snip ...
HeadRemove "X-Forwarded-For"
End
Once this is done, reload Pound.
Next you need nginx compiled with realip module - http://wiki.nginx.org/NginxHttpRealIpModule
On Ubuntu/Debian servers this module comes by default, otherwise you may have to compile it in yourself More >
Logging Google Analytics cookies with nginx
0I was recently tasked with adding Google tracking cookies to our nginx logging for a couple of sites. It was so it could be pushed through a log processor.
It turned out too be a little trickier than it would have been with Apache, but the process itself is still quite simple.
Open up the server definition you wish to add it to and add a custom log format like below:
log_format g-a '$remote_addr - $remote_user [$time_local] ' '"$request" $status $body_bytes_sent ' '"$http_referer" "$http_user_agent" More >
Debian/Ubuntu upgrade security packages only
0The command below no longer works, for an updated version that does work and should continue to work (until you upgrade to a new distro version e.g. 10.04 -> 12.04) please see here.
Really simple, should work for most cases, I've not found anything wrong with it.
sudo aptitude update && sudo aptitude install '?and(~U,~Asecurity)'
WordPress + nginx + Varnish + Apache 2
22Lately I've been doing a lot of work with Varnish, this includes testing it within a load balanced environment, putting it behind nginx, putting it in front of Solr, the list goes on.
This blog post will hopefully give you an insight in to a simple way of combining nginx, Varnish and Apache to create a powerful WordPress environment that can really take a hammering.
I'm going to assume you already have Apache and nginx working together, if not I suggest you read my other articles on these subjects to learn how to combine them.
Installing VarnishConfiguring More >sudo apt-get install varnish
Mounting a remote filesystem using sshfs
0First we need to install sshfs.
sudo apt-get install sshfs fuse-utils
Now we make a mount point, I'm going to use a directory in my home directory for this.
mkdir ~/remote-content
And now we simply mount our remote directory to it.
sshfs user@host:/path/to/location ~/remote-content
It's as simple as that.

