Re: dovecot quota-warning detection mail

2020-10-29 Thread Gedalya
Let me just add, of course you should play around with some test entries.
You don't want problems with dovecot finding the home directory, users suddenly 
seeing an empty mailbox, or LMTP delivering to the wrong place.
Just in case this isn't obvious :-)

On 10/29/20 2:08 PM, Gedalya wrote:
> Very good.
>
> See https://doc.dovecot.org/configuration_manual/authentication/passwd_file/
>
> You can add the "user" field as an "extra field"
>
> In users.auth, just add in the end "user=-...@ddd.example.com" to match 
> the respective entry in /etc/dovecot/users
>
> Good luck!
>
>
> On 10/29/20 2:02 PM, 森川 孝司 wrote:
>> OK. "passdb/userdb" Setting part
>>
>> $ dovecot -n (Excerpt from change)
>> 
>> -
>> passdb {
>>   args = scheme=CRYPT username_format=%u /etc/dovecot/users.auth
>>   driver = passwd-file
>> }
>>
>> userdb {
>>   args = username_format=%u /etc/dovecot/users.auth
>>   driver = passwd-file
>> }
>> protocol lmtp {
>>   info_log_path = /var/log/lmtplog
>>   mail_plugins = " quota quota sieve"
>>   userdb {
>> args = username_format=%u /etc/dovecot/users
>> driver = passwd-file
>> name =
>>   }
>> }
>> 
>> -
>>
>> cat /etc/dovecot/users.auth (Excerpt from change)
>> 
>> -
>> root:*/root::
>> :{CRAM-MD5}b09a26aedaddd0e66901eb4bc146b81930aac8be0dac96d1c83bb652fd4f7
>> 451/var/home/xxx/::
>> -ccc-ddd:{CRAM-MD5}b09a15aedaddd0e55901eb4bc146b81930aac8be0dac96d1c83bb
>> 652fd4f7451/home/vhosts/ddd/-ccc-ddd::
>> -fff-ggg:{CRAM-MD5}f4c336c68f063d1bbc2a1e32ae32bc9c978d0d2565eae42b4485d
>> 50370d157cd/home/vhosts/ggg/-fff-ggg::
>> -iii-jjj:{CRAM-MD5}78b337b326d57d564454d8019ed22b5d5cd181437aff77988e2c3
>> a12ec2d8490/home/vhosts/jjj/-iii-jjj::
>>   :
>>   :
>> 
>> -
>>
>> cat /etc/dovecot/users (Excerpt from change)
>> 
>> -
>> root:/root::
>> :/var/home/xxx/::
>> -...@ddd.example.com:/home/vhosts/ddd/-ccc-ddd::
>> -...@ggg.example.net:/home/vhosts/ggg/eeee-fff-ggg::
>> -...@jjj.example.co.jp:/home/vhosts/jjj/-iii-jjj::
>>   :
>>   :
>> 
>> -
>>
>> -Original Message-
>> From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Gedalya
>> Sent: Thursday, October 29, 2020 2:27 PM
>> To: dovecot@dovecot.org
>> Subject: Re: dovecot quota-warning detection mail
>>
>> Perhaps if you share some information about your passdb / userdb
>> authentication setup, I or others might be able to help further.
>>
>>
>> On 10/29/20 12:51 PM, 森川 孝司 wrote:
>>> Gedalya-san
>>>
>>> Thank you for the information.
>>>
>>> It seems to be difficult...
>>>
>>> morikawa
>>> -Original Message-
>>> From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of 
>>> Gedalya
>>> Sent: Thursday, October 29, 2020 1:17 PM
>>> To: dovecot@dovecot.org
>>> Subject: Re: dovecot quota-warning detection mail
>>>
>>> Aha. Then it's not a straightforward case of just adding the domain 
>>> name to the same username, you need to transform the username too.
>>> Dovecot's userdb / authdb allows you to return a "user" field, which 
>>> sets a new username for dovecot to use.
>>> Depending on what you use as your authentication backend, you may be 
>>> able to do the transformation at that layer.
>>>
>>> https://doc.dovecot.org/configuration_manual/authentication/user_extra
>>> _field
>>> /
>>>
>>> On 10/29/20 12:06 PM, 森川 孝司 wrote:
>>>> Gedalya-san
>>>>
>>>> You are currently logged in without a domain name.
>>>>
>>>> Currently, "abc-xyz-unyo-sekkei" users have been converted to 
>>>> "abc-xyz-u...@example.co.jp".
>>>> (There is no "sekkei" in the address.)
>>>>
>>>> Or just add "@example.co.jp"?
>>>> When it comes to "abc-xyz-unyo-sek...@example.co.jp"
>>>> I can't send a mail.
>>>>
>>>> Thank you.
>>>>
>>>> morikawa




Re: dovecot quota-warning detection mail

2020-10-29 Thread Gedalya
Very good.

See https://doc.dovecot.org/configuration_manual/authentication/passwd_file/

You can add the "user" field as an "extra field"

In users.auth, just add in the end "user=-...@ddd.example.com" to match the 
respective entry in /etc/dovecot/users

Good luck!


On 10/29/20 2:02 PM, 森川 孝司 wrote:
> OK. "passdb/userdb" Setting part
>
> $ dovecot -n (Excerpt from change)
> 
> -
> passdb {
>   args = scheme=CRYPT username_format=%u /etc/dovecot/users.auth
>   driver = passwd-file
> }
>
> userdb {
>   args = username_format=%u /etc/dovecot/users.auth
>   driver = passwd-file
> }
> protocol lmtp {
>   info_log_path = /var/log/lmtplog
>   mail_plugins = " quota quota sieve"
>   userdb {
> args = username_format=%u /etc/dovecot/users
> driver = passwd-file
> name =
>   }
> }
> 
> -
>
> cat /etc/dovecot/users.auth (Excerpt from change)
> 
> -
> root:*/root::
> :{CRAM-MD5}b09a26aedaddd0e66901eb4bc146b81930aac8be0dac96d1c83bb652fd4f7
> 451/var/home/xxx/::
> -ccc-ddd:{CRAM-MD5}b09a15aedaddd0e55901eb4bc146b81930aac8be0dac96d1c83bb
> 652fd4f7451/home/vhosts/ddd/-ccc-ddd::
> -fff-ggg:{CRAM-MD5}f4c336c68f063d1bbc2a1e32ae32bc9c978d0d2565eae42b4485d
> 50370d157cd/home/vhosts/ggg/-fff-ggg::
> -iii-jjj:{CRAM-MD5}78b337b326d57d564454d8019ed22b5d5cd181437aff77988e2c3
> a12ec2d8490/home/vhosts/jjj/-iii-jjj::
>   :
>   :
> 
> -
>
> cat /etc/dovecot/users (Excerpt from change)
> 
> -
> root:/root::
> :/var/home/xxx/::
> -...@ddd.example.com:/home/vhosts/ddd/-ccc-ddd::
> -...@ggg.example.net:/home/vhosts/ggg/-fff-ggg::
> -...@jjj.example.co.jp:/home/vhosts/jjj/-iii-jjj::
>   :
>   :
> ----
> -----
>
> -Original Message-
> From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Gedalya
> Sent: Thursday, October 29, 2020 2:27 PM
> To: dovecot@dovecot.org
> Subject: Re: dovecot quota-warning detection mail
>
> Perhaps if you share some information about your passdb / userdb
> authentication setup, I or others might be able to help further.
>
>
> On 10/29/20 12:51 PM, 森川 孝司 wrote:
>> Gedalya-san
>>
>> Thank you for the information.
>>
>> It seems to be difficult...
>>
>> morikawa
>> -Original Message-
>> From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of 
>> Gedalya
>> Sent: Thursday, October 29, 2020 1:17 PM
>> To: dovecot@dovecot.org
>> Subject: Re: dovecot quota-warning detection mail
>>
>> Aha. Then it's not a straightforward case of just adding the domain 
>> name to the same username, you need to transform the username too.
>> Dovecot's userdb / authdb allows you to return a "user" field, which 
>> sets a new username for dovecot to use.
>> Depending on what you use as your authentication backend, you may be 
>> able to do the transformation at that layer.
>>
>> https://doc.dovecot.org/configuration_manual/authentication/user_extra
>> _field
>> /
>>
>> On 10/29/20 12:06 PM, 森川 孝司 wrote:
>>> Gedalya-san
>>>
>>> You are currently logged in without a domain name.
>>>
>>> Currently, "abc-xyz-unyo-sekkei" users have been converted to 
>>> "abc-xyz-u...@example.co.jp".
>>> (There is no "sekkei" in the address.)
>>>
>>> Or just add "@example.co.jp"?
>>> When it comes to "abc-xyz-unyo-sek...@example.co.jp"
>>> I can't send a mail.
>>>
>>> Thank you.
>>>
>>> morikawa
>



Re: dovecot quota-warning detection mail

2020-10-29 Thread Gedalya
Perhaps if you share some information about your passdb / userdb authentication 
setup, I or others might be able to help further.


On 10/29/20 12:51 PM, 森川 孝司 wrote:
> Gedalya-san
>
> Thank you for the information.
>
> It seems to be difficult...
>
> morikawa
> -Original Message-
> From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Gedalya
> Sent: Thursday, October 29, 2020 1:17 PM
> To: dovecot@dovecot.org
> Subject: Re: dovecot quota-warning detection mail
>
> Aha. Then it's not a straightforward case of just adding the domain name to
> the same username, you need to transform the username too.
> Dovecot's userdb / authdb allows you to return a "user" field, which sets a
> new username for dovecot to use.
> Depending on what you use as your authentication backend, you may be able to
> do the transformation at that layer.
>
> https://doc.dovecot.org/configuration_manual/authentication/user_extra_field
> /
>
> On 10/29/20 12:06 PM, 森川 孝司 wrote:
>> Gedalya-san
>>
>> You are currently logged in without a domain name.
>>
>> Currently, "abc-xyz-unyo-sekkei" users have been converted to 
>> "abc-xyz-u...@example.co.jp".
>> (There is no "sekkei" in the address.)
>>
>> Or just add "@example.co.jp"?
>> When it comes to "abc-xyz-unyo-sek...@example.co.jp"
>> I can't send a mail.
>>
>> Thank you.
>>
>> morikawa




Re: dovecot quota-warning detection mail

2020-10-29 Thread Gedalya
Aha. Then it's not a straightforward case of just adding the domain name to the 
same username, you need to transform the username too.
Dovecot's userdb / authdb allows you to return a "user" field, which sets a new 
username for dovecot to use.
Depending on what you use as your authentication backend, you may be able to do 
the transformation at that layer.

https://doc.dovecot.org/configuration_manual/authentication/user_extra_field/

On 10/29/20 12:06 PM, 森川 孝司 wrote:
> Gedalya-san
>
> You are currently logged in without a domain name.
>
> Currently, "abc-xyz-unyo-sekkei" users have been converted to
> "abc-xyz-u...@example.co.jp".
> (There is no "sekkei" in the address.)
>
> Or just add "@example.co.jp"?
> When it comes to "abc-xyz-unyo-sek...@example.co.jp"
> I can't send a mail.
>
> Thank you.
>
> morikawa



Re: dovecot quota-warning detection mail

2020-10-28 Thread Gedalya
It should only affect users who authenticate with a username only, without a 
domain.
The only effect is to add the domain name to the username.
You could perhaps test, by logging in as just "user" and then as 
"u...@example.co.jp" and make sure everything behaves the same.
If everything behaves the same, then setting auth_default_realm should not do 
any harm.
In other words, the question is: does any functionality actually depend on 
having a username without a domain.

On 10/29/20 8:18 AM, 森川 孝司 wrote:
> Gedalya-san
>
> I have a question.
> Currently, there are thousands of users. (In multi-domain)
> The setting of "auth_default_realm = example.co.jp" is
> Is it possible to set without affecting the current user?
>
> Thank you.



RE: dovecot quota-warning detection mail

2020-10-28 Thread 森川 孝司
OK. "passdb/userdb" Setting part

$ dovecot -n (Excerpt from change)

-
passdb {
  args = scheme=CRYPT username_format=%u /etc/dovecot/users.auth
  driver = passwd-file
}

userdb {
  args = username_format=%u /etc/dovecot/users.auth
  driver = passwd-file
}
protocol lmtp {
  info_log_path = /var/log/lmtplog
  mail_plugins = " quota quota sieve"
  userdb {
args = username_format=%u /etc/dovecot/users
driver = passwd-file
name =
  }
}

-

cat /etc/dovecot/users.auth (Excerpt from change)

-
root:*/root::
:{CRAM-MD5}b09a26aedaddd0e66901eb4bc146b81930aac8be0dac96d1c83bb652fd4f7
451/var/home/xxx/::
-ccc-ddd:{CRAM-MD5}b09a15aedaddd0e55901eb4bc146b81930aac8be0dac96d1c83bb
652fd4f7451/home/vhosts/ddd/-ccc-ddd::
-fff-ggg:{CRAM-MD5}f4c336c68f063d1bbc2a1e32ae32bc9c978d0d2565eae42b4485d
50370d157cd/home/vhosts/ggg/-fff-ggg::
-iii-jjj:{CRAM-MD5}78b337b326d57d564454d8019ed22b5d5cd181437aff77988e2c3
a12ec2d8490/home/vhosts/jjj/-iii-jjj::
  :
  :

-

cat /etc/dovecot/users (Excerpt from change)

-
root:/root::
:/var/home/xxx/::
-...@ddd.example.com:/home/vhosts/ddd/-ccc-ddd::
-...@ggg.example.net:/home/vhosts/ggg/-fff-ggg::
-...@jjj.example.co.jp:/home/vhosts/jjj/-iii-jjj::
  :
  :

-

-Original Message-
From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Gedalya
Sent: Thursday, October 29, 2020 2:27 PM
To: dovecot@dovecot.org
Subject: Re: dovecot quota-warning detection mail

Perhaps if you share some information about your passdb / userdb
authentication setup, I or others might be able to help further.


On 10/29/20 12:51 PM, 森川 孝司 wrote:
> Gedalya-san
>
> Thank you for the information.
>
> It seems to be difficult...
>
> morikawa
> -Original Message-
> From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of 
> Gedalya
> Sent: Thursday, October 29, 2020 1:17 PM
> To: dovecot@dovecot.org
> Subject: Re: dovecot quota-warning detection mail
>
> Aha. Then it's not a straightforward case of just adding the domain 
> name to the same username, you need to transform the username too.
> Dovecot's userdb / authdb allows you to return a "user" field, which 
> sets a new username for dovecot to use.
> Depending on what you use as your authentication backend, you may be 
> able to do the transformation at that layer.
>
> https://doc.dovecot.org/configuration_manual/authentication/user_extra
> _field
> /
>
> On 10/29/20 12:06 PM, 森川 孝司 wrote:
>> Gedalya-san
>>
>> You are currently logged in without a domain name.
>>
>> Currently, "abc-xyz-unyo-sekkei" users have been converted to 
>> "abc-xyz-u...@example.co.jp".
>> (There is no "sekkei" in the address.)
>>
>> Or just add "@example.co.jp"?
>> When it comes to "abc-xyz-unyo-sek...@example.co.jp"
>> I can't send a mail.
>>
>> Thank you.
>>
>> morikawa




RE: dovecot quota-warning detection mail

2020-10-28 Thread 森川 孝司
Gedalya-san

Thank you for the information.

It seems to be difficult...

morikawa
-Original Message-
From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Gedalya
Sent: Thursday, October 29, 2020 1:17 PM
To: dovecot@dovecot.org
Subject: Re: dovecot quota-warning detection mail

Aha. Then it's not a straightforward case of just adding the domain name to
the same username, you need to transform the username too.
Dovecot's userdb / authdb allows you to return a "user" field, which sets a
new username for dovecot to use.
Depending on what you use as your authentication backend, you may be able to
do the transformation at that layer.

https://doc.dovecot.org/configuration_manual/authentication/user_extra_field
/

On 10/29/20 12:06 PM, 森川 孝司 wrote:
> Gedalya-san
>
> You are currently logged in without a domain name.
>
> Currently, "abc-xyz-unyo-sekkei" users have been converted to 
> "abc-xyz-u...@example.co.jp".
> (There is no "sekkei" in the address.)
>
> Or just add "@example.co.jp"?
> When it comes to "abc-xyz-unyo-sek...@example.co.jp"
> I can't send a mail.
>
> Thank you.
>
> morikawa



RE: dovecot quota-warning detection mail

2020-10-28 Thread 森川 孝司
Gedalya-san

You are currently logged in without a domain name.

Currently, "abc-xyz-unyo-sekkei" users have been converted to
"abc-xyz-u...@example.co.jp".
(There is no "sekkei" in the address.)

Or just add "@example.co.jp"?
When it comes to "abc-xyz-unyo-sek...@example.co.jp"
I can't send a mail.

Thank you.

morikawa
-Original Message-
From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Gedalya
Sent: Thursday, October 29, 2020 11:55 AM
To: dovecot@dovecot.org
Subject: Re: dovecot quota-warning detection mail

It should only affect users who authenticate with a username only, without a
domain.
The only effect is to add the domain name to the username.
You could perhaps test, by logging in as just "user" and then as
"u...@example.co.jp" and make sure everything behaves the same.
If everything behaves the same, then setting auth_default_realm should not
do any harm.
In other words, the question is: does any functionality actually depend on
having a username without a domain.

