Re: [Dovecot] getting quota error when accessing private namespace

2013-07-12 Thread Robert Schetterer
Am 12.07.2013 07:27, schrieb Andreas Oster:
 Hi all,
 
 I have run into a problem which I cannot find a solution for.
 
 I have created an additional private namespace with the following
 commands in dovecot.conf :
 
 namespace {
   disabled = no
   hidden = no
   ignore_on_failure = no
   inbox = no
   list = children
   location = maildir:/var/vmail/archives/%Ln/Maildir
   mailbox archived mails {
 auto = subscribe
 driver =
 special_use = \Archive
   }
   prefix = Archives/
   separator = /
   subscriptions = yes
   type = private
 }
 
 plugin {
   quota = maildir:User quota:ns=
   quota2 = maildir:Archives quota:ns=Archives/
   quota2_rule = *:storage=5G
   quota_rule = *:storage=1G
   quota_rule2 = Trash:storage=+200M
 }
 
 
 I can access the new namespace without any problems but every time
 a folder in this namespace is accessed, I get the following error
 messages in mail.err log:
 
   dovecot: imap(testuser): Error: quota: Unknown namespace: Archives/
   dovecot: last message repeated 49 times
 
 
 Quota seems to work, though I have the feeling, that it only will be
 updated when closing and reopening the mail client, but this can also
 be a client issue.
 
 Quota for the INBOX is either taken from LDAP or, if there is no value
 defined in LDAP, will be assigned a quota of 1G
 
 The Archives/ namespace has a static quota of 5G for every user.
 
 
 Does anyone have idea how to get rid of these error messages ?
 
 Thank you for your kind help
 
 Andreas
 

why you want to have a separate namespace for archives ?, why not use
simply a imap folder for every user ( which i wouldnt call archives,
cause that name is allready used by thunderbird etc ), or use some pub
namespace with an archive-username folder, restrictions can be done by
acl, what problem youre trying to solve?

perhaps you might have a look at

http://sys4.de/de/blog/2013/02/07/mailarchiv-mit-dovecot-und-postfix-sortiert-nach-datum-mailadressen-und-ein-ausgehend-unterordnern/

for ideas

also

http://sys4.de/de/blog/2013/03/25/outlook-2013-special-use-mit-dovecot/

should give you help for special use handling, guess german is ok for you


Best Regards
MfG Robert Schetterer

-- 
[*] sys4 AG

http://sys4.de, +49 (89) 30 90 46 64
Franziskanerstraße 15, 81669 München

Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer
Aufsichtsratsvorsitzender: Florian Kirstein


Re: [Dovecot] getting quota error when accessing private namespace

2013-07-12 Thread Andreas Oster
Am 12.07.2013 08:39, schrieb Robert Schetterer:
 Am 12.07.2013 07:27, schrieb Andreas Oster:
 Hi all,

 I have run into a problem which I cannot find a solution for.

 I have created an additional private namespace with the following
 commands in dovecot.conf :

 namespace {
   disabled = no
   hidden = no
   ignore_on_failure = no
   inbox = no
   list = children
   location = maildir:/var/vmail/archives/%Ln/Maildir
   mailbox archived mails {
 auto = subscribe
 driver =
 special_use = \Archive
   }
   prefix = Archives/
   separator = /
   subscriptions = yes
   type = private
 }

 plugin {
   quota = maildir:User quota:ns=
   quota2 = maildir:Archives quota:ns=Archives/
   quota2_rule = *:storage=5G
   quota_rule = *:storage=1G
   quota_rule2 = Trash:storage=+200M
 }


 I can access the new namespace without any problems but every time
 a folder in this namespace is accessed, I get the following error
 messages in mail.err log:

   dovecot: imap(testuser): Error: quota: Unknown namespace: Archives/
   dovecot: last message repeated 49 times


 Quota seems to work, though I have the feeling, that it only will be
 updated when closing and reopening the mail client, but this can also
 be a client issue.

 Quota for the INBOX is either taken from LDAP or, if there is no value
 defined in LDAP, will be assigned a quota of 1G

 The Archives/ namespace has a static quota of 5G for every user.


 Does anyone have idea how to get rid of these error messages ?

 Thank you for your kind help

 Andreas

 
 why you want to have a separate namespace for archives ?, why not use
 simply a imap folder for every user ( which i wouldnt call archives,
 cause that name is allready used by thunderbird etc ), or use some pub
 namespace with an archive-username folder, restrictions can be done by
 acl, what problem youre trying to solve?
 
 perhaps you might have a look at
 
 http://sys4.de/de/blog/2013/02/07/mailarchiv-mit-dovecot-und-postfix-sortiert-nach-datum-mailadressen-und-ein-ausgehend-unterordnern/
 
 for ideas
 
 also
 
 http://sys4.de/de/blog/2013/03/25/outlook-2013-special-use-mit-dovecot/
 
 should give you help for special use handling, guess german is ok for you
 
 
 Best Regards
 MfG Robert Schetterer
 

Hello Robert,

thank you for your fast response.

I wanted to use the Thunderbird archive feature to allow users to move
old mails, they want to keep, to a storage located on another server.
But it would be perfectly OK to just have another folder where they can
drop their old stuff.
Every user should have a quota of 5G in that folder, which is different
from the default INBOX quota.

best regards

Andreas


Re: [Dovecot] getting quota error when accessing private namespace

2013-07-12 Thread Robert Schetterer
Am 12.07.2013 09:07, schrieb Andreas Oster:
 Am 12.07.2013 08:39, schrieb Robert Schetterer:
 Am 12.07.2013 07:27, schrieb Andreas Oster:
 Hi all,

 I have run into a problem which I cannot find a solution for.

 I have created an additional private namespace with the following
 commands in dovecot.conf :

 namespace {
   disabled = no
   hidden = no
   ignore_on_failure = no
   inbox = no
   list = children
   location = maildir:/var/vmail/archives/%Ln/Maildir
   mailbox archived mails {
 auto = subscribe
 driver =
 special_use = \Archive
   }
   prefix = Archives/
   separator = /
   subscriptions = yes
   type = private
 }

 plugin {
   quota = maildir:User quota:ns=
   quota2 = maildir:Archives quota:ns=Archives/
   quota2_rule = *:storage=5G
   quota_rule = *:storage=1G
   quota_rule2 = Trash:storage=+200M
 }


 I can access the new namespace without any problems but every time
 a folder in this namespace is accessed, I get the following error
 messages in mail.err log:

   dovecot: imap(testuser): Error: quota: Unknown namespace: Archives/
   dovecot: last message repeated 49 times


 Quota seems to work, though I have the feeling, that it only will be
 updated when closing and reopening the mail client, but this can also
 be a client issue.

 Quota for the INBOX is either taken from LDAP or, if there is no value
 defined in LDAP, will be assigned a quota of 1G

 The Archives/ namespace has a static quota of 5G for every user.


 Does anyone have idea how to get rid of these error messages ?

 Thank you for your kind help

 Andreas


 why you want to have a separate namespace for archives ?, why not use
 simply a imap folder for every user ( which i wouldnt call archives,
 cause that name is allready used by thunderbird etc ), or use some pub
 namespace with an archive-username folder, restrictions can be done by
 acl, what problem youre trying to solve?

 perhaps you might have a look at

 http://sys4.de/de/blog/2013/02/07/mailarchiv-mit-dovecot-und-postfix-sortiert-nach-datum-mailadressen-und-ein-ausgehend-unterordnern/

 for ideas

 also

 http://sys4.de/de/blog/2013/03/25/outlook-2013-special-use-mit-dovecot/

 should give you help for special use handling, guess german is ok for you


 Best Regards
 MfG Robert Schetterer

 
 Hello Robert,
 
 thank you for your fast response.
 
 I wanted to use the Thunderbird archive feature to allow users to move
 old mails, they want to keep, to a storage located on another server.
 But it would be perfectly OK to just have another folder where they can
 drop their old stuff.
 Every user should have a quota of 5G in that folder, which is different
 from the default INBOX quota.
 
 best regards
 
 Andreas
 

a folder can have additional plus quota
via quota rules

http://wiki2.dovecot.org/Quota/Configuration

for short thinking you may use pub namespace with

http://wiki2.dovecot.org/MailboxFormat/dbox#Alternate_storage

but i nearly sure, there are some other solutions too for solving this,
wait for other maybe better ideas


Best Regards
MfG Robert Schetterer

-- 
[*] sys4 AG

http://sys4.de, +49 (89) 30 90 46 64
Franziskanerstraße 15, 81669 München

Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer
Aufsichtsratsvorsitzender: Florian Kirstein


