MGM:enable_auto(code)
This command is same as MGM:disable_auto(), but it does the opposite task.
By default, all the events are automatically enabled after disable_event() is called. So we only need to call this to undo earlier calling of disable_auto().
Syntax
MGM:enable_auto(code);
Arguments
| Name | Description |
|---|---|
|
code |
A LUA integer in hex format to indicate the event. Code Event Name 0x01 HTTP_REQUEST 0x02 HTTP_RESPONSE 0x04 HTTP_DATA_REQUEST 0x08 HTTP_DATA_RESPONSE 0x10 CLIENTSSL_HANDSHAKE 0x20 SERVERSSL_HANDSHAKE 0x40 TCP_ACCEPTED 0x80 TCP_CLOSED 0x100 CLIENTSSL_RENEGOTIATE 0x200 SERVERSSL_RENEGOTIATE 0x400 SERVER_CONNECTED 0x800 SERVER_CLOSED 0x1000 SERVER_BEFORE_CONNECT 0x2000 AUTH_RESULT 0x4000 COOKIE_BAKE 0x8000 PERSISTENCE 0x10000 BEFORE_AUTH 0x20000 POST_PERSIST 0x40000 WAF_REQUEST_BEFORE_SCAN 0x80000 WAF_RESPONSE_BEFORE_SCAN 0x100000 WAF_REQUEST_ATTACK_DETECTED 0x200000 WAF_RESPONSE_ATTACK_DETECTED 0x400000 VS_LISTENER_BIND |
Events
All events except: CLIENTSSL_RENEGOTIATE, RULE_INIT, PERSISTENCE, POST_PERSIST, VS_LISTENER_BIND
Example
when RULE_INIT {
count = 0
}
when HTTP_REQUEST {
count = count+1
if count>3 then
count=1
end
debug("==> begin REQUEST scripting: count=%d\n", count)
-- Disable RESPONSE event (code == 0x2)
code = 0x2
if (count == 1) then
debug("==> disable_event: count=%d\n", count)
MGM:disable_event(code)
--Also disable automatic enabling for the next request
MGM:disable_auto(code)
end
if (count == 2) then
-- Enable it for the third one.
MGM:enable_auto(code)
end
debug("==> end REQUEST scripting.\n\n")
}
when HTTP_RESPONSE {
debug("=====> begin RESPONSE scripting: count=%d\n", count)
debug("=====> end RESPONSE scripting.\n\n")
}
Note: Event can be "req", "res", "data_req", "data_res", "ssl_server", "ssl_renego_server", "server_connected", "server_close", "server_before_connect." Operation can be "enable", and "disable."
Supported Version
FortiADC version 5.0.x and later.