Daniel Schütze | 10 Jan 2012 13:05

How to prevent folder deletion (by owner) and/or prevent messages being deleted when a folder is deleted

Hi

 

I appreciate this has been discussed before but I don’t believe there was a solution given which met my needs so I thought I’d run this by the list.

 

I would like to prevent the owner of a mailbox deleting it, the reason being that if this is done accidently or maliciously the child messages are removed from the dbmail database and not recoverably without a major effort involving recovery from backups.  Normally of course if someone accidently (or maliciously) deletes a message and even purges it the message remains in the database until dbmail-util is run with the correct flags.  Unfortunately it is quite frequent for there to be a delay between a user deleting  folder and this being brought to anyone’s attention.  I’m sure everyone can imagine the user/admin conversations which have arisen as a result of user “finger trouble” etc.

 

Changing the permission flag in dbmail_mailboxes to 1 (from 2) has been suggested.  This prevents a user deleting the mailbox but also prevents all changes to messages in the mailbox (or adding messages to it) which is too restrictive.

 

Using ACL permissions has also been suggested but this doesn’t help because the owner always has delete permission on their own mailbox.  I suppose I could set up a system where all mailboxes are shared and people are not the owner of their “own” mailboxes  but this seems like a lot of trouble given we have several thousand mailboxes.

 

I considered changing the permissions on the dbmail_mailboxes table for the dbmail user to prevent deletion but then realised that using MySQL I would have to remove all the dbmail uers permissions (which are currently “grant all” on the dbmail database) and set permissions one at a time for each table, doable and I expect this is the approach I should take, but I’d be concerned about such a level of interference on a production system.

 

So, would the best “quick fix” for me be to remove the foreign key constraints to prevent the deletion of a mailbox having the knock-on effect (i.e. of deleting all the contained messages from the folder from the database) which I’m trying to avoid?  If so, should I just remove the dbmail_messages_ibfk_2 on dbmail_messages (cascade constraint on dbmail_mailboxes mailbox_idnr/mailbox_idnr).  If I make this change does anyone know of any possible unforeseen consequences?  The only one I can envisage is a situation where a mailbox is deleted and then another created (which I imagine could potentially have the same mailbox_idnr).

 

Clearly I’d prefer a dbmail “flag” or folder permission setting which achieves the same goal and if that exists I trust someone will let me know.

 

Thank you!


Daniel Schütze

_______________________________________________
DBmail mailing list
DBmail <at> dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
Paul J Stevens | 10 Jan 2012 15:11
Picon
Favicon
Gravatar

Re: How to prevent folder deletion (by owner) and/or prevent messages being deleted when a folder is deleted

On 01/10/2012 01:05 PM, Daniel Schütze wrote:

> So, would the best “quick fix” for me be to remove the foreign key
> constraints to prevent the deletion of a mailbox having the knock-on
> effect (i.e. of deleting all the contained messages from the folder from
> the database) which I’m trying to avoid?  If so, should I just remove
> the dbmail_messages_ibfk_2 on dbmail_messages (cascade constraint on
> dbmail_mailboxes mailbox_idnr/mailbox_idnr).  If I make this change does
> anyone know of any possible unforeseen consequences?  The only one I can
> envisage is a situation where a mailbox is deleted and then another
> created (which I imagine could potentially have the same mailbox_idnr).

If you remove that cascading constraint, messages in such a deleted
inbox become unconnected. This will lead to them being harvested by
dbmail-util -cy (implied by -ay). So you might want to re-assign those
messages to a newly created archive box before running that.

--

-- 
________________________________________________________________
Paul J Stevens        pjstevns  <at>  gmail, twitter, skype, linkedin

  * Premium Hosting Services and Web Application Consultancy *

           www.nfg.nl/info <at> nfg.nl/+31.85.877.99.97
________________________________________________________________
Zhang Huangbin | 13 Jan 2012 16:19
Picon

DBMailAdmin is now open source, download it now.

Dear all,

DBMailAdmin, a web-based admin panel for DBMail 2.x/3.x, is now open source, licensed under GPL v3.
DBMailAdmin is a sub-project of iRedMail[1] project.

First stable release is now available for download, works with DBMail 2.x and 3.x.

- Features: http://dbmailadmin.org/
- Download now: http://dbmailadmin.org/download.html
- Installation tutorials: http://dbmailadmin.org/doc.html
- Source code: https://bitbucket.org/zhb/dbmailadmin/