Re: [Dovecot] getting quota error when accessing private namespace

2013-07-12 Thread Robert Schetterer
Am 12.07.2013 09:37, schrieb Robert Schetterer:
 http://sys4.de/de/blog/2013/02/07/mailarchiv-mit-dovecot-und-postfix-sortiert-nach-datum-mailadressen-und-ein-ausgehend-unterordnern/

 for ideas

like above a little bit different ( no postfix bcc archive feature and
sieve autosort, instead for putting users mails by themselves to some
archive by imap ) you may solve it ,with some backup.domain.de with
alternate mail location in i.e ldap or mysql having some inbox and
archive folder for every user mailbox on other physical mount in shared
user namespace and using acl on it, this can be done automatic at user
mailbox creation time with subscribe archive folder, use some static
quota with it


Best Regards
MfG Robert Schetterer

-- 
[*] sys4 AG

http://sys4.de, +49 (89) 30 90 46 64
Franziskanerstraße 15, 81669 München

Sitz der Gesellschaft: München, Amtsgericht München: HRB 199263
Vorstand: Patrick Ben Koetter, Axel von der Ohe, Marc Schiffbauer
Aufsichtsratsvorsitzender: Florian Kirstein


Re: [Dovecot] getting quota error when accessing private namespace

2013-07-12 Thread Andreas Oster
Am 12.07.2013 09:54, schrieb Robert Schetterer:
 Am 12.07.2013 09:37, schrieb Robert Schetterer:
 http://sys4.de/de/blog/2013/02/07/mailarchiv-mit-dovecot-und-postfix-sortiert-nach-datum-mailadressen-und-ein-ausgehend-unterordnern/

 for ideas
 
 like above a little bit different ( no postfix bcc archive feature and
 sieve autosort, instead for putting users mails by themselves to some
 archive by imap ) you may solve it ,with some backup.domain.de with
 alternate mail location in i.e ldap or mysql having some inbox and
 archive folder for every user mailbox on other physical mount in shared
 user namespace and using acl on it, this can be done automatic at user
 mailbox creation time with subscribe archive folder, use some static
 quota with it
 
 
 Best Regards
 MfG Robert Schetterer
 
Hello Robert,

thank you for all your hints. I already know the +quota stuff, but this
is not shown in the mail client and the user has no way to see if he is
reaching the max level. That is why I tried to set up an additional
namespace in the first place.

Thank you very much for your kind help.

Andreas


Re: [Dovecot] avoid log message when using nagios check

2013-07-12 Thread Daniel Parthey

Am 12.07.2013 02:09, schrieb Timo Sirainen:

On 10.7.2013, at 23.47, Daniel Partheyd.part...@metaways.de  wrote:


You're right, TCP connections don't seem to be a real problem here.

I confused it with the following messages, we get every few minutes in the 
dovecot-director.log, but I'm not sure of their origin yet,
there are some other imap proxies/balancer in front of the director:

Jul 10 21:51:46 10.129.3.233 dovecot: director: Error: read(login connection) 
failed: Connection reset by peer
Jul 10 21:51:49 10.129.3.213 dovecot: director: Error: read(login connection) 
failed: Connection reset by peer


Those aren't really errors. They should just be ignored. This gets rid of them: 
http://hg.dovecot.org/dovecot-2.2/rev/ebbe00999da8

I'm not sure why I haven't seen these before though. Was this with Linux?


Yes, this was with Linux.


Or I guess more likely it's because you're not using it in high performance 
mode as explained in http://wiki2.dovecot.org/LoginProcess


Indeed we're currently using the default (high security mode).

Regards
Daniel
--
Dipl.-Inf. Daniel Parthey
System Engineer
Metaways Infosystems GmbH
Pickhuben 2, D-20457 Hamburg

E-Mail: d.part...@metaways.de
Web:http://www.metaways.de

Metaways Infosystems GmbH - Sitz: D-22967 Tremsbüttel
Handelsregister: Amtsgericht Lübeck HRB 4508 AH
Geschäftsführung: Hermann Thaele, Lüder-H.Thaele


Re: [Dovecot] virtual users

2013-07-12 Thread Eugene

Hello Gab,

well the most attractive feature of virtual users is ease of administration. 
Adding a new domain and user is a matter of adding a couple of text lines 
(if using simplest text-based user databases), mail users do not litter the 
system user space, you do not expose system access to mail-only users, you 
don't have to create and manage email-to-sysuser mapping, each user logins 
simply by his/her email address, mail storage is separated from system home 
dir, etc...


