summaryrefslogtreecommitdiff
path: root/config
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-01 08:14:05 +0000
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-01 08:14:05 +0000
commitac6180bcb04d3f7486b87bf1a950e8250c6e27a5 (patch)
tree5143ef5d9da3628c35ac2e5fe520d9e118abe51d /config
parent9ffabc6d7ed0c71d133a29671b50795fb621522c (diff)
parent775aa5ba7ce5ef335bcae81bbc2bf8b7b1321303 (diff)
downloadgitlab-ce-ac6180bcb04d3f7486b87bf1a950e8250c6e27a5.tar.gz
Merge branch 'rack_attack' of /home/git/repositories/gitlab/gitlabhq
Diffstat (limited to 'config')
-rw-r--r--config/application.rb3
-rw-r--r--config/initializers/rack_attack.rb.example16
-rw-r--r--config/routes.rb1
3 files changed, 20 insertions, 0 deletions
diff --git a/config/application.rb b/config/application.rb
index f483ccdad17..d85bcab7885 100644
--- a/config/application.rb
+++ b/config/application.rb
@@ -77,5 +77,8 @@ module Gitlab
# 3) In your unicorn.rb: ENV['RAILS_RELATIVE_URL_ROOT'] = "/gitlab"
#
# config.relative_url_root = "/gitlab"
+
+ # Uncomment to enable rack attack middleware
+ # config.middleware.use Rack::Attack
end
end
diff --git a/config/initializers/rack_attack.rb.example b/config/initializers/rack_attack.rb.example
new file mode 100644
index 00000000000..76fa7ad282e
--- /dev/null
+++ b/config/initializers/rack_attack.rb.example
@@ -0,0 +1,16 @@
+# To enable rack-attack for your GitLab instance do the following:
+# 1. In config/application.rb find and uncomment the following line:
+# config.middleware.use Rack::Attack
+# 2. Rename this file to rack_attack.rb
+# 3. Review the paths_to_be_protected and add any other path you need protecting
+# 4. Restart GitLab instance
+#
+
+paths_to_be_protected = [
+ "#{Rails.application.config.relative_url_root}/users/password",
+ "#{Rails.application.config.relative_url_root}/users/sign_in",
+ "#{Rails.application.config.relative_url_root}/users"
+]
+Rack::Attack.throttle('protected paths', limit: 6, period: 60.seconds) do |req|
+ req.ip if paths_to_be_protected.include?(req.path) && req.post?
+end
diff --git a/config/routes.rb b/config/routes.rb
index 9d47faa19d5..612a7327ec5 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -39,6 +39,7 @@ Gitlab::Application.routes.draw do
get 'help/web_hooks' => 'help#web_hooks'
get 'help/workflow' => 'help#workflow'
get 'help/shortcuts'
+ get 'help/security'
#
# Global snippets