Jan 112010

I came across an error after upgrading a Plesk server from 8.6 to 9.2.3:

# /usr/local/psa/admin/sbin/mchk –with-spam
==> Checking for: mailsrv_conf_init… ok
==> Checking for: mail_mailbox_restore… ok
==> Checking for: mailsrv_entities_dump… ok
==> Checking for: mail_admin_aliases… ok
==> Checking for: mail_auth_dump… ok
==> Checking for: mailman_lists_dump… ok
==> Checking for: mail_responder_restore… ok
==> Checking for: mail_drweb_restore… ok
==> Checking for: mail_kav_restore… not exsists
==> Checking for: mail_spf_restore… ok
==> Checking for: mail_dk_restore… ok
==> Checking for: mail_grey_restore… ok
awk: cmd. line:50: (END OF FILE)
awk: cmd. line:50: invalid char ‘�’ in expression
unable to process “pop3d”
awk: cmd. line:50: (END OF FILE)
awk: cmd. line:50: invalid char ‘�’ in expression
unable to process “pop3d-ssl”
awk: cmd. line:50: (END OF FILE)
awk: cmd. line:50: invalid char ‘�’ in expression
unable to process “imapd”
awk: cmd. line:50: (END OF FILE)
awk: cmd. line:50: invalid char ‘�’ in expression
unable to process “imapd-ssl”

As it turns out, all the sub-processes completed normally if run on their own, so the problem was with mchk itself.  If ound out that mchk calls courier_authpsa_configure and found that there is a syntax error – looks like a newline inserted by accident.

To get around this, open /usr/local/psa/admin/bin/courier_authpsa_configure  in a text editor and scroll down to line 80.  Replaced the following line:

}\
‘ $conf >>$temp
}

with:

}’ $conf >>$temp
}

Now mchk should complete normally:

# /usr/local/psa/admin/sbin/mchk –with-spam
==> Checking for: mail_spam_restore… ok
==> Checking for: mailsrv_conf_init… ok
==> Checking for: mail_mailbox_restore… ok
==> Checking for: mailsrv_entities_dump… ok
==> Checking for: mail_admin_aliases… ok
==> Checking for: mail_auth_dump… ok
==> Checking for: mailman_lists_dump… ok
==> Checking for: mail_responder_restore… ok
==> Checking for: mail_drweb_restore… ok
==> Checking for: mail_kav_restore… not exsists
==> Checking for: mail_spf_restore… ok
==> Checking for: mail_dk_restore… ok
==> Checking for: mail_grey_restore… ok

#

Jun 202009

This is something that comes up all the time when clients are having PCI compliance scans done on their servers – qmail, by default, allowes SSLv2 to be used.

To disable it is very easy.  Edit/create /var/qmail/control/tlsserverciphers and add the following line to it:

ALL:!ADH:!LOW:!SSLv2:!EXP:+HIGH:+MEDIUM

Now restart qmail, and you’re done!

Mar 162009

Today I got tasked with removing duplicate mails from a mail folder with over 100,000 mails in it.  Doing this from a mail client is so impractical, it’s not even worth giving any thought at all.  Fortunately, the mailbox is on a mail server using Maildir style mailboxes, so I knew this could be done with minimum effort.

I discovered the ‘reformail’ utility, part of courier-imap, and after a few trial runs, I settled on the following:

# cd /path/to/mailbox/Maildir/cur

# for i in `find . -type f`; do reformail -D 10000000 /tmp/duplicates <$i && rm $i; done


-D looks for, and deletes duplicates.

10000000 is the length of the temporary file where a list of message IDs will be written

/tmp/duplicates is the aforementioned temporary file.

The temporary file needs to be big enough to accommodate the message ID of each mail.  In this particular case, I have found the average length to be 54 characters, but I would suggest using around double that to be safe.  So adjust to your needs.

In a big mail folder, and especially on ext3, this will take a long time to complete.

Mar 092009

I recently decided to move my enormous mail archive from my trusty Courier-imap/Maildir setup to DBmail. The reason is simple.  I have several mail folders with 100,000+ mails in.  That means several directories with upwards of 100,000 files in.   And that means bad performance.    There is another reason:  I can execute far more powerful searches with an SQL query, than any mail client can allow me to do.

DBmail is a POP3/IMAP server that uses a regular database server (currently MySQL, PostgreSQL or SQLite) for its mail store.  Given the obvious advantages, I’m surprised this isn’t more popular.

There is one gotcha to the setup.  MySQL, being Swedish, has a default collation setting of ‘latin1_swedish_ci’ while DBmail assumes ‘utf8_general_ci’ will be set.  But the DBmail docs, and even the MySQL notes page, does not mention this* at all, and the included create_tables.mysql script does not set the correct collation either.   This results in the following error showing up in the logs:

Sep 14 03:00:01 hermes dbmail/maintenance[16708]: Error:[sql] dbmysql.c,db_mysql_check_collations(+138): collation mismatch, your MySQL configuration specifies a different charset than the data currently in your DBMail database.

This is easily fixed.  Assuming your database is called ‘dbmail’ do:

mysql> use information_schema;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

mysql> select * from SCHEMATA where SCHEMA_NAME = ‘dbmail’;

The ‘DEFAULT_COLLATION_NAME’ column will most likely show ‘latin1_swedish_ci’ – this is the problem.  Run the following:
mysql> alter database `dbmail` collate `utf8_general_ci`;
Query OK, 1 row affected (0.02 sec)

Run the select query again and check if the right collation is showing.  After doing this, dbmail should connect to MySQL without any problems.

Feb 222009

From time to time,  Squirrelmail gives this error on a Plesk machine:

Error opening /var/lib/squirrelmail/prefs/default_pref
Could not create initial preference file!
/var/lib/squirrelmail/prefs/ should be writable by user apache
Please contact your system administrator and report this error.

Squirrelmail depends on safe_mode being off.  Let’s see if this is the case:

# grep ^safe_mode /etc/php.ini
safe_mode = On

Since this is a multi-domain system, we want to make changes only to the effected subdomain, in this case the webmail.* subdomain.  But changing the Plesk config won’t help, since Plesk will just overwrite it.   So we create a second file, that will load after, and thus override the Plesk file:

# vi /etc/httpd/conf.d/zz011_squirrelmail_safemode_fix.conf

And add the following:

<Directory “/usr/share/squirrelmail”>
php_admin_flag safe_mode off
</Directory>

Now check your apache config and restart gracefully:

# httpd -t

OK

# apachectl graceful

Reload Squirrelmail in your browser – it should work now

Dec 142008

After doing some updates on my Debian Lenny workstation, I noticed that KDE’s Konsole is no longer able to find the “Console” font, and upon trying to install it, I’m greeted with an error saying:

Could not install console8×16.pcf.gz into fonts:/Personal/
Fortunately, this is easily fixable. As root, run the following:

# dpkg-reconfigure fontconfig-config

Choose the default option to all but the question about bitmap fonts – choose YES here. This will enable support for bitmap fonts. Then do:

# dpkg-reconfigure fontconfig

This will update the font cache. Now restart your Konsole, and your fonts should be back to normal.

Update 2009/03/07:   I had this happen to me again today (did a dist-upgrade to Squeeze) and after running the above fix, only one of the two missing fonts returned.   I found that removing the contents of ~/.fontconfig/ does the trick.

Update 2009/07/25:   I got a new PC at work, and this time did a clean install of Squeeze, which meant getting dumped into KDE4.  Again, the font was missing, and the font installer wouldn’t see the pcf file.  I had to do the above, and then, using the font installer, had to type *.pcf  in the filter field – this installed the font.  I also had to set font anti-aliasing to “enabled” instead of “system settings” in the System Settings panel –> Appearance –> Fonts.

Sep 092008

I use an AMOD AGL3080 GPS logger in my photography. For a few days now, I cannot get it to do anything. The storage light stays on, but nothing happens. I thought that I’m out of disc space, maybe the trash is taking up all the free space? But that seemed not to be the case – I had 112MB free.

Today I got to look at this more closely for the first time. In the .Trashes directory, there is a ‘501′ directory, and under that, I get the following:

# ls -lha
ls: QžÇØ\026gYø.œ?\036: No such file or directory
ls: ýdßÞæer˜.^ín: No such file or directory

# rm *
rm: cannot remove `QžÇØ\026gYø.œ?\036′: No such file or directory
rm: cannot remove `ýdßÞæer˜.^ín’: No such file or directory

Eventually, I gave up and plugged it into a linux box. Now the ‘501′ didn’t show up as a directory any more, but as a file. rm -rf, unmount it, switch it on, and what do you know, it’s working! I’m not sure if just deleting the 501 from the terminal in OSX would have worked, it probably would have. I just find it strange that it showed up as a directory and not a regular file.

Aug 122008

Firefox 3 adds support for colour profiles – finally! But (isn’t there always a “but”?) it is not enabled by default. To enable colour profiles, type the following into the address bar: about:config

Read the warning and take it serious. Click the button to proceed. Now, in the “Filter” bar, type: gfx.color – this will give three results. The second result should be gfx.color_management.enabled and it should be set to false – double click on it to set it to true. Now restart your browser, and you’re all set.

Jun 092008

I get this kind of problem every day: “We’ve run out of disc space on our Plesk server – what’s taking up all the space?” The answer, almost every time, is “logs.” Plesk doesn’t enable log rotation by default, so logs can end up taking a lot of space.

Geo Visitors Map