Skip to content

Bans Since v0.1 ​

A ban refuses every request from one IP address, on every application, until it ends. You ban a client by hand (from the console, the CLI or an event), or let the product do it: an access rule or a rate limit with action ban, or an automatic ban for a client that is refused again and again. Bans stop a scanner or attacker after the first signs, before it finds something that works.

Before you begin ​

  • Role: to add or lift bans, operator or admin with access to all applications (a ban applies to every application). To set up automatic bans for one application, operator for that application.
  • Bans refuse requests only where the application and its access module are in block. In detect, a banned client's requests are logged and pass.

Ban a client by hand ​

text
1. Open Monitor > Clients and bans.
2. Enter the Client IP address.
3. Choose For (15 minutes, 1 hour, 24 hours, 7 days or 30 days;
   default 1 hour) and, optionally, a Reason.
4. Select Ban.
sh
# flags come before the address
waap bans add -for 1h -m "scanner" 203.0.113.9
# ban the client of a security event
waap bans add -for 24h -event EVENT-ID
jsonc
// POST /v1/bans
{"client": "203.0.113.9", "for": "1h", "reason": "scanner"}

The ban reaches every inspection service within a few seconds. A ban from an event records "from event" and the event's transaction ID as its reason, unless you give one with -m.

Ban from a bot's page

On an application's Bot mitigation page, the Clients tab offers a ban for a single client, with its bot score as the reason.

List and lift bans ​

text
1. Open Monitor > Clients and bans.
2. The Banned clients table shows Client, Reason, Source, Since and
   Ends in. Select a client to see its events.
3. To end a ban early, select Lift ban.
sh
waap bans list
waap bans remove 203.0.113.9
text
GET    /v1/bans            list active bans
DELETE /v1/bans/{client}   lift one ban

Source tells you where a ban came from:

SourceCreated by
manual:accounta person, from the console, the CLI or the API
access:rulean access rule with action ban
rate_limits:limita rate limit with action ban
botsa bot score step with action ban (bot mitigation)
repeat-offenderan automatic ban

Adding and lifting bans is recorded in the audit log.

Turn on automatic bans ​

An automatic ban bans a client after it has been refused a number of times, by any module, within a window. All three settings are needed together.

text
1. Open Applications > All applications, and select the application.
2. Open Request checks > Access and rate limits, Automatic bans tab.
3. Set Ban after (blocks), Within and Ban for.
4. Select Preview changes, add a comment and select Apply.
sh
waap apps set -app shop -m "ban repeat offenders" \
  policy.bans.after_blocks=10 policy.bans.within=1m policy.bans.for=1h
# turn them off: clear all three
waap apps set -app shop policy.bans.after_blocks= policy.bans.within= policy.bans.for=
yaml
applications:
  - name: shop
    policy:
      bans:            # remove the section to turn automatic bans off
        after_blocks: 10
        within: 1m
        for: 1h

Automatic bans need the rate-limit module in block

Refusals are counted by the rate-limit module, which runs whenever automatic bans are set. A refusal counts only while the application and Rate limit protection mode are in block, and only when the request was actually refused or challenged. Inspection failures do not count.

One application's automatic ban applies everywhere

The count is per application, but the ban is for the address on every application. A shared address (a corporate gateway, a proxy that is not trusted) can lock out many users at once. Keep Ban after high enough for your busiest shared clients.

Settings reference ​

Automatic bans ​

SettingWhat it doesDefaultAllowed valuesApplies in
Ban after (policy.bans.after_blocks)Refusals of one client, by any module, that trigger a ban.none (no automatic bans)1 to 1000block mode of the application and of rate limits; needs all three
Within (policy.bans.within)The window the refusals are counted in.noneduration, 1s to 24has above
Ban for (policy.bans.for)How long the ban lasts.noneduration, 1s to 168has above

Manual ban ​

SettingWhat it doesDefaultAllowed valuesApplies in
Client IP address (client)The address to refuse.none (required)one IPv4 or IPv6 address (not a network)every application
For (for, CLI -for)How long the ban lasts.1hduration, 1s to 720h (the console offers fixed choices)every application
Reason (reason, CLI -m)Stored with the ban and shown in events.manual banat most 200 charactersall

Bans created by an access rule or a rate limit take their duration from that rule's Ban for. For details, see Access rules and Rate limits.

Examples ​

Ban after ten refusals in a minute, for an hour (a common starting point):

yaml
bans: {after_blocks: 10, within: 1m, for: 1h}

A stricter setting for a login-only application, combined with a login rate limit:

yaml
bans: {after_blocks: 5, within: 10m, for: 24h}
rate_limits:
  rules:
    - name: login
      when: {paths: ["/login"], methods: [POST]}
      limit: 5
      per: 1m

Limits ​

LimitValue
Manual ban duration1s to 720h (30 days)
Rule and automatic ban duration1s to 168h (7 days)
Ban after1 to 1000 refusals
Within1s to 24h
Reason200 characters
Events while bannedthe first refused request per client each minute is recorded (metrics count all)
High availabilitybans are copied from the active node to the standby; refusal counts are per node

Troubleshooting ​

policy.bans.within: must be between 1s and 24h0m0s after setting only Ban after ​

  • Cause: automatic bans need all three settings.
  • Fix: set Ban after, Within and Ban for in the same change. To turn them off, clear all three (Use default on each field, or KEY= in waap apps set).

A banned client still reaches the application ​

  • Cause: the application or Access protection mode is in detect, or the ban is on a proxy's address rather than the client's.
  • Check: waap bans list; the events of the client (rule ID banned).
  • Fix: switch to block, or add the proxy under Traffic > Trusted proxies and ban the real address.

Automatic bans never happen ​

  • Cause: Rate limit protection mode or the application is in detect, or the refusals are spread over more time than Within.
  • Fix: set both to block; check the refusal count against Ban after and Within.

waap bans add bans for 1 hour although I gave -for ​

  • Cause: flags after the address are not read.
  • Fix: put the flags first: waap bans add -for 24h 203.0.113.9.

for must be a duration between 1s and 720h0m0s ​

  • Cause: a manual ban lasts at most 30 days, written in hours (720h; there is no d).
  • Fix: use a shorter duration.