2014-12-15 12:47:26 -05:00
|
|
|
unless Rails.env.test?
|
2014-12-18 05:08:11 -05:00
|
|
|
# Tell the Rack::Attack Rack middleware to maintain an IP blacklist. We will
|
|
|
|
# update the blacklist from Grack::Auth#authenticate_user.
|
2014-12-15 12:47:26 -05:00
|
|
|
Rack::Attack.blacklist('Git HTTP Basic Auth') do |req|
|
|
|
|
Rack::Attack::Allow2Ban.filter(req.ip, Gitlab.config.rack_attack.git_basic_auth) do
|
|
|
|
# This block only gets run if the IP was not already banned.
|
|
|
|
# Return false, meaning that we do not see anything wrong with the
|
|
|
|
# request at this time
|
|
|
|
false
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|