=_("Omnibus Protected Paths throttle is active, and takes priority over these settings. From 12.4, Omnibus throttle is deprecated and will be removed in a future release. Please read the %{relative_url_link_start}Migrating Protected Paths documentation%{relative_url_link_end}.").html_safe%{relative_url_link_start: relative_url_link_start,relative_url_link_end: '</a>'.html_safe}
=_('All paths are relative to the GitLab URL. Do not include %{relative_url_link_start}relative URL%{relative_url_link_end}.').html_safe%{relative_url_link_start: relative_url_link_start,relative_url_link_end: '</a>'.html_safe}
=_('All paths are relative to the GitLab URL. Do not include %{relative_url_link_start}relative URLs%{relative_url_link_end}.').html_safe%{relative_url_link_start: relative_url_link_start,relative_url_link_end: '</a>'.html_safe}
@@ -15,9 +15,7 @@ performance, data, or could even exhaust the allocated resources for the applica
...
@@ -15,9 +15,7 @@ performance, data, or could even exhaust the allocated resources for the applica
Rate limits can be used to improve the security and durability of GitLab.
Rate limits can be used to improve the security and durability of GitLab.
For example, one script can make thousands of web requests per second. Whether malicious, apathetic, or just a bug, your application and infrastructure may not be able to cope with the load. Rate limits can help to mitigate these types of attacks.
Read more about [configuring rate limits](../security/rate_limits.md).
Read more about [configuring rate limits](../security/rate_limits.md) in the Security documentation.
### Issue creation
### Issue creation
...
@@ -128,16 +126,6 @@ This setting limits the import/export actions for groups and projects.
...
@@ -128,16 +126,6 @@ This setting limits the import/export actions for groups and projects.
Read more about [import/export rate limits](../user/admin_area/settings/import_export_rate_limits.md).
Read more about [import/export rate limits](../user/admin_area/settings/import_export_rate_limits.md).
### Rack attack
This method of rate limiting is cumbersome, but has some advantages. It allows
throttling of specific paths, and is also integrated into Git and container
registry requests.
Read more about the [Rack Attack initializer](../security/rack_attack.md) method of setting rate limits.
-**Default rate limit**: Disabled.
### Member Invitations
### Member Invitations
Limit the maximum daily member invitations allowed per group hierarchy.
Limit the maximum daily member invitations allowed per group hierarchy.
@@ -411,11 +411,11 @@ listed in the descriptions of the relevant settings.
...
@@ -411,11 +411,11 @@ listed in the descriptions of the relevant settings.
| `terminal_max_session_time` | integer | no | Maximum time for web terminal websocket connection (in seconds). Set to `0` for unlimited time. |
| `terminal_max_session_time` | integer | no | Maximum time for web terminal websocket connection (in seconds). Set to `0` for unlimited time. |
| `terms` | text | required by: `enforce_terms` | (**Required by:**`enforce_terms`) Markdown content for the ToS. |
| `terms` | text | required by: `enforce_terms` | (**Required by:**`enforce_terms`) Markdown content for the ToS. |
| `throttle_authenticated_api_enabled` | boolean | no | (**If enabled, requires:**`throttle_authenticated_api_period_in_seconds` and `throttle_authenticated_api_requests_per_period`) Enable authenticated API request rate limit. Helps reduce request volume (for example, from crawlers or abusive bots). |
| `throttle_authenticated_api_enabled` | boolean | no | (**If enabled, requires:**`throttle_authenticated_api_period_in_seconds` and `throttle_authenticated_api_requests_per_period`) Enable authenticated API request rate limit. Helps reduce request volume (for example, from crawlers or abusive bots). |
| `throttle_authenticated_api_period_in_seconds` | integer | required by:<br>`throttle_authenticated_api_enabled` | Rate limit period in seconds. |
| `throttle_authenticated_api_period_in_seconds` | integer | required by:<br>`throttle_authenticated_api_enabled` | Rate limit period (in seconds). |
| `throttle_authenticated_api_requests_per_period` | integer | required by:<br>`throttle_authenticated_api_enabled` | Max requests per period per user. |
| `throttle_authenticated_api_requests_per_period` | integer | required by:<br>`throttle_authenticated_api_enabled` | Maximum requests per period per user. |
| `throttle_authenticated_web_enabled` | boolean | no | (**If enabled, requires:**`throttle_authenticated_web_period_in_seconds` and `throttle_authenticated_web_requests_per_period`) Enable authenticated web request rate limit. Helps reduce request volume (for example, from crawlers or abusive bots). |
| `throttle_authenticated_web_enabled` | boolean | no | (**If enabled, requires:**`throttle_authenticated_web_period_in_seconds` and `throttle_authenticated_web_requests_per_period`) Enable authenticated web request rate limit. Helps reduce request volume (for example, from crawlers or abusive bots). |
| `throttle_authenticated_web_period_in_seconds` | integer | required by:<br>`throttle_authenticated_web_enabled` | Rate limit period in seconds. |
| `throttle_authenticated_web_period_in_seconds` | integer | required by:<br>`throttle_authenticated_web_enabled` | Rate limit period (in seconds). |
| `throttle_authenticated_web_requests_per_period` | integer | required by:<br>`throttle_authenticated_web_enabled` | Max requests per period per user. |
| `throttle_authenticated_web_requests_per_period` | integer | required by:<br>`throttle_authenticated_web_enabled` | Maximum requests per period per user. |
| `throttle_unauthenticated_enabled` | boolean | no | ([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/335300) in GitLab 14.3. Use `throttle_unauthenticated_web_enabled` or `throttle_unauthenticated_api_enabled` instead.) (**If enabled, requires:**`throttle_unauthenticated_period_in_seconds` and `throttle_unauthenticated_requests_per_period`) Enable unauthenticated web request rate limit. Helps reduce request volume (for example, from crawlers or abusive bots). |
| `throttle_unauthenticated_enabled` | boolean | no | ([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/335300) in GitLab 14.3. Use `throttle_unauthenticated_web_enabled` or `throttle_unauthenticated_api_enabled` instead.) (**If enabled, requires:**`throttle_unauthenticated_period_in_seconds` and `throttle_unauthenticated_requests_per_period`) Enable unauthenticated web request rate limit. Helps reduce request volume (for example, from crawlers or abusive bots). |
| `throttle_unauthenticated_period_in_seconds` | integer | required by:<br>`throttle_unauthenticated_enabled` | ([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/335300) in GitLab 14.3. Use `throttle_unauthenticated_web_period_in_seconds` or `throttle_unauthenticated_api_period_in_seconds` instead.) Rate limit period in seconds. |
| `throttle_unauthenticated_period_in_seconds` | integer | required by:<br>`throttle_unauthenticated_enabled` | ([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/335300) in GitLab 14.3. Use `throttle_unauthenticated_web_period_in_seconds` or `throttle_unauthenticated_api_period_in_seconds` instead.) Rate limit period in seconds. |
| `throttle_unauthenticated_requests_per_period` | integer | required by:<br>`throttle_unauthenticated_enabled` | ([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/335300) in GitLab 14.3. Use `throttle_unauthenticated_web_requests_per_period` or `throttle_unauthenticated_api_requests_per_period` instead.) Max requests per period per IP. |
| `throttle_unauthenticated_requests_per_period` | integer | required by:<br>`throttle_unauthenticated_enabled` | ([Deprecated](https://gitlab.com/gitlab-org/gitlab/-/issues/335300) in GitLab 14.3. Use `throttle_unauthenticated_web_requests_per_period` or `throttle_unauthenticated_api_requests_per_period` instead.) Max requests per period per IP. |
info:To determine the technical writer assigned to the Stage/Group associated with this page, see https://about.gitlab.com/handbook/engineering/ux/technical-writing/#assignments
type:reference, howto
---
---
# Rack Attack initializer **(FREE SELF)**
This document was moved to [another location](../user/admin_area/settings/protected_paths.md).
[Rack Attack](https://github.com/kickstarter/rack-attack), also known as Rack::Attack, is a Ruby gem
<!-- This redirect file can be deleted after <2022-01-14>. -->
that is meant to protect GitLab with the ability to customize throttling and
<!-- Before deletion, see: https://docs.gitlab.com/ee/development/documentation/#move-or-rename-a-page -->
to block user IP addresses.
You can prevent brute-force passwords attacks, scrapers, or any other offenders
by throttling requests from IP addresses that are making large volumes of requests.
If you find throttling is not enough to protect you against abusive clients,
Rack Attack offers IP whitelisting, blacklisting, Fail2ban style filtering, and
tracking.
For more information on how to use these options see the [Rack Attack README](https://github.com/kickstarter/rack-attack/blob/master/README.md).
NOTE:
See
[User and IP rate limits](../user/admin_area/settings/user_and_ip_rate_limits.md)
for simpler limits that are configured in the UI.
NOTE:
Starting with GitLab 11.2, Rack Attack is disabled by default. If your
instance is not exposed to the public internet, it is recommended that you leave
Rack Attack disabled.
## Behavior
If set up as described in the [Settings](#settings) section below, two behaviors
are enabled:
- Protected paths are throttled.
- Failed authentications for Git and container registry requests trigger a temporary IP ban.
### Protected paths throttle
GitLab responds with HTTP status code `429` to POST requests at protected paths
that exceed 10 requests per minute per IP address.
By default, protected paths are:
-`/users/password`
-`/users/sign_in`
-`/api/#{API::API.version}/session.json`
-`/api/#{API::API.version}/session`
-`/users`
-`/users/confirmation`
-`/unsubscribes/`
-`/import/github/personal_access_token`
-`/admin/session`
See [User and IP rate limits](../user/admin_area/settings/user_and_ip_rate_limits.md#response-headers) for the headers responded to blocked requests.
For example, the following are limited to a maximum 10 requests per minute:
- User sign-in
- User sign-up (if enabled)
- User password reset
After 10 requests, the client must wait a minute before it can
try again.
### Git and container registry failed authentication ban
GitLab responds with HTTP status code `403` for 1 hour, if 30 failed
authentication requests were received in a 3-minute period from a single IP address.
This applies only to Git requests and container registry (`/jwt/auth`) requests
(combined).
This limit:
- Is reset by requests that authenticate successfully. For example, 29
failed authentication requests followed by 1 successful request, followed by 29
more failed authentication requests would not trigger a ban.
- Does not apply to JWT requests authenticated by `gitlab-ci-token`.
No response headers are provided.
## Settings
**Omnibus GitLab**
1. Open `/etc/gitlab/gitlab.rb` with your editor
1. Add the following:
```ruby
gitlab_rails['rack_attack_git_basic_auth']={
'enabled'=>true,
'ip_whitelist'=>["127.0.0.1"],
'maxretry'=>10,# Limit the number of Git HTTP authentication attempts per IP
'findtime'=>60,# Reset the auth attempt counter per IP after 60 seconds
'bantime'=>3600# Ban an IP for one hour (3600s) after too many auth attempts
}
```
1. Reconfigure GitLab:
```shell
sudo gitlab-ctl reconfigure
```
The following settings can be configured:
-`enabled`: By default this is set to `false`. Set this to `true` to enable Rack Attack.
-`ip_whitelist`: Whitelist any IPs from being blocked. They must be formatted as strings within a Ruby array.
CIDR notation is supported in GitLab 12.1 and later.
For example, `["127.0.0.1", "127.0.0.2", "127.0.0.3", "192.168.0.1/24"]`.
-`maxretry`: The maximum amount of times a request can be made in the
specified time.
-`findtime`: The maximum amount of time that failed requests can count against an IP
before it's blacklisted (in seconds).
-`bantime`: The total amount of time that a blacklisted IP is blocked (in
seconds).
**Installations from source**
These settings can be found in `config/initializers/rack_attack.rb`. If you are
missing `config/initializers/rack_attack.rb`, the following steps need to be
taken in order to enable protection for your GitLab instance:
1. In `config/application.rb` find and uncomment the following line:
```ruby
config.middleware.useRack::Attack
```
1. Restart GitLab:
```shell
sudo service gitlab restart
```
If you want more restrictive/relaxed throttle rules, edit
`config/initializers/rack_attack.rb` and change the `limit` or `period` values.
For example, you can set more relaxed throttle rules with
`limit: 3` and `period: 1.seconds`, allowing 3 requests per second.
You can also add other paths to the protected list by adding to `paths_to_be_protected`
variable. If you change any of these settings you must restart your
GitLab instance.
## Remove blocked IPs from Rack Attack via Redis
In case you want to remove a blocked IP, follow these steps:
1. Find the IPs that have been blocked in the production log:
msgid "All merge request dependencies have been merged"
msgid "All merge request dependencies have been merged"
msgstr ""
msgstr ""
msgid "All paths are relative to the GitLab URL. Do not include %{relative_url_link_start}relative URL%{relative_url_link_end}."
msgid "All paths are relative to the GitLab URL. Do not include %{relative_url_link_start}relative URLs%{relative_url_link_end}."
msgstr ""
msgstr ""
msgid "All projects"
msgid "All projects"
...
@@ -8647,9 +8647,6 @@ msgstr ""
...
@@ -8647,9 +8647,6 @@ msgstr ""
msgid "Configure existing installation"
msgid "Configure existing installation"
msgstr ""
msgstr ""
msgid "Configure paths to be protected by Rack Attack."
msgstr ""
msgid "Configure repository mirroring."
msgid "Configure repository mirroring."
msgstr ""
msgstr ""
...
@@ -12703,7 +12700,7 @@ msgstr ""
...
@@ -12703,7 +12700,7 @@ msgstr ""
msgid "Enable or disable version check and Service Ping."
msgid "Enable or disable version check and Service Ping."
msgstr ""
msgstr ""
msgid "Enable protected paths rate limit"
msgid "Enable rate limiting for POST requests to the specified paths"
msgstr ""
msgstr ""
msgid "Enable reCAPTCHA"
msgid "Enable reCAPTCHA"
...
@@ -16841,7 +16838,7 @@ msgstr ""
...
@@ -16841,7 +16838,7 @@ msgstr ""
msgid "Helps reduce request volume (for example, from crawlers or abusive bots)"
msgid "Helps reduce request volume (for example, from crawlers or abusive bots)"
msgstr ""
msgstr ""
msgid "Helps reduce request volume for protected paths"
msgid "Helps reduce request volume for protected paths."
msgstr ""
msgstr ""
msgid "Here you will find recent merge request activity"
msgid "Here you will find recent merge request activity"
...
@@ -23619,9 +23616,6 @@ msgstr ""
...
@@ -23619,9 +23616,6 @@ msgstr ""
msgid "OmniAuth"
msgid "OmniAuth"
msgstr ""
msgstr ""
msgid "Omnibus Protected Paths throttle is active, and takes priority over these settings. From 12.4, Omnibus throttle is deprecated and will be removed in a future release. Please read the %{relative_url_link_start}Migrating Protected Paths documentation%{relative_url_link_end}."
msgstr ""
msgid "On"
msgid "On"
msgstr ""
msgstr ""
...
@@ -24754,6 +24748,9 @@ msgstr ""
...
@@ -24754,6 +24748,9 @@ msgstr ""
msgid "Paths can contain wildcards, like */welcome"
msgid "Paths can contain wildcards, like */welcome"
msgstr ""
msgstr ""
msgid "Paths to protect with rate limiting"
msgstr ""
msgid "Pause"
msgid "Pause"
msgstr ""
msgstr ""
...
@@ -27637,9 +27634,6 @@ msgstr ""
...
@@ -27637,9 +27634,6 @@ msgstr ""
msgid "Protected Environment"
msgid "Protected Environment"
msgstr ""
msgstr ""
msgid "Protected Paths"
msgstr ""
msgid "Protected Paths: requests"
msgid "Protected Paths: requests"
msgstr ""
msgstr ""
...
@@ -27655,6 +27649,9 @@ msgstr ""
...
@@ -27655,6 +27649,9 @@ msgstr ""
msgid "Protected environments"
msgid "Protected environments"
msgstr ""
msgstr ""
msgid "Protected paths"
msgstr ""
msgid "ProtectedBranch|%{wildcards_link_start}Wildcards%{wildcards_link_end} such as %{code_tag_start}*-stable%{code_tag_end} or %{code_tag_start}production/*%{code_tag_end} are supported."
msgid "ProtectedBranch|%{wildcards_link_start}Wildcards%{wildcards_link_end} such as %{code_tag_start}*-stable%{code_tag_end} or %{code_tag_start}production/*%{code_tag_end} are supported."
msgstr ""
msgstr ""
...
@@ -28027,6 +28024,9 @@ msgstr ""
...
@@ -28027,6 +28024,9 @@ msgstr ""
msgid "Rate limit"
msgid "Rate limit"
msgstr ""
msgstr ""
msgid "Rate limit access to specified paths."
msgstr ""
msgid "Rate limits can help reduce request volume (like from crawlers or abusive bots)."
msgid "Rate limits can help reduce request volume (like from crawlers or abusive bots)."
msgstr ""
msgstr ""
...
@@ -34672,9 +34672,6 @@ msgstr ""
...
@@ -34672,9 +34672,6 @@ msgstr ""
msgid "These existing issues have a similar title. It might be better to comment there instead of creating another similar issue."
msgid "These existing issues have a similar title. It might be better to comment there instead of creating another similar issue."
msgstr ""
msgstr ""
msgid "These paths are protected for POST requests."
msgstr ""
msgid "These runners are shared across projects in this group."
msgid "These runners are shared across projects in this group."