Re: [LP 7.1.3]how to limit an ip adress to x connections persecond for a specific page

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [LP 7.1.3]how to limit an ip adress to x connections persecond for a specific page

Alan Linnenbank
Your example is exactly what I mean but I'm thinking more towards a global set with an array of IP's wich is cleared every two seconds or so

This eliminates the need for lots off database calls.

Alan


On donderdag, 2 juni 2005 16:27, Karim Dahdah <[hidden email]> wrote:
Alan,

I haven't done this before, but I want to make something like that for a
webapplication.
The method I have in mind is the following:


I have a couple of IP addresses that are listed as 'trusted'. These IP
addresses can make as much connections to a page as they wish.

IP addresses that are not listed on that list can only make one
connection each 3 seconds (as an example).

I think of building 2 tables: one with the trusted IP addresses and one
with the connections (consist of IP address and timestamp).

Each time a connection is made, the webapp checks if the IP address is
listed in the trusted list. If it is, the client can view the page.
If it doesn't, then it checks if the timestamp in the second table (the
one with the connections) is more than 3 seconds old. Then the client
gets the page, otherwise a message or a blank page is displayed.

I haven't checked if this setup is a good one. But maybe we get some
thoughts from other people on this list! :)


Greetz,

Karim Dahdah
-------------------------
-ASP- and Lasso Developer
www.doran.be




Alan Linnenbank wrote:

> List,
>
> Has anybody tried something like this? We wan't a specific page to be restricted to x number off requests per ip adres per second. Probably need to use thread locks but I don't wan't it to work for all visitors as a whole like the extending examples state.
>
>
> Thanks
>
> Alan
>
>


--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage



--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: [LP 7.1.3]how to limit an ip adress to x connections persecond for a specific page

James Harvard
Have you looked for Apache modules to do this? I think that would be much faster / would have lower overheads, if there is an appropriate module available.
James Harvard

>Your example is exactly what I mean but I'm thinking more towards a global set with an array of IP's wich is cleared every two seconds or so
>
>This eliminates the need for lots off database calls.

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage
Reply | Threaded
Open this post in threaded view
|

Re: [LP 7.1.3]how to limit an ip adress to x connections persecond for a specific page

Alan Linnenbank
In reply to this post by Alan Linnenbank
Thanks but I want it to be page specific not serverwide

I've come with this so far and I know it is a bit rough but it works.

In lasso startup folder:

[global: 'hitlist_ip_array' = (array)]
[define_tag: 'YM_check_ip_array', -async]
[while: True]
[global: 'hitlist_ip_array' = (array)]
[sleep: 1000]
[/while]
[/define_tag]
[YM_check_ip_array]


In the page:

[If: (global: 'hitlist_ip_array')->(Contains: (client_ip))]
Not now
[abort]
[else]
[(global: 'hitlist_ip_array')->(insert: (client_ip))]
Thank you
[/If]





On donderdag, 2 juni 2005 17:09, James Harvard <[hidden email]> wrote:
Have you looked for Apache modules to do this? I think that would be much faster / would have lower overheads, if there is an appropriate module available.
James Harvard

>Your example is exactly what I mean but I'm thinking more towards a global set with an array of IP's wich is cleared every two seconds or so
>
>This eliminates the need for lots off database calls.

--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage



--
------------------------------
Lasso Support: http://support.omnipilot.com/
Search the list archives: http://www.listsearch.com/lassotalk.lasso
Manage your list subscription:  
http://www.listsearch.com/lassotalk.lasso?manage