# urbestack-modsec-rule-set

First published 19 Nov 2026 (release 0.2.30) · Unchanged since publication

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

## Usage

```
urbestack-modsec-rule-set --rule NUMBER [--enabled on|off] [--note TEXT] [--text-stdin < RULE]
```

## Description

Changes the custom ModSecurity rule selected by --rule. Give at least one of --enabled, --note or --text-stdin. Use --enabled on or off to switch the rule on or off. Use --note to describe its purpose in one line, or pass an empty string to clear the note.

With --text-stdin, supply one rule on standard input as a SecRule or SecAction directive or a complete chain. Put the rule number in an id:N action on the first directive. A different number renumbers the rule. It must be unused by other custom rules. Numbers from 90000 onward are reserved for UrbeStack and the rule set.

Enabling a rule or replacing the text of a rule that will remain enabled requires UrbeStack to manage ModSecurity and Apache to load the module. Apache tests its configuration before applying the change. If Apache rejects it, UrbeStack keeps the previous rule and returns Apache's error. You can switch a rule off even if Apache would reject its text.

## Same in the API

- [PATCH /security/modsec/rules/{id}](https://urbestack.com/docs/api/patch-security-modsec-rules-id.md): Update a custom ModSecurity rule

## Command family: modsec

- [urbestack-modsec-disabled-rule-add](https://urbestack.com/docs/commands/urbestack-modsec-disabled-rule-add.md): Turns off ModSecurity detection rules for one domain or for the whole server.
- [urbestack-modsec-disabled-rule-del](https://urbestack.com/docs/commands/urbestack-modsec-disabled-rule-del.md): Removes the setting that turns off a ModSecurity rule for one domain or for the whole server.
- [urbestack-modsec-disabled-rules](https://urbestack.com/docs/commands/urbestack-modsec-disabled-rules.md): Lists the ModSecurity rule set's detection rules that are turned off.
- [urbestack-modsec-domains](https://urbestack.com/docs/commands/urbestack-modsec-domains.md): Lists domains with their effective ModSecurity mode, the mode set for each domain and who set it and when, and its owner's choice.
- [urbestack-modsec-install](https://urbestack.com/docs/commands/urbestack-modsec-install.md): Installs the distribution's ModSecurity package.
- [urbestack-modsec-requests](https://urbestack.com/docs/commands/urbestack-modsec-requests.md): Lists requests ModSecurity blocked or would have blocked in logging mode, newest first.
- [urbestack-modsec-rule-add](https://urbestack.com/docs/commands/urbestack-modsec-rule-add.md): Adds a server-wide custom ModSecurity rule from standard input.
- [urbestack-modsec-rule-del](https://urbestack.com/docs/commands/urbestack-modsec-rule-del.md): Deletes a custom ModSecurity rule.
- [urbestack-modsec-rules](https://urbestack.com/docs/commands/urbestack-modsec-rules.md): Lists the custom ModSecurity rules shown in the ModSecurity section of the web interface, in rule number order.
- [urbestack-modsec-set](https://urbestack.com/docs/commands/urbestack-modsec-set.md): Sets the server's ModSecurity mode, changes who manages ModSecurity, or does both.
- [urbestack-modsec-sort](https://urbestack.com/docs/commands/urbestack-modsec-sort.md): Sorts ModSecurity audit records into domain logs.
- [urbestack-modsec-status](https://urbestack.com/docs/commands/urbestack-modsec-status.md): Reports whether UrbeStack manages ModSecurity, the configured server mode, and whether the module is installed and loaded by Apache.
