Re: [courier-users] How to force quota recalculation ?

2016-05-25 Thread chaouche yacine


- Original Message -
From: chaouche yacine 
To: "courier-users@lists.sourceforge.net" 
Sent: Wednesday, May 25, 2016 10:36 AM
Subject: Re: [courier-users] How to force quota recalculation ?


>root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # ./showquota.single 
>i.aitahmed
>Quota sur la boite aux lettres i.aitahmed
>62.85 Mo /  200.00 Mo ( 31.42% )
>Quota sur les archives
>327.07 Mo /  5120.00 Mo ( 6.38% )
>
>-
>root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # 


this is showquota.single in the hope that it would be useful to anyone.


root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # cat showquota.single

1   mega=$((1024*1024))
2   inbox="${1%@*}"
3   maildir="/var/vmail/domain.tld/$inbox"
4   backup="/var/vmail/backup.domain.tld/$inbox"
5   [ ! -e $maildir ] && echo "Boite email inexistante. Veuillez vérifier 
encore une fois l'orthogrape de $in...@domain.tld" && exit 1
6   function get_quota {
7 mailfolder="$1"

8 # then
9 #   echo "Aucune boite email portant ce nom. Veuillez vérifier 
l'orthographe"
10#   exit 128
11# fi
12maildirsize="$mailfolder/maildirsize" 
13fields=$(echo $(head -2 $maildirsize))
14max="${fields%%S*}"
15cur="$(echo $fields | cut -f2 -d ' ')"
16ratio=$(echo "scale=2; $cur * 100 / $max" | bc)
17cur=$(echo "scale=2; $cur / $mega" | bc)
18max=$(echo "scale=2; $max / $mega" | bc)
19echo "$cur Mo /  $max Mo ( $ratio% )"
20  }
21  echo Quota sur la boite aux lettres $inbox
22  get_quota "$maildir"
23  echo Quota sur les archives
24  get_quota "$backup"
25  echo 
"-"

root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # 


users of this script should change the maildir variable and comment out lines 4 
and 24 as they are specific to my setup.

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-25 Thread chaouche yacine





>That command hangs for reasons I don't understand. I did a trace and it seems 
>it is trying to access a random tmp file that doesn't exist, but it keeps 
>trying instead of giving up and exiting with an error :

>
># maildirmake.courier -q 209715200S /var/vmail/domain.tld/a.aitahmed


Oops, sorry was a typo in mailbox name. Works fine now and quota was 
recalculated.


$ maildirmake.courier -q 209715200S /var/vmail/algerian-radio.dz/i.aitahmed


-
root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # ./showquota.single 
i.aitahmed
Quota sur la boite aux lettres i.aitahmed
62.85 Mo /  200.00 Mo ( 31.42% )
Quota sur les archives
327.07 Mo /  5120.00 Mo ( 6.38% )
-
root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # 

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-25 Thread chaouche yacine

From: Matus UHLAR - fantomas 
To: courier-users@lists.sourceforge.net
Sent: Wednesday, May 25, 2016 7:10 AM
Subject: Re: [courier-users] How to force quota recalculation ?


