Create Isolation Exception Rule
Endpoint URL: https://<your server/rest/settings/isolation-rule
Endpoint URI: settings/isolation-rule
Action: POST
Creates an isolation exception rule.
Note
Ensure that you have logged into the Cybereason platform. For details, see Log in with the API.
Request Headers
You must add an Content-Type:application/json header with the request.
Note
If you are using cURL, add the authorization cookie details or the path to the file with cookie details with every request.
Request Body
Input: JSON
Depending on your browser settings, this linked file may open in a separate tab instead of downloading directly to your machine. If this happens, use the Save As option in your browser to save the file locally.
{
"ipAddressString": "<IP address>",
"ipAddress":["<IP address>"],
"domain":"<domain name>",
"port": "<port>",
"blocking": "<boolean value>",
"direction": "<communication direction>",
"lastUpdated": "<timestamp>"
}
Request Parameters
URL/URI parameters: none
Request Body Parameters: Use the following fields in the request. Required parameters are noted in bold.
Field |
Type |
Description |
---|---|---|
ipAddressString |
String |
The IP address of the machine to which the rule applies. |
port |
Integer |
Optional if the ipAddressString parameter exists. The port by which Cybereason communicates with an isolated machine, according to the rule. |
blocking |
Boolean |
States whether communication with the given IP or port is allowed. Set to true if communication is blocked. |
direction |
String |
The direction of the allowed communication. Values include ALL, INCOMING, or OUTGOING. |
lastUpdated |
Float |
The epoch timestamp for the last update time for the rule. |
Response Status Codes
This request can return the following status codes:
200: Success OK with details on the operation
Response Success Schema
The response returns an array of isolation rules, including the following fields:
Field |
Type |
Description |
---|---|---|
ruleID |
String |
A unique identifier for the rule. |
ipAddressString |
String |
The IP address of the machine to which the rule applies. |
port |
Integer |
Optional if the ipAddressString parameter exists. The port by which Cybereason communicates with an isolated machine, according to the rule. |
blocking |
Boolean |
States whether communication with the given IP or port is allowed. Set to true if communication is blocked. |
direction |
String |
The direction of the allowed communication. Values include ALL, INCOMING, or OUTGOING. |
lastUpdated |
Float |
The epoch timestamp for the last update time for the rule. |
Response Failure
A failed response returns a message stating the failure:
{
"message:": "<Your message here>",
"result": "<reason for failing>"
}
Important Response Fields
Important information is found in these fields:
ruleId: This string updates you that the rule has been created.
lastUpdated: This timestamp (in epoch) displays the time this rule was created. You will need this value if you want to update the rule in future requests.
Example: Create an isolation rule
Request
curl --request POST \
--url https://12.34.56.78/rest/settings/isolation-rule \
--header 'Content-Type:application/json' \
--data '{
"ipAddressString": "1.1.1.1",
"port": 8443,
"blocking": false,
"direction": "ALL"
}'
Response
{
"ruleId": "5a8557b1e4b0b22c22a82700",
"ipAddress": "AQEBAQ==",
"ipAddressString": "1.1.1.1",
"domain": null,
"port": 443,
"direction": "ALL",
"lastUpdated": 1518688177040,
"blocking": true
}
Request
Depending on your browser settings, this linked file may open in a separate tab instead of downloading directly to your machine. If this happens, use the Save As option in your browser to save the file locally.
Use this request body:
{
"ipAddressString": "1.1.1.1",
"port": 8443,
"blocking": false,
"direction": "ALL"
}
Response
{
"ruleId": "5a8557b1e4b0b22c22a82700",
"ipAddress": "AQEBAQ==",
"ipAddressString": "1.1.1.1",
"domain": null,
"port": 443,
"direction": "ALL",
"lastUpdated": 1518688177040,
"blocking": true
}
Request
Depending on your browser settings, this linked file may open in a separate tab instead of downloading directly to your machine. If this happens, use the Save As option in your browser to save the file locally.
import requests
import json
# Login information
username = "[email protected]"
password = "mypassword"
server = "yourserver.com"
port = "443"
data = {
"username": username,
"password": password
}
headers = {"Content-Type": "application/json"}
base_url = "https://" + server + ":" + port
login_url = base_url + "/login.html"
session = requests.session()
login_response = session.post(login_url, data=data, verify=True)
print (login_response.status_code)
print (session.cookies.items())
# Request URL
endpoint_url = "/rest/settings/isolation-rule"
api_url = base_url + endpoint_url
# These are the variables that represent different fields in the request.
ip_address = "1.1.1.1"
port = "443"
direction = "ALL"
rule = json.dumps({"ipAddressString":ip_address,"port":port,"blocking":"true","direction":direction})
api_headers = {'Content-Type':'application/json'}
api_response = session.request("POST", api_url, data=rule, headers=api_headers)
your_response = json.loads(api_response.content)
print(json.dumps(your_response, indent=4, sort_keys=True))
Response
{
"ruleId": "5a8557b1e4b0b22c22a82700",
"ipAddress": "AQEBAQ==",
"ipAddressString": "1.1.1.1",
"domain": null,
"port": 443,
"direction": "ALL",
"lastUpdated": 1518688177040,
"blocking": true
}