I’m running a Postfix server here at home to process incoming mail. To integrate spam filtering I’m delivering mails via procmail - it’s as simple as setting mailbox_command = /usr/bin/procmail in postfix’ main.cf.

Spam filtering works by invoking the filter (bogofilter in my case) from procmail like this:

:0 fw
| /usr/bin/bogofilter -uep

This command will pipe the mail content through bogofilter which will add a X-Bogosity header denoting the spam status of the mail.

A second procmail rule moves all spam to a designated spam folder on my IMAP server:

:0
* ^X-Bogosity: Spam.*
$HOME/.maildir/.INBOX.Spam/

For training I use two designated folders on my IMAP server: LearnSpam and LearnGood. I’m simply moving mails that I want to train as spam to the LearnSpam folder. Once per hour I train spam/good mails using this script:

#!/bin/bash
SPAM_FOLDER=$HOME/.maildir/.INBOX.Spam.LearnSpam
if [[ -d $SPAM_FOLDER ]]; then
        SPAM_CUR=$SPAM_FOLDER/cur
        # only invoke bogofilter if there are mails in the folder
        if [[ "$(ls -A $SPAM_CUR)" ]]; then
                /usr/bin/bogofilter -s -B $SPAM_FOLDER && rm $SPAM_CUR/*
        fi
fi
HAM_FOLDER=$HOME/.maildir/.INBOX.Spam.LearnGood
if [[ -d $HAM_FOLDER ]]; then
        HAM_CUR=$HAM_FOLDER/cur
        # only invoke bogofilter if there are mails in the folder
        if [[ "$(ls -A $HAM_CUR)" ]]; then
                /usr/bin/bogofilter -n -B $HAM_FOLDER && rm $HAM_CUR/*
        fi
fi

The script is invoked via cron.


Fixing the dreaded “problem with defaults entries” in debian

29.09.2018 by Dirk Olmes

At work we host a number of Debian VMs. Most of them are integrated into the central active directory server using the sssd package.

Quite unrelatedly my boss kept nagging me about incoming emails to root that looked like this

Subject: *** SECURITY information for <host> ***

<host> : Sep 29 05:45 …
read more

Chromecasting using a custom Chromium build

23.01.2018 by Dirk Olmes

I’m using Gentoo as my Linux distro of choice. Gentoo compiles everything from source giving you a maximum flexibility - but that’s another story.

At work we’re traditionally an Apple shop - with some exceptions including me. We have an Apple TV device and a big TV screen in …

read more

Setting up a software RAID1

12.07.2017 by Dirk Olmes

I’m helping a friend to set up a machine with Gentoo. This will be a machine to host production applications and it is equipped with 2 identical hard drives. I will set up a software RAID 1. This has been a life saver on a similar machine before where …

read more

Genkernel with virtio drivers

06.04.2017 by Dirk Olmes

A colleague asked me to help analyze problems migrating a Gentoo guest VM from a Xen Server based host to a Proxmox (KVM based) host. The Gentoo VM would not boot beyond the initramfs - it just died saying that the root device could not be found.

Since the VM itself …

read more

Enabling “Show in System Explorer” in Eclipse on Linux

10.02.2016 by Dirk Olmes

Show in System Explorer

On my Gentoo machine the “Show in System Explorer” menu item did not work on Eclipse. I kept getting this error message:

Execution of 'dbus-send --print-reply --dest=org.freedesktop.FileManager1 /org/freedesktop/FileManager1 org.freedesktop.FileManager1.ShowItems array:string:"file:/tmp/HelloWorld.java" string:""' failed with return code: 1

A …

read more

Linux Mint update from 17.2 to 17.3

30.12.2015 by Dirk Olmes

At work we use Linux Mint for some virtual machines that need a desktop environment. Recently, the Linux Mint project released a fairly major update to 17.3. At fist, they did not offer an update for an existing system but promised to release that laster.

Now, a good while …

read more

NFS setup

30.07.2015 by Dirk Olmes

I’m planning to put my Raspberry Pi back to use. I have always disliked its dependency on SD memory cards so I’m planning to put the Pi’s root filesystem on NFS. The Pi side will be a topic for another blog post later, first I’ll have …

read more

speeding up portage’s metadata cache

26.02.2015 by Dirk Olmes

Gentoo’s portage keeps metadata about installed ebuilds in /var/cache/edb. Dependency info for all installed ebuilds is in a dep subdirectory which typically looks something like this:

.
├── usr
│   └── portage
│       ├── app-admin
│       │   ├── eselect-1.4.1
│       │   ├── eselect-lib-bin-symlink-0.1.1
│       │   ├── eselect-opengl-1.2.7
│       │   ├── gamin-0.1.10-r1
│       │   ├── logrotate-3.8.7
│       │   └── perl-cleaner-2.16
...

When …

read more

exaile vs. gstreamer

25.02.2015 by Dirk Olmes

My favourite music player app on Linux is Exaile. On Gentoo it’s available straight from portage but getting playback working for different audio formats its not quite straightforward.

Exaile depends on gstreamer - albeit not on the latest version but on the 0.10 version line. Since Gentoo supports slotted …

read more