Ban ips

Can someone suggest me a quick solution for banning certain ips from
accessing my pages?
Recently I’ve got a series of smartasses that think that swearing on
forums
is cool. Banning certain words did not really help, since they can
always
write F/U/C… you the picture

Thanks,
Bogdan

if you have access to the router, the best place to intercept a
scoundrel
is on the router’s deny list. Login to the router.

if you have access to the http server, the second best thing to do is
add
the ip to the server’s deny list.
http://httpd.apache.org/docs/1.3/mod/mod_access.html

if those methods are unavailable, and you are using rails, you can add
the LoginEngine (http://rails-engines.rubyforge.org/), and then add the
following code,

login_engine.rb:
DENY_IP = [‘some.smart.ass.ip’,‘smart.ass.2.ip’]
# do you require a login?
LOGIN_REQUIRED = false

authenticated_system.rb:
def deny( ip )
DENY_IP.detect { |addr| addr == ip }
end

 def login_required
  if deny(@request.env["REMOTE_ADDR"])
	  redirect_to_url "http://www.google.com"
	  return false
  elsif ! LOGIN_REQUIRED
       	return true
  end
  ...

 end

application.rb:
class ApplicationController < ActionController::Base

 include LoginEngine
 before_filter :login_required

end

I’m sure there are lots of other ways, too.

If you run Linux, iptables is your friend.

Kent.