On 10/29/20 8:18 AM, 森川 孝司 wrote:
> Gedalya-san
>
> I have a question.
> Currently, there are thousands of users. (In multi-domain) The setting 
> of "auth_default_realm = example.co.jp" is Is it possible to set 
> without affecting the current user?
>
> Thank you.



RE: dovecot quota-warning detection mail

2020-10-28 Thread 森川 孝司
Gedalya-san

I have a question.
Currently, there are thousands of users. (In multi-domain)
The setting of "auth_default_realm = example.co.jp" is
Is it possible to set without affecting the current user?

Thank you.
-Original Message-
From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of 森川 孝司
Sent: Wednesday, October 28, 2020 4:16 PM
To: 'Gedalya' ; dovecot@dovecot.org
Subject: RE: dovecot quota-warning detection mail

Hi Gedalya-san

I would like to set "auth_default_realm = example.co.jp".

I'm just replacing from older server to new server, Older servers also had
this problem.

So, we decided to proceed with server replacement in this state.
As another task, we will start and set up this issue.

Therefore, it takes time to set and confirm.
If we can confirm it, we will report it again.

Thank you.




Re: dovecot quota-warning detection mail

2020-10-28 Thread Gedalya
On 10/28/20 12:19 PM, 森川 孝司 wrote:
> "
> "Recipient address rejected: User unknown in local recipient table"

If abc-xyz-unyo-sekkei is supposed to be abc-xyz-unyo-sek...@example.co.jp then 
you could try to set in dovecot configuration:

auth_default_realm = example.co.jp

Then %u will contain the domain part too.

Otherwise, you could try to configure postfix to qualify unqualified addresses 
with the appropriate domain.

Finally, you could just prohibit users from authenticating with an unqualified 
username (without a domain).




RE: dovecot quota-warning detection mail

2020-10-28 Thread Koga Hayashi
Morikawa-san,

Okey, then your conf should be right.

Did you try the conf below which was noticed by Gedalya?

auth_default_realm = example.co.jp

Kouga

-Original Message-
From: 森川 孝司  
Sent: Wednesday, October 28, 2020 4:28 PM
To: 林 宏河 ; dovecot@dovecot.org
Subject: RE: dovecot quota-warning detection mail

kouga-san

After copying and pasting, something went wrong.
Actually "quota_warning = storage=95%% quota-warning 95 %u"
It is set in.
(In fact, I usually receive a notification email.)

Thank you.
-Original Message-
From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Koga Hayashi
Sent: Wednesday, October 28, 2020 1:58 PM
To: 森川 孝司 ; dovecot@dovecot.org
Subject: RE: dovecot quota-warning detection mail

Morikawa-san,

Your conf is wrong.

Should be:
   quota_warning = storage = 95 %% quota-warning 95 %u Your conf:
  quota_warning = storage = 95 %% quota-warning 95% u

There's a space between % and u.

First of all, try the above and let us know if it changes.

Kouga



RE: dovecot quota-warning detection mail

2020-10-28 Thread 森川 孝司
kouga-san

After copying and pasting, something went wrong.
Actually "quota_warning = storage=95%% quota-warning 95 %u"
It is set in.
(In fact, I usually receive a notification email.)

Thank you.
-Original Message-
From: dovecot [mailto:dovecot-boun...@dovecot.org] On Behalf Of Koga Hayashi
Sent: Wednesday, October 28, 2020 1:58 PM
To: 森川 孝司 ; dovecot@dovecot.org
Subject: RE: dovecot quota-warning detection mail

Morikawa-san,

Your conf is wrong.

Should be:
   quota_warning = storage = 95 %% quota-warning 95 %u Your conf:
   quota_warning = storage = 95 %% quota-warning 95% u

There's a space between % and u.

First of all, try the above and let us know if it changes.

Kouga



RE: dovecot quota-warning detection mail

2020-10-28 Thread 森川 孝司
Hi Gedalya-san

I would like to set "auth_default_realm = example.co.jp".

I'm just replacing from older server to new server,
Older servers also had this problem.

So, we decided to proceed with server replacement in this state.
As another task, we will start and set up this issue.

Therefore, it takes time to set and confirm.
If we can confirm it, we will report it again.

Thank you.




RE: dovecot quota-warning detection mail

2020-10-27 Thread Koga Hayashi
Morikawa,

What do you mean by "logged-in user"?

%u stands for the username.
If, for an example, user "morikawa" exists in your dovecot server (I mean as 
local user), your quota warning configuration should be fine.
But if user "morikawa" does not exist in your server, and, dovecot can't 
resolve the username to the mail address, then the quota warning mail be 
rejected because dovecot can't find the "username" in local recipient table.

A little more information about your server environment will be appreciated.

Kouga
-Original Message-
From: dovecot  On Behalf Of 森川 孝司
Sent: Wednesday, October 28, 2020 10:17 AM
To: dovecot@dovecot.org
Subject: dovecot quota-warning detection mail

Hi, all.
we use quota-warning emails to notify you of quotas.

In rare cases, the email address has changed to the logged-in user.
(Because the address of %u is passed as the logged-in user.)

So I couldn’t send the email with “Recipient address rejected: User unknown in 
local recipient table”.

Why does my email address change to a logged-in user?
%u of "quota_warning = storage = 95 %% quota-warning 95% u"
The output is the logged-in user.

By Morikawa



RE: dovecot quota-warning detection mail

2020-10-27 Thread Koga Hayashi
Morikawa-san,

Your conf is wrong.

Should be:
   quota_warning = storage = 95 %% quota-warning 95 %u
Your conf:
   quota_warning = storage = 95 %% quota-warning 95% u

There's a space between % and u.

First of all, try the above and let us know if it changes.

Kouga

-Original Message-
From: 森川 孝司  
Sent: Wednesday, October 28, 2020 1:20 PM
To: 林 宏河 ; dovecot@dovecot.org
Subject: RE: dovecot quota-warning detection mail

Hi,Kouga-san

When quota-warning works normally
I'm sending an email to "From:  to = 
"

When it doesn't work
An email was sent to "From:  to = 
"
"Recipient address rejected: User unknown in local recipient table"

It will be.

cat /etc/dovecot/conf.d/90-quota.conf
--  plugin {
   quota_warning = storage = 95 %% quota-warning 95% u
   quota_warning1 = storage = 90 %% quota-warning 90% u
   quota_warning2 = storage = 85 %% quota-warning 85% u
   quota_warning3 = storage = 80 %% quota-warning 80% u }

service quota-warning {
   executable = script /usr/local/bin/quota-warning.pl
   user = dovecot
   unix_listener quota-warning {
 user = vmail
   }
}
-- -

And it is set.

Thank you.

-Original Message-
From: Koga Hayashi [mailto:haya...@progdence.co.jp]
Sent: Wednesday, October 28, 2020 12:50 PM
To: 森川 孝司 ; dovecot@dovecot.org
Subject: RE: dovecot quota-warning detection mail

Morikawa,

What do you mean by "logged-in user"?

%u stands for the username.
If, for an example, user "morikawa" exists in your dovecot server (I mean as 
local user), your quota warning configuration should be fine.
But if user "morikawa" does not exist in your server, and, dovecot can't 
resolve the username to the mail address, then the quota warning mail be 
rejected because dovecot can't find the "username" in local recipient table.

A little more information about your server environment will be appreciated.

Kouga
-Original Message-
From: dovecot  On Behalf Of 森川 孝司
Sent: Wednesday, October 28, 2020 10:17 AM
To: dovecot@dovecot.org
Subject: dovecot quota-warning detection mail

Hi, all.
we use quota-warning emails to notify you of quotas.

In rare cases, the email address has changed to the logged-in user.
(Because the address of %u is passed as the logged-in user.)

So I couldn’t send the email with “Recipient address rejected: User unknown in 
local recipient table”.

Why does my email address change to a logged-in user?
%u of "quota_warning = storage = 95 %% quota-warning 95% u"
The output is the logged-in user.

By Morikawa



RE: dovecot quota-warning detection mail

2020-10-27 Thread 森川 孝司
Hi,Kouga-san

When quota-warning works normally
I'm sending an email to "From:  to =
"

When it doesn't work
An email was sent to "From:  to =
"
"Recipient address rejected: User unknown in local recipient table"

It will be.

cat /etc/dovecot/conf.d/90-quota.conf
-- 
plugin {
   quota_warning = storage = 95 %% quota-warning 95% u
   quota_warning1 = storage = 90 %% quota-warning 90% u
   quota_warning2 = storage = 85 %% quota-warning 85% u
   quota_warning3 = storage = 80 %% quota-warning 80% u
}

service quota-warning {
   executable = script /usr/local/bin/quota-warning.pl
   user = dovecot
   unix_listener quota-warning {
 user = vmail
   }
}
-- -

And it is set.

Thank you.

-Original Message-
From: Koga Hayashi [mailto:haya...@progdence.co.jp]
Sent: Wednesday, October 28, 2020 12:50 PM
To: 森川 孝司 ; dovecot@dovecot.org
Subject: RE: dovecot quota-warning detection mail

Morikawa,

What do you mean by "logged-in user"?

%u stands for the username.
If, for an example, user "morikawa" exists in your dovecot server (I mean as
local user), your quota warning configuration should be fine.
But if user "morikawa" does not exist in your server, and, dovecot can't
resolve the username to the mail address, then the quota warning mail be
rejected because dovecot can't find the "username" in local recipient table.

A little more information about your server environment will be appreciated.

Kouga
-Original Message-
From: dovecot  On Behalf Of 森川 孝司
Sent: Wednesday, October 28, 2020 10:17 AM
To: dovecot@dovecot.org
Subject: dovecot quota-warning detection mail

Hi, all.
we use quota-warning emails to notify you of quotas.

In rare cases, the email address has changed to the logged-in user.
(Because the address of %u is passed as the logged-in user.)

So I couldn’t send the email with “Recipient address rejected: User
unknown in local recipient table”.

Why does my email address change to a logged-in user?
%u of "quota_warning = storage = 95 %% quota-warning 95% u"
The output is the logged-in user.

By Morikawa



Re: Dovecot, quota, warning, and issue with setup?

2019-06-16 Thread @lbutlr via dovecot
On 16 Jun2019, at 13:42, David Mehler via dovecot  wrote:
>  quota = maildir:User quota

This was covered a few days ago.

On 13 Jun2019, at 17:22, Ranbir via dovecot  wrote:
> I switched to "quota = count:User quota" (as Aki suggested) and now the
> errors are gone. Thanks to the both of you!

HTH


-- 
'An appointment is an engagement to see someone, while a morningstar is
a large lump of metal used for viciously crushing skulls. It is
important not to confuse the two.’




Re: Dovecot quota and Postfix smtpd_recipient_restrictions?

2019-03-23 Thread Yassine Chaouche via dovecot

On 3/21/19 10:17 PM, Davide Marchi via dovecot wrote:



I've a doubt (again): Is it correct the the space between 
"[..]service" and "inet[..]"? As suggested here: 
https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html


I've run:

postconf smtpd_recipient_restrictions=check_policy_service 
inet:mailstore.example.com:12340


but obtain the error:

postconf: fatal: missing '=' after attribute name: 
"inet:mailstore.example.com:12340"


Please, which is the correct syntax? :-)


Thanks again!

Davide


Davide,

I think this is the shell that is giving three arguments to postconf 
instead of just one (beacuse of the space). In order to disable this, 
you might want to try to put the whole argument between quotes. You also 
forgot to give the command the -e switch in order to edit the main.cf 
file. Try :


postconf -e smtpd_recipient_restrictions="check_policy_service 
inet:mailstore.example.com:12340"


Yassine.



Re: Dovecot quota and Postfix smtpd_recipient_restrictions?

2019-03-21 Thread Davide Marchi via dovecot

Well,

so the right syntax (in my case) would be:

-o smtpd_recipient_restrictions = 
reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject,check_policy_service

inet:mailstore.example.com:12340

right??
I configured it before the "permit_sasl_authenticated" and the "reject" 
statement.




I've a doubt (again): Is it correct the the space between "[..]service" 
and "inet[..]"? As suggested here: 
https://blog.sys4.de/postfix-dovecot-mailbox-quota-en.html


I've run:

postconf smtpd_recipient_restrictions=check_policy_service 
inet:mailstore.example.com:12340


but obtain the error:

postconf: fatal: missing '=' after attribute name: 
"inet:mailstore.example.com:12340"


Please, which is the correct syntax? :-)


Thanks again!

Davide



Re: Dovecot quota and Postfix smtpd_recipient_restrictions?

2019-03-21 Thread Davide Marchi via dovecot

From: Urban Loesch 
Hi,


Well,

so the right syntax (in my case) would be:

-o smtpd_recipient_restrictions = 
reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject,check_policy_service

inet:mailstore.example.com:12340

right??
I configured it before the "permit_sasl_authenticated" and the "reject" 
statement.




And eventually, should you suggest me how made some functional 
verification test?
According to: http://www.postfix.org/SMTPD_POLICY_README.html try on 
your postfix:


telnet mailstore.example.com 12340

and insert the following lines:

sender=somesen...@somedomain.com
recipient=y...@recipient.com
size=12345
[empty line]


Set a size= in bytes which is greater that your configured quota.
In theory the policy service should respond with your configured error 
message "552 5.2.2 Mailbox is full".


Example on my server:

...
sender=postmas...@somedomain.com
recipient=m...@recipient.com
size=12345000

action=552 5.2.2 Mailbox is full
...


For a livetest reduce the quota of your testaccount to ex. 100KB and 
the send a mail > 100BK from outside to it. You should see the "552" 
error
message in your logs and you should get back a bouncemail from the 
sending server.


Hope I explained it correct.

Best
Urban



WAW! Very very clear your example!

Thanks again Urban, you are a friend ;-)

I will try...


Thanks again to all!


Davide





--
cosmogoniA
n o p r o v a r e n o f a r e o n o n f a r e n o n c e p r o v a r e



Re: Dovecot quota and Postfix smtpd_recipient_restrictions?

2019-03-20 Thread Urban Loesch via dovecot

Hi,



Well,

so the right syntax (in my case) would be:

-o smtpd_recipient_restrictions = reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject,check_policy_service 
inet:mailstore.example.com:12340


right?  :-)


I configured it before the "permit_sasl_authenticated" and the "reject" 
statement.




And eventually, should you suggest me how made some functional verification 
test?


According to: http://www.postfix.org/SMTPD_POLICY_README.html try on your 
postfix:

telnet mailstore.example.com 12340

and insert the following lines:

sender=somesen...@somedomain.com
recipient=y...@recipient.com
size=12345
[empty line]


Set a size= in bytes which is greater that your configured quota.
In theory the policy service should respond with your configured error message "552 
5.2.2 Mailbox is full".

Example on my server:

...
sender=postmas...@somedomain.com
recipient=m...@recipient.com
size=12345000

action=552 5.2.2 Mailbox is full
...


For a livetest reduce the quota of your testaccount to ex. 100KB and the send a mail > 100BK from outside to it. You should see the "552" error 
message in your logs and you should get back a bouncemail from the sending server.


Hope I explained it correct.

Best
Urban


Re: Dovecot quota and Postfix smtpd_recipient_restrictions?

2019-03-20 Thread Davide Marchi via dovecot

From: Urban Loesch

Hi,

I would like to enable (the same) quota (count) for all 
(virtual)users,

on Debian Stretch, Postfix 3.1.8, Dovecot 2.2.27,
and is not clear for me if I need to tell Postfix to communicate with 
the service in /etc/postfix/main.cf as here:



smtpd_recipient_restrictions =
 ...
 check_policy_service inet:mailstore.example.com:12340

I configured it like your example above and it works for me.

Best
Urban


Well,

so the right syntax (in my case) would be:

-o smtpd_recipient_restrictions = 
reject_non_fqdn_recipient,reject_unknown_recipient_domain,permit_sasl_authenticated,reject,check_policy_service 
inet:mailstore.example.com:12340


right?  :-)


And eventually, should you suggest me how made some functional 
verification test?



Many many many thanks Urban!! ;-)


Davide




Re: Dovecot quota and Postfix smtpd_recipient_restrictions?

2019-03-20 Thread Yassine Chaouche via dovecot

On 3/19/19 6:00 PM, Davide Marchi via dovecot wrote:

[...] is not clear for me if I need to tell Postfix to communicate 
with the service in /etc/postfix/main.cf as here:



smtpd_recipient_restrictions =
    ...
    check_policy_service inet:mailstore.example.com:12340

Davide


Hey Davide,

You don't *have* to, but you can. Now whether you should or shouldn't is 
up to you. The downside of enabling this is that if John is over quota, 
then if you try to send a mail to three recipients John, Mary and 
Socrates postfix will refuse to relay mail for any of them, even if only 
John is over quota. This has confused my users who couldn't understand 
why things were like this, but apparently this is how postfix is 
designed to work ? (or is it a protocol limitation ?)


