slicehost configuration

general = { about, articles, links, projects }     meta = { date-posted: 2007-08-31 }

This is a merger of a few earlier articles on various portions of my Slicehost configuration. I merged them so they would be easier to find, and provide a potentially superior resource.

Some of my configuration has since changed, due to Slicehost adding support for Archlinux. :)

Install and update

Dapper to Edgy

The first steps was to choose an OS for my slice. I went with Ubuntu. No particular reason for the choice. I almost went with Debian Etch, but didn't. Note: All the following commands need to be run as root, or as sudo

The install Ubuntu option gives you Dapper. Time to upgrade.

Edgy to Feisty

The upgrade from Edgy to Feisty is pretty similar to what was done above.

Yay! Updated to feisty now.

Locking a few things down

tcp wrappers

sshd

firewall - iptables

random stuff

Google Apps Signup

I won't cover the actual Google Apps sign-up process. The Google Apps documentation covers that well enough. I will, however, cover the Slicehost side of the configuration.

DNS

In order to use Google Apps with my Slicehost slice, I had to add several DNS records. I am using Slicehost's provided DNS service, which seems to work very well.

These are the relevant records that I added...

domain.com.                     A        127.127.127.127
domain.com.                     NS       ns1.slicehost.net.
domain.com.                     NS       ns2.slicehost.net.
domain.com.                     NS       ns3.slicehost.net.
domain.com.                     MX       1 ASPMX.L.GOOGLE.COM.
domain.com.                     MX       5 ALT1.ASPMX.L.GOOGLE.COM.
domain.com.                     MX       5 ALT2.ASPMX.L.GOOGLE.COM.
domain.com.                     MX      10 ASPMX2.GOOGLEMAIL.COM.
domain.com.                     MX      10 ASPMX3.GOOGLEMAIL.COM.
domain.com.                     MX      10 ASPMX4.GOOGLEMAIL.COM.
domain.com.                     MX      10 ASPMX5.GOOGLEMAIL.COM.
domain.com.                     TXT     "v=spf1 include:aspmx.googlemail.com ~all"

_xmpp-server._tcp.domain.com.   SRV      5 0 5269 xmpp-server.l.google.com.
_xmpp-server._tcp.domain.com.   SRV     20 0 5269 xmpp-server1.l.google.com.
_xmpp-server._tcp.domain.com.   SRV     20 0 5269 xmpp-server2.l.google.com.
_xmpp-server._tcp.domain.com.   SRV     20 0 5269 xmpp-server3.l.google.com.
_xmpp-server._tcp.domain.com.   SRV     20 0 5269 xmpp-server4.l.google.com.

_jabber._tcp.domain.com.        SRV      5 0 5269 xmpp-server.l.google.com.
_jabber._tcp.domain.com.        SRV     20 0 5269 xmpp-server1.l.google.com.
_jabber._tcp.domain.com.        SRV     20 0 5269 xmpp-server2.l.google.com.
_jabber._tcp.domain.com.        SRV     20 0 5269 xmpp-server3.l.google.com.
_jabber._tcp.domain.com.        SRV     20 0 5269 xmpp-server4.l.google.com.

_xmpp-client._tcp.domain.com.   SRV     5 0 5222 talk.l.google.com.
_xmpp-client._tcp.domain.com.   SRV    20 0 5222 talk1.l.google.com.
_xmpp-client._tcp.domain.com.   SRV    20 0 5222 talk2.l.google.com.

Yes. Those domains really do all end in a dot. It is required. If the dot is not present at the end, then your domain will be auto suffixed.

Note: In the above, replace domain.com. with your domain. Also replace 127.127.127.127 with your server's ip address.

Jabber/xmpp

I use Gajim for xmpp messaging. To configure Gajim for gtalk...

That should be it. You should now be able to add buddies and chat away.

SMTP

I needed to get mail sent off the box, but I didn't need a full MTA. I only need cron job emails, custom notifications, rss2email, and a few other random messages. No mail receiving, just sending.

I used postfix at first, because I know the configuration of postfix fairly well. Postfix is overkill for what I need though. It was sitting idle pretty much all the time, and using some memory that I could use elsewhere (I have a 256 slice).

Since I use Google Apps for my mail hosting, it made sense to leverage that for sending mail from this box too. The solution, was msmtp.

MSMTP

The configuration for msmtp is fairly simple. Just a /etc/msmtprc file.

Prerequisites

Depending on the distribution, you may need to install the following packages:

You need to create a 'send only' email account in Google Apps. That is the account used for configuring msmtp.

Configuration file

Here is the /etc/msmtprc file.

account default
host smtp.gmail.com
port 587
auth on
user yourSendOnlyMailAccount@YourDomain.com
password YourSendOnlyMailAccountPassword
auto_from off
from yourSendOnlyMailAccount@YourDomain.com
maildomain YourDomain.com
tls on
tls_starttls on
tls_trust_file /etc/ssl/certs/ca-certificates.crt
logfile
syslog LOG_MAIL

Make sure the tls_trust_file path to the ca-certificates file is correct. Also set the user, password, and maildomain values are correct for your environment.