Thursday, December 3, 2009

CHKUSR - Enable characters for Blackberry devices

From QMail-Toaster

Intro

This tip is simply a step by step to recompile chkusr to allow the '/' character.

[edit] Why?

(PULLED FROM: This FAQ )

I keep getting "5.1.0 - Unknown address error 571-'sorry, sender address has invalid format (#5.7.1 - chkuser)'" errors, especially from people with Blackberry devices. What can I do?

The sender is using an illegal character. In Blackberry's case they're using a spam firewall that uses the slash character (/) in the sending email address when messages are sent from the Blackberry device, regardless of the reply-to address. To work around this you can either recompile chkuser to allow for the illegal character, or turn off chkuser checks for their mail servers.

So in this tip we are opting for the recompile. The reason I usually choose this one is simply because the blackberry servers can change IP's. This is more of a "blanket" method. I personally have found it more reliable for this kind of instance.

[edit] Precautions

  • Keep in mind that anytime you update your system with newer versions, that this setting will be reset to the default. So if the main qmail-toaster* package is updated - you need to do this process again.
  • Since this process usually is hand in hand with an update, keep in mind that if you have spamdyke installed to be sure after the operation that your /var/qmail/supervise/smtp/run file still has spamdyke in it.
  • New certificates will be created - below is the output from the rpm update command:

qmail-toaster warning: /var/qmail/control/servercert.pem created as /var/qmail/control/servercert.pem.rpmnew

So if you have any custom certificates or commercial ones, you may want to back them up prior to the process.

[edit] Step by Step

Much of this process is derived from this wiki entry.

  • Make sure that your toaster is completely up to date to avoid having to do this process all over when you realize that. We start with updating QmailToaster-Plus. If you do not have it installed, do so. Head over to the ( QTP website for instructions on how to do that). Assuming it is installed, we start with:

yum update qmailtoaster-plus

  • Update the rest of the toaster packages with the newmodel script included in the QmailToaster-Plus menus.

qtp-menu

  • Move into the working directory for the SRPMS from your original install.

cd /usr/src/redhat/SRPMS

  • Check the version of qmail-toaster installed.

rpm -qa | grep qmail-toaster

  • Get the matching SRPM from the toaster site (you will need to update below link for your version).

wget http://www.qmailtoaster.com/download/stable/qmail-toaster-1.03-1.3.18.src.rpm

  • Install the proper SRPM.

rpm -Uvh qmail-toaster*.src.rpm

  • Move to the SPEC directory.

cd /usr/src/redhat/SPECS

  • Edit qmail-toaster.spec (I use VI. Sub for your favorite CLI editor). find 'sleep 5' (should be line 606). change 5 to 300 (5 seconds to 300 seconds). save.

vi qmail-toaster.spec

  • Rebuild the RPM. Keep in mind that in future versions or architectures of CentOS that the --with flag value 'cnt50' might need an updated value). You will also need to sub that flag value if you are using another type of system such as Fedora, etc.

rpmbuild -bb --with cnt50 qmail-toaster.spec

  • When the build process pauses, open another terminal and edit /usr/src/redhat/BUILD/qmail-1.03/chkuser_settings.h to your liking. You have 5 minutes (or whatever you changed the sleep parameter to). Save your changes and wait for the 300 seconds to expire and watch it build.

vi /usr/src/redhat/BUILD/qmail-1.03/chkuser_settings.h

  • Search for "CHKUSER_ALLOW_SENDER_CHAR"
  • Uncomment and change it from:

/* #define CHKUSER_ALLOW_SENDER_CHAR_3 */

  • To:

  1. define CHKUSER_ALLOW_SENDER_CHAR_3 '/'

  • Save and exit.
  • Once the pause expires, the compile will continue.
  • Once the compile is done (there were no errors right?) move to the RPM directory.

cd /usr/src/redhat/RPMS/i386/

  • Stop Qmail.

qmailctl stop

  • Upgrade the Toaster package.

rpm -Uvh --replacefiles --replacepkgs qmail-*.rpm

  • Copy back any custom certificates you had backed up at the beginning (if you did so).
  • Restart Qmail.

qmailctl start

  • Is it all running?

qmailctl stat


[edit] Finito

You should now be all done and up and running again and the Blackberry users should be able to function as needed.