Page 1 of 1

Postfixadmin & Roundcube installed from Debian Repository.

Posted: 2018-07-19 09:55
by kedaha
I'd just like to post (if anyone's interested) that over the last three weeks—I'm a bit slow with such things—I've been working on a new email setup on stretch.

The objective was basically to set up a Postfix-Dovecot-Letsencrypt email server, similar to the one I'd been using in jessie with Roundcube and Postfixadmin.
The reason for using this was that I couldn't get the web_interfaces which I'd used in jessie for managing postfix to work in stretch. Another problem was that Postfixadmin is apparently incompatible with the tutorial at workaround org.

So I tried the tutorial at step-by-step-setting-up-mail-server.htm except that I didn't download Postfixadmin as detailed there but rather apt installed the official Debian package and can confirm that it works fine though I had to modify it for use with the Debian package and also for Letsencrypt. (For reference, there is, by the way, another very similar tutorial at a-mailserver-on-ubuntu-16-04-postfix-dovecot-mysql/). There were, as always, quite a few stumbling blocks along the way and multiple errors in the logs which were mainly due to faulty editing on my part :oops: ; however careful you are, needles find their way into the haystack. I ran into this bug, which was easy enough to correct (with chown -R root:www-data templates_c and chown 755 templates_c). But when running the postfixadmin GUI installation setup.php I ran into
Invalid query: Specified key was too long; max key length is 1000 bytes.
This I was able to resolve by reinstalling the mail database in mysql with:

Code: Select all

SET GLOBAL default_storage_engine = 'InnoDB';
CREATE DATABASE mail CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON mail.* TO 'postfixadmin'@'localhost' IDENTIFIED BY 'somelongpassword';
FLUSH PRIVILEGES;
mysql> QUIT
I think it's surely preferable to use the Debian official package when the directories go to the right places and are seen by apt rather than download the package from source, uncompress the directory and then chown and move it to /var/www/html/postfixadmin. But I'd be interested to hear your views on this as both methods must have their merits.
I still have to configure a few things but the new email system is finally up and running.

Update 22 July 2018]
How can Roundcube's password plugin be configured to work with Postfixadmin?
The answer is by executing these commands in mysql, which of course must be changed for your own user, database and passwords.
I found the answer in an old post from the year 2011 at lists.roundcube.net/, which I feared might not work because the syntax might've changed but I was pleasantly surprised.
Note that, in my setup, my database is called simply mail and limited to privileges GRANT, SELECT, UPDATE given to the user I named roundcube only to modify and update passwords.

Code: Select all

MariaDB [(none)]> GRANT SELECT, UPDATE (password, modified) ON mail.mailbox TO 'roundcube'@'localhost' IDENTIFIED BY 'Someverylong&complicatedPassword';
FLUSH PRIVILEGES;
Just to update the instructions given there for modifying the configuration file, which has changed a little since 2011
I modified, in /etc/roundcube/plugins/password/config.inc.php, the 'password_db_dsn' line at about line 81 like this:

Code: Select all

$config['password_db_dsn'] = 'mysql://roundcube:Someverylong&complicatedpassword@localhost/mail';
& I modified the 'password_query' further down at line 106 like this, exactly as stated in the referenced link.

Code: Select all

$config['password_query'] = "UPDATE `mailbox` SET `password` = %c, modified=now() WHERE `username` = %u LIMIT 1";
So one gets all the advantages detailed at postfixadmin.sourceforge.net which is thus compatible with the password plugin available in Roundcube. Not to mention the advantages of using the official, stable Debian packages.
Thanks for reading. :)

Re: Postfixadmin & Roundcube installed from Debian Repositor

Posted: 2018-07-22 04:29
by dotlj
Thanks for this post. I know others who agree that RoundCube and Postfixadmin are the way to go.
Your tips are helpful and useful. I'm interested in this and considering this for a rainy day.

Re: Postfixadmin & Roundcube installed from Debian Repositor

Posted: 2018-07-22 06:11
by kedaha
Thanks dotlj for your interest in the topic and kind words about my tips; :)

I don't know about your neck of the woods but there are certainly quite a few rainy days here so I've been able to make some progress with this. But, to continue in a metaphorical vein, there are so many guides out there, many of which are either incomplete, out-of-date or incompatible, that one can't see the woods for the trees! Not only this which is bad enough but there are always multiple issues when setting up an email server causing one to repeat things over and over again, do endless searches for answers, because the smallest configuration error can throw a spanner in the works which makes one feel like abandoning the attempt.

My general method is to try and always to do things the Debian way by which I mean to only use software—since it's for a server where stability and security are paramount—from the official stable Debian repository. I shy away from advice to download and extract the latest tarball which flatly goes against the rationale of using stable. As I see it, the proper place for the upstream software is in the developmental repositories, in experimental, sid or testing but not on a working stable server. And I'm not happy with the chowning and chmoding recommended when installing downloaded packages from source in, for example /var/www/html/postfixadmin; rather, I want my packages to be properly installed into the file system with the right permissions by the usual packaging tools. This way any glitches, bugs or security issues may be reported to Debian.

My email server is now fully functional so, now I at least know enough to achieve this practical result, when you wish to build such a server, I'll be happy to discuss any issues.