Latest Publications

Filtering and rejecting spam and virus mail with Sendmail and MIMEDefang

Beastie from FreeBSDMIMEDefang is a software program for Sendmail mail servers, that implements anti spam, anti virus and other customisable filtering off mail.

MIMEDefang uses Sendmail’s built-in milter, or mail filter, interface to individually inspect, scan, modify and optionally reject (bounce) or discard mail as it pass through the mail server.

MIMEDefang provides an interface between Sendmail and other mail scanning software, such as SpamAssassin, and when combined with spam filtering software and antivirus software, MIMEDefang provides a complete, robust, and configurable solution for spam filtering, virus scanning and other mail filtering.

Read more about MIMEDefang at Mickey Hill.

The following example will configure a Sendmail mail server on a FreeBSD operating system. It is assumed, that Sendmail is configured and running. It is also assumed, that SpamAssassin is installed, configured and running.

  • Mail, that has files with bad extensions attached, will have the files deleted and given a warning. This also count for files, that are hidden in zip archives.
  • Mail, that is recognised as spam by SpamAssassin, is bounced – and not delivered to the recipient.
  • Mail, that is otherwise is recognised as spam, is bounced.

You might want to go through the SpamAssassin configuration and adjust as necessary.

nano -w /usr/local/etc/mail/spamassassin/local.cf
cd /usr/local/etc/rc.d
./spamass-milter restart

Install the MIMEDefang milter.

cd /usr/ports/mail/mimedefang
make
make install

Configure the MIMEDefang filter. This is the configuration file for MIMEDefang. See our example here.

cd /usr/local/etc/mimedefang
nano -w mimedefang-filter

Configure the MIMEDefang milter to use the filter.

cd /usr/local/etc/rc.d
nano -w mimedefang
SUBFILTER=/usr/local/etc/mimedefang/mimedefang-filter

Start the MIMEDefang milter.

cd /usr/local/etc/rc.d
./mimedefang start
ps aux | grep mimedefang

If the MIMEDefang filter is edited while running, the MIMEDefang milter must reread.

cd /usr/local/etc/rc.d
./mimedefang reread

Configure FreeBSD, so the MIMEDefang milter is started at boot time.

cd /etc
nano -w rc.conf
mimedefang_enable="YES"

Edit the Sendmail configuration and insert the MIMEDefang milter instead if the SpamAsassin milter.

cd /etc/mail
nano -w `hostname`.mc
INPUT_MAIL_FILTER(`mimedefang', `S=unix:/var/spool/MIMEDefang/mimedefang.sock, F=T, T=S:5m;R:5m')
make
make install
make restart

View the mail log – and compare the amount of spam mail after the change. You might want to measure the amount of delivered mail and the amount of rejected mail. The FreeBSD system mail log is per default stored for a weak, which makes it possible to compare over the days.

tail -f /var/log/maillog

How to backup to encrypted file system on external storage device in Ubuntu

luks-logo-croppedIn this example, we will describe how to backup the files or contents of a home directory on an Ubuntu 11.04 operating system to an encrypted file system on an external hard disk or storage device for the USB port.

We will use the Linux Unified Key Setup (LUKS) to create the encrypted file system on the external storage device.

LUKS is the standard for Linux hard disk encryption. By providing a standard on-disk-format, it facilitates compatibility among the different Linux distributions.

LUKS is installed per default.

Prepare

Connect the device to the USB port and power up the device. Go to the menu, “System”, “Administration” and open “Disk Utility”. Select the device in “Storage Devices”. USB devices will be listed under “Peripheral Devices”.

If the device has one or more existing volumes and needs to be formatted, then click “Format Drive”. Set “Scheme” to “Master Boot Record”. Click “Format”. A confirmation window appear. Click “Format”.

Click “Create Partition”. Set “Type” to “Ext4″. Set “Name”. This name will be the mount point. Set “Take ownership of filesystem”. Set “Encrypt underlying device”. Click “Create”. The “Enter Passphrase” window will appear. Set “New Passphrase”, “Verify Passphrase” and “Remember passphrase until you log out”. Click “Create”. Click “Lock Volume”. If you have free space and need more volumes, then click the free volume space and repeat this step now as current user or later as another user.

Press Ctrl+Q to close the Disk Utility.

Mount

If the device is shared between different users or the file system does not get unmounted before powered off, you might have to unmount the hanging device mount point. This will even be the case after a reboot. The error message, related to this, is “Unable to mount” and “/dev/dm-0 is mounted”. In the following examples, the volume device is named “st1-opentech”.

sudo umount /media/st1-opentech

If the device is not attached to the USB port, then attach it to the USB port and power it up.

If the device is attached to the USB port, but not mounted, then go to the menu, “Places” and click the device. The device will be listed in the form “50 GB Encrypted”.

If the password is not remembered, then the dialog “Enter a password to unlock the volume” will appear. Type in the passphrase in “Password”, set “Forget password immediately” and click “Connect”.

Synchronise

You might want to empty trash, clear browser cache and remove other temporary files.

Synchronise files in local home directory with the device with rsync. In the following example, the device is named “st1-opentech”.

rsync -Cuav --delete ~/ /media/st1-opentech/

Options: Ignore files in the same way, that CVS does. Skip files, that are newer on the receiver. Recursive. Copy symbolic links as symbolic links. Preserve permissions. Preserve modification time stamps. Preserve owner. Preserve group. Preserve devices. Preserve specials. Verbose. Delete files on the receiver, that are no longer on the sender.

Unmount

If you are not in the Nautilus file organizer, then go to the desktop and double click the icon for the mounted file system.

Click the unmount icon for the mount name in “Places”. The mount name disappears and the device in now shown instead. Right click the device and click “Safely Remove Drive”. This will power off the device. Disconnect it from the USB port.

Keyboard shortcuts to special characters in Ubuntu

UbuntuIn the Ubuntu operating system, you can use keyboard shortcuts to insert special characters, such as the check mark symbol (✔) or the Euro currency symbol ().

In this example, we will use the keyboard shortcut to insert the check mark symbol in this article.

We open the Special Characters application. This can be opened from OpenOffice Writer. We set “Font” to “OpenSymbol”. We select the check mark. We note the code in the lower right. The check mark is “U+2714″. We close the Special Characters application.

We can now insert our special character by pressing Ctrl+Shift+U, typing 2714 and pressing Enter.

Dell Laser Printer 1710n

Dell 1710nOn many internet forums, you will find users of the Dell Laser Printer 1710n, that reports, that the printer will not print. On the homepage of the printer, the following error message is shown. The message remains the same even after inserting a new cartridge.

31 Missing or Defective Cart

The solution is to open the front door, pull out the cartridge and drum, release the cartridge from the drum, clean the contact points, remove the yellow or orange slip, install the cartridge and drum, press and hold the cancel button until all lights flash and close the front door. The printer is now ready to print.

Recovering pictures from a memory card

recoverjpeg is a tool, that identify JPEG pictures on a file system, such as a file system on a SD memory card, that is used in digital cameras.

In the following example, an Ubuntu operating system, recoverjpeg and a card reader is used to recover pictures on a SD memory card.

sudo recoverjpeg /dev/sdb

The recovered pictures are available in the current directory.