Create IP Penalty
POST /obp/v7.0.0/management/ip-penalties
OBPv7.0.0-createIpPenalty Roles: CanCreateIpPenalty Rate-LimitsSystem
Put one IP address under a temporary per-minute limit, for example during a denial-of-service or scanning incident.
An IP penalty limits one IP address to a number of requests per minute, on every endpoint of
this instance, until it expires. A per_minute_limit of 0 refuses every request. A refused
request gets 429 OBP-10062. Penalties are always
enforced, are shared by every instance (they are kept in Redis), and disappear by themselves
when they expire. The endpoints under /management/ip-penalties are never refused because of a
penalty, so a mistake can always be undone.
The address is the client address OBP-API resolves for the request. Behind a proxy that does not pass on the client's address, that is the proxy's address, and a penalty on it restricts everyone behind the proxy.
duration_minutes is from 1 to 10080 (one week). An address can have one
penalty at a time: to change it, delete it and create it again (409 when one exists).
User Authentication is Required. The User must be logged in. The Application must also be authenticated.
JSON request body fields (4)
- duration_minutes
- duration_minutes
- ip_address
- 198.51.100.42
- per_minute_limit
- per_minute_limit
- reason
- reason
JSON response body fields (6)
- created_at
- created_at
- created_by_user_id
- expires_at
- expires_at
- ip_address
- 198.51.100.42
- per_minute_limit
- per_minute_limit
- reason
- reason
Example request body
{
"ip_address": "203.0.113.42",
"per_minute_limit": 10,
"duration_minutes": 60,
"reason": "Vulnerability scan: about 900 requests a minute to resource-docs with changing filters"
}Example success response
{
"ip_address": "203.0.113.42",
"per_minute_limit": 10,
"reason": "Vulnerability scan: about 900 requests a minute to resource-docs with changing filters",
"created_by_user_id": "9ca9a7e4-6d02-40e3-a129-0b2bf89de9b1",
"created_at": "1100-01-01T01:01:01Z",
"expires_at": "1100-01-01T01:01:01Z"
}Possible errors (7)
- OBP-20001: User not logged in. Authentication is required!
- OBP-20006: User is missing one or more roles:
- OBP-10001: Incorrect json format.
- OBP-10066: Invalid IP penalty. per_minute_limit must be 0 or more, duration_minutes between 1 and 10080 (one week), and reason between 1 and 255 characters.
- OBP-10063: Invalid IP address. Give an IPv4 or IPv6 address, not a host name.
- OBP-10064: This IP address already has a penalty. Remove it first to change it.
- OBP-50000: Unknown Error.