命中管控策略中的bypass动作时,发送json日志并记录本地日志。

This commit is contained in:
zhengchao
2019-06-17 20:12:37 +08:00
parent 1e3ce2bcb0
commit 03098bc2cf
2 changed files with 15 additions and 3 deletions

View File

@@ -1178,6 +1178,12 @@ static enum pangu_action decide_ctrl_action(const struct Maat_rule_t * hit_rules
if (prior_action == PG_ACTION_WHITELIST)
{
if(*n_enforce==0)
{
*enforce_rules=ALLOC(struct Maat_rule_t, 1);
}
*enforce_rules[0]=*prior_rule;
*n_enforce=1;
return PG_ACTION_WHITELIST;
}
@@ -1908,8 +1914,12 @@ enum pangu_action http_scan(const struct tfe_http_session * session, enum tfe_ht
if (hit_cnt > 0)
{
ctx->action = decide_ctrl_action(result, hit_cnt, &ctx->enforce_rules, &ctx->n_enforce, &ctx->param);
if (ctx->action == PG_ACTION_WHITELIST) goto __out;
if (ctx->action == PG_ACTION_WHITELIST)
{
TFE_LOG_INFO(g_pangu_rt->local_logger, "Bypass rules matched: url=%s policy id=%d.",
session->req->req_spec.url, ctx->enforce_rules[0].config_id);
goto __out;
}
if (hit_cnt > 1)
{
p = buff;
@@ -2283,6 +2293,8 @@ void pangu_on_http_begin(const struct tfe_stream * stream,
}
if (ctx->action == PG_ACTION_WHITELIST)
{
TFE_LOG_INFO(g_pangu_rt->local_logger, "Bypass rules matched on http begin: url=%s policy id=%d.",
session->req->req_spec.url, ctx->enforce_rules[0].config_id);
tfe_http_session_detach(session);
}