I don't know if other people here can testify of this or have they found 
a way to circumvent this ? (or more likely is it simply a bad 
configuration on my part ^:^' ?)


Yassine.




Re: Dovecot quota and Postfix smtpd_recipient_restrictions?

2019-03-20 Thread Urban Loesch via dovecot

Hi,


I would like to enable (the same) quota (count) for all (virtual)users,
on Debian Stretch, Postfix 3.1.8, Dovecot 2.2.27,
and is not clear for me if I need to tell Postfix to communicate with the 
service in /etc/postfix/main.cf as here:


smtpd_recipient_restrictions =
     ...
     check_policy_service inet:mailstore.example.com:12340


I configured it like your example above and it works for me.

Best
Urban


Re: [dovecot quota-status] error "Invalid character in path"

2018-10-30 Thread Stephan Bosch

Hi,


Op 18/10/2018 om 23:59 schreef k675...@keit.eu:

Hello,

I'm using using:
- dovecot 2.3.3 (dcead646b)
- postfix 3.3.1
- dovecot "quota = maildir:User quota"

I'm facing the error:

"quota-status: Error: quota-status: Client sent
invalid recipient address: Invalid character in path"

This occurred with this e-mail address:
"John Smith"@keit.eu


That is weird. I just tested that the SMTP path parser in Dovecot 
correctly handles the address as you present it above. But I wonder what 
Postfix actually sends. Unfortunately, the current error message in 
quota-status is rather unhelpful in that regard. You could apply the 
following patch (against master, but v2.3 should be no problem) to get a 
better error message:


diff --git a/src/plugins/quota/quota-status.c 
b/src/plugins/quota/quota-status.c

index c88586d55..fdfd0fc4c 100644
--- a/src/plugins/quota/quota-status.c
+++ b/src/plugins/quota/quota-status.c
@@ -1,6 +1,7 @@
 /* Copyright (c) 2013-2018 Dovecot authors, see the included COPYING 
file */


 #include "lib.h"
+#include "str-sanitize.h"
 #include "ostream.h"
 #include "connection.h"
 #include "restrict-access.h"
@@ -169,8 +170,8 @@ static int client_input_line(struct connection 
*conn, const char *line)

    SMTP_ADDRESS_PARSE_FLAG_BRACKETS_OPTIONAL,
    &client->recipient, &error) < 0) {
    i_error("quota-status: "
-   "Client sent invalid recipient address: %s",
-   error);
+   "Client sent invalid recipient address 
`%s': "

+   "%s", str_sanitize(line + 10, 256), error);
    return 0;
    }
    } else if (str_begins(line, "size=")) {



Well I know it is not a conventional address but it is normally
perfectly authorized.


Yes, Dovecot v2.3 pays special attention to parse these correctly.

When I disable quota check, I can received correctly the incoming
e-mail.

So is there a mean to enable quota check with this kind of e-mail
address ?


Please try the patch.. then I can tell you more.

Regards,

Stephan.


Re: [Dovecot] quota-status not working in distributed environment

2018-07-29 Thread Aki Tuomi



On 27.07.2018 16:26, Tom Sommer wrote:
> On 2013-06-16 21:46, Timo Sirainen wrote:
>> On 14.6.2013, at 9.15, Benoit Panizzon  wrote:
>>
>>> Is there a way to get quota-status to also use the proxy feature to
>>> request
>>> the quota information from the correct machine?
>>
>> Looks like this is a missing feature. I first thought quota-status
>> would go through doveadm protocol, which would make this work via
>> doveadm proxying, but looks like it doesn't. Perhaps it optionally
>> should.
>
> Any news on this? Seems strange to lose this feature when running
> Director.
>
> -- 
> Tom

We'll look into this.

Aki


Re: [Dovecot] quota-status not working in distributed environment

2018-07-27 Thread Tom Sommer

On 2013-06-16 21:46, Timo Sirainen wrote:

On 14.6.2013, at 9.15, Benoit Panizzon  wrote:

Is there a way to get quota-status to also use the proxy feature to 
request

the quota information from the correct machine?


Looks like this is a missing feature. I first thought quota-status
would go through doveadm protocol, which would make this work via
doveadm proxying, but looks like it doesn't. Perhaps it optionally
should.


Any news on this? Seems strange to lose this feature when running 
Director.


--
Tom


Re: Dovecot quota

2018-03-28 Thread Aki Tuomi
Quota tables are used for quota *tracking*. To specify quota for a user,
you need to use quota_rules. You can returns these from userdb, as
quota_rule=, quota_rule2=... etc. as documented in
https://wiki.dovecot.org/Quota/Configuration

Aki

On 28.03.2018 07:57, David Mehler wrote:
> Hello,
>
> I'm running Dovecot on a FreeBSD system with Postfix in a virtual user
> setup, with Mysql. I am trying to understand the quota configuration.
>
> I've got a Mysql database with an accounts table with a quota field.
> I've also got two other tables one quota (currently has nothing in it
> an empty set), and quota2 messages and bytes which has one entry. My
> goal is to have different quotas for each user so say one user has a
> 512MB quota I put 512 in the accounts quota column, while another user
> might have 256MB, put 256 in the accounts quota column. These are just
> examples. I'm assuming messages in the quota2 table track how many
> messages are under that user's is it inbox or all folders in the
> account? And bytes is that the space being taken up again by inbox or
> by all messages in the account?
>
> I'm also trying to have a separate quota for my public folders, which
> is not working.
>
> If anyone could take a look at this configuration see if it looks good
> and maybe where public is not happening i'd appreciate it.
>
> Thanks.
> Dave.
>
> Configuration:
> mysql> describe accounts;
> +--+--+--+-+-++
> | Field| Type | Null | Key | Default | Extra  
> |
> +--+--+--+-+-++
> | id   | int(10) unsigned | NO   | PRI | NULL| auto_increment 
> |
> | name | varchar(255) | NO   | | NULL|
> |
> | username | varchar(64)  | NO   | MUL | NULL|
> |
> | domain   | varchar(255) | NO   | MUL | NULL|
> |
> | password | varchar(255) | NO   | | NULL|
> |
> | quota| int(10) unsigned | YES  | | 0   |
> |
> | enabled  | tinyint(1)   | YES  | | 0   |
> |
> | sendonly | tinyint(1)   | YES  | | 0   |
> |
> | last_login   | int(11)  | YES  | | NULL|
> |
> | last_login_ip| varchar(16)  | YES  | | NULL|
> |
> | last_login_date  | datetime | YES  | | NULL|
> |
> | last_login_proto | varchar(16)  | YES  | | NULL|
> |
> +--+--+--+-+-++
> 12 rows in set (0.00 sec)
>
> mysql> describe quota;
> +--+--+--+-+-+---+
> | Field| Type | Null | Key | Default | Extra |
> +--+--+--+-+-+---+
> | username | varchar(255) | NO   | PRI | NULL|   |
> | path | varchar(100) | NO   | PRI | NULL|   |
> | current  | bigint(20)   | NO   | | 0   |   |
> +--+--+--+-+-+---+
> 3 rows in set (0.00 sec)
>
> mysql> describe quota2;
> +--+--+--+-+-+---+
> | Field| Type | Null | Key | Default | Extra |
> +--+--+--+-+-+---+
> | username | varchar(100) | NO   | PRI | NULL|   |
> | bytes| bigint(20)   | NO   | | 0   |   |
> | messages | int(11)  | NO   | | 0   |   |
> +--+--+--+-+-+---+
> 3 rows in set (0.01 sec)
>
> mysql> select * from quota;
> Empty set (0.00 sec)
>
> mysql> select * from quota2;
> ++---+--+
> | username   | bytes | messages |
> ++---+--+
> | u...@example.com | 171430625 |20591 |
> ++---+--+
> 1 row in set (0.00 sec)
>
> doveconf -n
> # 2.2.35 (b1cb664): /usr/local/etc/dovecot/dovecot.conf
> # Pigeonhole version 0.4.23 (b2e41927)
> # OS: FreeBSD 11.1-RELEASE-p4 amd64
> # Hostname: localhost
> auth_cache_size = 24 M
> auth_cache_ttl = 18 hours
> auth_default_realm = example.com
> auth_mechanisms = plain login
> auth_realms = example.com
> dict {
>   acl = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
>   quota = mysql:/usr/local/etc/dovecot/dovecot-dict-sql.conf.ext
> }
> first_valid_gid = 999
> first_valid_uid = 999
> hostname = mail.example.com
> imap_idle_notify_interval = 10 mins
> last_valid_gid = 999
> last_valid_uid = 999
> lda_mailbox_autocreate = yes
> lda_mailbox_autosubscribe = yes
> lda_original_recipient_header = X-Original-To
> listen = 127.0.0.1 xxx.xxx.xxx.xxx
> log_path = /var/log/dovecot/dovecot.log
> log_timestamp = "%Y-%m-%d %H:%M:%S "
> mail_access_gro

Re: dovecot quota service for postfix

2015-10-03 Thread Michael Peter
Hello,

Thanks for the clarifications

plugin {
  quota = maildir:User quota
  quota_rule = *:storage=1G
  quota_grace = 10%%
  # 10% is the default
  quota_status_success = DUNNO
  quota_status_nouser = DUNNO
  quota_status_overquota = "552 5.2.2 Mailbox is full"
 }

The above configurations is my default for all users. but my mail system
is using mbox format and not maildir so what should i change in the
above configuration to use mbox INSTEAD of maildir ??

Also for the quota paramater, can i use (myquota =  maildir:User quota)
INSTEAD of (quota = maildir:User quota) ?? or it must "QUOTA =" and not
any thing else to work ?

same for quota_rule parameter, should i add (_rule) after quota to work
??? can i add for example qouta_restriction INSTEAD of quota_rules ?? i am
asking this question to better understand how dovecot work..

also last question
when i use the following command to get quota for existing system user
called michael , it gives me an error as follow, so why dovecot is not
able to get the quota for the system users?

doveadm quota get -u michael
doveadm(michael): Fatal: User doesn't exist


Many thanks


>> Incase user is underquota, then the email is returned back to postfix
for
>> processing and delivering email to user mbox, incase user has no
sufficient quota then dovecot will inform postfix to reject email. Please
confirm if what i mentioned above is correct and that i
>> understand
>> correctly how dove-cot policy works with postfix.
> Your understanding is mor or less correct, except that postfix never
passes the email itself to dovecot when performing the quota check. It
simply sends a message to the quota policy service asking if the
recipient is over quota. If the recipient is over quota, dovecot
provides postfix with the response configured in quota_status_overquota.
If the recipient is under quota, dovecot provides postfix with the
response configured in quota_status_success. If dovecot does not know the
user, it provides postfix with the response configured in
> quota_status_nouser.
>> Kindly check my configuration below and advise the missing parts to
add...
> I don't see anything wrong with your configuration on first appraisal,
but if it isn't working I would recommend you perform the following
troubleshooting steps.
> 1. Verify the user's mailbox is over or under quota in alignment with
your expectations
>  - `doveadm quota -u $RECIPIENT`
> 2. Test that the quota service provides the response you expect it to
>  - `echo "recipient=$RECIPIENT" | nc -q1 localhost 12340`
> On 09/26/2015 01:40 AM, Michael Peter wrote:
>> Hello,
>> I am trying to use dovecot quota service for postfix in order set quota
for some users.
>> i configure postfix policy service to ask dovecot if user quota is
sufficient to accept the email or not.
>> (dovecot in this case acts only as policy server to postfix as it only
ACCEPT/REJECT email according to user quota, but it is not used to deliver
>> email , because postfix will deliver the email to user mailbox) Incase
user is underquota, then the email is returned back to postfix for
>> processing and delivering email to user mbox, incase user has no
sufficient quota then dovecot will inform postfix to reject email. Please
confirm if what i mentioned above is correct and that i
>> understand
>> correctly how dove-cot policy works with postfix.
>> Kindly check my configuration below and advise the missing parts to
add...
>> plugin {
>>  quota_rule = *:storage=1G
>>  quota_grace = 10%%
>>  # 10% is the default
>>  quota_status_success = DUNNO
>>  quota_status_nouser = DUNNO
>>  quota_status_overquota = "552 5.2.2 Mailbox is full"
>>  ...
>> }
>> The above configurations is for all users which is not override by
quota
>> rules in  userdb's extra fields in my password file below.
>> Is the above configuration missing some thing ? i am using mbox format
for
>> emails storage. do you i have to add (quota= SOMETHING) before
>> (quote_rule
>> =  *:storage=1G) and what to do add to make dovecot support mbox quota?
smtpd_recipient_restrictions =
>>  check_policy_service inet:SERVER-HIDDEN-FOR-SECRUITY.com:12340
>> service quota-status {
>>  executable = quota-status -p postfix
>>  inet_listener {
>>  port = 12340
>>  }
>>  client_limit = 1
>> }
>> now in order to configure dovecot specific quota for user named (user1)
i
>> use passwd-file as follow
>> user1:{plain}pass3:1002:1002::/home/user1::userdb_mail=mbox:~/mymail:INBOX=/var/mail/user1
userdb_quota_rule=*:bytes=300M
>> All other users except users1 should have 1GB storage according to this
configuration. which user1 will only have 300MB
>> Please advise what is my configuration is missing and if i need to add
any
>> thing to run without issues.
>> Many thanks
>> Michael Peter


Re: dovecot quota service for postfix

2015-09-29 Thread James Lott

Incase user is underquota, then the email is returned back to postfix for
processing and delivering email to user mbox, incase user has no
sufficient quota then dovecot will inform postfix to reject email.

Please confirm if what i mentioned above is correct and that i understand
correctly how dove-cot policy works with postfix.


Your understanding is mor or less correct, except that postfix never
passes the email itself to dovecot when performing the quota check. It
simply sends a message to the quota policy service asking if the
recipient is over quota. If the recipient is over quota, dovecot
provides postfix with the response configured in quota_status_overquota.
If the recipient is under quota, dovecot provides postfix with the
response configured in quota_status_success. If dovecot does not know
the user, it provides postfix with the response configured in
quota_status_nouser.


Kindly check my configuration below and advise the missing parts to add...


I don't see anything wrong with your configuration on first appraisal,
but if it isn't working I would recommend you perform the following
troubleshooting steps.

1. Verify the user's mailbox is over or under quota in alignment with
your expectations
- `doveadm quota -u $RECIPIENT`
2. Test that the quota service provides the response you expect it to
- `echo "recipient=$RECIPIENT" | nc -q1 localhost 12340`


On 09/26/2015 01:40 AM, Michael Peter wrote:

Hello,

I am trying to use dovecot quota service for postfix in order set quota
for some users.

i configure postfix policy service to ask dovecot if user quota is
sufficient to accept the email or not.

(dovecot in this case acts only as policy server to postfix as it only
ACCEPT/REJECT email according to user quota, but it is not used to deliver
email , because postfix will deliver the email to user mailbox)

Incase user is underquota, then the email is returned back to postfix for
processing and delivering email to user mbox, incase user has no
sufficient quota then dovecot will inform postfix to reject email.

Please confirm if what i mentioned above is correct and that i understand
correctly how dove-cot policy works with postfix.


Kindly check my configuration below and advise the missing parts to add...





plugin {
 quota_rule = *:storage=1G
 quota_grace = 10%%
 # 10% is the default
 quota_status_success = DUNNO
 quota_status_nouser = DUNNO
 quota_status_overquota = "552 5.2.2 Mailbox is full"
 ...
}

The above configurations is for all users which is not override by  quota
rules in  userdb's extra fields in my password file below.

Is the above configuration missing some thing ? i am using mbox format for
emails storage. do you i have to add (quota= SOMETHING) before (quote_rule
=  *:storage=1G) and what to do add to make dovecot support mbox quota?

smtpd_recipient_restrictions =
 check_policy_service inet:SERVER-HIDDEN-FOR-SECRUITY.com:12340


service quota-status {
 executable = quota-status -p postfix
 inet_listener {
 port = 12340
 }
 client_limit = 1
}

now in order to configure dovecot specific quota for user named (user1) i
use passwd-file as follow

user1:{plain}pass3:1002:1002::/home/user1::userdb_mail=mbox:~/mymail:INBOX=/var/mail/user1
userdb_quota_rule=*:bytes=300M

All other users except users1 should have 1GB storage according to this
configuration. which user1 will only have 300MB

Please advise what is my configuration is missing and if i need to add any
thing to run without issues.

Many thanks

Michael Peter


Re: [Dovecot] quota using wrong limits in user shared mailboxes

2014-10-03 Thread Nick Edwards
We were supposed to get an update to fix this (and other bugs) over a
month or more ago if I remember right, but developer seems to be on
extended hiatus

On 10/3/14, Bartłomiej Nogaś  wrote:
> Hi,
>
> I confirm this bug with LDAP userdb. The temporary workaround is to set
> quota ignore rule for Shared namespace or specific shared folder. This is
> obviously not secure workaround.
>
> Example:
> for a shared namespace:
>
> namespace
> (
>   
>   prefix = Shared Folders/%%u/
>   ...
> }
>
> you have to set
> quota_rule4 = Shared Folders/*:ignore
> or
> quota_rule4 = Shared Folders/username/*:ignore
>
> -
> Bartlomiej Nogas
>


Re: [Dovecot] quota using wrong limits in user shared mailboxes

2014-10-03 Thread Bartłomiej Nogaś
Hi,

I confirm this bug with LDAP userdb. The temporary workaround is to set
quota ignore rule for Shared namespace or specific shared folder. This is
obviously not secure workaround.

Example:
for a shared namespace:

namespace
(
  
  prefix = Shared Folders/%%u/
  ...
}

you have to set
quota_rule4 = Shared Folders/*:ignore
or
quota_rule4 = Shared Folders/username/*:ignore

-
Bartlomiej Nogas


Re: [Dovecot] Quota-Status issue

2014-02-27 Thread Cyberonic Turbo
Thanks for the help. For some reason I couldn't find the dovecot log
before, but there it was staring me in the face, haha.

Here's the error I was getting:
Feb 27 14:55:06 auth-worker(30525): Error: sql(t...@example.com): User
query failed: Unknown column 'mailbox.enablequota-status' in 'where
clause'

Feb 27 14:55:06 quota-status: Error: user t...@example.com: Auth USER
lookup failed

Looks like it was missing a column in the table. Was able to fix it by
adding:
ALTER TABLE vmail.umailbox ADD `enablequota-status` tinyint(1) DEFAULT 1
AFTER `enablelib-storage`;

Now it works as expected!
 printf "recipient=t...@example.com\nsize=12304\n\n" | nc 127.0.0.1
12340
action=552 5.2.2 Mailbox is full

Once again, thanks for the help. Everything is working smoothly now.


On Mon, Feb 24, 2014 at 5:56 PM, Charles Sprickman  wrote:

> On Feb 20, 2014, at 5:12 PM, Cyberonic Turbo wrote:
>
> > Following this guide:
> > http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/ I can't
> > seem to get it to work, as soon as I add the smtpd_recipient_restrictions
> > setting to postfix I can no longer send mail at all. I get the message
> SMTP
> > Error (450): Failed to add recipient "postmas...@example.com" (4.7.1 :
> > Recipient address rejected: Internal error occurred. Refer to server log
> > for more information.). I googled around and found this command to test
> the
> > quota-status service: printf "recipient=postmaster at
> > example.com\nsize=1234\n\n"
> > | nc 127.0.0.1 12340
> > It seems to always return the quota_status_nouser message. I'm really
> > stumped here. What logs do I need to check for errors and does anyone
> have
> > any experience with this?
>
> I'm not an expert, I just followed the same guide a few days ago
> while preparing to front an old vpopmail system with postfix.  It
> did work for me.
>
> Before moving on to enabling the check in postfix, verify that the
> dovecot side is working.
>
> Your example test should work, I did the same here:
>
> [root@util-b /usr/local/etc/postfix]# printf 
> "recipient=c...@test.bway.net\nsize=12304\n\n"
> | nc mbox.i 25001
> action=DUNNO
>
> [root@util-b /usr/local/etc/postfix]# printf 
> "recipient=c...@test.bway.net\nsize=1234\n\n"
> | nc mbox.i
> 25001 action=552 5.2.2 Mailbox is full
>
> If that fails for you, examine the dovecot log.  In my case, I did
> have to provide the full path to the "quota-status" binary and
> dovecot complained about not being able to find it.  Make sure you
> actually have quota-status installed.  Full dovecot snippet for this
> below:
>
> # report quota to postfix
> # see http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/
>
> plugin {
> quota_status_success = DUNNO
> quota_status_nouser = DUNNO
> quota_status_overquota = "552 5.2.2 Mailbox is full"
> }
>
> service quota-status {
> executable = /usr/local/libexec/dovecot/quota-status -p postfix
> inet_listener {
> address = 10.x.x.19  # In my case I want it listening on a
> particular IP
> port = 25001
> }
> client_limit = 5
> }
>
> If the dovecot portion is working, then move on to your postfix logs...
>
> Charles
>
> >
> > I'm running Dovect 2.2.10 with Postfix 2.6.6
> >
> > Here's my dovecot -n result:
> >
> > # 2.2.10: /etc/dovecot/dovecot.conf
> > # OS: Linux 2.6.32-431.5.1.el6.x86_64 x86_64 CentOS release 6.5 (Final)
> > auth_master_user_separator = *
> > auth_mechanisms = PLAIN LOGIN
> > dict {
> >  acl = mysql:/etc/dovecot/dovecot-share-folder.conf
> >  quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
> > }
> > first_valid_uid = 2000
> > last_valid_uid = 2000
> > listen = *
> > log_path = /var/log/dovecot.log
> > mail_gid = 2000
> > mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/
> > mail_plugins = quota
> > mail_uid = 2000
> > managesieve_notify_capability = mailto
> > managesieve_sieve_capability = fileinto reject envelope encoded-character
> > vacation subaddress comparator-i;ascii-numeric relational regex
> imap4flags
> > copy include variables body enotify environment mailbox date ihave
> > namespace {
> >  inbox = yes
> >  location =
> >  prefix =
> >  separator = /
> >  type = private
> > }
> > namespace {
> >  list = children
> >  location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
> >  prefix = Shared/%%u/
> >  separator = /
> >  subscriptions = yes
> >  type = shared
> > }
> > passdb {
> >  args = /etc/dovecot/dovecot-mysql.conf
> >  driver = sql
> > }
> > passdb {
> >  args = /etc/dovecot/dovecot-master-users-password
> >  driver = passwd-file
> >  master = yes
> > }
> > plugin {
> >  acl = vfile
> >  acl_shared_dict = proxy::acl
> >  auth_socket_path = /var/run/dovecot/auth-master
> >  autocreate = INBOX
> >  autocreate2 = Sent
> >  autocreate3 = Trash
> >  autocreate4 = Drafts
> >  autocreate5 = Junk
> >  autosubscribe = INBOX
> >  autosubscribe2 = Sent
> >  autosubscribe3 = Trash
> >  autosubscribe4 = Drafts
> >  autosubscribe5 = Junk
> >  quota = dict:

Re: [Dovecot] Quota-Status issue

2014-02-24 Thread Charles Sprickman
On Feb 20, 2014, at 5:12 PM, Cyberonic Turbo wrote:

> Following this guide:
> http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/ I can't
> seem to get it to work, as soon as I add the smtpd_recipient_restrictions
> setting to postfix I can no longer send mail at all. I get the message SMTP
> Error (450): Failed to add recipient "postmas...@example.com" (4.7.1 :
> Recipient address rejected: Internal error occurred. Refer to server log
> for more information.). I googled around and found this command to test the
> quota-status service: printf "recipient=postmaster at
> example.com\nsize=1234\n\n"
> | nc 127.0.0.1 12340
> It seems to always return the quota_status_nouser message. I'm really
> stumped here. What logs do I need to check for errors and does anyone have
> any experience with this?

I'm not an expert, I just followed the same guide a few days ago
while preparing to front an old vpopmail system with postfix.  It
did work for me.

Before moving on to enabling the check in postfix, verify that the
dovecot side is working.

Your example test should work, I did the same here:

[root@util-b /usr/local/etc/postfix]# printf 
"recipient=c...@test.bway.net\nsize=12304\n\n" | nc mbox.i 25001
action=DUNNO

[root@util-b /usr/local/etc/postfix]# printf 
"recipient=c...@test.bway.net\nsize=1234\n\n" | nc mbox.i
25001 action=552 5.2.2 Mailbox is full

If that fails for you, examine the dovecot log.  In my case, I did
have to provide the full path to the "quota-status" binary and
dovecot complained about not being able to find it.  Make sure you
actually have quota-status installed.  Full dovecot snippet for this
below:

# report quota to postfix
# see http://sys4.de/en/blog/2013/04/08/postfix-dovecot-mailbox-quota/

plugin {
quota_status_success = DUNNO
quota_status_nouser = DUNNO
quota_status_overquota = "552 5.2.2 Mailbox is full"
}

service quota-status {
executable = /usr/local/libexec/dovecot/quota-status -p postfix
inet_listener {
address = 10.x.x.19  # In my case I want it listening on a particular IP
port = 25001
}
client_limit = 5
}

If the dovecot portion is working, then move on to your postfix logs…

Charles

> 
> I'm running Dovect 2.2.10 with Postfix 2.6.6
> 
> Here's my dovecot -n result:
> 
> # 2.2.10: /etc/dovecot/dovecot.conf
> # OS: Linux 2.6.32-431.5.1.el6.x86_64 x86_64 CentOS release 6.5 (Final)
> auth_master_user_separator = *
> auth_mechanisms = PLAIN LOGIN
> dict {
>  acl = mysql:/etc/dovecot/dovecot-share-folder.conf
>  quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
> }
> first_valid_uid = 2000
> last_valid_uid = 2000
> listen = *
> log_path = /var/log/dovecot.log
> mail_gid = 2000
> mail_location = maildir:/%Lh/Maildir/:INDEX=/%Lh/Maildir/
> mail_plugins = quota
> mail_uid = 2000
> managesieve_notify_capability = mailto
> managesieve_sieve_capability = fileinto reject envelope encoded-character
> vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
> copy include variables body enotify environment mailbox date ihave
> namespace {
>  inbox = yes
>  location =
>  prefix =
>  separator = /
>  type = private
> }
> namespace {
>  list = children
>  location = maildir:/%%Lh/Maildir/:INDEX=/%%Lh/Maildir/Shared/%%u
>  prefix = Shared/%%u/
>  separator = /
>  subscriptions = yes
>  type = shared
> }
> passdb {
>  args = /etc/dovecot/dovecot-mysql.conf
>  driver = sql
> }
> passdb {
>  args = /etc/dovecot/dovecot-master-users-password
>  driver = passwd-file
>  master = yes
> }
> plugin {
>  acl = vfile
>  acl_shared_dict = proxy::acl
>  auth_socket_path = /var/run/dovecot/auth-master
>  autocreate = INBOX
>  autocreate2 = Sent
>  autocreate3 = Trash
>  autocreate4 = Drafts
>  autocreate5 = Junk
>  autosubscribe = INBOX
>  autosubscribe2 = Sent
>  autosubscribe3 = Trash
>  autosubscribe4 = Drafts
>  autosubscribe5 = Junk
>  quota = dict:user::proxy::quotadict
>  quota_grace = 10%%
>  quota_rule = *:storage=1G
>  quota_status_nouser = DUNNO
>  quota_status_overquota = 552 5.2.2 Mailbox is full
>  quota_status_success = DUNNO
>  quota_warning = storage=85%% quota-warning 85 %u
>  quota_warning2 = storage=90%% quota-warning 90 %u
>  quota_warning3 = storage=95%% quota-warning 95 %u
>  sieve = /%Lh/sieve/dovecot.sieve
>  sieve_dir = /%Lh/sieve
>  sieve_global_dir = /var/vmail/sieve
>  sieve_global_path = /var/vmail/sieve/dovecot.sieve
> }
> protocols = pop3 imap sieve
> service auth {
>  unix_listener /var/spool/postfix/dovecot-auth {
>group = postfix
>mode = 0666
>user = postfix
>  }
>  unix_listener auth-master {
>group = vmail
>mode = 0666
>user = vmail
>  }
>  unix_listener auth-userdb {
>group = vmail
>mode = 0660
>user = vmail
>  }
> }
> service dict {
>  unix_listener dict {
>group = vmail
>mode = 0660
>user = vmail
>  }
> }
> service imap-login {
>  process_limit = 500
>  service_count = 1
> }
> service pop3-login {
>  service_count = 1
> }
> service

Re: [Dovecot] quota warning by script fails

2013-11-24 Thread Jimmy Koerting
Wow, ok, I finally solved this on my own. I just wanted to let anyone know,
if one encounters a similar situation:

The point was as simple as bad: The script called a command that just hang
in my environment :/

With the fixed script, everything is fine ;)

kind regards,
jimmy



Hello!
>
> I looked around all online resources I found, but I'm not able to find my
> failure. So any help would be welcome!
>
> The problem arises with an dovecot 2.2.6 on a 9.2 FreeBSD RELEASE in a
> jailed environment. I have the following config settings regarding quota
> (which works in general, but just without calling the script):
>
> /etc/dovecot/conf.d/90-quota.conf:
> ...
> plugin {
>   quota_warning = storage=95%% quota-warning 95 %u
>   quota_warning2 = storage=80%% quota-warning 80 %u
> }
>
> service quota-warning {
>   executable = script /usr/sbin/quota-warning.sh
>   unix_listener quota-warning {
> mode = 0666
>   }
> }
> ...
>
>
> script:
> -rwxrwxrwx  1 root  wheel  580 23 Nov 17:14 /usr/sbin/quota-warning.sh*
>
>
> socket:
> [root@testfbsd ~]# ll /var/run/dovecot/quota-warning
> srw-rw-rw-  1 root  wheel  0 23 Nov 17:06 /var/run/dovecot/quota-warning=
>
>
>
> Calling the 'quota-warning.sh' script from the console works:
>
> Nov 23 17:00:42 testfbsd dovecot: lda(ad...@testfbsd.x.net):
> msgid=: saved mail to INBOX
>
>
> But when I force dovecot to call it with sending to much mails to the
> server, the following log comes up (which show, that dovecot at least wants
> to call the script :"Debug: quota: Executing warning: quota-warning 95
> admin@testfbnet" in my understanding): (no further errors or
> messages about non existing sockets or wrong perms etc. comes up)
>
>
> ==> /var/log/maillog <==
> Nov 23 18:19:15 testfbsd sm-mta[75486]: STARTTLS=server, relay=
> mail-wi0-f196.google.com [209.85.212.196], version=TLSv1/SSLv3,
> verify=NOT, cipher=RC4-SHA, bits=128/128
> Nov 23 18:19:15 testfbsd sm-mta[75486]: rANHJEOP075486: from=<
> jtx...@gmail.com>, size=288072, class=0, nrcpts=1,
> msgid=,
> proto=ESMTP, daemon=MTA, relay=mail-wi0-f196.google.com [209.85.212.196]
>
> ==> /var/log/debug.log <==
> Nov 23 18:19:17 testfbsd dovecot: lda: Debug: Loading modules from
> directory: /usr/iports/lib/dovecot
> Nov 23 18:19:17 testfbsd dovecot: lda: Debug: Module loaded:
> /usr/iports/lib/dovecot/lib10_quota_plugin.so
> Nov 23 18:19:17 testfbsd dovecot: auth: Debug: master in: USER  1
> admin@testfbnet service=lda
> Nov 23 18:19:17 testfbsd dovecot: auth: Debug:
> passwd-file(admin@testfbnet): lookup:
> user=admin@testfbnet file=/etc/mail/mailuser
> Nov 23 18:19:17 testfbsd dovecot: auth: Debug: userdb out: USER 1
> admin@testfbnet uid=1000gid=1000
>  home=/home/admin@testfbnet  quota_rule=*:storage=2M
> Nov 23 18:19:17 testfbsd dovecot: lda: Debug: auth input:
> admin@testfbnet uid=1000 gid=1000
> home=/home/admin@testfbnet quota_rule=*:storage=2M
> Nov 23 18:19:17 testfbsd dovecot: lda: Debug: Added userdb setting:
> plugin/quota_rule=*:storage=2M
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Effective uid=1000, gid=1000, home=/home/admin@testfbnet
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota root: name=User quota backend=maildir args=
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota rule: root=User quota mailbox=* bytes=2097152 messages=0
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota rule: root=User quota mailbox=Trash bytes=+10485760 messages=0
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota rule: root=User quota mailbox=Deleted Messages bytes=+10485760
> messages=0
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota warning: bytes=1992294 (95%) messages=0 reverse=no
> command=quota-warning 95 admin@testfbnet
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota warning: bytes=1677721 (80%) messages=0 reverse=no
> command=quota-warning 80 admin@testfbnet
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota warning: bytes=1048576 (50%) messages=0 reverse=no
> command=quota-warning 50 admin@testfbnet
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Quota grace: root=User quota bytes=209715 (10%)
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: Namespace inbox: type=private, prefix=, sep=, inbox=yes, hidden=no,
> list=yes, subscriptions=yes
> location=maildir:/home/admin@testfbnet/mail
> Nov 23 18:19:17 testfbsd dovecot: lda(admin@testfbnet):
> Debug: maildir++: root=/home/admin@testfbnet/mail, index=,
> indexpvt=, control=, inbox=/home/admin@testfbnet/mail, al

Re: [Dovecot] Quota question.

2013-09-11 Thread Noel Butler
On Wed, 2013-09-11 at 15:05 -0400, Bruce Markey wrote:

> I think it's something more. Apparently it's not even looking at the 
> database.  Not sure what I didn't do.
> If anyone can point me to a good dovecot / mysql quota how to that would 
> be helpful.
> 
> Thank you
> bruce
> 
> 




signature.asc
Description: This is a digitally signed message part


Re: [Dovecot] Quota question.

2013-09-11 Thread Daniel Parthey
Hi Bruce,

please follow the Dovecot Mailing List guidelines and post your output of

doveconf -n

Also have a look in the List Archives. There has been a similar quota question 
in the last few days.

Regards
Daniel

Re: [Dovecot] Quota question.

2013-09-11 Thread Vijay Rajah
Check if new quota is recognized using 'doveadm quota get -u '

If it does then there is some other issue... It is hard to tell without
knowing how it is setup.

Thanks
VIjay


On Thu, Sep 12, 2013 at 12:35 AM, Bruce Markey  wrote:

> I think it's something more. Apparently it's not even looking at the
> database.  Not sure what I didn't do.
> If anyone can point me to a good dovecot / mysql quota how to that would
> be helpful.
>
>
> Thank you
> bruce
>
>
> --
> Please use PGP, ENCRYPT everything.
> For information about acquiring a secryption.com account, email me.
>
> My public key: 
> https://www.secryption.com/**BruceMarkey.asc
>   or
>https://keyserver.pgp.com
>
>


Re: [Dovecot] Quota question.

2013-09-11 Thread Bruce Markey
I think it's something more. Apparently it's not even looking at the 
database.  Not sure what I didn't do.
If anyone can point me to a good dovecot / mysql quota how to that would 
be helpful.


Thank you
bruce


--
Please use PGP, ENCRYPT everything.
For information about acquiring a secryption.com account, email me.

My public key: https://www.secryption.com/BruceMarkey.asc   or
   https://keyserver.pgp.com



Re: [Dovecot] Quota based on LDAP group

2013-06-24 Thread Pavel Herrmann
Hi

On Tuesday 25 of June 2013 00:13:05 Timo Sirainen wrote:
> On 25.6.2013, at 0.05, Pavel Herrmann  wrote:
> >> Sounds like you need to do two LDAP lookups and merge them. That requires
> >> Dovecot v2.2.
> > 
> > Sure, I am open to upgrading, if it solves the issue.
> > 
> > I would actually need more than 2 requests, as AD supports recursive
> > groups (a group being member of another group), which I do use.
> > 
> > One possible issue is that from what I can see on the wiki does not really
> > work with how groups in LDAP usually work. What I would need is the
> > opposite direction - locate a group that has "member=myUserDn" attribute,
> > look whether it has quota attribute set, if not use the group DN as
> > myUserDn and repeat the search.
> > Granted, AD has a backlink "memberOf" attribute, but I am still left with
> > recursively looking up whether the group has a quota attribute, and
> > whether it is a member of another group (cyclic membership is not
> > possible AFAIK). Is this possible with Dovecot 2.2?
> 
> http://wiki2.dovecot.org/AuthDatabase/LDAP/Userdb -> "Subqueries and
> pointers" does what you need I think. My head can't really follow LDAP
> stuff well enough to say for sure.

Yeah, I figured that one out. the thing I dont see is how I set this up to work 
recursively (until the quota attribute is found). What I need is something 
similar to postfix "special_result_attribute" and "leaf_result_attribute" 
options (with the exception that I need to select one/closest of the 
attributes found, whereas postfix gets them all)

thanks
Pavel Herrmann


Re: [Dovecot] Quota based on LDAP group

2013-06-24 Thread Timo Sirainen
On 25.6.2013, at 0.05, Pavel Herrmann  wrote:

>> Sounds like you need to do two LDAP lookups and merge them. That requires
>> Dovecot v2.2.
> 
> Sure, I am open to upgrading, if it solves the issue.
> 
> I would actually need more than 2 requests, as AD supports recursive groups 
> (a 
> group being member of another group), which I do use.
> 
> One possible issue is that from what I can see on the wiki does not really 
> work with how groups in LDAP usually work. What I would need is the opposite 
> direction - locate a group that has "member=myUserDn" attribute, look whether 
> it has quota attribute set, if not use the group DN as myUserDn and repeat 
> the 
> search.
> Granted, AD has a backlink "memberOf" attribute, but I am still left with 
> recursively looking up whether the group has a quota attribute, and whether 
> it 
> is a member of another group (cyclic membership is not possible AFAIK). Is 
> this possible with Dovecot 2.2?

http://wiki2.dovecot.org/AuthDatabase/LDAP/Userdb -> "Subqueries and pointers" 
does what you need I think. My head can't really follow LDAP stuff well enough 
to say for sure.



Re: [Dovecot] Quota based on LDAP group

2013-06-24 Thread Pavel Herrmann
On Monday 24 of June 2013 23:01:54 Timo Sirainen wrote:
> On 24.6.2013, at 16.35, Pavel Herrmann  wrote:
> > I have a setup where my dovecot (2.0, if that makes a difference)
> > authenticates against an LDAP directory. In my scenario, I have two types
> > of users, lets call them "normal" and "privileged". What I need is for
> > the normal user to have a fixed quota, but for the priviledged to have
> > none. (The users do not exist on the underlying system, so I cant do
> > quota based on FS)
> > 
> > The issue is that my LDAP is actually an AD, and there is a fair amount of
> > new accounts over the time (in other words, I cannot use LDAP attribute
> > for storing quota, because the AD tools don't understand it, and I would
> > have to add it manually for each new account).
> > 
> > The approach I had in mind is using quota based on user group (I do have
> > groups representing both normal and priviledged users), but I cannot find
> > a way to set it up in dovecot.
> > Am I missing something or does dovecot not support LDAP groups as
> > attribute
> > source?
> 
> Sounds like you need to do two LDAP lookups and merge them. That requires
> Dovecot v2.2.

Sure, I am open to upgrading, if it solves the issue.

I would actually need more than 2 requests, as AD supports recursive groups (a 
group being member of another group), which I do use.

One possible issue is that from what I can see on the wiki does not really 
work with how groups in LDAP usually work. What I would need is the opposite 
direction - locate a group that has "member=myUserDn" attribute, look whether 
it has quota attribute set, if not use the group DN as myUserDn and repeat the 
search.
Granted, AD has a backlink "memberOf" attribute, but I am still left with 
recursively looking up whether the group has a quota attribute, and whether it 
is a member of another group (cyclic membership is not possible AFAIK). Is 
this possible with Dovecot 2.2?

thanks
Pavel Herrmann




Re: [Dovecot] Quota based on LDAP group

2013-06-24 Thread Timo Sirainen
On 24.6.2013, at 16.35, Pavel Herrmann  wrote:

> I have a setup where my dovecot (2.0, if that makes a difference) 
> authenticates 
> against an LDAP directory. In my scenario, I have two types of users, lets 
> call them "normal" and "privileged". What I need is for the normal user to 
> have a fixed quota, but for the priviledged to have none. (The users do not 
> exist on the underlying system, so I cant do quota based on FS)
> 
> The issue is that my LDAP is actually an AD, and there is a fair amount of 
> new 
> accounts over the time (in other words, I cannot use LDAP attribute for 
> storing quota, because the AD tools don't understand it, and I would have to 
> add it manually for each new account).
> 
> The approach I had in mind is using quota based on user group (I do have 
> groups representing both normal and priviledged users), but I cannot find a 
> way 
> to set it up in dovecot.
> Am I missing something or does dovecot not support LDAP groups as attribute 
> source?

Sounds like you need to do two LDAP lookups and merge them. That requires 
Dovecot v2.2.



Re: [Dovecot] quota-status not working in distributed environment

2013-06-16 Thread Timo Sirainen
On 14.6.2013, at 9.15, Benoit Panizzon  wrote:

> Is there a way to get quota-status to also use the proxy feature to request 
> the quota information from the correct machine?

Looks like this is a missing feature. I first thought quota-status would go 
through doveadm protocol, which would make this work via doveadm proxying, but 
looks like it doesn't. Perhaps it optionally should.

> Btw, the quota-status just return DUNNO or 'Quota Full'. Is there a similar 
> easy way to check the ammount of quota used? I could then update that 
> information in the database and use it to, for example find abandoned 
> mailboxes.

doveadm quota get command can be used to ask for the user's current quota. You 
can ask the same via TCP protocol as well: 
http://wiki2.dovecot.org/Design/DoveadmProtocol



Re: [Dovecot] quota-status not working in distributed environment

2013-06-14 Thread Ben Morrow
At  8AM +0200 on 14/06/13 you (Benoit Panizzon) wrote:
>
> It's quite simple (compared with sendmail milter). I will directly
> connect to the policy service on the correct machine from wihtin the
> milter. The milter has to do a database query anyway so I get the
> mailbox hostname in the same query. So I can do a IO::Socket::INET
> connect to the right machine which knows the quota of that recipient.
> 
> Btw, the quota-status just return DUNNO or 'Quota Full'. Is there a
> similar easy way to check the ammount of quota used? I could then
> update that information in the database and use it to, for example
> find abandoned mailboxes.

Not as far as I know, but if you're talking to a database anyway why not
get Dovecot to store its quota information in the database directly (see
wiki2/Quota/Dict)? That way you don't need to talk to Dovecot at all.

Ben



Re: [Dovecot] quota-status not working in distributed environment

2013-06-13 Thread Benoit Panizzon
Hi Ben

thank you for your reply.

> The quota-status protocol is just the ordinary Postfix policy delegation
> protocol, documented in Postfix's SMTPD_POLICY_README. I would have
> thought that if you give 'service quota-status' an inet_listener you
> could have the Postfix policy check the quota on several machines over
> the network, though of course the policy protocol has absolutely no
> security so you may not want to do that.

Well security is not such an issue as the mailservers are in a lan where 
access from outside (to prevent direct access to LMTP and other ports) is 
restricted anyway. So yes, they could connect that policy port from each 
other. But doing three connects (or even more if we add more servers) for each 
incomming email could cause scaling issues or performance issues if one server 
becomes laggy for some reason.
I read about the policy protocol. It's quite simple (compared with sendmail 
milter).
I will directly connect to the policy service on the correct machine from 
wihtin the milter. The milter has to do a database query anyway so I get the 
mailbox hostname in the same query. So I can do a IO::Socket::INET connect to 
the right machine which knows the quota of that recipient.

Btw, the quota-status just return DUNNO or 'Quota Full'. Is there a similar 
easy way to check the ammount of quota used? I could then update that 
information in the database and use it to, for example find abandoned 
mailboxes.

Kind regards

Benoit Panizzon
-- 
I m p r o W a r e   A G-
__

Zurlindenstrasse 29 Tel  +41 61 826 93 07
CH-4133 PrattelnFax  +41 61 826 93 02
Schweiz Web  http://www.imp.ch
__


Re: [Dovecot] quota-status not working in distributed environment

2013-06-13 Thread Ben Morrow
At 12PM +0200 on 13/06/13 you (Benoit Panizzon) wrote:
> 
> Or is the postfix policy daemon call to the quota-status socket documented 
> somewhere (it must be, but where?) so we could implement it from within the 
> Milter? (we use the sendmail Milter API from postfix to filter spam and 
> viruses, do sender/recipient rewriting, forward bounce matching, rate 
> limmiting, login/IP statistics to block botnets abusing phished addresses and 
> legal intercept stuff anyway)

The quota-status protocol is just the ordinary Postfix policy delegation
protocol, documented in Postfix's SMTPD_POLICY_README. I would have
thought that if you give 'service quota-status' an inet_listener you
could have the Postfix policy check the quota on several machines over
the network, though of course the policy protocol has absolutely no
security so you may not want to do that.

Ben



Re: [Dovecot] Quota not working with dict proxy

2013-05-16 Thread Chris Richards


On Wed, May 15, 2013 9:15 pm, Daniel Parthey wrote:

> map {
>   pattern = priv/quota/storage  # dictionary for storage bytes
>   table = quota # table where to write storage count
>   username_field = username # username of whom storage should be
> counted
>   value_field = bytes   # number of bytes in user mailbox
> }
>
> map {
>   pattern = priv/quota/messages # dictionary for message count
>   table = quota # table where to write email count
>   username_field = username # username whose emails should be
> counted
>   value_field = messages# number of messages in user mailbox
> }
>
> Regards
> Daniel

I think more correctly, value_field is the name of the field in the db. 
The 'storage' dictionary will always contain bytes,and the 'messages'
dictionary will always store the number of messages into the db field
named by the 'value_field' parameter.

I would guess that if you changed the pattern to 'shared/quota/messages'
then you could set the shared quota as well.



Re: [Dovecot] quota with imapc

2013-05-16 Thread pvsuja


Ok...

Thanks for the response.

Waiting to see it soon

:)



--
View this message in context: 
http://dovecot.2317879.n4.nabble.com/quota-with-imapc-tp42280p42285.html
Sent from the Dovecot mailing list archive at Nabble.com.


Re: [Dovecot] quota with imapc

2013-05-16 Thread Timo Sirainen
On 16.5.2013, at 13.31, pvsuja  wrote:

> I have set up my mail system with a mail gateway connecting to mail server
> using imapc.
> Now I need my web mail client to show up the quota info.
> I enabled quota plugins in dovecot.conf.
> The problem is since all mails reside in the server, the web mail which is
> in mail gateway always shows the quota as 0.
> Is there any way the plugin will get quota info from the mail server?

imapc doesn't support remote IMAP QUOTA extension yet.



Re: [Dovecot] Quota not working with dict proxy

2013-05-15 Thread Daniel Parthey
Chris Richards wrote:
> Is there any documentation that goes into more detail regarding the 'map'
> settings, what they mean, etc., of which you are aware?
> hoping to avoid digging through the code just to satisfy my curiosity.

I couldn't find much in the docs:
http://wiki.dovecot.org/Quota/Dict

So here's some documentation, please correct me if I'm wrong:

map {
  pattern = priv/quota/storage  # dictionary for storage bytes
  table = quota # table where to write storage count
  username_field = username # username of whom storage should be counted
  value_field = bytes   # number of bytes in user mailbox
}

map {
  pattern = priv/quota/messages # dictionary for message count
  table = quota # table where to write email count
  username_field = username # username whose emails should be counted
  value_field = messages# number of messages in user mailbox
}

Regards
Daniel
-- 
https://plus.google.com/103021802792276734820


Re: [Dovecot] Quota not working with dict proxy

2013-05-15 Thread Chris Richards
> Are you using the same SQL table "email" for user lookup
> and quota/storage accounting?
>
> Try to use two different tables for user and quota database, because the
> quota
> accounting might have deleted an entry from the "user" table while it only
> tried to delete a row from the "quota" table.
>
> Regards
> Daniel

Daniel,
Per your suggestion, I created a new table, quote_usage, and changed the
config files to look at it instead.  Things appear to be working now. 
Thank you very much for your guidance.

Is there any documentation that goes into more detail regarding the 'map'
settings, what they mean, etc., of which you are aware?  I was rather
hoping to avoid digging through the code just to satisfy my curiosity.

Thanks again.

Chris



Re: [Dovecot] quota-related crash for doveadm dsync operation

2013-05-15 Thread Timo Sirainen
On 29.4.2013, at 10.43, Emmanuel Dreyfus  wrote:

> I understand the crash below is caused by filesystem quota. I just report
> it because perhaps it could have a more graceful failure.
> 
> 
> Apr 29 09:39:17 danceny dovecot: dsync-local(jdoe): Error: Mailbox Sent: 
> Saving failed: Not enough disk space
> Apr 29 09:39:17 danceny syslogd[165]: last message repeated 4 times
> Apr 29 09:39:17 danceny dovecot: doveadm: Error: dsync-remote(jdoe): Error: 
> Cached message size smaller than expected (35111 < 40830)
> Apr 29 09:39:17 danceny dovecot: doveadm: Error: dsync-remote(jdoe): Error: 
> Corrupted index cache file /mail/indexes/jdoe/.imap/Sent/dovecot.index.cache: 
> Broken physical size for mail UID 976
> Apr 29 09:39:17 danceny dovecot: doveadm: Error: dsync-remote(jdoe): Error: 
> dsync(local): read(/home/pct/jdoe/mail/Sent) failed: Invalid argument
> Apr 29 09:39:17 danceny dovecot: dsync-local(jdoe): Error: 
> dsync(r...@volanges.net.espci.fr): read() failed: Broken pipe
> Apr 29 09:39:17 danceny dovecot: dsync-local(jdoe): Panic: file 
> mail-storage.c: line 1830 (mailbox_transaction_commit_get_changes): assertion 
> failed: (ret < 0 || seq_range_count(&changes_r->saved_uids) == save_count || 
> array_count(&changes_r->saved_uids) == 0)
> Apr 29 09:39:17 danceny dovecot: dsync-local(jdoe): Fatal: master: 
> service(doveadm): child 23443 killed with signal 6 (core not dumped - set 
> service doveadm { drop_priv_before_exec=yes })

Fixed the crash: http://hg.dovecot.org/dovecot-2.2/rev/1d6f42853492

Also fixed a few other mbox issues. But I see that there are still others left 
when running dsync+mbox. I'll try to get them fixed, but mbox isn't very high 
priority format..



Re: [Dovecot] quota and dict

2013-05-15 Thread Timo Sirainen
On 3.5.2013, at 8.04, Jeff Gustafson  wrote:

> Shouldn't I be able to use a dictionary
> proxy to attach any custom program to a quota dict socket?
> 
> plugin {
>  quota = dict:User quota::proxy:/tmp/test-socket
> }

This tells quota plugin to connect to /tmp/test-socket and talk dict protocol 
to it.

>   Neither one create a socket in /tmp.

No, your external program needs to create the socket.



Re: [Dovecot] Quota not working with dict proxy

2013-05-13 Thread Chris Richards
On Mon, May 13, 2013 5:55 pm, Daniel Parthey wrote:
> Are you using the same SQL table "email" for user lookup
> and quota/storage accounting?
>
> Try to use two different tables for user and quota database, because the
> quota
> accounting might have deleted an entry from the "user" table while it only
> tried to delete a row from the "quota" table.
>
> Regards
> Daniel

I am using the same table for both user lookkup and quota accounting. 
I'll try creating another table for the lookup and quota accounting, but I
find it disconcerting that it would be deleting entries from the database
at all when all I asked it to do was recalc the quota.  One wouldn't think
that 'update an entry with the correct information' would equate to
'delete this row and recreate it'.

Chris



Re: [Dovecot] Quota not working with dict proxy

2013-05-13 Thread Daniel Parthey
Chris Richards wrote:
> Attempting to recalc quota on one account using command:
> "doveadm -f tab quota recalc -u user@domain"
> returns with nothing, and when I repeat 'quota get' command, it says:
> doveadm(user@domain): Fatal: User doesn't exist
> 
> Indeed, looking in the database shows the account in question was actually
> DELETED!
> 
> Obviously, I've got something messed here, but I don't know what.
>
> dovecot-dict-sql.conf.ext:
> 
> connect = host=localhost dbname=maildb user=dbuser password=dbpass
> 
> map {
>   pattern = priv/quota/storage
>   table = email
>   username_field = address
>   value_field = quota_bytes
> }
> map {
>   pattern = priv/quota/messages
>   table = email
>   username_field = address
>   value_field = quota_messages
> }

Are you using the same SQL table "email" for user lookup
and quota/storage accounting?

Try to use two different tables for user and quota database, because the quota
accounting might have deleted an entry from the "user" table while it only
tried to delete a row from the "quota" table.

Regards
Daniel
-- 
https://plus.google.com/103021802792276734820


Re: [Dovecot] Quota not working with dict proxy

2013-05-12 Thread Chris Richards


On Sun, May 12, 2013 12:24 pm, Chris Richards wrote:
> Hello all,
> I'm sure this has been covered somewhere before, but my googlefu is not up
> to the challenge.

More info; this is the debug output from the doveadm command:

doveadm -Df tab quota recalc -u 'user@domain'

doveadm(root): Debug: Loading modules from directory: /usr/lib64/dovecot
doveadm(root): Debug: Module loaded: usr/lib64/dovecot/lib10_quota_plugin.so
doveadm(root): Debug: Loading modules from directory:
/usr/lib64/dovecot/doveadm
doveadm(root): Debug: Skipping module doveadm_acl_plugin, because dlopen()
failed: /usr/lib64/dovecot/doveadm/lib10_doveadm_acl_plugin.so: undefined
symbol: acl_user_module (this is usually intentional, so just ignore this
message)
doveadm(root): Debug: Skipping module doveadm_expire_plugin, because
dlopen() failed:
/usr/lib64/dovecot/doveadm/lib10_doveadm_expire_plugin.so: undefined
symbol: expire_set_deinit (this is usually intentional, so just ignore
this message)
doveadm(root): Debug: Module loaded:
/usr/lib64/dovecot/doveadm/lib10_doveadm_quota_plugin.so
doveadm(root): Debug: Skipping module doveadm_zlib_plugin, because
dlopen() failed: /usr/lib64/dovecot/doveadm/lib10_doveadm_zlib_plugin.so:
undefined symbol: i_stream_create_deflate (this is usually intentional, so
just ignore this message)
doveadm(root): Debug: Skipping module doveadm_fts_plugin, because dlopen()
failed: /usr/lib64/dovecot/doveadm/lib20_
doveadm_fts_plugin.so: undefined symbol: fts_backend_rescan (this is
usually intentional, so just ignore this message)
doveadm(user@domain): Debug: auth input: user@domain
home=/home/vmail/domains/domain/user/
mail=maildir:/home/vmail/domains/domain/user/Maildir/ uid=1004 gid=100
quota_rule=*:storage=200M
doveadm(user@domain): Debug: Added userdb setting:
mail=maildir:/home/vmail/domains/domain/user/Maildir/
doveadm(user@domain): Debug: Added userdb setting:
plugin/quota_rule=*:storage=200M
doveadm(user@domain): Debug: Effective uid=1004, gid=100,
home=/home/vmail/domains/domain/user/
doveadm(user@domain): Debug: Quota root: name=User quota backend=dict
args=user@domain:proxy::quota
doveadm(user@domain): Debug: Quota rule: root=User quota mailbox=*
bytes=209715200 messages=0
doveadm(user@domain): Debug: Quota warning: bytes=207618048 (99%)
messages=0 reverse=no command=quota-warning 99 user domain
doveadm(user@domain): Debug: Quota warning: bytes=199229440 (95%)
messages=0 reverse=no command=quota-warning 95 user domain
doveadm(user@domain): Debug: Quota warning: bytes=167772160 (80%)
messages=0 reverse=no command=quota-warning 80 user domain
doveadm(user@domain): Debug: Quota warning: bytes=199229440 (95%)
messages=0 reverse=yes command=quota-warning 'less than 95' user domain
doveadm(user@domain): Debug: dict quota: user=user@domain,
uri=proxy::quota, noenforcing=0
doveadm(user@domain): Debug: Namespace inbox: type=private, prefix=INBOX.,
sep=., inbox=yes, hidden=no, list=yes, subscriptions=yes
location=maildir:/home/vmail/domains/domain/user/Maildir/
doveadm(user@domain): Debug: maildir++:
root=/home/vmail/domains/domain/user/Maildir, index=, control=,
inbox=/home/vmail/domains/domain/user/Maildir, alt=

I don't see anything here that would explain why it is deleting my user
account, but I can tell you with certainty that this command is doing
SOMETHING that is resulting in the deletion of my account.



Re: [Dovecot] Quota Problems with LMTP in HG 62a930eb22b5

2013-02-18 Thread Thomas Leuxner
* Timo Sirainen  2013.02.18 14:18:

> > > ==> /var/log/dovecot/dovecot.log <==
> > > Feb 18 09:47:32 spectre dovecot: lmtp(14340): Connect from local
> > > Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: 
> > > mkdir_parents(/var/vmail/domains/leuxner.net/tlx/mdbox) failed: File 
> > > exists
> > > Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: 
> > > mkdir_parents(/var/vmail/domains/leuxner.net/tlx/mdbox) failed: File 
> > > exists
> > > Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: 
> > > dict quota: Quota update failed, it's now desynced
> 
> Not sure about these. Are they fixed now?
> 
> > Feb 18 13:00:33 spectre dovecot: lmtp(15093): Error: Temp file creation to 
> > /tmp/dovecot.lmtp.�/usr/lib/dovecot/lmtp.15093.
> >  failed: No such file or directory
> 
> This is definitely fixed. I was worried about the environment getting
> cleared when coding it, but it appeared to work and looks like I didn't
> test well enough.

Both seem to be fixed with 2.2.beta1 (3ca7e0eaaf4b). Thanks Timo.


signature.asc
Description: Digital signature


Re: [Dovecot] Quota Problems with LMTP in HG 62a930eb22b5

2013-02-18 Thread Timo Sirainen
On Mon, 2013-02-18 at 13:24 +0100, Thomas Leuxner wrote:
> * Thomas Leuxner  2013.02.18 09:58:
> 
> > Since updating to the latest HG these errors occur. Nothing else changed in 
> > the config:
> > 
> > $ dovecot --version
> > 2.2.beta1 (62a930eb22b5)
> > 
> > ==> /var/log/dovecot/dovecot.log <==
> > Feb 18 09:47:32 spectre dovecot: lmtp(14340): Connect from local
> > Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: 
> > mkdir_parents(/var/vmail/domains/leuxner.net/tlx/mdbox) failed: File exists
> > Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: 
> > mkdir_parents(/var/vmail/domains/leuxner.net/tlx/mdbox) failed: File exists
> > Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: dict 
> > quota: Quota update failed, it's now desynced

Not sure about these. Are they fixed now?

> Feb 18 13:00:33 spectre dovecot: lmtp(15093): Error: Temp file creation to 
> /tmp/dovecot.lmtp.�/usr/lib/dovecot/lmtp.15093.
>  failed: No such file or directory

This is definitely fixed. I was worried about the environment getting
cleared when coding it, but it appeared to work and looks like I didn't
test well enough.




Re: [Dovecot] Quota Problems with LMTP in HG 62a930eb22b5

2013-02-18 Thread Thomas Leuxner
* Thomas Leuxner  2013.02.18 09:58:

> Since updating to the latest HG these errors occur. Nothing else changed in 
> the config:
> 
> $ dovecot --version
> 2.2.beta1 (62a930eb22b5)
> 
> ==> /var/log/dovecot/dovecot.log <==
> Feb 18 09:47:32 spectre dovecot: lmtp(14340): Connect from local
> Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: 
> mkdir_parents(/var/vmail/domains/leuxner.net/tlx/mdbox) failed: File exists
> Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: 
> mkdir_parents(/var/vmail/domains/leuxner.net/tlx/mdbox) failed: File exists
> Feb 18 09:47:32 spectre dovecot: lmtp(14340, t...@leuxner.net): Error: dict 
> quota: Quota update failed, it's now desynced

Seems there's more to the latest changes as a mail that has to be saved 
temporarily also breaks LMTP:

Feb 18 13:00:32 spectre postfix/qmgr[21702]: 3Z8hWT6jxszFV: 
from=, size=460096, nrcpt=1 (queue active)

==> /var/log/dovecot/dovecot.log <==
Feb 18 13:00:32 spectre dovecot: lmtp(15093): Connect from local
Feb 18 13:00:33 spectre dovecot: lmtp(15093): Error: Temp file creation to 
/tmp/dovecot.lmtp.�/usr/lib/dovecot/lmtp.15093.
 failed: No such file or directory
Feb 18 13:00:33 spectre dovecot: lmtp(15093): Disconnect from local: Temporary 
internal failure (in DATA)


signature.asc
Description: Digital signature


Re: [Dovecot] Quota

2012-11-05 Thread Christian Rößner
Hi,

>> If connecting from the policy service, can I use Dovecot master password to 
>> get quota over IMAP?
> 
> Yes, I think a master user login should work as if the user has logged in.
> 
> If you store quota in a database, the policy service could query the database.


thanks a lot for your information. I have written a policy service in python 
for Postfix that can check "over quota" in Dovecot. Using IMAPS and the master 
user to check quota.

If someone is interested, I can send a copy off list.

-Christian Rößner

--
[*] 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: Joerg Heidrich



Re: [Dovecot] Quota

2012-11-04 Thread Daniel Parthey
Christian Rößner wrote:
> > perl: IMAP::Admin->get_quotaroot
> > php:  imap_get_quota
> > ruby: Net::IMAP::MailboxQuota
> 
> python-imaplib in my case ;)
> 
> If connecting from the policy service, can I use Dovecot master password to 
> get quota over IMAP?

Yes, I think a master user login should work as if the user has logged in.

If you store quota in a database, the policy service could query the database.

Regards
Daniel
-- 
https://plus.google.com/103021802792276734820


Re: [Dovecot] Quota

2012-11-04 Thread Timo Sirainen
On 4.11.2012, at 22.34, Christian Rößner wrote:

> is it possible to ask Dovecot for a users quota by talking to the Dovecot 
> server over TCP? I know about doveadm quota -u , but I would like to 
> know, if I can query for that over a network connection (on the Postfix ML 
> they suggested writing a policy service that checks quota. Postfix is not 
> always on the same server as Dovecot is).
> 
> Does the LMTP protocol give that information somehow? I am not so familiar 
> with LMTP. Or some Unix-Socket to query that could also be configured as 
> inet_listener?

You could connect to doveadm-server socket and basically ask the "doveadm 
quota" command via it. There's not much documentation about it though. But I'm 
sure I've mentioned details a couple of times in this mailing list..

I've also had some plans to make a somewhat easier socket for asking this. 
Maybe using doveadm-server process, or maybe a whole new quota-query binary 
that can talk multiple protocols.. It would be pretty easy to do, mainly I just 
haven't been sure what would be the cleanest way to implement this.



Re: [Dovecot] Quota

2012-11-04 Thread Christian Rößner
Hi

> perl: IMAP::Admin->get_quotaroot
> php:  imap_get_quota
> ruby: Net::IMAP::MailboxQuota

python-imaplib in my case ;)

If connecting from the policy service, can I use Dovecot master password to get 
quota over IMAP?

Thanks again

Christian
> 
> Regards
> Daniel
> -- 
> https://plus.google.com/103021802792276734820


Re: [Dovecot] Quota

2012-11-04 Thread Daniel Parthey
Christian Rößner wrote:
> is it possible to ask Dovecot for a users quota by talking to the Dovecot
> server over TCP? I know about doveadm quota -u , but I would like to
> know, if I can query for that over a network connection (on the Postfix ML
> they suggested writing a policy service that checks quota. Postfix is not
> always on the same server as Dovecot is).
> 
> Does the LMTP protocol give that information somehow?
> I am not so familiar with LMTP. Or some Unix-Socket to
> query that could also be configured as inet_listener?

LMTP only returns an error if you're already over quota.

You can query the quota of a specific mailbox
via IMAP using GETQUOTAROOT:
http://tools.ietf.org/rfc/rfc2087.txt

Several script languages provide helper functions for this:

perl: IMAP::Admin->get_quotaroot
php:  imap_get_quota
ruby: Net::IMAP::MailboxQuota

Regards
Daniel
-- 
https://plus.google.com/103021802792276734820


Re: [Dovecot] Quota - usage counting.

2012-10-09 Thread wamp
Hi
> Do you actually have a Guide?
No, I read some docs like http://www.serverubuntu.it/postfix-dovecot-guide


> How did you set up quota form MySql?
> I'm having an issu getting it working.
> Can you share your dovecot.conf and dovecot-sql.conf?
>
> What's the user_query in your dovecot-sql.conf ?

I can't make it working - so need information about general idea how this
values should be compared. Where is info about actual size of maildir.

regards,


>
> Thank you!
>
> - Original Message -
> From: w...@promax.media.pl
> To: dovecot@dovecot.org
> Subject: [Dovecot] Quota - usage counting.
>
> Hello,
>
> I use dovecot 1.2 version with postfix virtual users and mysql. All
> information about quota for every user is in mysql table.
> How dovecot compare if quota in database is over quota in
> /var/vmail/exampleuser directory ?
>
> It uses something like du command ?
>
>
> regards,
> Wamp
>
>
>
>




Re: [Dovecot] Quota - usage counting.

2012-10-09 Thread Tibby
Do you actually have a Guide?
How did you set up quota form MySql?
I'm having an issu getting it working.
Can you share your dovecot.conf and dovecot-sql.conf?

What's the user_query in your dovecot-sql.conf ?

Thank you!

- Original Message -
From: w...@promax.media.pl
To: dovecot@dovecot.org
Subject: [Dovecot] Quota - usage counting.

Hello,

I use dovecot 1.2 version with postfix virtual users and mysql. All
information about quota for every user is in mysql table.
How dovecot compare if quota in database is over quota in
/var/vmail/exampleuser directory ?

It uses something like du command ?


regards,
Wamp





Re: [Dovecot] Quota less mailbox with mdbox

2012-09-11 Thread Timo Sirainen
On 7.9.2012, at 13.43, Héctor Moreno Blanco wrote:

> Currently we have dovecot 2.0.10 with Maildir as mailbox system. We want to 
> migrate to mdbox.
> 
> The migration is simple and easy, but there are some configuration settings 
> we cannot set to work properly.
> 
> In our dovecot with Maildir we have the namespace INBOX with certain quota 
> and another one without quota.

The only difference should be that you need to switch from Maildir++ quota to 
dict quota backend. http://wiki2.dovecot.org/Quota/Dict

Re: [Dovecot] Quota less mailbox with mdbox

2012-09-07 Thread Charles Marcus

On 2012-09-07 6:43 AM, Héctor Moreno Blanco  wrote:

Currently we have dovecot 2.0.10 with Maildir as mailbox system. We want to 
migrate to mdbox.


If you're going to migrate to mdbox, you'd be much better off if you 
upgraded to the latest 2.1.x...


Mdbox is much better supported in the current stable builds.

--

Best regards,

Charles



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-28 Thread Timo Sirainen
On 26.8.2012, at 2.28, Daniel Parthey wrote:

> What would the configuration look like if I want to setup
> one lmtp service with quota enforcing on port 10024 and
> another lmtp service without enforcing on port 20024?
> Especially how to define two "protocol lmtp" sections
> which are assigned to their specific service?

You can't. (Maybe you could create another service lmtp2 {} block and override 
the quota setting with lmtp -o plugin/quota=.. parameter, but I don't know if 
that would work.)

> or will I need to define SQL statements in the userdb
> lookup which selects "noenforcing" depending on local port?

That would work.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-27 Thread Sven Hartge
Angel L. Mateo  wrote:
> El 25/08/12 09:23, Timo Sirainen escribió:
>> On 25.8.2012, at 1.49, Sven Hartge wrote:
>>
 How about just disabling the quota enforcing and doing a nightly run
 of some type of enforcing (sending notification email and/or disabling
 new mail delivery until user has more quota again)?
>>>
>>> As a last resort, yes. If possible, I'd like to keep the feedback about
>>> mailbox size as direct as possible.
>>>
>>> Disabling an account only once per night might be acceptable, but the
>>> reenabling of the account, once a user has freed some space, has to be
>>> instant or I would get constant complains from the users (the ones with
>>> the biggest mailboxes being the professors, which can be quite the pain
>>> to work with, if they believe they don't get what they think they are
>>> entitled to get).

>> You can use quota warning scripts to send warnings and enable account
>> instantly when it goes under 100%.
>>
> But, if you still use quota, you are still counting deleted messages
> in the quota. Aren't you?

Quota would be noenforcing. So the users still sees "105% of quota used"
but this does not result in any mail bouncing at once.

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-26 Thread Angel L. Mateo

El 25/08/12 09:23, Timo Sirainen escribió:

On 25.8.2012, at 1.49, Sven Hartge wrote:


How about just disabling the quota enforcing and doing a nightly run
of some type of enforcing (sending notification email and/or disabling
new mail delivery until user has more quota again)?


As a last resort, yes. If possible, I'd like to keep the feedback about
mailbox size as direct as possible.

Disabling an account only once per night might be acceptable, but the
reenabling of the account, once a user has freed some space, has to be
instant or I would get constant complains from the users (the ones with
the biggest mailboxes being the professors, which can be quite the pain
to work with, if they believe they don't get what they think they are
entitled to get).


You can use quota warning scripts to send warnings and enable account instantly 
when it goes under 100%.

	But, if you still use quota, you are still counting deleted messages in 
the quota. Aren't you?


	Is not easier just making users conscious of deleted messages? Many 
clients that hide deleted messages, show them in a trash folder 
(although they don't use move to trash) so it's easy for user to expunge 
deleted messages. And you could also run a cron to expunge old deleted 
messages from user mailboxes (for example, messages deleted more than 15 
days ago)


--
Angel L. Mateo Martínez
Sección de Telemática
Área de Tecnologías de la Información
y las Comunicaciones Aplicadas (ATICA)
http://www.um.es/atica
Tfo: 868887590
Fax: 86337


Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-25 Thread Daniel Parthey
Sven Hartge wrote:
> I want to use LMTP to deliver the mails.
> Would this nested plugin configuration work to disable quota:
> 
> protocol lmtp {
>   mail_plugins = $mail_plugins sieve
>   plugin {
> quota = dict:Benutzer-Quota::noenforcing:proxy::quota
>   }
> }

Concerning
http://dovecot.org/list/dovecot/2012-June/066298.html

I'm using MySQL userdb, but just want to keep things
as simple as possible (KISS principle).

What would the configuration look like if I want to setup
one lmtp service with quota enforcing on port 10024 and
another lmtp service without enforcing on port 20024?
Especially how to define two "protocol lmtp" sections
which are assigned to their specific service?

Will this work with two simple 'nested configuration'
or will I need to define SQL statements in the userdb
lookup which selects "noenforcing" depending on local port?

Regards
Daniel
-- 
https://plus.google.com/103021802792276734820


Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-25 Thread Sven Hartge
Timo Sirainen  wrote:
> On 25.8.2012, at 18.28, Sven Hartge wrote:

>> But because of performance considerations I want to use LMTP to deliver
>> the mails. Would this nested plugin configuration work:
>> (sorry, not at work, cannot test directly)
>> 
>> protocol lmtp {
>>  mail_plugins = $mail_plugins sieve
>>  plugin {
>>quota = dict:Benutzer-Quota::noenforcing:proxy::quota
>>  }
>> }

> That should work, yes.

Very good, thank you for your fast answers.

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-25 Thread Timo Sirainen
On 25.8.2012, at 18.28, Sven Hartge wrote:

> But because of performance considerations I want to use LMTP to deliver
> the mails. Would this nested plugin configuration work:
> (sorry, not at work, cannot test directly)
> 
> protocol lmtp {
>  mail_plugins = $mail_plugins sieve
>  plugin {
>quota = dict:Benutzer-Quota::noenforcing:proxy::quota
>  }
> }

That should work, yes.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-25 Thread Sven Hartge
Timo Sirainen  wrote:
> On 25.8.2012, at 15.40, Sven Hartge wrote:

>> Warning the user at 95%, 97% and 99% using the warning scripts is
>> easy and was already configured and is working like a charm.
>> 
>> But how do I instantly reenable the account when it drops below 100%
>> with the warning scripts? As far as I understand the documentation,
>> they are only triggered if the quota use rises over the configured
>> thresholds.

> Setting the warning at -100% would do that I think. In any case "-"
> before the percentage means "reverse". Yeah, not in wiki, I'll add it
> there..

Ah, very nice.

Now I need to put the pieces together and test whether this is a working
solution for me.

Question: is it possible to enforce the quota for IMAP/POP and have it
on noenforcing for LDA/LMTP?

LDA would be easy, as I could just add 
 -o "plugin/quota=dict:Benutzer-Quota::noenforcing:proxy::quota"
to the command line of dovecot-ldap in my exim4.conf.

But because of performance considerations I want to use LMTP to deliver
the mails. Would this nested plugin configuration work:
(sorry, not at work, cannot test directly)

protocol lmtp {
  mail_plugins = $mail_plugins sieve
  plugin {
quota = dict:Benutzer-Quota::noenforcing:proxy::quota
  }
}

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-25 Thread Timo Sirainen
On 25.8.2012, at 15.40, Sven Hartge wrote:

> Warning the user at 95%, 97% and 99% using the warning scripts is easy
> and was already configured and is working like a charm.
> 
> But how do I instantly reenable the account when it drops below 100%
> with the warning scripts? As far as I understand the documentation, they
> are only triggered if the quota use rises over the configured
> thresholds.

Setting the warning at -100% would do that I think. In any case "-" before the 
percentage means "reverse". Yeah, not in wiki, I'll add it there..



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-25 Thread Sven Hartge
Timo Sirainen  wrote:
> On 25.8.2012, at 1.49, Sven Hartge wrote:

>>> How about just disabling the quota enforcing and doing a nightly run
>>> of some type of enforcing (sending notification email and/or
>>> disabling new mail delivery until user has more quota again)?
>> 
>> As a last resort, yes. If possible, I'd like to keep the feedback
>> about mailbox size as direct as possible.
>> 
>> Disabling an account only once per night might be acceptable, but the
>> reenabling of the account, once a user has freed some space, has to
>> be instant or I would get constant complains from the users (the ones
>> with the biggest mailboxes being the professors, which can be quite
>> the pain to work with, if they believe they don't get what they think
>> they are entitled to get).

> You can use quota warning scripts to send warnings and enable account
> instantly when it goes under 100%.

Warning the user at 95%, 97% and 99% using the warning scripts is easy
and was already configured and is working like a charm.

Disabling the account in a nightly cronjob will be easy as well. Since I
use the Mysql-dict for quota, I can just query that, compare the value
to the configured quota from LDAP and act accordingly.

But how do I instantly reenable the account when it drops below 100%
with the warning scripts? As far as I understand the documentation, they
are only triggered if the quota use rises over the configured
thresholds.

I seem to somehow miss a piece, but I cannot see which one.

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-25 Thread Timo Sirainen
On 25.8.2012, at 1.49, Sven Hartge wrote:

>> How about just disabling the quota enforcing and doing a nightly run
>> of some type of enforcing (sending notification email and/or disabling
>> new mail delivery until user has more quota again)?
> 
> As a last resort, yes. If possible, I'd like to keep the feedback about
> mailbox size as direct as possible.
> 
> Disabling an account only once per night might be acceptable, but the
> reenabling of the account, once a user has freed some space, has to be
> instant or I would get constant complains from the users (the ones with
> the biggest mailboxes being the professors, which can be quite the pain
> to work with, if they believe they don't get what they think they are
> entitled to get).

You can use quota warning scripts to send warnings and enable account instantly 
when it goes under 100%.

> So far, the description of the delete_to_trash plugin sounds promising,
> because I can already ignore the Trash (or add to the total quota for
> this folder and do a nightly expunge run for it), if only it would
> compile for dovecot 2.1.


I don't like the idea behind deleted_to_trash and won't offer any support for 
it if I don't have to.

Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-24 Thread Sven Hartge
Timo Sirainen  wrote:
> On 24.8.2012, at 16.13, Sven Hartge wrote:

 quota_rule = *:storage=1G:ignoredeleted
 quota_rule2 = Trash:storage=+100M
>> 
>>> This can't be implemented race-condition-free without huge changes to code.
>> 
>> Damn, too bad.

>> I know for sure either my users or my 1st level support team are
>> going to kill me if I don't find a solution.

> How about just disabling the quota enforcing and doing a nightly run
> of some type of enforcing (sending notification email and/or disabling
> new mail delivery until user has more quota again)?

As a last resort, yes. If possible, I'd like to keep the feedback about
mailbox size as direct as possible.

Disabling an account only once per night might be acceptable, but the
reenabling of the account, once a user has freed some space, has to be
instant or I would get constant complains from the users (the ones with
the biggest mailboxes being the professors, which can be quite the pain
to work with, if they believe they don't get what they think they are
entitled to get).

I know, this all sounds a bit "whiny", but  I've been working for over 8
years in this position and the harsh reality made me somewhat cautious.

So far, the description of the delete_to_trash plugin sounds promising,
because I can already ignore the Trash (or add to the total quota for
this folder and do a nightly expunge run for it), if only it would
compile for dovecot 2.1.

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-24 Thread Timo Sirainen
On 24.8.2012, at 16.13, Sven Hartge wrote:

>>> quota_rule = *:storage=1G:ignoredeleted
>>> quota_rule2 = Trash:storage=+100M
> 
>> This can't be implemented race-condition-free without huge changes to code.
> 
> Damn, too bad.
> 
> I know for sure either my users or my 1st level support team are going
> to kill me if I don't find a solution.

How about just disabling the quota enforcing and doing a nightly run of some 
type of enforcing (sending notification email and/or disabling new mail 
delivery until user has more quota again)?



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-24 Thread Sven Hartge
Sven Hartge  wrote:
> Robert Schetterer  wrote:
>> Am 24.08.2012 15:13, schrieb Sven Hartge:

>>> Is is possible to forcibly expunge a message at once, directly after
>>> a client has marked it as deleted? Kind of the opposite of the
>>> lazy_expunge plugin?

>> hm perhaps as workaround

>> http://wiki2.dovecot.org/Plugins/deleted-to-trash
>> and do often
>> http://wiki2.dovecot.org/Plugins/Expire
>> via cron i.e
>> doveadm expunge -A mailbox Trash savedbefore 1h

> I stumbled upon deleted_to_trash 5 minutes ago. This could work, if the
> code still works with dovecot 2.1. 

Nope, does not compile (dovecot-dev headers are installed):

cc\
  -fPIC -shared -Wall \
  -I/usr/include/dovecot \
  -I/usr/include/dovecot/src \
  -I/usr/include/dovecot/src/lib \
  -I/usr/include/dovecot/src/lib-storage \
  -I/usr/include/dovecot/src/lib-mail \
  -I/usr/include/dovecot/src/lib-imap \
  -I/usr/include/dovecot/src/lib-index \
  -DHAVE_CONFIG_H \
  deleted-to-trash-plugin.c -o lib_deleted_to_trash_plugin.so
deleted-to-trash-plugin.c: In function ‘mailbox_open_or_create’:
deleted-to-trash-plugin.c:79: error: ‘MAILBOX_FLAG_KEEP_RECENT’ undeclared 
(first use in this function)
deleted-to-trash-plugin.c:79: error: (Each undeclared identifier is reported 
only once
deleted-to-trash-plugin.c:79: error: for each function it appears in.)
deleted-to-trash-plugin.c: In function ‘copy_deleted_mail_to_trash’:
deleted-to-trash-plugin.c:136: warning: passing argument 1 of 
‘mailbox_keywords_unref’ from incompatible pointer type
/usr/include/dovecot/mail-storage.h:612: note: expected ‘struct mail_keywords 
**’ but argument is of type ‘struct mailbox *’
deleted-to-trash-plugin.c:136: error: too many arguments to function 
‘mailbox_keywords_unref’
make: *** [lib_deleted_to_trash_plugin.so] Error 1

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-24 Thread Sven Hartge
Robert Schetterer  wrote:
> Am 24.08.2012 15:13, schrieb Sven Hartge:
>> Timo Sirainen  wrote:
>>> On 24.8.2012, at 15.02, Sven Hartge wrote:
>> 
 Ignoring the content (or increasing the quota) of the Trash folder is
 easy and no problem, but ignoring deleted messages seems impossible
 without changes to the code.

 So I propose an additional flag for the quota_rule config option to be
 able to enable a more lax interpretation of the quota enforcement:

  quota_rule = *:storage=1G:ignoredeleted
  quota_rule2 = Trash:storage=+100M
 
>>> This can't be implemented race-condition-free without huge changes
>>> to code.
>> 
>> Damn, too bad.
>> 
>> I know for sure either my users or my 1st level support team are
>> going to kill me if I don't find a solution.
>> 
>> Is is possible to forcibly expunge a message at once, directly after
>> a client has marked it as deleted? Kind of the opposite of the
>> lazy_expunge plugin?

> hm perhaps as workaround

> http://wiki2.dovecot.org/Plugins/deleted-to-trash
> and do often
> http://wiki2.dovecot.org/Plugins/Expire
> via cron i.e
> doveadm expunge -A mailbox Trash savedbefore 1h

I stumbled upon deleted_to_trash 5 minutes ago. This could work, if the
code still works with dovecot 2.1. 

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-24 Thread Robert Schetterer
Am 24.08.2012 15:13, schrieb Sven Hartge:
> Timo Sirainen  wrote:
>> On 24.8.2012, at 15.02, Sven Hartge wrote:
> 
>>> Ignoring the content (or increasing the quota) of the Trash folder is
>>> easy and no problem, but ignoring deleted messages seems impossible
>>> without changes to the code.
>> ..
>>> So I propose an additional flag for the quota_rule config option to be
>>> able to enable a more lax interpretation of the quota enforcement:
>>>
>>>  quota_rule = *:storage=1G:ignoredeleted
>>>  quota_rule2 = Trash:storage=+100M
> 
>> This can't be implemented race-condition-free without huge changes to code.
> 
> Damn, too bad.
> 
> I know for sure either my users or my 1st level support team are going
> to kill me if I don't find a solution.
> 
> Is is possible to forcibly expunge a message at once, directly after a
> client has marked it as deleted? Kind of the opposite of the
> lazy_expunge plugin?
> 
> Grüße,
> Sven.
> 

hm perhaps as workaround

http://wiki2.dovecot.org/Plugins/deleted-to-trash
and do often
http://wiki2.dovecot.org/Plugins/Expire
via cron i.e
doveadm expunge -A mailbox Trash savedbefore 1h

-- 
Best Regards
MfG Robert Schetterer


Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-24 Thread Sven Hartge
Timo Sirainen  wrote:
> On 24.8.2012, at 15.02, Sven Hartge wrote:

>> Ignoring the content (or increasing the quota) of the Trash folder is
>> easy and no problem, but ignoring deleted messages seems impossible
>> without changes to the code.
> ..
>> So I propose an additional flag for the quota_rule config option to be
>> able to enable a more lax interpretation of the quota enforcement:
>> 
>>  quota_rule = *:storage=1G:ignoredeleted
>>  quota_rule2 = Trash:storage=+100M

> This can't be implemented race-condition-free without huge changes to code.

Damn, too bad.

I know for sure either my users or my 1st level support team are going
to kill me if I don't find a solution.

Is is possible to forcibly expunge a message at once, directly after a
client has marked it as deleted? Kind of the opposite of the
lazy_expunge plugin?

Grüße,
Sven.

-- 
Sigmentation fault. Core dumped.



Re: [Dovecot] quota: ignore deleted messages (?)

2012-08-24 Thread Timo Sirainen
On 24.8.2012, at 15.02, Sven Hartge wrote:

> Ignoring the content (or increasing the quota) of the Trash folder is
> easy and no problem, but ignoring deleted messages seems impossible
> without changes to the code.
..
> So I propose an additional flag for the quota_rule config option to be
> able to enable a more lax interpretation of the quota enforcement:
> 
>  quota_rule = *:storage=1G:ignoredeleted
>  quota_rule2 = Trash:storage=+100M

This can't be implemented race-condition-free without huge changes to code.



Re: [Dovecot] quota fs: Support for hardlimit quotas (where softquota is unset)

2012-07-17 Thread Timo Sirainen
On Sun, 2012-07-08 at 09:42 +0200, Jan Friesse wrote:
> Hi,
> included is patch which adds support for calculating fs quota from hardlimit 
> where softlimit is unset. I'm usually not setting softlimit on my server 
> causing dovecot work incorrectly (not reporting quota at all).

Committed to v2.2: http://hg.dovecot.org/dovecot-2.2/rev/cdba6fec5ddf

Seems like it could cause behavior to change for existing installations
and maybe cause trouble, so I won't add it to v2.1.




Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Luuk@dovecot
On 12-05-2012 20:42, Reindl Harald wrote:
> 
> Am 12.05.2012 20:35, schrieb Luuk@dovecot:
>> On 12-05-2012 19:48, Gedalya wrote:
>>>
>>> I understand you sent an email to yourself?
>>> If you gained one $message_size upon reception and lost 2*$message_size
>>> upon deletion from Inbox+Sent, I would suspect quota plugin isn't active
>>> when the message is being delivered. How are messages delivered? Dovecot
>>> LDA, LMTP or an external MTA?
>>> You really should use LDA or LMTP to handle quota accounting.
>>
>> Yes, i was sending it to meself...
>> Postfix delivers mail using procmail.
>> Next thing i need to read about mailservers are the LDA/LMTP pages
> 
> this should be one of the first things
> 
> nobody needs procmail/shellscripts to get quota with postfix
> and a MDA with LMPT support wokring these days
> 
> usually the better way implementing services is to draw
> what exactly is needed and read docs how all this things
> can be achived

Everything (besides quota ;) is working as needed

> 
> example from dbmail (dovecot should be the same)
> /etc/postfix/master.cf:
> dbmail-lmtp unix  -   -   n   --  lmtp -o 
> disable_dns_lookups=yes
> 
> set the postfix-transport to "dbmail-lmtp:127.0.0.1:24" for each domain which 
> should
> be delivered to LMTP and you are done, "dbmail-lmtp" is only a name
> 
> 
> 
> 

i have a line like that in my master.cf, i reads:
lmtp  unix  -   -   n   -   -   lmtp

but (apparantly) is not used.

Before starting to use that, i should make sure all received mail keeps
coming in at the right place...


Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Reindl Harald

Am 12.05.2012 20:35, schrieb Luuk@dovecot:
> On 12-05-2012 19:48, Gedalya wrote:
>>
>> I understand you sent an email to yourself?
>> If you gained one $message_size upon reception and lost 2*$message_size
>> upon deletion from Inbox+Sent, I would suspect quota plugin isn't active
>> when the message is being delivered. How are messages delivered? Dovecot
>> LDA, LMTP or an external MTA?
>> You really should use LDA or LMTP to handle quota accounting.
> 
> Yes, i was sending it to meself...
> Postfix delivers mail using procmail.
> Next thing i need to read about mailservers are the LDA/LMTP pages

this should be one of the first things

nobody needs procmail/shellscripts to get quota with postfix
and a MDA with LMPT support wokring these days

usually the better way implementing services is to draw
what exactly is needed and read docs how all this things
can be achived

example from dbmail (dovecot should be the same)
/etc/postfix/master.cf:
dbmail-lmtp unix  -   -   n   --  lmtp -o 
disable_dns_lookups=yes

set the postfix-transport to "dbmail-lmtp:127.0.0.1:24" for each domain which 
should
be delivered to LMTP and you are done, "dbmail-lmtp" is only a name






signature.asc
Description: OpenPGP digital signature


Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Luuk@dovecot
On 12-05-2012 19:48, Gedalya wrote:
> 
> I understand you sent an email to yourself?
> If you gained one $message_size upon reception and lost 2*$message_size
> upon deletion from Inbox+Sent, I would suspect quota plugin isn't active
> when the message is being delivered. How are messages delivered? Dovecot
> LDA, LMTP or an external MTA?
> You really should use LDA or LMTP to handle quota accounting.
> 


Yes, i was sending it to meself...

Postfix delivers mail using procmail.

Next thing i need to read about mailservers are the LDA/LMTP pages


Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Gedalya

On 5/12/2012 1:34 PM, Luuk@dovecot wrote:

On 12-05-2012 18:40, Gedalya wrote:

On 5/12/2012 12:21 PM, Luuk@dovecot wrote:

On 12-05-2012 18:00, Gedalya wrote:

On 5/12/2012 11:42 AM, Luuk@dovecot wrote:

In the log, the following message showed:
2012-05-12 17:11:43 imap(luuk): Error: quota:
net_connect_unix(/var/run/dovecot/quota-warning.sh) failed: No such
file
or directory

I think i have to revert the changes, and retest.;)

Wiki says: quota_warning =  


You define a listening socket in the unix_listener line in the service
definition, and refer to that socket in your quota_warning plugin
configuration.

Duane wasn't saying to delete the path, he said to use the socket name.
So, just quota-warning without the .sh

plugin {
quota_warning = storage=95%% quota-warning 95 %u
quota_warning2 = storage=90%% quota-warning 90 %u
quota_warning3 = storage=10%% quota-warning 10 %u
}

service quota-warning {
executable = script /usr/local/bin/quota-warning.sh
unix_listener quota-warning {
  user = dovecot
}
user = dovecot
}



ok, after this error, i must have seen them all:
2012-05-12 18:08:31 imap(luuk): Error: quota:
net_connect_unix(/var/run/dovecot/quota-warning) failed: Permission
denied (euid=1000(luuk) egid=100(users) missing +r perm:
/var/run/dovecot/quota-warning, dir owned by 0:0 mode=0755)

opensuse:/var/run/dovecot # ls -l /var/run/dovecot/quota-warning
srw--- 1 dovecot root 0 May 12 18:18 /var/run/dovecot/quota-warning
opensuse:/var/run/dovecot #

Changing the permissions using chmod +rw /var/run/dovecot/quota-warning
is reset when dovecot is restarted.


You should probably add mode = 0666 like so:

service quota-warning {
   executable = script /usr/local/bin/quota-warning.sh
   unix_listener quota-warning {
 user = dovecot
 mode = 0666
   }
   user = dovecot
}

Indeed you can't use chmod from the command line because these sockets
are created by dovecot when it starts up.


ok, it seems to work now ;)

but my quota-usage is dropping harder that it should

i started at 71%,
received a file, it went to 74%
deleted the message in Inbox
deleted the message from Sent
and not the quota is at 68%.

Recovery is possible with:
doveadm quota recalc -u


I understand you sent an email to yourself?
If you gained one $message_size upon reception and lost 2*$message_size 
upon deletion from Inbox+Sent, I would suspect quota plugin isn't active 
when the message is being delivered. How are messages delivered? Dovecot 
LDA, LMTP or an external MTA?

You really should use LDA or LMTP to handle quota accounting.



Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Luuk@dovecot
On 12-05-2012 18:40, Gedalya wrote:
> On 5/12/2012 12:21 PM, Luuk@dovecot wrote:
>> On 12-05-2012 18:00, Gedalya wrote:
>>> On 5/12/2012 11:42 AM, Luuk@dovecot wrote:
 In the log, the following message showed:
 2012-05-12 17:11:43 imap(luuk): Error: quota:
 net_connect_unix(/var/run/dovecot/quota-warning.sh) failed: No such
 file
 or directory

 I think i have to revert the changes, and retest.;)
>>> Wiki says: quota_warning =  >> name>  
>>>
>>>
>>> You define a listening socket in the unix_listener line in the service
>>> definition, and refer to that socket in your quota_warning plugin
>>> configuration.
>>>
>>> Duane wasn't saying to delete the path, he said to use the socket name.
>>> So, just quota-warning without the .sh
>>>
>>> plugin {
>>>quota_warning = storage=95%% quota-warning 95 %u
>>>quota_warning2 = storage=90%% quota-warning 90 %u
>>>quota_warning3 = storage=10%% quota-warning 10 %u
>>> }
>>>
>>> service quota-warning {
>>>executable = script /usr/local/bin/quota-warning.sh
>>>unix_listener quota-warning {
>>>  user = dovecot
>>>}
>>>user = dovecot
>>> }
>>>
>>>
>> ok, after this error, i must have seen them all:
>> 2012-05-12 18:08:31 imap(luuk): Error: quota:
>> net_connect_unix(/var/run/dovecot/quota-warning) failed: Permission
>> denied (euid=1000(luuk) egid=100(users) missing +r perm:
>> /var/run/dovecot/quota-warning, dir owned by 0:0 mode=0755)
>>
>> opensuse:/var/run/dovecot # ls -l /var/run/dovecot/quota-warning
>> srw--- 1 dovecot root 0 May 12 18:18 /var/run/dovecot/quota-warning
>> opensuse:/var/run/dovecot #
>>
>> Changing the permissions using chmod +rw /var/run/dovecot/quota-warning
>> is reset when dovecot is restarted.
>>
> 
> You should probably add mode = 0666 like so:
> 
> service quota-warning {
>   executable = script /usr/local/bin/quota-warning.sh
>   unix_listener quota-warning {
> user = dovecot
> mode = 0666
>   }
>   user = dovecot
> }
> 
> Indeed you can't use chmod from the command line because these sockets
> are created by dovecot when it starts up.
> 

ok, it seems to work now ;)

but my quota-usage is dropping harder that it should

i started at 71%,
received a file, it went to 74%
deleted the message in Inbox
deleted the message from Sent
and not the quota is at 68%.

Recovery is possible with:
doveadm quota recalc -u


Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Gedalya

On 5/12/2012 12:21 PM, Luuk@dovecot wrote:

On 12-05-2012 18:00, Gedalya wrote:

On 5/12/2012 11:42 AM, Luuk@dovecot wrote:

In the log, the following message showed:
2012-05-12 17:11:43 imap(luuk): Error: quota:
net_connect_unix(/var/run/dovecot/quota-warning.sh) failed: No such file
or directory

I think i have to revert the changes, and retest.;)

Wiki says: quota_warning =


You define a listening socket in the unix_listener line in the service
definition, and refer to that socket in your quota_warning plugin
configuration.

Duane wasn't saying to delete the path, he said to use the socket name.
So, just quota-warning without the .sh

plugin {
   quota_warning = storage=95%% quota-warning 95 %u
   quota_warning2 = storage=90%% quota-warning 90 %u
   quota_warning3 = storage=10%% quota-warning 10 %u
}

service quota-warning {
   executable = script /usr/local/bin/quota-warning.sh
   unix_listener quota-warning {
 user = dovecot
   }
   user = dovecot
}



ok, after this error, i must have seen them all:
2012-05-12 18:08:31 imap(luuk): Error: quota:
net_connect_unix(/var/run/dovecot/quota-warning) failed: Permission
denied (euid=1000(luuk) egid=100(users) missing +r perm:
/var/run/dovecot/quota-warning, dir owned by 0:0 mode=0755)

opensuse:/var/run/dovecot # ls -l /var/run/dovecot/quota-warning
srw--- 1 dovecot root 0 May 12 18:18 /var/run/dovecot/quota-warning
opensuse:/var/run/dovecot #

Changing the permissions using chmod +rw /var/run/dovecot/quota-warning
is reset when dovecot is restarted.



You should probably add mode = 0666 like so:

service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
user = dovecot
mode = 0666
  }
  user = dovecot
}

Indeed you can't use chmod from the command line because these sockets 
are created by dovecot when it starts up.




Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Luuk@dovecot
On 12-05-2012 18:00, Gedalya wrote:
> On 5/12/2012 11:42 AM, Luuk@dovecot wrote:
>> In the log, the following message showed:
>> 2012-05-12 17:11:43 imap(luuk): Error: quota:
>> net_connect_unix(/var/run/dovecot/quota-warning.sh) failed: No such file
>> or directory
>>
>> I think i have to revert the changes, and retest.;)
> 
> Wiki says: quota_warning =   name> 
> 
> 
> You define a listening socket in the unix_listener line in the service
> definition, and refer to that socket in your quota_warning plugin
> configuration.
> 
> Duane wasn't saying to delete the path, he said to use the socket name.
> So, just quota-warning without the .sh
> 
> plugin {
>   quota_warning = storage=95%% quota-warning 95 %u
>   quota_warning2 = storage=90%% quota-warning 90 %u
>   quota_warning3 = storage=10%% quota-warning 10 %u
> }
> 
> service quota-warning {
>   executable = script /usr/local/bin/quota-warning.sh
>   unix_listener quota-warning {
> user = dovecot
>   }
>   user = dovecot
> }
> 
> 

ok, after this error, i must have seen them all:
2012-05-12 18:08:31 imap(luuk): Error: quota:
net_connect_unix(/var/run/dovecot/quota-warning) failed: Permission
denied (euid=1000(luuk) egid=100(users) missing +r perm:
/var/run/dovecot/quota-warning, dir owned by 0:0 mode=0755)

opensuse:/var/run/dovecot # ls -l /var/run/dovecot/quota-warning
srw--- 1 dovecot root 0 May 12 18:18 /var/run/dovecot/quota-warning
opensuse:/var/run/dovecot #

Changing the permissions using chmod +rw /var/run/dovecot/quota-warning
is reset when dovecot is restarted.



Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Luuk@dovecot
On 12-05-2012 18:02, Gedalya wrote:
> On 5/12/2012 11:59 AM, Luuk@dovecot wrote:
>> 2012-05-12 17:50:22 imap(luuk): Error: quota:
>> net_connect_unix(/usr/local/bin/quota-warning.sh) failed: Permission
>> denied (euid=1000(luuk) egid=100(users) missing +w perm:
>> /usr/local/bin/quota-warning.sh, dir owned by 0:0 mode=0755)
> 
> This is net_connect_unix(), it's trying to write to a socket. But it
> ended up with a path to a script, not a socket.
> 

i just read you other post, and re-test ;)


Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Gedalya

On 5/12/2012 11:59 AM, Luuk@dovecot wrote:

2012-05-12 17:50:22 imap(luuk): Error: quota:
net_connect_unix(/usr/local/bin/quota-warning.sh) failed: Permission
denied (euid=1000(luuk) egid=100(users) missing +w perm:
/usr/local/bin/quota-warning.sh, dir owned by 0:0 mode=0755)


This is net_connect_unix(), it's trying to write to a socket. But it 
ended up with a path to a script, not a socket.




Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Gedalya

On 5/12/2012 11:42 AM, Luuk@dovecot wrote:

In the log, the following message showed:
2012-05-12 17:11:43 imap(luuk): Error: quota:
net_connect_unix(/var/run/dovecot/quota-warning.sh) failed: No such file
or directory

I think i have to revert the changes, and retest.;)


Wiki says: quota_warning =  name> 



You define a listening socket in the unix_listener line in the service 
definition, and refer to that socket in your quota_warning plugin 
configuration.


Duane wasn't saying to delete the path, he said to use the socket name. 
So, just quota-warning without the .sh


plugin {
  quota_warning = storage=95%% quota-warning 95 %u
  quota_warning2 = storage=90%% quota-warning 90 %u
  quota_warning3 = storage=10%% quota-warning 10 %u
}

service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
user = dovecot
  }
  user = dovecot
}




Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Luuk@dovecot
On 12-05-2012 17:42, Luuk@dovecot wrote:
> On 12-05-2012 15:55, Gedalya wrote:
>> On 05/12/2012 04:50 AM, Luuk@dovecot wrote:
>>> It seems i am at 79% of my quota
>>> so, i added a line to conf.d/90-quota.conf, to get a wraning when quota
>>> exceeds 10%:
>> Quota warnings are only sent when you _cross_ the limit, they are not
>> sent (again) when you are already over the limit.
>> So, in your case you will get your next warnings at 90% and 95%.
>>
> 
> OK, so i tweaked my rules a bit, and send meself a huge mail to make
> sure i cross a border. (I've overdone this, because the pdf got base64
> encoded, and stored in Sent AND in INBOX   ;)
> 
> 
> I also followed the suggestion form 'Duane Hill' and delete the path
> before the quota-warning.sh. I hope he did mean that when he was
> referring to the docs ;)
> 
> In the log, the following message showed:
> 2012-05-12 17:11:43 imap(luuk): Error: quota:
> net_connect_unix(/var/run/dovecot/quota-warning.sh) failed: No such file
> or directory
> 
> I think i have to revert the changes, and retest. ;)
> 


2012-05-12 17:50:22 imap(luuk): Error: quota:
net_connect_unix(/usr/local/bin/quota-warning.sh) failed: Permission
denied (euid=1000(luuk) egid=100(users) missing +w perm:
/usr/local/bin/quota-warning.sh, dir owned by 0:0 mode=0755)
^C
opensuse:/etc/dovecot # ll /usr/local/bin/quota-warning.sh
-rwxr-xr-x 1 root root 301 Apr  9 16:09 /usr/local/bin/quota-warning.sh

Why does this script need +w ?? or am i misreading the error message?


opensuse:/home/luuk # dovecot -n | grep -i quota
mail_plugins = mail_log notify fts fts_squat quota
  quota = maildir:User quota
  quota_rule = *:storage=800M
  quota_rule2 = *:messages=6
  quota_warning = storage=95%% /usr/local/bin/quota-warning.sh 95 %u
  quota_warning2 = storage=90%% /usr/local/bin/quota-warning.sh 90 %u
  quota_warning3 = storage=72%% /usr/local/bin/quota-warning.sh 72 %u
service quota-warning {
  executable = script /usr/local/bin/quota-warning.sh
  unix_listener quota-warning {
  mail_plugins = mail_log notify fts fts_squat quota imap_quota
opensuse:/home/luuk #


Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Luuk@dovecot
On 12-05-2012 15:55, Gedalya wrote:
> On 05/12/2012 04:50 AM, Luuk@dovecot wrote:
>> It seems i am at 79% of my quota
>> so, i added a line to conf.d/90-quota.conf, to get a wraning when quota
>> exceeds 10%:
> Quota warnings are only sent when you _cross_ the limit, they are not
> sent (again) when you are already over the limit.
> So, in your case you will get your next warnings at 90% and 95%.
> 

OK, so i tweaked my rules a bit, and send meself a huge mail to make
sure i cross a border. (I've overdone this, because the pdf got base64
encoded, and stored in Sent AND in INBOX   ;)


I also followed the suggestion form 'Duane Hill' and delete the path
before the quota-warning.sh. I hope he did mean that when he was
referring to the docs ;)

In the log, the following message showed:
2012-05-12 17:11:43 imap(luuk): Error: quota:
net_connect_unix(/var/run/dovecot/quota-warning.sh) failed: No such file
or directory

I think i have to revert the changes, and retest. ;)



Re: [Dovecot] Quota, message is never send?

2012-05-12 Thread Gedalya

On 05/12/2012 04:50 AM, Luuk@dovecot wrote:

It seems i am at 79% of my quota
so, i added a line to conf.d/90-quota.conf, to get a wraning when quota
exceeds 10%:
Quota warnings are only sent when you _cross_ the limit, they are not 
sent (again) when you are already over the limit.

So, in your case you will get your next warnings at 90% and 95%.



  1   2   3   4   5   6   >