feat: 1.3.0 thirteen new pages, charts, tooltips and error analysis
Release / Plan (reuse the published image?) (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 20s
CI / Tests (Linux, race detector) (push) Successful in 1m10s
Release / ci (push) Successful in 1m10s
Release / Build image (arm64) (push) Successful in 55s
Release / Build image (amd64) (push) Successful in 1m16s
Release / Publish tags (push) Successful in 14s
Release / Gitea release (push) Skipped
Release / Plan (reuse the published image?) (push) Successful in 3s
CI / Docker image (build and smoke test) (push) Skipped
CI / Format and vet (push) Successful in 28s
CI / Dependency audit (push) Successful in 20s
CI / Tests (Linux, race detector) (push) Successful in 1m10s
Release / ci (push) Successful in 1m10s
Release / Build image (arm64) (push) Successful in 55s
Release / Build image (amd64) (push) Successful in 1m16s
Release / Publish tags (push) Successful in 14s
Release / Gitea release (push) Skipped
New pages grouped in the rail (Monitor, Investigate, Analyze, Operate, Reports): Services (SLO, Apdex, latency app vs proxy), Sessions (stage funnel), Campaigns, Event search, MITRE ATT&CK matrix, Evolution, Concentration (Pareto, Gini), Survival (Kaplan-Meier per attack episode, recidivists), Where errors come from (application vs failed attack vs proxy vs client), Protocols and TLS, Defense (fail2ban, SSH, blocklist), Integrity, and a printable executive report. Chart library (donut, radar, stacked area, bars, heatmap, gauge), glossary with accessible "?" tooltips, self-explanatory category names (nonexistent page 404), page loader through pages.json. Unique visitors fixed: real browsers opening a page, one per IP per day, deduplicated across domains, with non-human clients counted apart. Anonymous legitimate visits on the Live page (?visits=1, no IP). Traefik origin, service, protocol and TLS fields parsed. Paths and Referer paths drop e-mail and token segments. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b7462c14fa
commit
2ebda1e4d7
79 files changed
+9091
-171
No files matched your search
@@ -114,6 +114,11 @@ func New(opt Options) http.Handler {
|
||||
m.HandleFunc("GET /api/v1/ip/{ip}/stix", s.api(s.stixAPI))
|
||||
m.HandleFunc("GET /api/v1/events", s.api(s.eventsAPI))
|
||||
m.HandleFunc("GET /api/v1/events/sessions", s.api(s.sessionsAPI))
|
||||
// Analysis routes added by api_<name>.go files through registerUserRoute
|
||||
// (init): user auth only, same wrapper as every /api/v1 route.
|
||||
for _, r := range userRoutes {
|
||||
m.HandleFunc(r.pattern, s.api(r.handler(s)))
|
||||
}
|
||||
m.HandleFunc("GET /api/v1/events/stream", s.api(s.stream))
|
||||
m.HandleFunc("GET /api/v1/blocklist.txt", s.api(s.blocklist(false)))
|
||||
m.HandleFunc("GET /api/v1/blocklist.json", s.api(s.blocklist(true)))
|
||||
@@ -633,21 +638,34 @@ func (s *Server) stream(w http.ResponseWriter, r *http.Request) {
|
||||
defer stopHub()
|
||||
hubCh = c
|
||||
}
|
||||
// ?visits=1 also streams the legitimate visits (no address in them); nil blocks forever
|
||||
var visCh, hubVisCh <-chan store.VisitMsg
|
||||
if r.URL.Query().Get("visits") == "1" {
|
||||
c, stopV := s.opt.Store.SubscribeVisits()
|
||||
defer stopV()
|
||||
visCh = c
|
||||
if s.opt.Hub != nil {
|
||||
c, stopHV := s.opt.Hub.SubscribeVisits()
|
||||
defer stopHV()
|
||||
hubVisCh = c
|
||||
}
|
||||
}
|
||||
fmt.Fprint(w, "retry: 3000\n: connected\n\n")
|
||||
fl.Flush()
|
||||
tick := time.NewTicker(sseHeartbeat)
|
||||
defer tick.Stop()
|
||||
send := func(e store.LiveEvent) bool {
|
||||
sendAs := func(name string, e any) bool {
|
||||
if k := s.authKind(r); k != "session" && k != "bearer" {
|
||||
return false
|
||||
}
|
||||
b, _ := json.Marshal(e)
|
||||
if _, err := fmt.Fprintf(w, "event: ev\ndata: %s\n\n", b); err != nil {
|
||||
if _, err := fmt.Fprintf(w, "event: %s\ndata: %s\n\n", name, b); err != nil {
|
||||
return false
|
||||
}
|
||||
fl.Flush()
|
||||
return true
|
||||
}
|
||||
send := func(e store.LiveEvent) bool { return sendAs("ev", e) }
|
||||
for {
|
||||
select {
|
||||
case <-r.Context().Done():
|
||||
@@ -668,6 +686,14 @@ func (s *Server) stream(w http.ResponseWriter, r *http.Request) {
|
||||
if !send(e) {
|
||||
return
|
||||
}
|
||||
case e := <-visCh:
|
||||
if !sendAs("visit", e) {
|
||||
return
|
||||
}
|
||||
case e := <-hubVisCh:
|
||||
if !sendAs("visit", e) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -697,6 +723,12 @@ func (s *Server) peerStream(w http.ResponseWriter, r *http.Request) {
|
||||
h.Set("X-Accel-Buffering", "no")
|
||||
ch, stop := s.opt.Store.Subscribe()
|
||||
defer stop()
|
||||
var visCh <-chan store.VisitMsg // only with ?visits=1; carries no address
|
||||
if r.URL.Query().Get("visits") == "1" {
|
||||
c, stopV := s.opt.Store.SubscribeVisits()
|
||||
defer stopV()
|
||||
visCh = c
|
||||
}
|
||||
fmt.Fprint(w, "retry: 3000\n: connected\n\n")
|
||||
fl.Flush()
|
||||
tick := time.NewTicker(sseHeartbeat)
|
||||
@@ -705,6 +737,12 @@ func (s *Server) peerStream(w http.ResponseWriter, r *http.Request) {
|
||||
select {
|
||||
case <-r.Context().Done():
|
||||
return
|
||||
case v := <-visCh:
|
||||
b, _ := json.Marshal(v)
|
||||
if _, err := fmt.Fprintf(w, "event: visit\ndata: %s\n\n", b); err != nil {
|
||||
return
|
||||
}
|
||||
fl.Flush()
|
||||
case <-tick.C:
|
||||
if !s.opt.NoAuth && s.authKind(r) != "peer" {
|
||||
return
|
||||
|
||||
Reference in new issue
Block a user