Bug#694819: tumgreyspf: Cron file doesn't remove expired entries with greylistByIPOnly = 0
Hi Thomas! These 2 lines seems to solve both cases: find ${greylistDir} -type f -mtime +${GREYLISTEXPIREDAYS} -delete find ${greylistDir} -type d -empty -delete I've sent to you a tarball with examples (I am not including it on the bug report to protect the e-mail addresses). With greylistByIPOnly = 0 we can see that it creates a structure like this: /var/lib/tumgreyspf/data/client_address/200/35/145/greylist/email@fromdomain/destination@mydomain destination@mydomain is an empty file With greylistByIPOnly = 1 we have: /var/lib/tumgreyspf/data/200/35/145/check_file check_file is also an empty file So basically it works the same way with both modes: we can make the script delete all files that have a mtime GREYLISTEXPIREDAYS and then clean the empty dirs. Best regards, Nelson -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#694819: tumgreyspf: Cron file doesn't remove expired entries with greylistByIPOnly = 0
There is a bonus too: we won't need the loops in /etc/cron.daily/tumgreyspf since find nicely removes all the empty dirs for us. Example: $ mkdir -p a/b/c/d/e/f $ find a a a/b a/b/c a/b/c/d a/b/c/d/e a/b/c/d/e/f $ find a -mindepth 1 -type d -empty -delete $ find a a And just one minor fix is needed on my example before (otherwise there is a risk of removing /var/lib/tumgreyspf/data/): find ${greylistDir} -mindepth 1 -type d -empty -delete -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#694819: tumgreyspf: Cron file doesn't remove expired entries with greylistByIPOnly = 0
Attached is the crontab that I would use, fixing #694819. This will also fix #673386 and #610322. From my tests it's good but I would like to have somebody else reviewing it too :-) Best regards, Nelson #!/bin/sh if [ -f /etc/tumgreyspf/default.conf ] ; then GREYLISTEXPIREDAYS=`grep -E -m 1 ^\s*GREYLISTEXPIREDAYS /etc/tumgreyspf/default.conf | cut -d'=' -f2 | awk '{print $1}' | cut -d'.' -f1` fi if [ -z ${GREYLISTEXPIREDAYS} ] ; then GREYLISTEXPIREDAYS=10 fi greylistDir=`grep -E -m 1 ^\s*greylistDir /etc/tumgreyspf/tumgreyspf.conf | cut -d'=' -f2 | awk -F \' '{print $2}'` if [ ! -d ${greylistDir} -o -z ${greylistDir} ] ; then exit 0 fi find ${greylistDir} -type f -mtime +${GREYLISTEXPIREDAYS} -delete find ${greylistDir} -mindepth 1 -type d -empty -delete
Bug#694819: tumgreyspf: Cron file doesn't remove expired entries with greylistByIPOnly = 0
Hi Thomas! On Sat, Dec 1, 2012 at 11:46 AM, Thomas Goirand z...@debian.org wrote: Could you try to write a version of the script that would work on your system? We can later check the value of greylistByIPOnly, and have 2 types of clean, depending on that value. I am very busy this week but I will take a look at this for the weekend/next week. Thank you! Best regards, Nelson -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#694819: tumgreyspf: Cron file doesn't remove expired entries with greylistByIPOnly = 0
On 12/01/2012 02:12 AM, Nelson A. de Oliveira wrote: Package: tumgreyspf Version: 1.35-7 Severity: normal Hi! Using greylistByIPOnly = 0 I saw that the expired entries aren't removed after GREYLISTEXPIREDAYS. From /etc/cron.daily/tumgreyspf it's possible to see, for example: = + [ -f /etc/tumgreyspf/default.conf ] + grep GREYLISTEXPIREDAYS /etc/tumgreyspf/default.conf + cut -d= -f2 + awk {print $1} + cut -d. -f1 + GREYLISTEXPIREDAYS=10 + [ -z 10 ] + greylistDir=/var/lib/tumgreyspf/data + [ -d /var/lib/tumgreyspf/data ] + ls /var/lib/tumgreyspf/data + [ -z client_address ] + find /var/lib/tumgreyspf/data/client_address/1/161/ -name check_file -mtime +10 -delete + rmdir --ignore-fail-on-non-empty /var/lib/tumgreyspf/data/client_address/1/161 + rmdir --ignore-fail-on-non-empty /var/lib/tumgreyspf/data/client_address/1 + find /var/lib/tumgreyspf/data/client_address/103/10/ -name check_file -mtime +10 -delete (...) = But what I have in /var/lib/tumgreyspf/data/client_address/1/161/ is: = /var/lib/tumgreyspf/data/client_address/1/161/ /var/lib/tumgreyspf/data/client_address/1/161/0 /var/lib/tumgreyspf/data/client_address/1/161/0/greylist /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/mail@somedomain /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/mail@somedomain/receiver1@mydomain /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/othermail@otherdomain /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/othermail@otherdomain/receiver2@mydomain = Note that it tries to remove check_file (that is not created with greylistByIPOnly = 0) and also remove the dirs that aren't empty. Problem is that these dirs will grow without limit (and maybe reaching some filesystems limit). It also affects testing/unstable's 1.36-4 Thank you! Best regards, Nelson Hi Nelson, I am the one who wrote the cron job, because the python script provided by upstream was buggy in many ways. I didn't know and never used that mode, with greylisting by email address, and not by IP address only. That's interesting. Could you try to write a version of the script that would work on your system? We can later check the value of greylistByIPOnly, and have 2 types of clean, depending on that value. I can try to have a look myself, but it would help a lot of you could attach to this bug a tarball of an example /var/lib/tumgreyspf folder, with few entries, so I can do some tests runs. For the time being, I would recommend any stable or testing users to use greylistByIPOnly = 1, and then we can try to fix the problem in experimental first... If it works well, then I think it would be a good idea to have greylistByIPOnly = 0 by default. Thoughts? Thomas -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org
Bug#694819: tumgreyspf: Cron file doesn't remove expired entries with greylistByIPOnly = 0
Package: tumgreyspf Version: 1.35-7 Severity: normal Hi! Using greylistByIPOnly = 0 I saw that the expired entries aren't removed after GREYLISTEXPIREDAYS. From /etc/cron.daily/tumgreyspf it's possible to see, for example: = + [ -f /etc/tumgreyspf/default.conf ] + grep GREYLISTEXPIREDAYS /etc/tumgreyspf/default.conf + cut -d= -f2 + awk {print $1} + cut -d. -f1 + GREYLISTEXPIREDAYS=10 + [ -z 10 ] + greylistDir=/var/lib/tumgreyspf/data + [ -d /var/lib/tumgreyspf/data ] + ls /var/lib/tumgreyspf/data + [ -z client_address ] + find /var/lib/tumgreyspf/data/client_address/1/161/ -name check_file -mtime +10 -delete + rmdir --ignore-fail-on-non-empty /var/lib/tumgreyspf/data/client_address/1/161 + rmdir --ignore-fail-on-non-empty /var/lib/tumgreyspf/data/client_address/1 + find /var/lib/tumgreyspf/data/client_address/103/10/ -name check_file -mtime +10 -delete (...) = But what I have in /var/lib/tumgreyspf/data/client_address/1/161/ is: = /var/lib/tumgreyspf/data/client_address/1/161/ /var/lib/tumgreyspf/data/client_address/1/161/0 /var/lib/tumgreyspf/data/client_address/1/161/0/greylist /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/mail@somedomain /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/mail@somedomain/receiver1@mydomain /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/othermail@otherdomain /var/lib/tumgreyspf/data/client_address/1/161/0/greylist/othermail@otherdomain/receiver2@mydomain = Note that it tries to remove check_file (that is not created with greylistByIPOnly = 0) and also remove the dirs that aren't empty. Problem is that these dirs will grow without limit (and maybe reaching some filesystems limit). It also affects testing/unstable's 1.36-4 Thank you! Best regards, Nelson -- System Information: Debian Release: wheezy/sid APT prefers testing APT policy: (990, 'testing'), (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.2.0-2-amd64 (SMP w/4 CPU cores) Locale: LANG=pt_BR.UTF-8, LC_CTYPE=pt_BR.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org