Simple Mail Server

As an admin I have to be lazy. Currently I am moving several websites to a new server. This is workload enough, so I do not want to bother with stuff like a mailserver config. Especially, as I do not really see need for it. There are enough companies offering mail services, so I only want my server to accept mails for the domains he serves and then delivering them to my (or somebody else’s) personal mail address. And of course mails generated from the websites have to be sent out.

I chose exim4 for that purpose. After setting it up (as an “internet site” with splitting into several config files) via

dpkg-reconfigure exim4-config

I created the file /etc/exim4/conf.d/router/050_exim4-config_forwarding with the following content

### router/50_exim4-config_forwarding
#################################

# This router handles forwarding of mails to
# their appropriate recipients

sender_redirect:
  driver = redirect
  domains = +local_domains
  data = ${lookup{$local_part}lsearch{/etc/exim4/virtual/$domain}}

When a new mail arrives, this file is checked first and looks for forwarding rules in /etc/exim4/virtual/DOMAIN. So to set up forwarding for domain.com mail addresses create /etc/exim4/virtual/domain.com with one forwarding rule in each line

root: me@gmail.com
me: me@gmail.com
another-mail: somebody@gmail.com

[UPDATE 15.02.2014]
Although only accepting mail for several domains, I got some spam problems. Spam that was sent to me was then blocked by gmail after forwarding it. As the return address was not existing, my server sent a bounce message to gmail, which was blocked again. I ended up having a lot of frozen messages. To enable some blacklisting with exim on Debian is straight forward, if you know where to look. Check out this tutorial for further information: http://www.linuxlookup.com/howto/dns_blacklist_exim

NetworkManager Dispatcher

To keep my data backed up savely I rely on CrashPlan. For the last weeks I had a quite long bug request pending. What I took from it, was the problem CrashPlan had when the network is not yet available when the service is started. Therefore I disabled its automatic startup and wrote a dispatcher script for the NetworkManager to automatically start crashplan, whenever I get a network connection and stop it, when the connection breaks down. Find the script here: 02crashplan.sh

During mmy research I found out, that the dispatcher service was not enabled on my Arch Linux system. That’s important for the scripts to work.

$ sudo systemctl enable NetworkManager-dispatcher

Similarly the service for the modemmanager was disabled, which caused my UMTS card to not work.

$ sudo systemctl enable ModemManager

While working on this, I wrote another dispatcher script, which takes care of connecting to the univeristy vpn (works for all Munich universities, which get their internet services from the lrz) automatically, when I connect to the corresponding network. Find the script here: 01lrzvpn.sh
The idea for this script and its frame is taken from Ubuntuusers.de. Make sure, to save your credentials in the corresponding VPN configuration file and update the name of the VPN in the script to the one you are using.

Multiboot USB Drive

I just created a usb drive containing different linux distributions. I wanted the drive to have the original iso files on it with no need to unpack.

Here is what I did:

sudo mkfs.vfat -n MultibootUSB /dev/sdd1
sudo mount /dev/sdd /mnt/
sudo grub-install --no-floppy --root-directory=/mnt /dev/sdd

All iso files have to put to ‘/mnt/iso’.
My config file ‘/mnt/boot/grub.cfg’ can be downloaded here.

Especially the configuration for Arch Linux was a bit tricky to create.
‘archisolabel’ has to be the label of the image file used.
‘img_dev’ is set to the uuid of the usb device used.

Quite interesting is also the remastering of certain files. I put the neo keymap into /arch/any/usr-share.fs.sfs.

See here: https://wiki.archlinux.org/index.php/Remastering_the_Install_ISO. If anybody wants to have the iso file, just tell me.

For further information check:
http://www.panticz.de/MultiBootUSB
https://wiki.archlinux.de/title/Multiboot_USB_Stick
https://wiki.archlinux.org/index.php/Grub2#Booting_an_ISO_Directly_From_GRUB2
https://bbs.archlinux.org/viewtopic.php?pid=749337
https://bbs.archlinux.org/viewtopic.php?id=78171&p=3