Типы правил

ID статьи: 2702
Последнее обновление: 23 мар, 2026
Product: SWG
Version: 7.5.x

Правила контентной фильтрации

Префиксы

Имя

Описание

PASS

Разрешение посещения.

DENY

Блокировка веб-страницы.

WARNING

Предупреждение пользователя о том, что страница нежелательна для посещения.

Условия

src.zonesrc.geoipsrc.ip

dst.zonedst.geoipdst.ip.

categorymorphologyscenario, timeurluser.

request.header.Referer — Список URL, в котором указаны рефереры для текущей страницы.
request.header.User-Agent — User agent пользовательских браузеров.
response.header.Content-Type — Списки типов контента.
http.method — Метод, используемый в HTTP-запросах.

Свойства

namedescenabledrule_logvirus_heuristic.

Пример

[content "Content Rules"]
 % ----------------- 1 --- "Content Rules" --------------
PASS \
    url = lib.url("Education institutions") \
    src.zone = Trusted \
    desc("Content filtering rule which allows access to the list of URLs. This is an example rule which can be changed or deleted if necessary.") \
    rule_log(yes) \
    enabled(true) \
    name("Example white list")
% ----------------- 2 --- "Content Rules" --------------
DENY("Blockpage (EN)") \
    url = lib.url("Education institutions") \
    dst.zone = Untrusted \
    rule_log(yes) \
    enabled(false) \
    name("Example block RU RKN by URL list")
% ----------------- 3 --- "Content Rules" --------------
DENY \
    url = lib.network("Private IPs") \
    morphology = lib.morphology(Drugs) \
    src.zone = Trusted \
    time = lib.time(Weekdays) \
    rule_log(yes) \
    redirect(302, "https://bing.com") \
    enabled(false) \
    name("Example redirect to safesearch engines")

Правила межсетевого экрана

Префиксы

Имя

Описание

PASS

Разрешение трафика.

DENY

Блокировка трафика.

Условия

src.zonesrc.geoipsrc.ip.

dst.zonedst.geoipdst.ip.

servicescenariotimeurluser, hip_profile.

Свойства

namedescenabledrule_logreject_with.

Пример

[firewall "Firewall rules"]
% ----------------- 1 -----------------
DENY \
    scenario = "Example torrent detection scenario" \
    dst.zone = Untrusted \
    dst.ip = lib.network("Botnets IP list") \
    rule_log(session) \
    reject_with("host-unreach") \
    enabled(true) \
    name("Example block RU RKN by IP list")

Правила NAT и маршрутизации

Префиксы

Имя

Описание

OK

Всегда ОК.

Тип правила определяется действием (Action):

  • nat — правило NAT;
  • dnat — правило DNAT;
  • port_mapping — правило порт-форвардинга;
  • netmap — правило Network mapping;
  • route — правило policy-based.

Условия

src.zonesrc.geoipsrc.ipsrc.mac.

dst.zonedst.geoipdst.ip.

servicescenariotimeurluser.

Свойства

namedescenabledrule_logdirectiontarget_iptarget_snatsnat_target_ip

port_mapgateway.

Пример

[nat_routing "NAT and Routing Rules"]
% ----------------- 1 -----------------
OK \
    src.zone = Trusted \
    service = (HTTP, HTTPS) \
    snat_target_ip("192.168.13.210") \
    rule_log(session) \
    enabled(true) \
    name("NAT Rule")\
    nat
% ----------------- 2 -----------------
OK \
    src.zone = Management \
    dst.ip = (lib.network("Private IPs"), lib.url("Microsoft Windows Internet checker")) \
    target_ip("171.168.1.1") \
    target_snat(yes) \
    snat_target_ip("192.168.1.1") \
    enabled(true) \
    name("DNAY Rule")\
    dnat
% ----------------- 3 -----------------
OK \
    target_ip("172.168.1.1") \
    snat_target_ip("192.168.1.1") \
    port_map(tcp, 2000, 2000) \
    enabled(true) \
    name("Port-forwarding Rule")\
    port_mapping
% ----------------- 4 -----------------
OK \
    user = example \
    scenario = "Example torrent detection scenario" \
    gateway(My) \
    enabled(true) \
    name("Policy-base Rule")\
    route
% ----------------- 5 -----------------
OK \
    dst.geoip = (RW, SO) \
    target_ip("172.168.1.1") \
    direction(input) \
    enabled(true) \
    name("Network mapping Rule")\
    netmap

Правила Captive-портала

Префиксы

Имя

Описание

PASS

Не использовать аутентификацию.

OK

Использовать Captive-профиль.

Условия

src.zonesrc.geoipsrc.ip.

dst.zonedst.geoipdst.ip.

timeurlcategory.

Свойства

namedescenabledrule_logprofile.

Пример

[captive "Captive Rules"]
% ----------------- 1 -----------------
PASS \
    category = lib.category(Threats) \
    url = lib.url("Microsoft Windows Internet checker") \
    time = lib.time(Weekends) \
    rule_log(yes) \
    enabled(true) \
    name("Skip auth for Microsoft Internet checker")
% ----------------- 2 -----------------
OK \
    src.zone = Trusted \
    profile("Example Captive profile") \
    enabled(true) \
    name("Example Captive portal")

Правила инспектирования SSL

Префиксы

Имя

Описание

PASS

Не расшифровывать передаваемые данные.

OK

Расшифровать передаваемые данные.

Пересылка определяется действием (Action):

  • forward — в случае успешной расшифровки трафика SSL/TLS копия трафика будет переслана в соответствии с правилом и профилем инспектирования SSL (ssl_forward_profile).

Условия

src.zonesrc.geoipsrc.ip,

dst.geoipdst.ip,

timeserviceusercategory.

Свойства

namedescenabledrule_logssl_profilessl_forward_profile.

block_invalid_certcheck_revoc_certblock_expired_certblock_self_signed_cert.

Пример

[ssl "Decrypt Rules"]
% ----------------- 1 -----------------
PASS \
    category = (Finance, "Information Security") \
    rule_log(yes) \
    ssl_profile("Default SSL profile") \
    enabled(false) \
    name("Example DO NOT Decrypt rule for Finance and Security sites")
% ----------------- 2 -----------------
OK \
    category = lib.category(Threats) \
    rule_log(yes) \
    block_invalid_cert(yes) \
    check_revoc_cert(yes) \
    block_expired_cert(yes) \
    block_self_signed_cert(yes) \
    ssl_profile("Default SSL profile") \
    enabled(false) \
    name("Example decrypt rule for parental control")
% ----------------- 3 -----------------
OK \
    url = lib.url("Default SSL profile") \
    rule_log(yes) \
    ssl_profile("Default SSL profile") \
    ssl_forward_profile("SSL forward profile") \
    enabled(false) \
    name("Example decrypt RU RKN")\
    forward

DNS-правила

Префиксы

Имя

Описание

OK

Всегда OK.

Условия

url.domain.

Свойства

namedescenableddns_server.

Пример

[dns "DNS Rules"]
% ----------------- 1 -----------------
OK \
    url.domain = "*.example.com" \
    dns_server(1.2.3.4) \
    enabled(true) \
    name("Dns rule")

ICAP-правила

Префиксы

Имя

Описание

PASS

Пропуск. Не посылать данные на ICAP-сервер.

OK

Пересылка данных на ICAP-сервер.

Действие (Action):

  • ignore — игнорировать ответ от ICAP-сервера.

Условия

src.zonesrc.geoipsrc.ip.

dst.zonedst.geoipdst.ip.

urlcategoryuserservice, http.methodresponse.header.Content-Type.

Свойства

namedescenabledrule_logprofile.

Правила reverse-прокси

Префиксы

Имя

Описание

OK

Всегда ОК.

Условия

src.zonesrc.geoipsrc.ipsrc.mac.

dst.zonedst.geoipdst.ip.

user, request.header.User-Agenturl.port.

Свойства

namedescenabledrule_logprofile, certificatecert_auth_enabledis_httpsssl_profile

rewrite_path.

Пример

[reverseproxy "Reverse proxy Rules"]
% ----------------- 1 -----------------
OK \
    url.port = 80 \
    src.zone = Untrusted \
    desc("Example reverse proxy rule. This is an example rule which can be changed or deleted if necessary. ") \
    profile("Example reverse proxy server") \
    rewrite_path("example.com/path1", "example.local/path1") \
    enabled(true) \
    name("Example reverse proxy rule")

Правила веб-безопасности

Префиксы

Имя

Описание

OK

Всегда ОК.

Условия

src.zonesrc.geoipsrc.ipsrc.mac.

dst.zonedst.geoipdst.ip.

timeuser,

Свойства

namedescenabledrule_log.

enable_adblocksafe_searchsearch_history_loggingsocial_sites_blockenable_injector

custom_injectorurl_list_exclusions.

Пример

[safebrowsing "Safe browsing Rules"]
% ----------------- 1 -----------------
OK \
    rule_log(yes) \
    enable_adblock(yes) \
    safe_search(yes) \
    search_history_logging(yes) \
    social_sites_block(yes) \
    enable_injector(yes) \
    custom_injector(code) \
    url_list_exclusions(FISHING_BLACK_LIST) \
    desc("Safebrowsing rule for all users. This is an example rule which can be changed or deleted if necessary.") \
    enabled(false) \
    name("Example safebrowsing")

Правила пропускной способности

Префиксы

Имя

Описание

OK

Всегда ОК.

Условия

src.zonesrc.geoipsrc.ipsrc.mac.

dst.zonedst.geoipdst.ip.

timeuser applicationservicescenario,

Свойства

namedescenabledrule_logbandwidth_pool.

Пример

[shaper "Shaper Rules"]
% ----------------- 1 -----------------
OK \
    scenario = "Example torrent detection scenario" \
    service = "HTTP Proxy" \
    rule_log(session) \
    bandwidth_pool("1 Mbps") \
    enabled(true) \
    name("Example Bandwidth rule")
% ----------------- 2 -----------------
OK \
    scenario = "Example torrent detection scenario" \
    src.zone = Trusted \
    application = lib.category("Coin Miners", Business) \
    rule_log(yes, "3/h", 5) \
    bandwidth_pool("100 Kbps") \
    enabled(true) \
    name("Example torrent shaper")

Правила веб-портала

Префиксы

Имя

Описание

OK

Всегда ОК.

Условия

urluser, url.domain.

Свойства

namedescenabled.

iconssl_profilecertificateadditional_urlrdp_check_session_alivetransparent_auth.

Пример

[webportal "Web portal Rules"]
% ----------------- 1 -----------------
OK \
    user = "CN=Default Group,DC=LOCAL" \
    url = "http://www.intranet.loc" \
    icon("default.svg") \
    rdp_check_session_alive(yes) \
    transparent_auth(yes) \
    certificate("CA (Default)") \
    ssl_profile("Default SSL profile") \
    enabled(false) \
    name("Example http application published via web portal")

Правила сценариев

Префиксы

Имя

Описание

OK

Всегда ОК.

Условия

scenario_cond.

Свойства

namedescenabled.

operation_modetriggerduration.

Условия сценария

Категория URL (url_category)

Условия

category

Свойства

count_intervalmax_event_countscond_type

Обнаружение вируса (virus_detection)

Свойства

scond_type

Тип котента (mime_type)

Условия

response.header.Content-Type

Свойства

count_intervalmax_event_countscond_type

Размер пакета  (net_packet_size)

Свойства

packet_sizescond_type

Сессий c одного IP  (sessions_per_ip)

Свойства

sessions_limitscond_type

Объем трафика  (traffic)

Свойства

traffic_limitperiodscond_type

Проверка состояния (health_check)

Условия

url.addressurl.domain

Свойства

health_check_methodhealth_resulthealth_request_timeouthealth_type_request

health_answer_timeoutcount_intervalmax_event_countscond_type

Пример


[scenarios "Scenario Rules"]
% ----------------- 1 -----------------
def scenario_cond example_scenario_define
    category = (lib.category(Threats), "Advertisements & Pop-Ups") count_interval(10) max_event_count(3) scond_type(url_category)
    scond_type(virus_detection)
    application = lib.category(Threats) count_interval(2) max_event_count(1) scond_type(app)
    ips_tl(medium) scond_type(ips)
    response.header.Content-Type = lib.mime("Java script") count_interval(0) max_event_count(0) scond_type(mime_type)
    packet_size(200MB) scond_type(net_packet_size)
    sessions_limit(50) scond_type(sessions_per_ip)
    traffic_limit(2GB) period(hour) scond_type(traffic)
    url.address = "192.168.100.100" url.domain = "example.com" health_check_method(dns) \
        health_result(negative) health_request_timeout(4) health_type_request(a) \
        count_interval(5) max_event_count(3) scond_type(health_check)
    url.domain = "example.com" health_check_method(get) \
        health_result(negative) health_request_timeout(5) health_answer_timeout(10) \
        count_interval(0) max_event_count(0) scond_type(health_check)
end
OK \
    scenario_cond = example_scenario_define \
    operation_mode(all) \
    trigger(one_user) \
    duration(5) \
    enabled(false) \
    name("Example torrent detection scenario")

Правила балансировки нагрузки TCP/UDP

Префиксы

Имя

Описание

OK

Всегда ОК.

Условия

src.zonesrc.geoipsrc.ipsrc.mac.

service, url.addressurl.port.

Свойства

namedescenabled.

schedulerreal_serveripvs_fallback

monitor_kindmonitor_servicemonitor_requestmonitor_responsemonitor_interval

monitor_timeoutmonitor_failurecount

Пример

[ipvs_server "TCP/UDP load balancing Rules"]
% ----------------- 1 -----------------
OK \
    src.geoip = RW \
    url.address = 192.168.1.100 \
    url.port = 80 \
    service = tcp \
    scheduler(rr) \
    real_server(gate, 1.1.1.1:80, 50) \
    ipvs_fallback(masq_snat, 8.8.8.8:10000) \
    monitor_kind(negotiate) \
    monitor_service(http) \
    monitor_request("example.com") \
    monitor_interval(60) \
    monitor_timeout(60) \
    monitor_failurecount(10) \
    enabled(true) \
    name("TCP load balancing")

Правила балансировки ICAP

Префиксы

Имя

Описание

OK

Всегда ОК.

Свойства

namedescenabled, profile.

Пример

[icap_balancing "ICAP load balancing Rules"]
% ----------------- 1 -----------------
OK \
    profile("Example ICAP server") \
    enabled(true) \
    name("ICAP load balancing")

Правила балансировки reverse-прокси

Префиксы

Имя

Описание

OK

Всегда ОК.

Свойства

namedescenabled, profile.

Пример

[reverseproxy_balancing "Reverse proxy load balancing Rules"]
% ----------------- 1 -----------------
OK \
    profile("Example reverse proxy server") \
    enabled(true) \
    name("Reverse-proxy load balancing")

Эта статья была:   Полезна | Не полезна
ID статьи: 2702
Последнее обновление: 23 мар, 2026
Ревизия: 6
Просмотры: 155
Комментарии: 0
Теги