# urbestack-jail-add

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 command, run as root in the server shell.

## Usage

```
urbestack-jail-add --name NAME --log /path/to/log --pattern 'REGEX with <HOST>' [--tries 5] [--window 10m] [--bantime 1h] [--scope all|mail|web] [--off]
```

## Description

Adds a custom ban rule. Choose a name of up to 32 characters that no custom or shipped rule already uses. Fail2ban reserves the names default and includes. Give --log the absolute path to an existing log file. Give --pattern a single-line regular expression of up to 500 characters, with <HOST> where the IP address appears.

--tries sets how many matches for an IP address within --window trigger a ban. The default is 5 matches in 10m. --tries accepts 1 to 1000, and --window accepts 10 seconds to 30 days. --bantime defaults to 1h and accepts 10 seconds to 366 days. Enter durations in whole seconds or with a unit, as in 10s, 10m, 1h, 2d or 1w.

--scope defaults to all, which blocks all ports. Use mail or web to limit bans to the corresponding ports. The rule is enabled by default. Use --off to add it disabled.

## Same in the API

- [POST /security/jails](https://urbestack.com/docs/api/post-security-jails.md): Create a custom ban rule

## Command family: jail

- [urbestack-jail-del](https://urbestack.com/docs/commands/urbestack-jail-del.md): Removes a custom ban rule.
- [urbestack-jail-list](https://urbestack.com/docs/commands/urbestack-jail-list.md): Lists the ban rules shipped with UrbeStack, followed by custom rules in name order.
- [urbestack-jail-set](https://urbestack.com/docs/commands/urbestack-jail-set.md): Updates an existing ban rule.
- [urbestack-jail-test](https://urbestack.com/docs/commands/urbestack-jail-test.md): Tests a ban rule or a regular expression against up to 1,000 of the most recent lines from a log file or systemd journal.
