summaryrefslogtreecommitdiff
path: root/config/initializers
diff options
context:
space:
mode:
authorMarin Jankovski <maxlazio@gmail.com>2013-09-26 22:40:55 +0200
committerMarin Jankovski <maxlazio@gmail.com>2013-09-30 11:10:46 +0200
commit055b60d4200aeee0eeab762f162c05305e58c41d (patch)
tree46efa952dcd01e92fa6217bed2b0f990261253f9 /config/initializers
parentc562d290eaab16f8e72e7e3e9ff188e172372226 (diff)
downloadgitlab-ce-055b60d4200aeee0eeab762f162c05305e58c41d.tar.gz
Add documentation to help section, rack_attack as example
Diffstat (limited to 'config/initializers')
-rw-r--r--config/initializers/rack_attack.rb3
-rw-r--r--config/initializers/rack_attack.rb.example16
2 files changed, 16 insertions, 3 deletions
diff --git a/config/initializers/rack_attack.rb b/config/initializers/rack_attack.rb
deleted file mode 100644
index 88e638ba118..00000000000
--- a/config/initializers/rack_attack.rb
+++ /dev/null
@@ -1,3 +0,0 @@
-Rack::Attack.throttle('user logins, registration and password reset', limit: 6, period: 60.seconds) do |req|
- req.ip if ["/users/password", "/users/sign_in", "/users"].include?(req.path) && req.post?
-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