The query log classified every non-drop blocklist match as a block, even when an RPZ A or CNAME rule returned a successful redirect. Record redirect results with their own action so NOERROR address overrides are not presented or counted as blocked. Expose the new action in the Logs filter.
This commit is contained in:
1 parent
87b6946ab7
commit
98b65945f6
4 files changed
+18
-4
No files matched your search
@@ -368,6 +368,13 @@ func (e *Engine) Handle(ctx context.Context, req Request) Response {
|
|||||||
res.Duration = time.Since(start)
|
res.Duration = time.Since(start)
|
||||||
e.finish(req, res, start, decision)
|
e.finish(req, res, start, decision)
|
||||||
return res
|
return res
|
||||||
|
case blocklist.ActionRedirect, blocklist.ActionCNAME:
|
||||||
|
res.Msg = e.finalize(e.blockedMsg(q, blocked), q, req)
|
||||||
|
res.Action = qlog.ActionRedirect
|
||||||
|
res.BlockSource = blocked.Source
|
||||||
|
res.CacheHit = false
|
||||||
|
e.finish(req, res, start, decision)
|
||||||
|
return res
|
||||||
default:
|
default:
|
||||||
res.Msg = e.finalize(e.blockedMsg(q, blocked), q, req)
|
res.Msg = e.finalize(e.blockedMsg(q, blocked), q, req)
|
||||||
res.Action = qlog.ActionBlock
|
res.Action = qlog.ActionBlock
|
||||||
@@ -502,6 +509,8 @@ func outcomeFor(res Response) string {
|
|||||||
return metrics.OutcomeCache
|
return metrics.OutcomeCache
|
||||||
case qlog.ActionBlock:
|
case qlog.ActionBlock:
|
||||||
return metrics.OutcomeBlocked
|
return metrics.OutcomeBlocked
|
||||||
|
case qlog.ActionRedirect:
|
||||||
|
return metrics.OutcomeLocal
|
||||||
case qlog.ActionError, qlog.ActionDrop:
|
case qlog.ActionError, qlog.ActionDrop:
|
||||||
return metrics.OutcomeError
|
return metrics.OutcomeError
|
||||||
case qlog.ActionRefused:
|
case qlog.ActionRefused:
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ const (
|
|||||||
ActionAllow Action = "allow"
|
ActionAllow Action = "allow"
|
||||||
// ActionBlock is a blocklist hit.
|
// ActionBlock is a blocklist hit.
|
||||||
ActionBlock Action = "block"
|
ActionBlock Action = "block"
|
||||||
|
// ActionRedirect is a blocklist rewrite to an address or CNAME target.
|
||||||
|
ActionRedirect Action = "redirect"
|
||||||
// ActionCached is a cache hit.
|
// ActionCached is a cache hit.
|
||||||
ActionCached Action = "cached"
|
ActionCached Action = "cached"
|
||||||
// ActionError is a SERVFAIL or other failure.
|
// ActionError is a SERVFAIL or other failure.
|
||||||
@@ -246,11 +248,11 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// ShouldLog reports whether an entry with this action passes the sampling
|
// ShouldLog reports whether an entry with this action passes the sampling
|
||||||
// policy. Blocked, cached and error entries are always kept when their
|
// policy. Blocked, redirected, cached and error entries are always kept when
|
||||||
// category flag is set; ordinary resolutions are sampled.
|
// their category flag is set; ordinary resolutions are sampled.
|
||||||
func (l *Logger) ShouldLog(a Action) bool {
|
func (l *Logger) ShouldLog(a Action) bool {
|
||||||
switch a {
|
switch a {
|
||||||
case ActionBlock:
|
case ActionBlock, ActionRedirect:
|
||||||
return l.opts.LogBlocked
|
return l.opts.LogBlocked
|
||||||
case ActionCached:
|
case ActionCached:
|
||||||
return l.opts.LogCached
|
return l.opts.LogCached
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ export type Health = 'ok' | 'degraded' | 'down'
|
|||||||
/** One upstream server's circuit-breaker view. */
|
/** One upstream server's circuit-breaker view. */
|
||||||
export type UpstreamHealth = 'up' | 'down' | 'degraded'
|
export type UpstreamHealth = 'up' | 'down' | 'degraded'
|
||||||
/** The decision the pipeline reached for a query (qlog.Action). */
|
/** The decision the pipeline reached for a query (qlog.Action). */
|
||||||
export type LogAction = 'allow' | 'block' | 'cached' | 'error' | 'drop' | 'refused'
|
export type LogAction = 'allow' | 'block' | 'redirect' | 'cached' | 'error' | 'drop' | 'refused'
|
||||||
/** What a rule does to the name it matches (blocklist.ParseAction). */
|
/** What a rule does to the name it matches (blocklist.ParseAction). */
|
||||||
export type DomainAction =
|
export type DomainAction =
|
||||||
| 'allow'
|
| 'allow'
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ const ACTION_OPTIONS = [
|
|||||||
{ value: '', label: 'All actions' },
|
{ value: '', label: 'All actions' },
|
||||||
{ value: 'allow', label: 'Allow' },
|
{ value: 'allow', label: 'Allow' },
|
||||||
{ value: 'cached', label: 'Cached' },
|
{ value: 'cached', label: 'Cached' },
|
||||||
|
{ value: 'redirect', label: 'Redirect' },
|
||||||
{ value: 'block', label: 'Block' },
|
{ value: 'block', label: 'Block' },
|
||||||
{ value: 'error', label: 'Error' },
|
{ value: 'error', label: 'Error' },
|
||||||
{ value: 'drop', label: 'Drop' },
|
{ value: 'drop', label: 'Drop' },
|
||||||
@@ -73,6 +74,8 @@ function actionTone(action: string): 'default' | 'ok' | 'warn' | 'danger' | 'inf
|
|||||||
return 'default'
|
return 'default'
|
||||||
case 'cached':
|
case 'cached':
|
||||||
return 'info'
|
return 'info'
|
||||||
|
case 'redirect':
|
||||||
|
return 'info'
|
||||||
case 'block':
|
case 'block':
|
||||||
return 'warn'
|
return 'warn'
|
||||||
case 'error':
|
case 'error':
|
||||||
|
|||||||
Reference in new issue
Block a user