In fact it is more convenient and consistent to use virtual mailboxes even 
for system users (e.g. admin), just add an alias root - u...@domain.zz
(Naturally system password and mail password are independent so they can be 
different for added security).


Of course in simplest form all virtual users use one system account but 
exploiting this would require circumventing Dovecot security which is pretty 
high. Also at most it would get access to other accounts' mail, not other 
system access.


Migration is really quite easy, actually I just created the virtual user 
infrastructure (postfix + dovecot) and then simply copied each Maildir 
directory from ~user/ to ~vmail/u...@domain.zz/


Best wishes
Eugene

-Original Message- 
From: Gab IIpop

Sent: Thursday, July 11, 2013 5:31 PM
To: dovecot@dovecot.org
Subject: [Dovecot] (no subject)


From the documentation, virtual users seem like a good idea if you plan on

having a lot of users. Although I'm wondering about the following:

What other benefits/consequences are there to using virtual over system
users and vice versa?

Will virtual users have the same protection as system users (system users
would use linux permissions, which is pretty secure)?

How easy will it be to switch from using system users to virtual users or
vice versa? 



Re: [Dovecot] login_trusted_networks from webmail ?

2013-07-12 Thread Jan-Frode Myklebust
On Thu, Jul 04, 2013 at 08:51:47PM +0200, Benny Pedersen wrote:
 Timo Sirainen skrev den 2013-07-03 22:34:
 
 If backend has login_trusted_networks pointing to directors, then the
 IP gets forwarded to backends as well.
 
 how does imap get ip from http ?

The webmail-server will use the HTTP REMOTE_ADDR header in the IMAP ID
when initiating the IMAP connection.

a ID (x-originating-ip $REMOTE_ADDR)


  -jf


[Dovecot] Dovecot Virtual Folders... could these be managed by a/the Client?

2013-07-12 Thread Charles Marcus

Hi all/Timo,

I was thinking about Thunderbirds ability to create Virtual folders 
allowing you to have many different views of your messages...


The downside though, is you only see these in Thunderbird.

I know that dovecot supports server side virtual folders:

http://wiki2.dovecot.org/Plugins/Virtual

But I'm wondering about the possibility to manage these from the client 
side...


For example, would it be possible to create an extension in Thunderbird 
that allowed the user to manage these (create, edit the filters for, 
delete, rename, etc)?


Thanks,

--

Best regards,

Charles




[Dovecot] mail not reject when the mailbox is full (Dovecot-LDAP-Imap_quota)

2013-07-12 Thread Victor Oñate
Hello List.
Currently I have configured the share of users through the LDAP query as
shown

#dovecot.conf

protocol imap {
  mail_plugins = quota imap_quota
}

plugin {
  quota = dirsize
}

userdb ldap {
args = /etc/dovecot/dovecot-ldap.conf
  }

#dovecot-ldap.conf
auth_bind = yes

ldap_version = 3
base = dc=XXX,dc=YY,dc=ZZ
deref = never
scope = subtree

user_attrs =
homeDirectory=home,uidNumber=uid,gidNumber=gid,mail=Maildir,mailQuotaSize=quota_rule=*:storage=%$
user_filter = ((objectClass=posixAccount)(uid=%u))

pass_attrs =
uid=user,userPassword=password,homeDirectory=userdb_home,uidNumber=userdb_uid,gidNumber=userdb_gid
pass_filter = ((objectClass=posixAccount)(uid=%u))


Additionally in thunderbird customers have the plug so they can see the
share. This works perfect!

However, when the mailbox exceeds 100% users continue to receive mail which
makes the risk set allocated disk space, the idea is that when full the mail
reject
with a message mailbox XXX full .


As always appreciate the ideas.

Victor Oñate


Re: [Dovecot] Dovecot Virtual Folders... could these be managed by a/the Client?

2013-07-12 Thread Timo Sirainen
Hi,

On 12.7.2013, at 16.21, Charles Marcus cmar...@media-brokers.com wrote:

 I know that dovecot supports server side virtual folders:
 
 http://wiki2.dovecot.org/Plugins/Virtual
 
 But I'm wondering about the possibility to manage these from the client 
 side...
 
 For example, would it be possible to create an extension in Thunderbird that 
 allowed the user to manage these (create, edit the filters for, delete, 
 rename, etc)?