Hope you guys like this new year gift. Enjoy. :)

[1] iRedMail: http://www.iredmail.org/

----
Zhang Huangbin <zhb <at> iredmail.org>

iRedMail: free, open source mail server solution for for Red Hat
Enterprise Linux, CentOS, Scientific Linux, Debian, Ubuntu,
openSUSE, FreeBSD. http://www.iredmail.org/
d egberts | 16 Jan 2012 00:15
Picon

Imap connections trough android phone application K9-mail are not being terminated


Hello,

For some reason and iam not sure it u can help me.. but K9-mail for android
is keeping all connections open.
Perhaps K9 doesent close them proparly. therefore a dbmail imap server is
growing to a 400mb ram eating monster.
Is thery anything i can do to stop this behavior? my mail server is very
small 6mailboxes medium usage.
Roundcube front. and 2x android phone. 1 win7 client.

For 1 day i get 232 open connections. 85% K9.

--

-- 
View this message in context: http://old.nabble.com/Imap-connections-trough-android-phone-application-K9-mail-are-not-being-terminated-tp33144897p33144897.html
Sent from the dbmail users mailing list archive at Nabble.com.
Reindl Harald | 16 Jan 2012 08:38
Favicon

Re: Imap connections trough android phone application K9-mail are not being terminated


Am 16.01.2012 00:15, schrieb d egberts:
> 
> Hello,
> 
> For some reason and iam not sure it u can help me.. but K9-mail for android
> is keeping all connections open.
> Perhaps K9 doesent close them proparly. therefore a dbmail imap server is
> growing to a 400mb ram eating monster.
> Is thery anything i can do to stop this behavior? my mail server is very
> small 6mailboxes medium usage.
> Roundcube front. and 2x android phone. 1 win7 client.
> 
> For 1 day i get 232 open connections. 85% K9.

this is the definition of IMAP IDLE / push
we have open 200-250 IMAP connections all the time and
consuming 8 GB RAM at all

are you using the newest versions with all bugfixes?

_______________________________________________
DBmail mailing list
DBmail <at> dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
Paul J Stevens | 16 Jan 2012 10:12
Picon
Favicon
Gravatar

Re: Imap connections trough android phone application K9-mail are not being terminated

On 01/16/2012 08:38 AM, Reindl Harald wrote:

>> For 1 day i get 232 open connections. 85% K9.
> 
> this is the definition of IMAP IDLE / push
> we have open 200-250 IMAP connections all the time and
> consuming 8 GB RAM at all

Crazy amount of RAM! One big TODO tracking that down...

FYI you can easily disable IDLE by removing it from the CAPABILITY
parameter in dbmail.conf

But really IDLE should not be so expensive....

--

-- 
________________________________________________________________
Paul J Stevens        pjstevns  <at>  gmail, twitter, skype, linkedin

  * Premium Hosting Services and Web Application Consultancy *

           www.nfg.nl/info <at> nfg.nl/+31.85.877.99.97
________________________________________________________________
Reindl Harald | 16 Jan 2012 10:39
Favicon

Re: Imap connections trough android phone application K9-mail are not being terminated


Am 16.01.2012 10:12, schrieb Paul J Stevens:
> On 01/16/2012 08:38 AM, Reindl Harald wrote:
> 
>>> For 1 day i get 232 open connections. 85% K9.
>>
>> this is the definition of IMAP IDLE / push
>> we have open 200-250 IMAP connections all the time and
>> consuming 8 GB RAM at all
> 
> Crazy amount of RAM! One big TODO tracking that down...
> 
> FYI you can easily disable IDLE by removing it from the CAPABILITY
> parameter in dbmail.conf
> 
> But really IDLE should not be so expensive....

the 8 GB RAM are the whole machine including innodb_buffer_pool,
dovecot-proxy processes, postfix-processes and os-caches

that is why "therefore a dbmail imap server is growing to a 400mb
ram eating monster" does not scare me much if this is not only
one imapd-process for one connection, if it is for one connection
than it would scare me because that would mean 250x400 MB = 100.000 MB

_______________________________________________
DBmail mailing list
DBmail <at> dbmail.org
http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
Paul J Stevens | 16 Jan 2012 11:13
Picon
Favicon
Gravatar

