Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upAre we able to whitelist a subnet of IPs? #98
Comments
This comment has been minimized.
This comment has been minimized.
You can use require 'ipaddr'
Rack::Attack.whitelist('allow from 199.27.128.0/21') do |request|
IPaddr.new('199.27.128.0/21').include? request.ip
end |
This comment has been minimized.
This comment has been minimized.
@shanaver: I recommend @gsamokovarov's solution above. Cheers. |
ktheory
closed this
Oct 18, 2014
This comment has been minimized.
This comment has been minimized.
bensomers
commented
Oct 18, 2014
Word to the wise: past versions of IPAddr have had very serious memory leaks - I attempted to use it in a blacklisting tool and it wasn't remotely feasible. Don't know about the current version - I believe that was on an early 1.9.2 release. |
This comment has been minimized.
This comment has been minimized.
thanks for the input everyone - perfect. |
grzuy
added
type: question
area: safelist
labels
Mar 20, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
shanaver commentedOct 17, 2014
For example, all of CloudFlare's IPs:
199.27.128.0/21
173.245.48.0/20
103.21.244.0/22
103.22.200.0/22
103.31.4.0/22
141.101.64.0/18
108.162.192.0/18
190.93.240.0/20
188.114.96.0/20
197.234.240.0/22
198.41.128.0/17
162.158.0.0/15
104.16.0.0/12
How would I create a rule to whitelist all of those?