[Dovecot] Restoring individual messages from a backup into a Maildir setup?

Thomas Harold thomas-news at nybeta.com
Thu Jan 8 22:36:58 EET 2009


We have a user who deleted IMAP folders from his account, so I simply 
tried to restore the folder ".FolderName" from our backup.  I checked 
that file/folder ownership was the same as the original, but the Dovecot 
IMAP server is throwing errors at the client.

I've tried copying the individual message files from the "cur" folders 
in the backup directory, but Dovecot immediate goes into panic mode and 
throws errors at the IMAP client when I do that.  Even if the file is 
owned by the currect UID.  I've tried putting those files into "tmp" and 
"new" as well, with no luck.

I looked at the following thread, but it didn't help.

http://www.dovecot.org/list/dovecot/2007-August/024971.html

The thread from Sep 2008 wasn't much help either:

http://www.mail-archive.com/dovecot@dovecot.org/msg12846.html

...

Eh, I figured this out before I even posted.  Restoration is indeed that 
simple.  The problem is that the files were not labeled with the proper 
SELinux security context after being restored.  When the file was 
restored, it was assigned a context of "root:object_r:file_t", which is 
not a context that the Dovecot service has permissions to interact with.

I had to re-label the files after restoring them with

# chcon -R user_u:object_r:mail_spool_t foldername

So the lesson here is to check /var/log/messages and look for sealert 
indicators when restoring files.

...

Hopefully that helps some other people out when dealing with Red Hat / 
CentOS with SELinux set to enforcing mode.



More information about the dovecot mailing list