Re: Imap connections trough android phone application K9-mail are not being terminated

On 01/16/2012 10:39 AM, Reindl Harald wrote:

> the 8 GB RAM are the whole machine including innodb_buffer_pool,
> dovecot-proxy processes, postfix-processes and os-caches
> 
> that is why "therefore a dbmail imap server is growing to a 400mb
> ram eating monster" does not scare me much if this is not only
> one imapd-process for one connection, if it is for one connection
> than it would scare me because that would mean 250x400 MB = 100.000 MB

Still, I do see continuing growth of the process over time.

I'm setting up some valgrind/massif sessions to see where this growth is
coming from.

--

-- 
________________________________________________________________
Paul J Stevens        pjstevns  <at>  gmail, twitter, skype, linkedin

  * Premium Hosting Services and Web Application Consultancy *

           www.nfg.nl/info <at> nfg.nl/+31.85.877.99.97
________________________________________________________________
d egberts | 16 Jan 2012 12:46
Picon

Re: Imap connections trough android phone application K9-mail are not being terminated


Hello Guys, thanks for looking into this.

Iam going to disable IDLE in the configuration.
I have already set the timeout period (but does not kill connections).

Iam running the latest build from svn (dont know if there are bugfixes?)
just use make to install it..
I can mange myself but dont know exactly where the bugfixes are. i was under
the impression they where installed when i pull latest svn and compile it.

imapd is spawned as 1 process and starts around 178Mb ram usage.
After 1 day iam on 558Mb ram. 
788 dbmail    20   0  558M  337M  3188 S  0.0 22.4  0:35.49
/usr/local/sbin/dbmail-imapd

If i can provide any logs or what u need just let me know. 

Paul J Stevens wrote:
> 
> On 01/16/2012 10:39 AM, Reindl Harald wrote:
> 
>> the 8 GB RAM are the whole machine including innodb_buffer_pool,
>> dovecot-proxy processes, postfix-processes and os-caches
>> 
>> that is why "therefore a dbmail imap server is growing to a 400mb
>> ram eating monster" does not scare me much if this is not only
>> one imapd-process for one connection, if it is for one connection
>> than it would scare me because that would mean 250x400 MB = 100.000 MB
> 
> Still, I do see continuing growth of the process over time.
> 
> I'm setting up some valgrind/massif sessions to see where this growth is
> coming from.
> 
> 
> -- 
> ________________________________________________________________
> Paul J Stevens        pjstevns  <at>  gmail, twitter, skype, linkedin
> 
>   * Premium Hosting Services and Web Application Consultancy *
> 
>            www.nfg.nl/info <at> nfg.nl/+31.85.877.99.97
> ________________________________________________________________
> _______________________________________________
> DBmail mailing list
> DBmail <at> dbmail.org
> http://mailman.fastxs.nl/cgi-bin/mailman/listinfo/dbmail
> 
> 

--

-- 
View this message in context: http://old.nabble.com/Imap-connections-trough-android-phone-application-K9-mail-are-not-being-terminated-tp33144897p33146994.html
Sent from the dbmail users mailing list archive at Nabble.com.
Martin Mačura | 16 Jan 2012 13:03
Picon

Re: Imap connections trough android phone application K9-mail are not being terminated

On Mon, Jan 16, 2012 at 11:13 AM, Paul J Stevens <paul <at> nfg.nl> wrote:
> On 01/16/2012 10:39 AM, Reindl Harald wrote:
>
>> the 8 GB RAM are the whole machine including innodb_buffer_pool,
>> dovecot-proxy processes, postfix-processes and os-caches
>>
>> that is why "therefore a dbmail imap server is growing to a 400mb
>> ram eating monster" does not scare me much if this is not only
>> one imapd-process for one connection, if it is for one connection
>> than it would scare me because that would mean 250x400 MB = 100.000 MB
>
> Still, I do see continuing growth of the process over time.
>
> I'm setting up some valgrind/massif sessions to see where this growth is
> coming from.
>

i can confirm that imapd eats memory, though I don't have the above
problem with lingering connections.
this is memory usage after four weeks:
PID TTY      STAT   TIME  MAJFL   TRS   DRS   RSS %MEM COMMAND
8342 ?        Sl   152:46    400    98 2388437 614812 41.1
/usr/sbin/dbmail-imapd

Gmane