Rules
List all rules
Request
Definition
GET /api/v1/rules
Headers
-
Authorization
requiredAuthentication token with privileges to view the resource.
Bearer {token}
Query string parameters
Parameter | Type | Required | Description |
---|---|---|---|
paginate | boolean | Yes | If the result must be paginated. |
page | integer | Yes if paginate is true | Page index. |
page_size | integer | Yes if paginate is true | Number of items displayed per page. |
id | string | No | Filters results whose ID matches the entered string. |
id_list | array<string> | No | Filters results whose id matches any of the list items. |
kind | string | No | Filters results whose kind matches the entered string. |
pattern | string | No | Filters results where the pattern matches the entered string. |
rq_host | string | No | Filters results where the Host matches the entered string. |
rq_host_list | array<string> | No | Filters results whose Host matches any of the entered Hosts list. |
rq_host_search | string | No | Filters results whose Host matches all or part of the entered string. |
target | string | No | Filters results whose target matches the entered string. |
target_list | array<string> | No | Filters results whose target matches any of the targets in the entered list. |
target_search | string | No | Filters results whose target matches all or part of the entered string. |
action | string | No | Filters results related to the action entered. |
action_list | array<string> | No | Filters the results related to the list of actions entered. |
not_action_list | array<string> | No | Filters the results whose action does not match any of the actions in the list entered. |
network_only | boolean | No | If true, filters the network rules. |
alert_id | string | No | Filters the results related to the alert whose ID was entered. |
alert_id_list | array<string> | No | Filters the results related to the alerts (indicated by their ID) in the inserted list. |
attack_code | string | No | Filters the results related to the attack code entered. |
attack_code_list | array<string> | No | Filters the results related to the entered attack code list. |
timestamp | integer | No | Filters the results related to the timestamp entered. |
timestamp_start | integer | No | Filters results created after the date entered. |
timestamp_end | integer | No | Filters results created before the date entered. |
username | string | No | Filters the results whose username of the person who created the rule matches the string entered. |
username_list | array<string> | No | Filters the results where the username of the rule matches one of the items in the list. |
username_search | string | No | Filters results where the username of the person who created the rule matches all or part of the specified string. |
Response
Status codes
Status code | Message |
---|---|
200 | "List of rules" |
400 | "Error with pagination fields" |
403 | "Forbidden" |
Body
- Attributes
- Example
-
data.rules.action
stringAction defined in the rule.
-
data.rules.attack_category
stringAttack category.
-
data.rules.attack_code
stringCode identifying the type of attack.
-
data.rules.attack_name
stringType of attack.
-
data.rules.case_sensitive
booleanIndicates whether the rule match should be case sensitive.
-
data.rules.id
stringRule ID.
-
data.rules.alert_id
stringIdentification code of the alert to which the rule refers.
-
data.rules.deleted
booleanIndicates whether the rule has been deleted.
-
data.rules.rq_host
stringHost header indicated in request.
-
data.rules.target
stringField of the request on which the rule should act.
-
data.rules.timestamp
integerDate and time in UNIX format (in microseconds) when the rule was created.
-
data.rules.username
stringUsername of who created rule.
-
data.rules.description
stringRule description.
-
data.rules.duration
integerRule duration.
-
data.rules.enabled
booleanIndicates whether the rule is enabled.
-
data.rules.expression
objectObject specifying the matching directives of the rule.
-
data.rules.kind
stringRule type.
-
data.rules.loaded
stringIndicates if the rule has been loaded on firewall.
-
data.rules.matching_method
stringIndicates how the expression value should be compared with the target.
-
data.rules.network_only
booleanIf true, it defines a network rule.
-
data.rules.pattern
stringPattern blocked by a rule if associated to an alert.
-
data.rules.priority
stringPriority with which the rule is activated in relation to the others.
-
data.rules.rq_host
stringHeader Host associated with the rule.
-
data.rules.spec_values
objectSpecification of the context of the rule if associated with an alert.
-
data.rules.start_time
integerIn the case of a network rule, date and time the rule was activated in UNIX timestamp format (microseconds).
{
"data": {
"rules": [
{
"action": "deny",
"alert_id": null,
"attack_category": null,
"attack_code": null,
"attack_name": null,
"case_sensitive": true,
"deleted": false,
"description": null,
"duration": null,
"enabled": true,
"expression": {
"type": "values",
"values": [
"A=0"
]
},
"id": "CxxQnxxx£Cx=",
"kind": "negative",
"loaded": "off",
"matching_method": "full",
"network_only": false,
"pattern": null,
"priority": "1",
"rq_host": "www.xxxxxxxxx-xxx.it",
"spec_values": {
"path": "any",
"request:Host": [
"www.xxxxxxxx-xxx.it"
]
},
"start_time": null,
"target": "parameter_key",
"timestamp": 10,
"username": "admin"
}
]
},
"message": "List of rules",
"pagination": {
"first": 1,
"last": 1,
"page": 0,
"total_count": 1,
"total_pages": 1
},
"status": "ok"
}
List a specific rule
Request
Definition
GET /api/v1/rules/{rule_id}
Header
-
Authorization
requiredAuthentication token with privileges to view the resource.
Bearer {token}
Response
Status codes
Status code | Message |
---|---|
200 | "Rule retrieved." |
400 | "Error retrieving rule" |
400 | "Error with pagination fields" |
403 | "Forbidden" |
Body
{
"data": {
"rule": {
"action": "deny",
"alert_id": null,
"attack_category": null,
"attack_code": null,
"attack_name": null,
"case_sensitive": true,
"deleted": false,
"description": null,
"duration": null,
"enabled": true,
"expression": {
"type": "values",
"values": [
"A=0"
]
},
"id": "CxxQnxxx£Cx=",
"kind": "negative",
"loaded": "off",
"matching_method": "full",
"network_only": false,
"pattern": null,
"priority": "1",
"rq_host": "www.pluribus-one.it",
"spec_values": {
"path": "any",
"request:Host": [
"www.pluribus-one.it"
]
},
"start_time": null,
"target": "parameter_key",
"timestamp": 10,
"username": "admin"
}
},
"message": "Rule retrieved",
"status": "ok"
}