mailserver

Useful things

set user password with dovecot:

doveadm pw -s SHA512-CRYPT

output starts with “$6$” and gets added to msyql table

to add a domain:

mysql> INSERT INTO `mailserver`.`virtual_domains`
  (`id` ,`name`)
VALUES
  ('1', 'newdomain.com');

to add a user:

mysql> INSERT INTO `mailserver`.`virtual_users`
  (`id`, `domain_id`, `password` , `email`)
VALUES
  ('1', '1', '$6$YOURPASSWORDHASH', 'user@newdomain.com');

domain id should match value of domain created in virtual_domains. when adding another user (or domain) the id value can be omitted as it auto-increments.

had to edit /etc/dovecot/dovecot.conf with:

protocols = imap lmtp

mysql password stored in dovecot config can’t have any ‘#’ symbols as they’re interpreted as comments

found this after error:

Details: public key: does not support hash algorithm 'sha256'

suggestion was to create opendkim key with -h sha256 not -h rsa-sha256

Sieve

The .dovecot.sieve file needs to have “Junk” instead of “Spam” as .Spam doesn’t exist in mail inbox

Roundcube

apt-get install roundcube

db-config needs mysql root pw

Backing up mail ideas

use gpg-zip!

import key:

gpg --search-keys $USER_KEY

zip and encrypt mail dir

gpg-zip --encrypt --output $FILE -r $USER $ZIPDIR

Found Syncthing to handle copying backup files to a remote machine. Port 22000 needed to be opened up on the server’s firewall. The remote maching is behind a nat, but doesn’t need a port forwarded to it, which is another reason this seems like a better idea than scp’ing the backups out.

Fixing d(z)-push

Cloned https://github.com/fmbiete/Z-Push-contrib

have to edit both config.php (set to state file in /decrypted-mail/dpush-state/), and configure backend to imap in backends/imap/config.php. Following code had to be changed:

// Trash folder name (case doesn't matter)
define('IMAP_FOLDER_TRASH', 'DELETED MESSAGES');

Deleting messages on the mobile device didn’t work without this update.