Currently Dovecot doesn't provide an IMAP level interface for managing these. 
There have been two proposed IMAP extensions for these, but nothing really came 
ouf ot those. It would be possible to add some new IMAP extension to configure 
the virtual folders, but the main reason why there isn't one is simply because 
I haven't thought anyone would bother to implement such spec.



[Dovecot] Difference between using auth_realms and setting up virtual mailboxes in postfix?

2013-07-12 Thread Gab IIpop
Hi, there is a possibility in the future that I might have to support
multiple domain names(but using the same IP address). Postfix has something
called 'virtual mailboxes' to help handle this.

But I also noticed that dovecot has a setting auth_realms where I can
specify domains separated by a space.

What is the relationship between the two?


Re: [Dovecot] Ambiguous behavior with prefetch database?

2013-07-12 Thread Axel Luttgens
Le 12 juil. 2013 à 01:44, Timo Sirainen a écrit :

 [...]
 
 Here: http://hg.dovecot.org/dovecot-2.2/rev/2be295a0b64f

Hello Timo,

I hope I'll have the opportunity to try it tomorrow.
In the meantime, thanks again for your care,
Axel




[Dovecot] A sqlite-based quota dict

2013-07-12 Thread Axel Luttgens
Hello,

While experimenting with the sqlite backend, I noticed a big vacuum wrt its use 
for a quota dict.

This is thus an opportunity to share a solution I managed to devise after some 
trials and errors and a (very quick and unscientific) look at the code.

And also the opportunity to ask the community to check for possible flaws.
Yes, nothing comes for free... ;-)

TIA,
Axel


This is the SQL for creating the database or for adding needed table/trigger to 
an existing database (with many comments and few active lines):

CREATE TABLE quota (

-- We will assume that, in the case of a sqlite DB (and 
probably a pgsql DB
-- as well), Dovecot will *always* act along these lines:
--  In case of a row creation:
--  INSERT  INTO quota (subject, byte_count)
--  VALUES  (some id, byte count);
--  INSERT  INTO quota (subject, 
message_count)
--  VALUES  (some id, msg count);
--  In case of a recalculation:
--  UPDATE  quota
--  SET byte_count = byte_count 
+ byte count diff,
--  message_count = 
message_count + msg count diff
--  WHERE   subject = some id;
--  In case of a row deletion:
--  DELETE  FROM quota
--  WHERE   subject = some id;
-- For example, a doveadm quota recalc may first delete the 
relevant row
-- if it exists, then (re-)create it.
-- Clearly, the row creation case is a bit problematic, hence 
the need for
-- a trigger.

-- An id for the entity subjected to a quota (a user/mailbox, a 
domain...).
subject TEXT PRIMARY KEY NOT NULL,

-- The entity's size, expressed as a storage space use and as a 
message
-- count.
-- Note the NULL defaults: they allow to simplify the trigger's 
logics.
byte_count  INTEGER DEFAULT NULL,
message_count   INTEGER DEFAULT NULL
);


CREATE  TRIGGER quota_insert
BEFORE  INSERT ON quota
FOR EACH ROW
BEGIN

-- If there's a row to update, that's because the first INSERT 
of the row
-- creation has been performed.
-- (this UPDATE could probably be simplified if the insertion 
order,
-- byte_count then message_count, was guaranteed; anyway, since 
the row
-- creation operation shouldn't be very frequent, we may 
afford a slight
-- inefficiency).
UPDATE  quota
SET byte_count =
CASE
WHEN NEW.byte_count ISNULL THEN 
byte_count
ELSE NEW.byte_count
END,
message_count =
CASE
WHEN NEW.message_count ISNULL 
THEN message_count
ELSE NEW.message_count
END
WHERE   subject = NEW.subject;

-- In which case we may ignore that second (current) INSERT, 
since the
-- previously inserted row has just been updated with the value 
coming
-- from the current INSERT statement.
SELECT  raise(IGNORE)
WHERE   EXISTS (SELECT * FROM quota WHERE subject = 
NEW.subject);

END;

The corresponding dict configuration being thus supposed to be similar to this 
one:

connect = /path/to/database

map {
  pattern = priv/quota/storage
  table = quota
  username_field = subject
  value_field = byte_count
}

map {
  pattern = priv/quota/messages
  table = quota
  username_field = subject
  value_field = message_count
}