diff --git a/Gemfile b/Gemfile index dd465bb..6a9a35e 100644 --- a/Gemfile +++ b/Gemfile @@ -14,6 +14,7 @@ gem 'jbuilder' gem 'activeresource', github: 'rails/activeresource', require: 'active_resource' gem 'pry-rails' +gem "rack-attack", "~> 6.7" # gem 'spreadsheet_architect' diff --git a/Gemfile.lock b/Gemfile.lock index bab908e..24edf39 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -144,6 +144,8 @@ GEM nio4r (~> 2.0) racc (1.6.0) rack (2.2.4) + rack-attack (6.7.0) + rack (>= 1.0, < 4) rack-test (2.0.2) rack (>= 1.3) rails (6.0.5.1) @@ -226,6 +228,7 @@ DEPENDENCIES pg pry-rails puma (< 5) + rack-attack (~> 6.7) rails (~> 6.0.4) sass-rails spring diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb new file mode 100644 index 0000000..553e327 --- /dev/null +++ b/config/initializers/rack_attack.rb @@ -0,0 +1,5 @@ +require "net/http" + +Net::HTTP.get(URI("https://lists.fissionrelays.net/tor/exits.txt")).split("\n").each do |tor_exit| + Rack::Attack.blocklist_ip(tor_exit) +end