Emails redownloading

B. Reino reinob at bbmk.org
Fri Apr 12 16:35:47 EEST 2019


On 2019-04-12 11:05, azurit--- via dovecot wrote:
> Citát "B. Reino via dovecot" <dovecot at dovecot.org>:
> 
>> On 2019-04-12 07:43, azurit--- via dovecot wrote:
>>> Hi,
>>> 
>>> recently, we had a problem on one of our mail servers and, after
>>> reboot, HDD with emails wasn't mounted into system. Until we fixed 
>>> it,
>>> LOTS of users logged in (Dovecot allowed login and recreated
>>> directory  structure of mailboxes) and saw empty mailboxes. Now they
>>> are  redownloading all email, which isn't fun, as it's about 2 TB of
>>> data.
>>> 
>>> Anyway, is there a way how to prevent this in the future? Can i set
>>> Dovecot to disallow logins in such situations? Thanks.
>> 
>> You didn't tell which OS or init system you are using.
>> With systemd, you can add use "systemctl edit dovecot" and use:
>> 
>> [Unit]
>> RequiresMountsFor=/path/to/your/mounted/mailbox
>> 
>> This way dovecot will be started when the directory has been mounted.
>> 
>> IMHO, and with no offence intended, if you can't control your system  
>> initialization, then you should not start daemons automatically,  i.e. 
>> you should take the role of systemd.
>> 
>> Cheers.
> 
> 
> Thanks. Any other suggestions? Some which will cover also situations
> where HDD is disconnected while server is already running (so Dovecot
> won't display empty mailbox but deny login instead).

You could set the permissions of the mount point so that dovecot cannot 
read or write from there.
This way, if for any reason the HDD is unmounted dovecot won't be able 
to continue working (i.e. won't be able to access the mailboxes or 
create empty ones).

This may or may not prevent users from logging in (you can test it).

.. I suppose your "use case" is pretty unusual. Normally you don't 
randomly pull HDDs from a running server, but I don't know which 
environment you have to live with :)

(That said, there's probably a way to automatically run a script when a 
device is unmounted, and then have the script stop dovecot, etc. -- but 
then this is outside of the scope of dovecot itself, and more a system 
administration issue.. and you still haven't said which operating system 
or init system you have).

Cheers.


More information about the dovecot mailing list