Tag Archive for 'Linux'

IPTables Passive FTP Connection Tracking on non-standard ports

Ever tried to run a Linux FTP Server behind a IPTables firwall on non-standard ports, i.e. not on port 21?

The problem is that the FTP connection tracking module nf_conntrack_ftp only watches port 21. If you want to use other ports the module must be loaded with the parameter “ports=21,5367″ if you want to run an ftp server on port 21 and one on port 5367. The usual other iptables rules apply, too.

VBoxAdm – Management-GUI for Postfix and Dovecot

Last weekend I’ve released a new web-based management GUI for Mailservers running Postfix and Dovecot. It is called VBoxAdm.

Its features:

  • All-in-one mailserver solution
  • written in Perl (despite some tiny bits of PHP for the Roundcube integration)
  • MySQL Backend
  • Sane Database schema, w/ normalized tables
  • Roundcube integration which allows users to change their vacation messages and passwords
  • ships with its own Anti-Spam Proxy (no need for AMAViS, SpamPD or others)
  • and vacation auto-responder (RFC 3834 compliant)

You can grab it directly from here or get to its page for more details and some more screenshots.

Please beware, this is ALPHA quality code. Don’t use it in production yet. Some parts of the application haven’t even been tested partly. But the code ist more or less complete so besides testing and minor fixes it is in pretty good shape.

Continue reading ‘VBoxAdm – Management-GUI for Postfix and Dovecot’

Resize a Xen disk image

Its as easy as appending zeros to the disk image.

Here I append 10 GB to disk.img. Please note that resize2fs will, of course, only work if your disk contains a ext2/3 partition.

cd /var/lib/xend/domains/domain/
dd if=/dev/zero bs=1024 count=10000000 >> disk.img
resize2fs -f disk.img

Perl Best Practices

Recently I’ve read a really interesting book. A book every perl developer should read. At least have a look at Appendix B which lists all guidelines in a brief summary.

Threads in Perl are broken

Ok, for most experienced perl programmers this is not new, but let me repeat it:

Threads in Perl are broken. Really, really, severe broken. Do not use threads with Perl.

Thread async is probably ok for smaller computations but for anything else use fork().

Not only are IPC-Signals really dangerous with threads and DBI can’t work with threads but also the memory usage is magnitudes higher with threads than with fork(). At the moment I’m hacking a perl app that uses a lot ressouces but I was impressed how fast I could kill my system with fair amout of concurrent threads. From Java I was used to threads being very lightweight, but with Perl this is the other way round. My app has its core part modularized and I’ve wrote it once using threads and once using fork(). The threads-version uses about 300MB RSS while the fork()ing version uses no more the 30MB RSS for the same workload. Quiet a difference.

virt-manager: Error starting domain

Using KVM/virt-manager in Debian sid is interesing. You’ll get nice and fresh errors from time to time. KVM is constantly improving but you have to deal with unexpected changes from time to time which tend to break existing VMs.

With the latest version I’ve got this error:

Error starting domain: internal error unable to reserve PCI address 0:0:3

The long text:

Traceback (most recent call last):
File “/usr/share/virt-manager/virtManager/engine.py”, line 589, in run_domain
File “/usr/share/virt-manager/virtManager/domain.py”, line 1208, in startup
File “/usr/lib/python2.5/site-packages/libvirt.py”, line 317, in create
if ret == -1: raise libvirtError (‘virDomainCreate() failed’, dom=self)
libvirtError: internal error unable to reserve PCI address 0:0:3

The solution was to edit the /etc/libvirt/qemu/<domain>.xml and change the conflicting PCI id. The line looked like this before:

<address type=’pci’ domain=’0×0000′ bus=’0×00′ slot=’0×03′ function=’0×0′/>

and like that after the change:

<address type=’pci’ domain=’0×0000′ bus=’0×00′ slot=’0×02′ function=’0×0′/>

Don’t forget to reload libvirt after this change.

KDE4.4: Getting rid of Akonadi-MySQL Startup Errors

Since upgrading to KDE4.4 I’ve got startup errors each time Akonadi was started due to some missing MySQL system tables.

It’s easy to fix this:

akonadictl stop
mysql_install_db  --datadir=$HOME/.local/share/akonadi/db_data
akonadictl start

And don’t forget to install akonadi-kde-resource-googledata. Thanks to Trumpton.

udev Notes

udevinfo was renamed to/replaced by udevadm in Debian sid. Must tutorials still refer to udevinfo.

A udev rule that works on sid w/o warnings would be something like this for a garmin gps device:

# cat /etc/udev/rules.d/51-garmin.rules
ATTR{idVendor}=="091e", ATTR{idProduct}=="0003", MODE="666", SYMLINK+="GarminGPS"

Voyage Linux on an ALIX.2D13

I’ve just spent far too much time trying to install voyage linux on my new ALIX.2D13. Everything was fine, the only problem was that I did try to use GRUB and that wasn’t working. After changing to LILO it works like a charm. The problem is probably caused by a huge version gap between etch and sid. Etch has some something like 0.9x and sid 1.9x. I thought that the Voyage installer would use the shipped grub inside a chroot. Anyway, LILO works and this is fine. I have no special requirements for this box’s bootmanager. As soon as everything is set up and tested the box is going to be deployed.

The installation of voyage linux itself is covered in detail in the Getting Started guide.

Very usefull information can be found at networksoul and this chaos wiki.

I recommend picocom to connect to the serial console:

picocom –baud 38400 –flow n –databits 8 /dev/ttyUSB0

If your computer doesn’t have a serial port anymore, like mine, I recommend the LogiLink “USB2.0 to Serial Adapter” (UA0043 v.2.0). It’s cheap and works flawlessly. Another great LogiLink product I can reommend in this context is the LogiLink “USB2.0 Aluminum All-in-one Card Reader” (CR0001B v.2.0). Why I mention these two here? I find it hard to find cheap linux compatible adapters of which I know that they work on linux, so here is the information I would have like had before I bought those. The USB-Serial-Adapter is recognized as “Prolific Technology, Inc. PL2303 Serial Port”. The Card-Reader is shown as four separate drives.

DS18S20: CRC Error

I just got me some DS18S20 (1-wire Temperature sensors) and a DS2940 (1-wire to USB adapter). The first two did work like a charm, but the third one gave me CRC errors.

CRC Failed. CRC is 63 instead of 0×00

The reason was just that, after running the first two for a while, I did just disconnect them and attached the thrid one. My mistake was not to delete/re-initialize the .digitemprc. After moving the .digitemprc out of the way and re-initializing the new one the thrid one did also work.

Show all devices on the 1-wire bus:

digitemp_DS2490 -sUSB -w

Initialize the .digitemprc:

digitemp_DS2490 -sUSB -i

Read all sensors:

digitemp -sUSB -a -r750

Thanks to Marc for the hint.

Some usefull links:

Here are some pictures of my 1-wire bus: