Log processors: in-process hub update

Aperta
#4,773 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
go
Ambito
backend, security

Direzione di ricerca

Start by reading the existing cron/systemd hub update flow and the configuration and reload paths. The issue identifies exprhelpers globals, appsec configuration parsing, atomic reload, and the update mechanism as separate work areas, but does not name files or tests. Done means updates run in process, validate before swapping configuration, and publish the two specified metrics.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

kind/enhancement needs/triage

Automated hub updates are currently handled by a cron/systemd timer that invokes cscli hub update / cscli hub upgrade then reloads crowdsec.

This works fine for deployment in VMs/bare metal, but cannot work for container/k8s/deployment (and windows currently has no support at all for hub auto updates).

We should replace the cron with an-in process update that has no external dependancies.

A new config key would be introduced:

crowdsec_service:
 hub_auto_update:
  enabled: true
  interval: 24h

This would default to enabled (the cron would be removed in the 1st release shipping this).

When crowdsec performs an update, the new configuration would be tested then swapped with the current one (the current cron cannot handle a rollback during a config upgrade, so we will also address this).

Because this require some important internal changes, we should split the work:

  • Stop relying on package level globals for exprhelpers (datafiles, geoip, ...) so that they can be swapped at runtime
  • Decouple appsec configuration parsing from the datasource itself to allow for testing before loading the configuration (this would have the side effect of being able to test them with crowdsec -t)
  • Implement the atomic configuration swap on reload (probably LP only at first ?): this would make crowdsec behaves more like nginx during a reload (a reload can fail, but the current version stays up), where currently we simply refuse the new config and exit.
  • Implement the actual update mechanism

A successfull auto-update would kill all existing buckets (like the current reload does)

New metrics would be published:

  • cs_autoupdate_last_timestamp: timestamp of the last successful autoupdate
  • cs_autoupdate_total: counter that tracks how many autoupdates with changes were performed
Lingua principale
Go
Stelle
15.1k
Fork
726
Merge medio
2g 51m
PR unite (30g)
18

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di crowdsecurity/crowdsec

Tutte le issue di crowdsecurity/crowdsec

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.