🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: rocksolid.nodes
5 messages
5 total messages Started by Retro Guy Wed, 06 Jan 2021 10:06
rate limiting in rslight
#377
Author: Retro Guy
Date: Wed, 06 Jan 2021 10:06
13 lines
1831 bytes
I've finally set up rate limiting in rslight so that it's not necessary to do so with web server settings.

The server works great for this as long as each client has it's own ip address, which is fine in clearnet and i2p, but does not work well in tor. tor users all have the same ip address, so it ends up blocking all tor users if one is abusing the server.

I'm now limiting per session, and so far it seems to be working fine. It should be fine for clearnet and tor also, but it's really for tor. Most of my tor traffic is badly configured crawlers that just hit the server as fast as they possibly can, so you get many hits per second. Now the logs show the crawlers getting a '429' and regular users are still able to load the site.

I'll keep testing this and see how it goes.

Retro Guy

-- 
Posted on Rocksolid Light
news.novabbs.org
Re: rate limiting in rslight
#383
Author: Anonymous
Date: Wed, 06 Jan 2021 12:27
8 lines
1025 bytes
>I'm now limiting per session,

I was not aware that rslight uses sessions. How did you do that, cookies ?

Good that it works against the crawlers, though. I just realized that cookies will not work against crawlers that do not take them, so probably you have found another way (really curious here).

-- 
Posted on def2
Re: rate limiting in rslight
#379
Author: Retro Guy
Date: Wed, 06 Jan 2021 22:59
31 lines
2004 bytes
On Wed, 06 Jan 2021 04:27:53 -0800
Anonymous <poster@anon.com> wrote:

> >I'm now limiting per session,
> 
> I was not aware that rslight uses sessions. How did you do that,
> cookies ?
> 
> Good that it works against the crawlers, though. I just realized that
> cookies will not work against crawlers that do not take them, so
> probably you have found another way (really curious here).
> 

What I do is connect to the session in specific files, not every file:
session_start();

Then verify a start time or create a start time (of the session), count
hits (views), then I can monitor hit rates:
$rate = ($_SESSION['views'] / (time() - $_SESSION['starttime']));

If there is a big gap since start time, it is reset to avoid spoofing
rate. Then, reading $rate it's decided whether it's too fast or not and
if it is, it sends a 429 "Too Many Requests" and exits the script
(sending no content).

In my logs, all the crawlers are receiving 429, and the non crawlers
(users) are able to load the page with no issues.

Cookies are not involved, just sessions.

Retro Guy
Re: rate limiting in rslight
#380
Author: trw
Date: Sat, 09 Jan 2021 18:17
7 lines
1319 bytes
thx for the explanation. I was just wondering how a specific request is mapped to a session, but I can read it up in the php documentation then.
if there are no cookies involved it is probably done with a session token ? I will check it out.
I have not used sessions in any of my own php code, but fudforum does of course (in the adapted version the session token is embedded in the links, so that the resulting GET string contains the token).

-- 
Posted on def4
Re: rate limiting in rslight
#401
Author: Retro Guy
Date: Fri, 05 Feb 2021 02:00
30 lines
2225 bytes
On Sat, 09 Jan 2021 18:17:04+0000
trw <trw@anon.org> wrote:

> 
> thx for the explanation. I was just wondering how a specific request
> is mapped to a session, but I can read it up in the php documentation
> then. if there are no cookies involved it is probably done with a
> session token ? I will check it out. I have not used sessions in any
> of my own php code, but fudforum does of course (in the adapted
> version the session token is embedded in the links, so that the
> resulting GET string contains the token).
> 

That's interesting. I was wondering how you resolved the sessions in
tor issue :)

My reasons in rslight is that tor users all have the same ip address
from the web server's view, so fail2ban, throttling in the web server,
etc. won't work properly without just blocking all tor users.

I can see in the logs clients being throttled, while other tor users
are not affected. It's much better than when a spider could just shut
the site down by getting itself blocked (so all tor users blocked). The
spiders seem to hit around 5 request per second and get blocked very
quickly.

I wish the operators of the crawlers would check their logs and see all
they are getting is 429 and nothing useful, but they'll probably just
keep it up forever. To get actual stuff to use in your search engine,
or whatever, slow the f down and don't get blocked.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads