Skip to content
Smarter by Design.Simpler for Business

lb condition ​

The lb condition command creates the conditions that determine in which traffic an action will be applied. A condition does nothing on its own: when it is bound to an action or to a profile, it makes that work run only on the matching requests. Its panel equivalent is the Conditions section.

The first field written is criteria

What will be looked at is selected first; this selection determines which fields will be asked for. No other field is listed until the criterion is written.

Command Summary ​

TR7 WEB-CLI · lb condition
# Tab after the command
admin@TR7LBWAF01> lb condition
add delete list show update
 
admin@TR7LBWAF01> lb condition list # list all of them
admin@TR7LBWAF01> lb condition show <id> # show one
admin@TR7LBWAF01> lb condition add criteria <criterion> … # new condition
admin@TR7LBWAF01> lb condition update id <id> … # change
admin@TR7LBWAF01> lb condition delete <id> # delete
admin@TR7LBWAF01>  

Writing Order ​

Step 1 Select the criterion
There are forty-two criteria; Tab lists them all. lb condition add criteria path
Step 2 Write the required fields of the criterion
Fields such as the value to be searched, the header name and the cookie name are asked for according to the criterion.
Step 3 Add the matching form and the name
--content_placement start --name admin-path
Step 4 Bind it to an action
lb action update id <action> --cond <condition>

Required Fields ​

The criterion is a discriminator in this command: the CLI first asks for criteria, then asks for the required fields of that criterion in order. The required fields specific to the criterion are written without a prefix even if the field starts with -- in the line, and no field starting with -- is accepted until they are all completed. In the criteria that are not in the list there is no additional required field.

OrderFieldStatusValue
1criteriaRequiredOne of the forty-two criteria; Tab lists them
2queryConditionally requiredThe value to be searched in the req_body · res_body · query_param · path · pathq · url criteria
2 · 3headerName · queryConditionally requiredhttp_header; the header name and the value to be searched
2 · 3cookieName · queryConditionally requireduser_cookie · be_cookie; the cookie name and the value to be searched
2 · 3rdpCookieName · queryConditionally requiredrdp_cookie; the RDP cookie name and the value to be searched
2 · 3mapKey · mapContentConditionally requiredcustom_map; the key to be searched and the list content
2acceptLanguageConditionally requiredaccept_language; the language code
2 · 3srcIpType · country · city · src · asnConditionally requiredsrc_ip; first the type, then the country, the city, the address or the ASN according to the type
2dstConditionally requireddst; the destination address
2manualCondContentConditionally requiredmanualCond; the condition expression
2 · 3smartVar · smartOperatorConditionally requiredsmartCond; the variable and the operator. Then the value field of the operator is asked for (see Dynamic Conditions)
2 · 3agsVar · agsOperatorConditionally requiredagsCond; the variable and the operator. Then the value field of the operator is asked for
4 · 5smartStrRefValue · staticStrRefValue · staticRegexRefValue · smartIntRefValue · smartIntRefFrom · smartIntRefTo · staticIpCidrRefValue.ip · staticIpCidrRefValue.cidrConditionally requiredsmartCond and agsCond; the value field of the selected operator. Which one will be asked for is in the Dynamic Conditions table; in the bool operator there is no value field

The Fields That Can Be Found in Every Criterion ​

FieldWhat it doesWhat is written after it
--nameGives a name to the condition; a named condition can be selected from other placesThe name of the condition. It is not required
--content_placementDetermines how the searched value will matchexactMatch exact match (default) · start starts with · end ends with · sub contains · regex regular expression · found looks only at the existence of the field
--caseInsensitiveRemoves the distinction between uppercase and lowercase in the matchingtrue · false (default false)
--condLocSelects whether the condition will be evaluated in the request or in the responseatRequest (default) · atResponse
--condProSelects at which stage the condition will be evaluatedatRequest (default) · atResponse

In which criterion these fields open depends on the type of the criterion: the matching form and the case sensitivity appear only in the criteria that search text, and --condLoc and --condPro only in the criteria whose stage can be selected.

The Criteria ​

In the tables below all forty-two criteria are given with their required and criterion-specific optional fields. The common fields above are not written again.

The Criteria That Match Content ​

criteriaPanel equivalentRequired fieldsOptional fields specific to the criterion
pathPathquery—
pathqPath + queryquery—
urlURLquery—
query_paramQuery parameterquery—
http_headerHTTP headerheaderName · query—
user_cookieUser cookie namecookieName · query—
be_cookieServer cookie namecookieName · query—
rdp_cookieRDP cookierdpCookieName · query—
req_bodyHTTP request bodyquery--bodySize
res_bodyHTTP response bodyquery--bodySize

The Criteria That Recognize the Client ​

criteriaPanel equivalentRequired fieldsOptional fields specific to the criterion
browserBrowser—--browserName.N
operatingSystemOperating system—--operatingSystem.N
mobileMobile platform—--mobilePlatform.N
botBot type—--botType.N
nettype_groupNetwork type group—--nettypeGroup.N
nettype_categoryNetwork type category—--nettypeCategory.N
blacklist_ip_categoryBlacklist IP category—--blacklistIpCategory
accept_languageClient language preferenceacceptLanguage--acceptLanguageCompare.N

The Address and Port Criteria ​

criteriaPanel equivalentRequired fieldsOptional fields specific to the criterion
src_ipSource IPsrcIpType → country · city · src · asn according to the type—
dstDestination IPdst—
dst_portDestination port—--dst_port.op · --dst_port.val

The Numeric Criteria ​

criteriaPanel equivalentRequired fieldsOptional fields specific to the criterion
statusStatus code—--status_op.op · --status_op.val
resp_timeServer response time—--resp_time_op.op · --resp_time_op.val
nbsrvNumber of active servers—--nbsrv_op.op · --nbsrv_op.val
req_sizeRequest size (bytes)—--req_size_op.op · --req_size_op.val
res_sizeResponse size (bytes)——
fe_connFrontend connection—--fe_conn_op.op · --fe_conn_op.val
fe_sess_rateFrontend number of new sessions / s—--fe_sess_rate_op.op · --fe_sess_rate_op.val
fe_req_rateFrontend number of HTTP requests / s—--fe_req_rate_op.op · --fe_req_rate_op.val

The TLS Criteria ​

criteriaPanel equivalentRequired fieldsOptional fields specific to the criterion
ssl_fc_cipherSSL cipher——
ssl_fc_protocolSSL version——
ssl_fc_sniSSL SNI info——

The Identity and WAF Criteria ​

criteriaPanel equivalentRequired fieldsOptional fields specific to the criterion
http_authUser authentication—--userPassPairs.N.username · --userPassPairs.N.password
waf_attack_idWAF attack ID—--wafAttackIds.N
waf_attack_groupWAF attack group—--wafAttackGroups.N

The List and Dynamic Criteria ​

criteriaPanel equivalentRequired fieldsOptional fields specific to the criterion
url_listResponse based URL list——
custom_mapDynamic listmapKey · mapContent--mapMethod
manualCondManual conditionmanualCondContent—
smartCondDynamic conditionsmartVar · smartOperator—
agsCondAGS conditionagsVar · agsOperator—
trackingCondTracking conditiontrackingCondCriteria · trackingCondOp.val · trackingTableTag--trackingCondOp.op
quarantineCondQuarantine conditiontrackingCondCriteria · trackingCondOp.val--trackingCondOp.op

The Equivalents of the Criterion Fields ​

FieldWhat it doesWhat is written after it
queryCarries the value to be searchedThe searched text; how it will match is determined by --content_placement
headerNameDetermines which HTTP header will be looked atThe header name, for example X-Forwarded-For
cookieNameDetermines which cookie will be looked atThe cookie name
rdpCookieNameDetermines which RDP cookie will be looked atThe RDP cookie name
--bodySizeLimits how many bytes of the body will be parsedThe number of bytes
--browserName.N · --operatingSystem.N · --mobilePlatform.N · --botType.NLooks at which browser, operating system, mobile platform or bot type the client isThe values selected from the list; each with its own index
--nettypeGroup.N · --nettypeCategory.NLooks at the network type group or the category of the source addressThe values selected from the list
--blacklistIpCategoryLooks at which blacklist category the source address is inThe category value
acceptLanguageLooks at the language preference of the clientThe language code
--acceptLanguageCompare.NDetermines the additional languages to be comparedThe language codes
srcIpTypeSelects how the source address will be determinedcountry according to the country · city according to the city · manual the address written by hand · asn according to the autonomous system number
country · city · src · asnCarries the value to be compared according to the selected typeThe country, the city, the address or the ASN; which one will be asked for is determined by srcIpType
dstLooks at the destination addressThe IP address
--dst_port.op · --dst_port.val · --dst_port.val2Compares the destination port with a threshold or with a rangeThe operator (default =), the number and the upper limit in a range
--status_op.op · --status_op.val · --status_op.val2Compares the status code of the responseThe operator, the number and the upper limit in a range
--resp_time_op.op · --resp_time_op.val · --resp_time_op.val2Compares the response time of the backendThe operator, the time value and the upper limit in a range
--nbsrv_op.op · --nbsrv_op.val · --nbsrv_op.val2Compares the number of servers that are upThe operator, the number and the upper limit in a range
--req_size_op.op · --req_size_op.val · --req_size_op.val2Compares the request sizeThe operator, the number of bytes and the upper limit in a range
--fe_conn_op.op · --fe_conn_op.val · --fe_conn_op.val2Compares the number of connections on the listening sideThe operator, the number and the upper limit in a range
--fe_sess_rate_op.op · --fe_sess_rate_op.val · --fe_sess_rate_op.val2Compares the number of new sessions per secondThe operator, the number and the upper limit in a range
--fe_req_rate_op.op · --fe_req_rate_op.val · --fe_req_rate_op.val2Compares the number of requests per secondThe operator, the number and the upper limit in a range
--userPassPairs.N.username · --userPassPairs.N.passwordDefines the users that will be accepted in the basic authenticationThe user name and the password; every pair with its own index
--wafAttackIds.N · --wafAttackGroups.NLooks at the attack id or the group that WAF has markedThe id or the group values
mapKey · mapContentDetermines which key will be searched in which list in the dynamic listThe key to be searched and the list content
--mapMethodSelects the form of the dynamic list searchexactMatch (default) · start · end · sub · regex · ip
manualCondContentWrites the condition directly as an expressionThe condition expression
smartVar · agsVarDetermines which variable will be looked at in the dynamic conditionThe variable name
trackingCondCriteriaSelects which measure will be tracked in the tracking tableThe tracking criterion
trackingCondOp.val · --trackingCondOp.op · --trackingCondOp.val2Compares the tracked measure with a threshold or with a rangeThe number, the operator (default =) and the upper limit in a range
trackingTableTagDetermines which tracking table will be looked atThe table tag; it is asked for only in the trackingCond criterion

The Numeric Comparison Fields ​

All the numeric criteria use the same three-part structure: the operator, the value and, when the range operator is selected, the second value.

PartWhat it doesWhat is written after it
--<criterion>_op.opSelects the comparison operator= equal (default) · < smaller · > greater · - range. Since it contains a sign, it is written inside double quotes
--<criterion>_op.valGives the value to be comparedA number; it is the lower limit in a range
--<criterion>_op.val2Gives the upper limit of the rangeA number; it opens only when --<criterion>_op.op "-" is written

The fields that use this structure: status_op · dst_port · resp_time_op · nbsrv_op · req_size_op · fe_conn_op · fe_sess_rate_op · fe_req_rate_op · trackingCondOp. For example, in order to search the status code between 500 and 599, --status_op.op "-" --status_op.val 500 --status_op.val2 599 is written.

Dynamic Conditions: The Operator and the Value Field ​

In the smartCond and agsCond criteria first the variable to be looked at (smartVar or agsVar), then the operator is written. Which field the value will be written to is determined by the selected operator.

OperatorWhat it doesValue field
strEqIs the text exactly equalsmartStrRefValue
strSubDoes the text containstaticStrRefValue
strStartDoes it start with the textstaticStrRefValue
strEndDoes it end with the textstaticStrRefValue
strRegexDoes it match the regular expressionstaticRegexRefValue
intEqIs the number equalsmartIntRefValue
intGtIs the number greatersmartIntRefValue
intLtIs the number smallersmartIntRefValue
intRangeIs the number between two valuessmartIntRefFrom and smartIntRefTo
boolIs the value trueThere is no value field
ipCidrDoes the address fall into the given networkstaticIpCidrRefValue.ip and staticIpCidrRefValue.cidr

The moment the operator is written, the related value field becomes required and is written without a prefix; the other value fields drop from the list.

Examples ​

TR7 WEB-CLI · A) Path and header conditions
# the requests that start with /yonetim
admin@TR7LBWAF01> lb condition add criteria path query /yonetim \
--content_placement start --name admin-path
 
# the requests that carry a certain API key
admin@TR7LBWAF01> lb condition add criteria http_header headerName X-API-Key query <value> \
--caseInsensitive true --name api-key
admin@TR7LBWAF01>  
TR7 WEB-CLI · B) Source address and numeric criterion
# the source address according to the country
admin@TR7LBWAF01> lb condition add criteria src_ip srcIpType country country <country> --name abroad
 
# the response time threshold; since the operator contains a sign it is quoted
admin@TR7LBWAF01> lb condition add criteria resp_time --resp_time_op.op ">" --resp_time_op.val 2000 \
--name slow-response
admin@TR7LBWAF01>  
TR7 WEB-CLI · C) A dynamic condition and binding it to an action
# when the ipCidr operator is selected, the address and mask fields open
admin@TR7LBWAF01> lb condition add criteria smartCond smartVar <variable> smartOperator ipCidr \
staticIpCidrRefValue.ip 10.0.0.0 staticIpCidrRefValue.cidr 8 --name internal-network
 
admin@TR7LBWAF01> lb action update id <action> --cond <condition>
admin@TR7LBWAF01>  

Updating and Deleting ​

TR7 WEB-CLI · update and delete
admin@TR7LBWAF01> lb condition update id <id> --query /panel
admin@TR7LBWAF01> lb condition delete <id>
admin@TR7LBWAF01>  

Things to Know ​

  • A condition does not work on its own. It comes into play when it is bound to an action (lb action → --cond), to a cache rule or to a profile field.
  • The name is not required. A condition without a name can also be created; however, giving a name makes it easier for it to be selected from other places.
  • The operator values require quotes. Signs such as > and < carry a special meaning for the parser on the command line; they are written inside double quotes.
  • The operator determines the value field. In the dynamic conditions, when the operator changes, the previous value field drops from the list and the new one becomes required.
  • The matching form is not found in every criterion. --content_placement and --caseInsensitive appear only in the criteria that search text.