Syntax of WAF UPL Rules

Правила WAF в межсетевом экране UserGate описываются с помощью языка UPL.

Прежде всего, UPL контролирует следующее:

  • user authentication requirements

  • access to web resources

  • various aspects of request and response processing

  • logging.

Правила обычно пишутся в одной строке, но могут быть разбиты на строки с помощью специального символа обратного слеша.

Любая строка, начинающаяся с символа %, является комментарием. A percent symbol after a space or tab defines a comment that continues to the end of the line (unless the percent symbol appears inside quotation marks, then it is a part of an expression).

% This is a comment DENY("Too many Host headers") request.header.Host.count = 2.. % and this is a comment too

A rule consists of conditions and a number of actions, written in any order. Есть еще свойства (properties), которые синтаксически выглядят как действие, но при этом активных действий не производят. Например, свойство name просто ставит атрибут имя на правило. Rules are usually written on one line, but can be broken into lines using the special backslash character. When a rule is executed, the condition is checked for the current specific transaction. If the condition evaluates to True, all listed actions are performed and the current layer ends with the prefixes PASS/FORCE_PASS/DENY/FORCE_DENY/WARNING/OK. If the triggered rule does not have the prefixes PASS/FORCE_PASS/DENY/FORCE_DENY/WARNING/OK, then actions are performed and then the next rule is processed. Если условие оценивается как False для этой транзакции, то дальше обрабатывается уже следующее правило.

Все условия в правиле проверяются по логическому 'И'. Если все условия выполняются, то к трафику применяются все перечисленные в правиле действия.

В свою очередь, условие является логической комбинацией триггеров (triggers). Триггеры --- это отдельные тесты, которые можно сделать над компонентами запроса (url= ), ответа (response.Header.Content-Type=), связанным пользователем (user=, group=) или состоянием системы (time=).

Действия --- это настройки, которые управляют обработкой транзакции. For example, deny or process an object, for example rewrite the header.

Rule ::= (PASS|FORCE_PASS|DENY|(DENY '(' string ')')|FORCE_DENY|FORCE_DENY'(' string ')'|WARNING|OK)? Conditions '\'? Actions Conditions ::= condition '\'? Conditions Actions ::= action '\'? Actions