Posts tagged apache
Recently I’ve had this really nagging issue where I could no longer send email from Roundcube. Mail would send just fine from any email client. A review of the mail logs for the failed message being sent from Roundcube gave a puzzling error about an unbalanced “< ” proceeding the recipient’s name with the email address. I did find that removing the person’s name proceeding the email address from the “To” line allowed me to send the message. Basically, removing the name when the field looks like this:
John Doe <firstname.lastname@example.org>
I tried playing around with a few things including re-installations of Roundcube and did a really thorough glean of my sendmail config files comparing them to the defaults. Looking through the MySQL database showed no extra angle brackets in any of the stored contacts. I did find a post on the Roundcube forums about the same error but for an older version. I tried messing around with some of the PHP files as the fix mentioned in the article was no longer applicable due to filename changes, but had no change in behavior. Thinking that perhaps there was some bug in the PHP code itself I tried installing later versions but I still got the same error about the message failing to send. I had no issues with the 0.3.x releases. This issue cropped up in the 0.5.x branch.
Finally on a hunch I began to suspect that mini_sendmail-chroot was the culprit. It turns out that I was exactly right. A search of the OpenBSD mailing list archives pointed me to a replacement called femail-chroot which was described as being less problematic. I tried it out and problem resolved! I’m not sure what it was about mini_sendmail that breaks with newer PHP scripts. Unfortunately, the project is apparently no longer maintained with the last release being from 2005.
Femail is basically a drop-in replacement for mini_sendmail. The only work involved is to just point PHP to it in your php.ini and restart Apache. You can install femail-chroot as a package (run pkg_add femail-chroot as root) or from ports (mail/femail). If you install it from ports please note that the chrooted version is available as a flavor.
I’ve finally hopped on the bandwagon. I’ve tried several different types of web based email clients while working for a web hosting company (most free/open source and some proprietary) and all of them were horrid with SquirrelMail being the best of the worst. SquirrelMail is a very simple IMAP client that is mostly frame-based with some pretty nice plugins. While uncluttered and pretty fast it doesn’t have the elegance of some of the large email providers’ interfaces such as Gmail.
Not too long ago a fellow OpenBSD user recommended Round Cube to me on Twitter. At first I was a bit lazy to install it and now I realize the error of my ways. You’re probably wondering so far what the heck Round Cube has to do with OpenBSD since this is a site dedicated to it. That’s actually the nice part since Round Cube is available both as a package (roundcubemail) and is in the Ports tree (mail/roundcubemail). As of OpenBSD 4.7 the latest supported release is 0.3.1p1. It appears that 0.4.2 might be in -current/4.8 as OpenPorts.se has it listed as a download.
Round Cube has a very clean interface and is fairly reminiscent of most desktop email clients and Apple’s MobileMe web client. It supports folders, address books, and more. The address book feature even supports the import of vCards.
The installation was somewhat complicated at first. The application itself is PHP based but uses MySQL, PostgreSQL, or SQLite to store user settings. The INSTALL file placed in /var/www/roundcubemail is pretty straightforward but incomplete in a couple places. I went with the MySQL installation for the database backend. Once you’ve created your database and roundcube user be sure that you then put the user’s password in the config/db.inc.php file on that line that looks like this where “pass” is the password:
$rcmail_config['db_dsnw'] = ‘mysql://roundcube:pass@localhost/roundcubemail’
You also need to enable the web installer in the config/main.inc.php by change the following line to “true”:
$rcmail_config['enable_installer'] = false;
There are also TLS and SSL options that you can turn on and probably will if you’ve read my previous posts on enabling these in Apache and sendmail.
The installer will run some checks to be sure that it can connect to your database and that you have the necessary PHP extensions installed and options enabled in php.ini. At the end it checks whether it can make an IMAP and SMTP connection.
So, check it out at http://roundcube.net/. The download link will first list the requirements as LAMP with a small link to the FreeBSD and OpenBSD versions. Be not afraid. You now know that Round Cube works on OAMP!
Actually it’s much easier on OpenBSD than I was making it out to be. I’m used to working with Apache on FreeBSD and Linux where you need to set everything in httpd.conf for the most part. After trying numerous things out desperately I figured out how to do it.
Add this line to your /etc/rc.conf.local:
This starts up Apache with mod_ssl turned on when your server starts up.
Comment out the “Listen 80″ line in /var/www/conf/httpd.conf. The section will look something like this:
# Listen: Allows you to bind Apache to specific IP addresses and/or
# ports, in addition to the default. See also the
Next, you need to add the lines for the certificate such as SSLCertificateFile, SSLCertificateKeyFile, etc. If you’re installing the certificate for the primary host (i.e., not a virtual host) you will want to put these somewhere near the Global SSL section and above the SSL virtual host section.
That’s really all there is to it. You can either issue a “reboot” command or “apachectl stop” followed by “apachectl startssl”. Your SSL certificates now be picked up by the server for all to see. To verify that your server is listening on port 443 (as it should) you can run:
netstat -an | grep LISTEN | grep 443
If you don’t have your own SSL certificate or don’t wish to buy one the OpenBSD FAQ has some further reading about how to create a self-signed certificate. This is extraordinarily simple and means that you don’t have to add the SSLCertificate lines as the commands use the default file names already in the httpd.conf. It also appears that 4.7 may have made some changes to the httpd.conf that makes most of the work I’ve outlined a bit simpler.