>>On 25/05/16 01:48, chaouche yacine wrote:
>>> maildirsize shows 200Mb+ of disk usage while du shows only 64Mb.
>
>how could this happen? Did someone modify the maildir's data manually
(not by courier's sw)?


I don't think so. I'm not running another software except courier.


>>> How
>>> can I ask courier to recaclculate the quota and allow this poor user
>>> to receive mail again ?

>I have used rebuilsing quota with "maildirmake -q209715200S ./"

That command hangs for reasons I don't understand. I did a trace and it seems 
it is trying to access a random tmp file that doesn't exist, but it keeps 
trying instead of giving up and exiting with an error :

# maildirmake.courier -q 209715200S /var/vmail/domain.tld/a.aitahmed

Here's an strace of it :

root@messagerie[CHROOT][10.10.10.19] ~ # ps ax | grep maildirmake
2510 ? S 0:00 su -c maildirmake -q 1073741824S domain.tld/meziane.ziani vmail
2511 ? S 0:00 maildirmake -q 1073741824S domain.tld/meziane.ziani
9608 pts/7 S+ 0:00 maildirmake.courier -q 209715200S 
/var/vmail/domain.tld/a.aitahmed
10455 pts/6 S+ 0:00 grep --color=always maildirmake
root@messagerie[CHROOT][10.10.10.19] ~ # strace -p 9608
Process 9608 attached - interrupt to quit
restart_syscall(<... resuming interrupted call ...>) = 0
stat("/var/vmail/domain.tld/a.aitahmed/tmp/146416.9608_NeWmAiLdIrSiZe.messagerie",
 0x7fffc3728da0) = -1 ENOENT (No such file or directory)
open("/var/vmail/domain.tld/a.aitahmed/tmp/146416.9608_NeWmAiLdIrSiZe.messagerie",
 O_RDWR|O_CREAT|O_APPEND|O_NONBLOCK, 0644) = -1 ENOENT (No such file or 
directory)
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({3, 0}, 0x7fffc3728c40) = 0
stat("/var/vmail/domain.tld/a.aitahmed/tmp/1464167780.9608_NeWmAiLdIrSiZe.messagerie",
 0x7fffc3728da0) = -1 ENOENT (No such file or directory)
open("/var/vmail/domain.tld/a.aitahmed/tmp/1464167780.9608_NeWmAiLdIrSiZe.messagerie",
 O_RDWR|O_CREAT|O_APPEND|O_NONBLOCK, 0644) = -1 ENOENT (No such file or 
directory)
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({3, 0},
0x7fffc3728c40) = 0
stat("/var/vmail/domain.tld/a.aitahmed/tmp/1464167783.9608_NeWmAiLdIrSiZe.messagerie",
 0x7fffc3728da0) = -1 ENOENT (No such file or directory)
open("/var/vmail/domain.tld/a.aitahmed/tmp/1464167783.9608_NeWmAiLdIrSiZe.messagerie",
 O_RDWR|O_CREAT|O_APPEND|O_NONBLOCK, 0644) = -1 ENOENT (No such file or 
directory)
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({3, 0},
0x7fffc3728c40) = 0
stat("/var/vmail/domain.tld/a.aitahmed/tmp/1464167786.9608_NeWmAiLdIrSiZe.messagerie",
 0x7fffc3728da0) = -1 ENOENT (No such file or directory)
open("/var/vmail/domain.tld/a.aitahmed/tmp/1464167786.9608_NeWmAiLdIrSiZe.messagerie",
 O_RDWR|O_CREAT|O_APPEND|O_NONBLOCK, 0644) = -1 ENOENT (No such file or 
directory)
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({3, 0},





0x7fffc3728c40) = 0
stat("/var/vmail/domain.tld/a.aitahmed/tmp/1464167789.9608_NeWmAiLdIrSiZe.messagerie",
 0x7fffc3728da0) = -1 ENOENT (No such file or directory)
open("/var/vmail/domain.tld/a.aitahmed/tmp/1464167789.9608_NeWmAiLdIrSiZe.messagerie",
 O_RDWR|O_CREAT|O_APPEND|O_NONBLOCK, 0644) = -1 ENOENT (No such file or 
directory)
rt_sigprocmask(SIG_BLOCK, [CHLD], [], 8) = 0
rt_sigaction(SIGCHLD, NULL, {SIG_DFL, [], 0}, 8) = 0
rt_sigprocmask(SIG_SETMASK, [], NULL, 8) = 0
nanosleep({3, 0},



^C 
Process 9608 detached
root@messagerie[CHROOT][10.10.10.19] ~ #

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-25 Thread Mark Constable
On 25/05/16 19:00, chaouche yacine wrote:
> I've move maildirsize to maildirsize- but quota is still shown as
> 209715200 (instead of 64764) even after an authentification lookup
> [...]
>  Authenticated: i.aitah...@domain.tld  (uid 5000, gid 5000)
> Home Directory: /var/vmail
>Maildir: domain.tld/i.aitahmed
>  Quota: 209715200
> Encrypted Password: $1$j5tuqwxC$rsLuOD5v8DDBydp.kBEPf0
> Cleartext Password: (none)
>Options: disableimap=n,disablepop3=n

You are seeing the default quota setting, not the dynamic value
determined by courier as to how full the mailbox currently is.

If anyone is using Thunderbird then RMB on the Inbox and go to
Properties -> Quota and that will give you a real time estimate
AFTER removing the maildirsize file and restarting TB to enforce
a fresh login and scan of the IMAP/POP folders.


--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-25 Thread chaouche yacine
I've move maildirsize to maildirsize- but quota is still shown as 209715200 
(instead of 64764) even after an authentification lookup : 

Console 1

root@messagerie[CHROOT][10.10.10.19] /var/vmail/domain.tld/i.aitahmed # mv 
maildirsize maildirsize-
root@messagerie[CHROOT][10.10.10.19] /var/vmail/domain.tld/i.aitahmed # ls
total 48K
drwx-- 2 vmail vmail 4.0K May 23 15:20 courierimapkeywords
-rwxr--r-- 1 vmail vmail   47 Sep 21  2014 courierimapsubscribed
-rw-r--r-- 1 vmail vmail 5.5K May 23 15:11 courierimapuiddb
drwx-- 2 vmail vmail  12K May 23 15:11 cur
-rw-rw 1 vmail vmail  450 May 24 16:42 ispconfig_mailsize
-rw-r- 1 vmail vmail 1.1K May 24 16:41 maildirsize-
drwx-- 2 vmail vmail 4.0K May 24 16:45 new
-rwxr--r-- 1 vmail vmail   23 Sep 21  2014 subscriptions
drwx-- 2 vmail vmail 4.0K May 24 16:42 tmp
root@messagerie[CHROOT][10.10.10.19] /var/vmail/domain.tld/i.aitahmed #


Console 2

root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL # authtest 
i.aitah...@domain.tld
Authentication succeeded.

 Authenticated: i.aitah...@domain.tld  (uid 5000, gid 5000)
    Home Directory: /var/vmail
   Maildir: domain.tld/i.aitahmed
 Quota: 209715200
Encrypted Password: $1$j5tuqwxC$rsLuOD5v8DDBydp.kBEPf0
Cleartext Password: (none)
   Options: disableimap=n,disablepop3=n
root@messagerie[CHROOT][10.10.10.19] ~/SCRIPTS/MAIL #
Console 1 again

root@messagerie[CHROOT][10.10.10.19] /var/vmail/domain.tld/i.aitahmed # du -s
64764   .
root@messagerie[CHROOT][10.10.10.19] /var/vmail/domain.tld/i.aitahmed # 

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-25 Thread Mark Constable
On 25/05/16 16:38, Matus UHLAR - fantomas wrote:
> so this depends on authdaemon providing that information, e.g. this
> won't work with standard user accounts other that removing quota at
> all...

You're right, not with authpam (and maybe authpipe / authcustom
depending what's returned), but I think all the others have a quota
field...

authmodulelistorig="authuserdb authpam authpgsql authldap authmysql authsqlite 
authcustom authpipe"


--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-24 Thread Matus UHLAR - fantomas
>On 25/05/16 16:10, Matus UHLAR - fantomas wrote:
>> On 25.05.16 12:41, Mark Constable wrote:
>>> There may be more elegant solutions but I just simply delete that
>>> file and quotawarn. The maildirsize file will be rebuilt soon
>>> enough.
>>
>> isn't quota lost when you lose maildirsize?
>> I thought the first line sets the quota...

On 25.05.16 16:21, Mark Constable wrote:
>The quota comes from an authdaemon lookup...
>
>May 25 16:16:01 s2 authdaemond[23816]:
>Authenticated: sysusername=, sysuserid=, sysgroupid=,
>homedir=/xxx/xxx/markc, address=ma...@renta.net, fullname=,
>maildir=, quota=2097152000S, options=
>
>so when there is no maildirsize it gets rebuilt. The proof is that
>when maildirmake first creates a users maildir area there is no
>maildirsize file and everything works fine, it simply gets created
>if it doesn't exist.

so this depends on authdaemon providing that information, e.g. this won't
work with standard user accounts other that removing quota at all...

-- 
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Support bacteria - they're the only culture some people have. 

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-24 Thread Mark Constable
On 25/05/16 16:10, Matus UHLAR - fantomas wrote:
> On 25.05.16 12:41, Mark Constable wrote:
>> There may be more elegant solutions but I just simply delete that
>> file and quotawarn. The maildirsize file will be rebuilt soon
>> enough.
>
> isn't quota lost when you lose maildirsize?
> I thought the first line sets the quota...

The quota comes from an authdaemon lookup...

May 25 16:16:01 s2 authdaemond[23816]:
Authenticated: sysusername=, sysuserid=, sysgroupid=,
homedir=/xxx/xxx/markc, address=ma...@renta.net, fullname=,
maildir=, quota=2097152000S, options=

so when there is no maildirsize it gets rebuilt. The proof is that
when maildirmake first creates a users maildir area there is no
maildirsize file and everything works fine, it simply gets created
if it doesn't exist.


--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-24 Thread Matus UHLAR - fantomas
>On 25/05/16 01:48, chaouche yacine wrote:
>> maildirsize shows 200Mb+ of disk usage while du shows only 64Mb.

how could this happen? Did someone modify the maildir's data manually
(not by courier's sw)?

>> How
>> can I ask courier to recaclculate the quota and allow this poor user
>> to receive mail again ?

I have used rebuilsing quota with "maildirmake -q209715200S ./"
in order to rebuild quota, but Sam's recommendation should be easier for
users.

On 25.05.16 12:41, Mark Constable wrote:
>There may be more elegant solutions but I just simply delete that file
>and quotawarn. The maildirsize file will be rebuilt soon enough.

isn't quota lost when you lose maildirsize?
I thought the first line sets the quota...

-- 
Matus UHLAR - fantomas, uh...@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
I intend to live forever - so far so good. 

--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-24 Thread Mark Constable
On 25/05/16 01:48, chaouche yacine wrote:
> maildirsize shows 200Mb+ of disk usage while du shows only 64Mb. How
> can I ask courier to recaclculate the quota and allow this poor user
> to receive mail again ?

There may be more elegant solutions but I just simply delete that file
and quotawarn. The maildirsize file will be rebuilt soon enough.


--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j
___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users


Re: [courier-users] How to force quota recalculation ?

2016-05-24 Thread Sam Varshavchik

chaouche yacine writes:


Hello list,

maildirsize shows 200Mb+ of disk usage while du shows only 64Mb. How can I  
ask courier to recaclculate the quota and allow this poor user to receive  
mail again ?


Create and delete a folder using IMAP.




pgpVjHqDRVfRN.pgp
Description: PGP signature
--
Mobile security can be enabling, not merely restricting. Employees who
bring their own devices (BYOD) to work are irked by the imposition of MDM
restrictions. Mobile Device Manager Plus allows you to control only the
apps on BYO-devices by containerizing them, leaving personal data untouched!
https://ad.doubleclick.net/ddm/clk/304595813;131938128;j___
courier-users mailing list
courier-users@lists.sourceforge.net
Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users