<html>
<head>
<base href="https://bugzilla.netfilter.org/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - limit-burst is not fully consumed and rule stops matching"
href="https://bugzilla.netfilter.org/show_bug.cgi?id=1170">1170</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>limit-burst is not fully consumed and rule stops matching
</td>
</tr>
<tr>
<th>Product</th>
<td>netfilter/iptables
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>x86_64
</td>
</tr>
<tr>
<th>OS</th>
<td>Ubuntu
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>major
</td>
</tr>
<tr>
<th>Priority</th>
<td>P5
</td>
</tr>
<tr>
<th>Component</th>
<td>ip_tables (kernel)
</td>
</tr>
<tr>
<th>Assignee</th>
<td>netfilter-buglog@lists.netfilter.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>emailsummerhome@gmail.com
</td>
</tr></table>
<p>
<div>
<pre>Using the limit module, with the limit-burst option, I can successfully enter a
rule that contains a limit and limit-burst. However, when I then send
connections to this server, the rule only matches for a fraction of the
specified limit-burst connections. Then the rule stops matching.
EXAMPLE: Apache keepalives are off and I want to limit connections to around a
maximum of 500 per month. I specify limit 18/day, limit-burst 500
Rules are added as follows:
sudo ipset create TESTCLIENT hash:net
sudo ipset add TESTCLIENT 165.227.31.204
sudo iptables -A INPUT -m state --state RELATED,ESTABLISHED -j ACCEPT
sudo iptables -A INPUT -p tcp -m set --match-set TESTCLIENT src -m tcp --dport
80 -m limit --limit 18/day --limit-burst 500 -j ACCEPT
sudo iptables -A INPUT -p tcp -m set --match-set TESTCLIENT src -m tcp --dport
80 -m comment --comment "over test quota" -j LOG
sudo iptables -A INPUT -p tcp -m tcp --dport 80 -m comment --comment "fast
failures" -j REJECT --reject-with tcp-reset
I wrote a simple bash script on my TESTCLIENT system which uses curl to connect
and download the index page on this webserver in a loop.
EXPECTED RESULTS: I expect to be able to fairly quickly use all 500
connections (keepalives are off) and then after a day passes, have 18 new
connections available for use again. If no more connections are made, then
after 28 days, all 500 connections are available (the burst is completely
refilled).
ACTUAL RESULTS: What actually happened is that my test script made 24
successful connections and the rest of the connections were rejected. I can
also see on the server's iptables listing that the ACCEPT rule matched 24
times, but no more, even though the limit-burst was set to 500.
TESTED PLATFORMS: CentOS 6.8 x64 (iptables v1.4.7) and Ubuntu 16.04 x64
(iptables v1.6.0) - behavior is the same on both with these same limit and
limit-burst options. Both are VMs running in DigitalOcean datacenter SFO2.
ADDITIONAL INFO: Interesting enough, using different values for limit and
limit-burst, I'm able to get expected results.
In the first case I used --limit 10/hour --limit-burst 50. I was able to make
50 successful connections to this server (same Ubuntu server previously
mentioned) and the 51st connection was rejected.
In the second case, I used --limit 500/day --limit-burst 500. I was able to
make 500 successful connections to this server (same Ubuntu server previously
mentioned) and the 501st connection was rejected. However, "recharging" the
burst in a single day is not desired.
Thanks in advance</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are watching all bug changes.</li>
</ul>
</body>
</html>