mirror of
https://github.com/samsonjs/rack-attack.git
synced 2026-04-27 15:07:41 +00:00
Updated all non-secure HTTP URLs to HTTPS.
This commit is contained in:
parent
389287f060
commit
0457bf22f9
5 changed files with 12 additions and 12 deletions
|
|
@ -18,4 +18,4 @@ Instances of abusive, harassing, or otherwise unacceptable behavior may be repor
|
||||||
|
|
||||||
:hand: :page_with_curl:
|
:hand: :page_with_curl:
|
||||||
|
|
||||||
This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org) (v1.0.0), available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org) (v1.0.0), available at [https://www.contributor-covenant.org/version/1/0/0/](https://www.contributor-covenant.org/version/1/0/0/)
|
||||||
|
|
|
||||||
16
README.md
16
README.md
|
|
@ -4,9 +4,9 @@
|
||||||
|
|
||||||
Protect your Rails and Rack apps from bad clients. Rack::Attack lets you easily decide when to *allow*, *block* and *throttle* based on properties of the request.
|
Protect your Rails and Rack apps from bad clients. Rack::Attack lets you easily decide when to *allow*, *block* and *throttle* based on properties of the request.
|
||||||
|
|
||||||
See the [Backing & Hacking blog post](http://www.kickstarter.com/backing-and-hacking/rack-attack-protection-from-abusive-clients) introducing Rack::Attack.
|
See the [Backing & Hacking blog post](https://www.kickstarter.com/backing-and-hacking/rack-attack-protection-from-abusive-clients) introducing Rack::Attack.
|
||||||
|
|
||||||
[](http://badge.fury.io/rb/rack-attack)
|
[](https://badge.fury.io/rb/rack-attack)
|
||||||
[](https://travis-ci.org/kickstarter/rack-attack)
|
[](https://travis-ci.org/kickstarter/rack-attack)
|
||||||
[](https://codeclimate.com/github/kickstarter/rack-attack)
|
[](https://codeclimate.com/github/kickstarter/rack-attack)
|
||||||
|
|
||||||
|
|
@ -155,8 +155,8 @@ end
|
||||||
#### Fail2Ban
|
#### Fail2Ban
|
||||||
|
|
||||||
`Fail2Ban.filter` can be used within a blocklist to block all requests from misbehaving clients.
|
`Fail2Ban.filter` can be used within a blocklist to block all requests from misbehaving clients.
|
||||||
This pattern is inspired by [fail2ban](http://www.fail2ban.org/wiki/index.php/Main_Page).
|
This pattern is inspired by [fail2ban](https://www.fail2ban.org/wiki/index.php/Main_Page).
|
||||||
See the [fail2ban documentation](http://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Jail_Options) for more details on
|
See the [fail2ban documentation](https://www.fail2ban.org/wiki/index.php/MANUAL_0_8#Jail_Options) for more details on
|
||||||
how the parameters work. For multiple filters, be sure to put each filter in a separate blocklist and use a unique discriminator for each fail2ban filter.
|
how the parameters work. For multiple filters, be sure to put each filter in a separate blocklist and use a unique discriminator for each fail2ban filter.
|
||||||
|
|
||||||
Fail2ban state is stored in a [configurable cache](#cache-store-configuration) (which defaults to `Rails.cache` if present).
|
Fail2ban state is stored in a [configurable cache](#cache-store-configuration) (which defaults to `Rails.cache` if present).
|
||||||
|
|
@ -272,7 +272,7 @@ Note that `Rack::Attack.cache` is only used for throttling, allow2ban and fail2b
|
||||||
|
|
||||||
## Customizing responses
|
## Customizing responses
|
||||||
|
|
||||||
Customize the response of blocklisted and throttled requests using an object that adheres to the [Rack app interface](http://rack.rubyforge.org/doc/SPEC.html).
|
Customize the response of blocklisted and throttled requests using an object that adheres to the [Rack app interface](http://www.rubydoc.info/github/rack/rack/file/SPEC).
|
||||||
|
|
||||||
```ruby
|
```ruby
|
||||||
Rack::Attack.blocklisted_response = lambda do |env|
|
Rack::Attack.blocklisted_response = lambda do |env|
|
||||||
|
|
@ -388,7 +388,7 @@ so try to keep the number of throttle checks per request low.
|
||||||
If a request is blocklisted or throttled, the response is a very simple Rack response.
|
If a request is blocklisted or throttled, the response is a very simple Rack response.
|
||||||
A single typical ruby web server thread can block several hundred requests per second.
|
A single typical ruby web server thread can block several hundred requests per second.
|
||||||
|
|
||||||
Rack::Attack complements tools like `iptables` and nginx's [limit_conn_zone module](http://nginx.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn_zone).
|
Rack::Attack complements tools like `iptables` and nginx's [limit_conn_zone module](https://nginx.org/en/docs/http/ngx_http_limit_conn_module.html#limit_conn_zone).
|
||||||
|
|
||||||
## Motivation
|
## Motivation
|
||||||
|
|
||||||
|
|
@ -408,7 +408,7 @@ adhere to the [Code of Conduct](CODE_OF_CONDUCT.md).
|
||||||
|
|
||||||
### Testing pull requests
|
### Testing pull requests
|
||||||
|
|
||||||
To run the minitest test suite, you will need both [Redis](http://redis.io/) and
|
To run the minitest test suite, you will need both [Redis](https://redis.io/) and
|
||||||
[Memcached](https://memcached.org/) running locally and bound to IP `127.0.0.1` on
|
[Memcached](https://memcached.org/) running locally and bound to IP `127.0.0.1` on
|
||||||
default ports (`6379` for Redis, and `11211` for Memcached) and able to be
|
default ports (`6379` for Redis, and `11211` for Memcached) and able to be
|
||||||
accessed without authentication.
|
accessed without authentication.
|
||||||
|
|
@ -434,4 +434,4 @@ New releases of Rack::Attack are announced on
|
||||||
|
|
||||||
Copyright Kickstarter, PBC.
|
Copyright Kickstarter, PBC.
|
||||||
|
|
||||||
Released under an [MIT License](http://opensource.org/licenses/MIT).
|
Released under an [MIT License](https://opensource.org/licenses/MIT).
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ module Rack
|
||||||
|
|
||||||
def key_and_expiry(unprefixed_key, period)
|
def key_and_expiry(unprefixed_key, period)
|
||||||
epoch_time = Time.now.to_i
|
epoch_time = Time.now.to_i
|
||||||
# Add 1 to expires_in to avoid timing error: http://git.io/i1PHXA
|
# Add 1 to expires_in to avoid timing error: https://git.io/i1PHXA
|
||||||
expires_in = (period - (epoch_time % period) + 1).to_i
|
expires_in = (period - (epoch_time % period) + 1).to_i
|
||||||
["#{prefix}:#{(epoch_time / period).to_i}:#{unprefixed_key}", expires_in]
|
["#{prefix}:#{(epoch_time / period).to_i}:#{unprefixed_key}", expires_in]
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ class Rack::Attack
|
||||||
|
|
||||||
# When using Rack::Attack with a Rails app, developers expect the request path
|
# When using Rack::Attack with a Rails app, developers expect the request path
|
||||||
# to be normalized. In particular, trailing slashes are stripped.
|
# to be normalized. In particular, trailing slashes are stripped.
|
||||||
# (See http://git.io/v0rrR for implementation.)
|
# (See https://git.io/v0rrR for implementation.)
|
||||||
#
|
#
|
||||||
# Look for an ActionDispatch utility class that Rails folks would expect
|
# Look for an ActionDispatch utility class that Rails folks would expect
|
||||||
# to normalize request paths. If unavailable, use a fallback class that
|
# to normalize request paths. If unavailable, use a fallback class that
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ Gem::Specification.new do |s|
|
||||||
s.email = "aaron@ktheory.com"
|
s.email = "aaron@ktheory.com"
|
||||||
|
|
||||||
s.files = Dir.glob("{bin,lib}/**/*") + %w(Rakefile README.md)
|
s.files = Dir.glob("{bin,lib}/**/*") + %w(Rakefile README.md)
|
||||||
s.homepage = 'http://github.com/kickstarter/rack-attack'
|
s.homepage = 'https://github.com/kickstarter/rack-attack'
|
||||||
s.rdoc_options = ["--charset=UTF-8"]
|
s.rdoc_options = ["--charset=UTF-8"]
|
||||||
s.require_paths = ["lib"]
|
s.require_paths = ["lib"]
|
||||||
s.summary = %q{Block & throttle abusive requests}
|
s.summary = %q{Block & throttle abusive requests}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue