Problems adding Getmail to the Postfix / mySQL / Dovecot mix

I think, after several abortive attempts to run my own mailserver over the years, I'm on the verge of finally getting there, thanks to Linode's excellent Email with Postfix, Dovecot, and MySQL tutorial. I've been able to successfully send and receive email on a couple of seldom-used domains I own :mrgreen:

However, there's just one more step which I need to crack before declaring victory…

I'm now ready to switch my 'main' domain over to using my new mailserver setup. However, it has 3 IMAP user ccounts on it [including my own email account which has a couple of thousand messages]. I don't want to lose all my old correspondence and am looking for a way to bring the old email with me when I switch servers. From what I've gleaned from the intarwebs, it would seem that one way to do this would be to use getmail to retrieve the emails from my current mailserver and pass them to Dovecot on my new setup, which would then distribute them to the appropriate mailboxes.

I've got getmail config set up as follows:

[retriever]
type = SimpleIMAPSSLRetriever
server = imap.yandex.com
port = 993
username = me@mydomain.com
password = xxxxxxx

[destination]
type = MDA_external
path = /usr/lib/dovecot/deliver
arguments = ("-e", "-f", "%(sender)", "-d", "%(recipient)")
user = getmail
group = getmail
[options]
delete = false
message_log = ~/.getmail/xxx.log

when I run getmail I can see that it successfully connects to the server and begins downloading to my Linode. I can see the messages downloading when I 'tail' the getmail log file. However there seems to be a permissions problem with the actual 'deliver' command:

2015-03-07 13:58:04 msg    3/7223 (9615 bytes) msgid 1418515470/12 from <disk-news@yandex.com>2015-03-07 13:58:05 Delivery error (command deliver 27920 error (127, exec of command deliver failed (change UID/GID to 5001/5001 failed ([Errno 1] Operation not permitted))))
2015-03-07 13:58:05 msg    4/7223 (1722 bytes) msgid 1418515470/13 from <noreply@linode.com>2015-03-07 13:58:05 Delivery error (command deliver 27921 error (127, exec of command deliver failed (change UID/GID to 5001/5001 failed ([Errno 1] Operation not permitted))))</noreply@linode.com></disk-news@yandex.com> 

UID/GID 5001 referred to in the error messages is getmail

Thinking that maybe user/group in my getmail config was wrong, I changed that to

...
user = dovecot
group = postfix
...

But got a similar error. This time with the UID/GIDs of dovecot and :postfix instead

So, I'm not really sure where I go from here. As per the article I referenced above, my mail should be being moved to /var/mail/vhosts/domain.com which is owned by vmail:vmail. I tried adding getmail, dovecot and postfix to the :vmail group to see if that would allow them to play nicely together [although postfix and dovecot seem to be managing their side of things OK, without belonging to any other groups] –but that didn't help either.

Any pointers anyone? Even an explanation of the getmail error messages would help. At least then I'd narrow down at what stage of the "email pass-the-parcel" game the problems were arising.

1 Reply

QUICK UPDATE:

I seem to have managed to get this working by copying all the getmail config over to 'root's' ~/ dir and then su root-ing and running getmail as root.

Doubtless a dumb thing to do but, as I'm only planning to run getmail once, to mgrate my old email over to my Linode, I'll risk it and then remove it! :mrgreen:

I also simplified my getmail config to just chuck everything directly into the Maildir, rather than filtering it through Dovecot.

[retriever]
type = SimpleIMAPSSLRetriever
server = imap.yandex.com
port = 993
username = user@domain.com
password = xxxxxxxx

[destination]
user = vmail
group = vmail
type = Maildir
path = /var/mail/vhosts/domain.com/username/

[options]
delete = false
message_log = ~/.getmail/log-domain.com

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct