mirror of
https://github.com/safedep/pmg.git
synced 2026-08-03 07:24:09 +02:00
add event type & logging interceptor for unknown hosts (#157)
* add event type & logging interceptor for unknown hosts * update logging * add break * rename host_observation interceptor to audit_logger * restore MITMDecider and make AuditLogger telemetry skip MITM on CONNECT
This commit is contained in:
+18
-4
@@ -212,11 +212,25 @@ func (ps *proxyServer) configureMITM() {
|
||||
ps.mu.RLock()
|
||||
shouldMITM := false
|
||||
for _, interceptor := range ps.interceptors {
|
||||
if interceptor.ShouldIntercept(reqCtx) {
|
||||
shouldMITM = true
|
||||
log.Debugf("[%s] Interceptor %s will handle %s", reqCtx.RequestID, interceptor.Name(), host)
|
||||
break
|
||||
if !interceptor.ShouldIntercept(reqCtx) {
|
||||
continue
|
||||
}
|
||||
|
||||
mitm := true
|
||||
if decider, ok := interceptor.(MITMDecider); ok {
|
||||
mitm = decider.ShouldMITM(reqCtx)
|
||||
}
|
||||
|
||||
if !mitm {
|
||||
// Allow non-MITM interceptors (e.g., telemetry) to observe CONNECT traffic.
|
||||
if _, err := interceptor.HandleRequest(reqCtx); err != nil {
|
||||
log.Errorf("[%s] Interceptor %s error on CONNECT: %v", reqCtx.RequestID, interceptor.Name(), err)
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
shouldMITM = true
|
||||
log.Debugf("[%s] Interceptor %s will handle %s", reqCtx.RequestID, interceptor.Name(), host)
|
||||
}
|
||||
ps.mu.RUnlock()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user