Addrule

Add a rule to a security profile

Tokens

This action requires the following tokens:

  • securityprofile-write

Arguments

Required arguments are marked in bold, and optional arguments are marked in italics.

Argument Type Default Description
securityprofile Hash   Hash of the security profile to add the rule to
type String  

Type of the rule to add

This argument can only contain one of the following values:

  • blanket
  • ip
  • country
  • continent
  • useragent
  • time
  • timelocal
verdict String  

Verdict for this rule

This argument can only contain one of the following values:

  • allow
  • deny
position Integer   Position of the rule. If omitted, it will be added at the end
ip IP Mask   If ruletype is “ip”, IP address (with possible netmask) for this rule
country String   If ruletype is “country”, country-code for this rule. See Geo for a list of values
continent String   If ruletype is “continent”, continent-code for this rule. See Geo for a list of values
useragent String   If ruletype is “useragent”, user agent for this rule. If it starts with a /, it is treated as a regular expression. Otherwise it will be matched litteraly.
starttime Time   If ruletype is “timeofday” or “timeofdaylocal”, start time for this rule
endtime Time   If ruletype is “timeofday” or “timeofdaylocal”, end time for this rule
validfrom DateTime   If set, this rule is only valid from (and including) the given date and time
validuntil DateTime   If set, this rule is only valid until (and including) the given date and time

Output

This action produces the following output on success:

An object containing the following fields:

Name Type Description
id Hash Security profile ID
name String The name of this security profile
account

The account this profile belongs to

The value of this field is an object containing the following fields:

Name Type Description
id Hash Account ID
name String Account name
datecreated DateTime When this security profile was created
datemodified DateTime When this security profile was last modified
rules

Rules in this profile

The value of this field is an array containing zero or more elements, each one being an object containing the following fields:

Name Type Description
position Integer Position of this rule in the profile
type String Type of the rule. One of: blanket, ip, country, continent, useragent, time, timelocal
ip IP Mask If ruletype is “ip”, IP address (with possible netmask) for this rule
country

If ruletype is “country”, country for this rule

The value of this field is an object containing the following fields:

Name Type Description
code String Code of this contry
name String Name of this contry
continent

Continent of this country

The value of this field is an object containing the following fields:

Name Type Description
code String Code of this continent
name String Name of this continent
continent

If ruletype is “continent”, continent for this rule

The value of this field is an object containing the following fields:

Name Type Description
code String Code of this continent
name String Name of this continent
useragent String If ruletype is “useragent”, user agent for this rule
starttime Time If ruletype is “timeofday” or “timeofdaylocal”, start time for this rule. For “timeofday” it will be returned in the the timezone of the actor. For “timeofdaylocal” it is timezone independent and should be checked with the time in the timezone of the entity accessing the security profile
endtime Time If ruletype is “timeofday” or “timeofdaylocal”, end time for this rule. For “timeofday” it will be returned in the the timezone of the actor. For “timeofdaylocal” it is timezone independent and should be checked with the time in the timezone of the entity accessing the security profile
validfrom DateTime If set, this rule is only valid from (and including) the given date and time
validuntil DateTime If set, this rule is only valid until (and including) the given date and time
verdict String Verdict for this rule, either allow or deny

Errors

This action can return one of the default status codes, or one of the following status codes on error:

STATUS_SECURITY_PROFILE_NOT_FOUND (380)
The requested security profile was not found
STATUS_SECURITY_RULE_NOT_VALID (381)