Mailing List Archive

Ratelimit database
Hello list, I've recently implemented a ratelimit acl on my servers. I
would like to know how to delete an entry for a specific user in the
/var/spool/exim/db/ratelimit database.? If someone took the time to do a
script, and want to share it, I'll appreciate.



Regards, Juan.

--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Ratelimit database [ In reply to ]
On Wed, 5 Sep 2018, Juan Bernhard via Exim-users wrote:

> Hello list, I've recently implemented a ratelimit acl on my servers. I would
> like to know how to delete an entry for a specific user in the
> /var/spool/exim/db/ratelimit database.? If someone took the time to do a
> script, and want to share it, I'll appreciate.

From
http://exim.org/exim-html-current/doc/html/spec_html/ch-exim_utilities.html
section 14
exim_fixdb

The exim_fixdb program is a utility for interactively modifying databases.
Its main use is for testing Exim, but it might also be occasionally useful
for getting round problems in a live system. It has no options, and its
interface is somewhat crude. On entry, it prompts for input with a right
angle-bracket. A key of a database record can then be entered, and the
data for that record is displayed.

If "d" is typed at the next prompt, the entire record is deleted.
For all except the retry database, that is the only operation that can be
carried out. For the retry database, each field is output preceded by a
number, and data for individual fields can be changed by typing the field
number followed by new data, for example:

> 4 951102:1000

resets the time of the next delivery attempt. Time values are given as a
sequence of digit pairs for year, month, day, hour, and minute. Colons can
be used as optional separators.


I don't have a script for this, but you want to type (as root):
exim_fixdb /var/spool/exim ratelimit
useraddress
d

- or possibly replace the d with some field number and value.

Best of luck,

--
Andrew C. Aitchison Cambridge, UK
andrew@aitchison.me.uk
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/
Re: Ratelimit database [ In reply to ]
Juan Bernhard via Exim-users <exim-users@exim.org> (Mi 05 Sep 2018 13:52:07 CEST):
> Hello list, I've recently implemented a ratelimit acl on my servers. I would
> like to know how to delete an entry for a specific user in the
> /var/spool/exim/db/ratelimit database.  If someone took the time to do a
> script, and want to share it, I'll appreciate.

The files are simple Berkeley-DB files. Here is a small Perl snippet, maybe you
can use this as a starting point.

~~~ .pl
use strict;
use warnings;
use DB_File;

tie my %db, DB_File => 'ratelimit'
or die $!;

while (my ($k, $v) = each %db) {
print "$k: $v\n";
}
~~~

For occasional use, the exim_fixdb tool should be sufficient.

Best regards from Dresden/Germany
Viele Grüße aus Dresden
Heiko Schlittermann
--
SCHLITTERMANN.de ---------------------------- internet & unix support -
Heiko Schlittermann, Dipl.-Ing. (TU) - {fon,fax}: +49.351.802998{1,3} -
gnupg encrypted messages are welcome --------------- key ID: F69376CE -
! key id 7CBF764A and 972EAC9F are revoked since 2015-01 ------------ -
Re: Ratelimit database [ In reply to ]
On Fri, Sep 7, 2018 at 8:45 AM Andrew C Aitchison via Exim-users <
exim-users@exim.org> wrote:

>
> If "d" is typed at the next prompt, the entire record is deleted.
> For all except the retry database, that is the only operation that can be
> carried out.


This is either out of date, or it's been changed since exim 4.84 (Debian
Jessie).

The ratelimit database can be modified in real-time.

Here is how I do it:

1) file=~/tmp/ratelimit.$(date +%F_%T); exim_dumpdb /var/spool/exim4
ratelimit > $file; echo $file

2) I then grep the file for the entry I need, e.g. the IP address 127.2.3.4:

07-Sep-2018 09:34:24.253257 rate: 12.423 key: 1h/per_rcpt/127.2.3.4

3) exim_fixdb /var/spool/exim4 ratelimit
Modifying Exim hints database /var/spool/exim4/db/ratelimit
>

4) At the prompt, enter the key:

> 1h/per_rcpt/127.2.3.4
07-Sep-2018 09:35:11
0 time stamp: 07-Sep-2018 09:35:11
1 fract. time: .327344
2 sender rate: 13.391
>

5) At the prompt, enter the key number you want to change (2 for the sender
rate), a space, and the new value:

> 2 1.151
07-Sep-2018 09:35:37
0 time stamp: 07-Sep-2018 09:35:37
1 fract. time: .327344
2 sender rate: 1.151
>

And that's it.


--
Jan
--
## List details at https://lists.exim.org/mailman/listinfo/exim-users
## Exim details at http://www.exim.org/
## Please use the Wiki with this list - http://wiki.exim.org/