Commit graph

181 commits

Author SHA1 Message Date
mmetc
31b914512a
refact pkg/database: unnecessary pointers (#3611)
* refact pkg/database: unnecessary pointers

* lint
2025-05-07 11:12:27 +02:00
Manuel Sabban
e6b85b641c
feat(apic): add ApicAuth client and token re-authentication logic (#3522) 2025-05-06 16:23:56 +02:00
mmetc
15dcbdeec9
refact: remove unused metod DeleteDecisionsWithFilter() (#3605) 2025-05-06 16:10:18 +02:00
blotus
959b872118
allowlists: automatically expire current matching decisions on update (#3601) 2025-05-06 14:10:30 +02:00
mmetc
f8f0b2a211
improve support for parsing time durations with 'day' units (#3599)
* custom duration type for "cscli decisions list", "cscli alerts list"
* custom duration type for "cscli allowlist add"
* custom duration type for "cscli machines prune"
* custom duration type for "cscli bouncers prune"
* replace old function ParseDuration
* use custom duration type in expr helpers
* update dependency
* lint
* test fix
* support days in 'metrics_max_age'
* DurationWithDays for 'max_age'
2025-05-05 15:12:29 +02:00
mmetc
d10067e772
refactor pkg/database/Client.createAlertChunk() (#3585) 2025-05-02 14:12:00 +02:00
Laurence Jones
46e6398868
enhance: Allow the use of 'd' suffix in profiles (#3594) 2025-04-29 12:18:06 +01:00
mmetc
5bc2b49387
allowlists: check during bulk decision import (#3588) 2025-04-28 17:11:17 +02:00
mmetc
418a27596e
lint/gocritic: enable importShadow, typeUnparen, unnecessaryDefer (#3583) 2025-04-24 11:12:38 +02:00
mmetc
34e306505c
refact pkg/database: dry decision count (#3586) 2025-04-24 10:25:48 +02:00
blotus
4004868245
fix mysql client certificate support (#3575) 2025-04-16 14:39:26 +02:00
mmetc
620bd0117a
Refact pkg/database/decisions.go (#3541) 2025-04-16 11:53:52 +02:00
Laurence Jones
bcce4afe5e
enhance: Flags now superceed all log levels (#3496)
* enhance: Flags now superceed all log levels

* enhance: remove global var for local scope

* test

---------

Co-authored-by: marco <marco@crowdsec.net>
2025-03-07 13:42:08 +00:00
blotus
16d0677938
Add support for centralized allowlists (#3355) 2025-02-19 15:04:47 +01:00
mmetc
efbb42bf9e
deps: use ent 0.14.2 (#3259) 2025-02-18 17:08:58 +01:00
srkoster
62308f535c
Removed last_heartbeat update in MachineUpdateBaseMetrics (#3425) 2025-01-23 18:50:31 +01:00
mmetc
fe931af5ca
lint: gocritic/captLocal (don't capitalize local variables) (#3402)
* lint: gocritic/captLocal (don't capitalize local variables)

* lint (whitespace)
2025-01-16 14:03:53 +01:00
mmetc
6529215775
CI: golangci-lint 1.63 (#3396) 2025-01-16 13:22:08 +01:00
mmetc
fc17c0c613
lint: replace type assertions and type switch on errors (#3376)
* errorlint: replace type assertions on errors
* errorlint: replace type switch on errors
* lint
2024-12-27 10:40:50 +01:00
mmetc
26c15a1267
refact pkg/database: clean up code and error messages (#3263)
* refact pkg/database: extract alertfilter.go
* refact pkg/database: extract function rollbackOnError(); dry error messages
2024-12-19 17:01:16 +01:00
blotus
fb733ee43a
Allow bouncers to share API keys (#3323) 2024-11-19 14:47:59 +01:00
mmetc
897613e837
CI: check generated code in test workflow (#3261) 2024-09-25 09:02:53 +02:00
mmetc
3945a991bd
context propagation: pkg/database/alerts (#3252)
* alerts
* drop CTX from dbclient
* lint
* pkg/database/alerts: context.TODO()
* cscli: context.Background() -> cmd.Context()
2024-09-24 14:13:45 +02:00
mmetc
1133afe58d
context propagation: pkg/database/{lock,decision} (#3251)
* context propagation: pkg/database/lock

* QueryAllDecisionsWithFilters(ctx...), QueryExpiredDecisionsWithFilters(ctx...)

* more Query...Decision...(ctx..)

* rest of decisions

* lint
2024-09-23 17:33:46 +02:00
mmetc
4a2a663227
context propagation: pkg/database/bouncers (#3249) 2024-09-20 20:45:21 +02:00
mmetc
fee3debdcc
context propagation: pkg/database/machines (#3248) 2024-09-20 16:00:58 +02:00
mmetc
29f3d2710d
context propagation: pkg/database/metrics (#3247) 2024-09-19 14:27:34 +02:00
mmetc
eeb28014c6
context propagation: pkg/database/config (#3246) 2024-09-19 14:09:35 +02:00
mmetc
b4a2403fdf
context propagation: bouncer list (#3236) 2024-09-19 11:14:33 +02:00
mmetc
2a60c99036
context propagation: pkg/database/flush (#3235) 2024-09-19 11:11:50 +02:00
mmetc
519693270e
refact: alerts query (#3216)
* refact alerts: log messages

* refact: AlertPredicatesFromFilter
2024-09-18 15:00:19 +02:00
mmetc
b93b240bd4
lint: enable (some) gocritic checks (#3238)
* lint: gocritic configuration
* lint: octal literals
* lint: gocritic (filepath.Join)
* ling: gocritic (badRegexp, regexpSimplify)
* lint: gocritic (preferStringWriter)
* lint: gocritic (emtpyStringTest)
* filepath.Clean(a+b) -> filepath.Join(a, b)
* gofumpt
2024-09-17 17:07:30 +02:00
mmetc
ce085dc4cd
logs and user messages: use "parse" and "serialize" instead of marshal/unmarshal (#3240) 2024-09-17 13:19:14 +02:00
mmetc
6810b41dd8
refact pkg/database: context propagation (start) (#3226)
* refact pkg/database: context propagation (part)

* more context propagation (usagemetrics)

* propagate errors when updating metrics
2024-09-12 17:28:16 +02:00
mmetc
6b9b19b8c1
CI: use golangci-lint 1.60 (#3180)
* use golangci-lint 1.60

* lint (gosimple/S1009) -> len(nil) == 0

* nerf govet for now
2024-08-19 14:09:17 +02:00
mmetc
48e3f51954
cscli: add option --ignore-missing to "bouncers delete", "machines delete" (#3177)
* cscli: add option --ignore-missing to "bouncers delete", "machines delete"

* lint
2024-08-13 16:49:27 +02:00
mmetc
24bd8bb92c
perf: retrieve unsorted metrics (#3148) 2024-07-24 10:50:19 +02:00
mmetc
64e4ecde90
LAPI: detailed metrics endpoint (#2858) 2024-07-24 10:29:18 +02:00
blotus
c4bfdf1991
Store alert remediations status in DB (#3115) 2024-07-16 10:08:00 +02:00
mmetc
5390b8ea4b
remove warning "maxopenconns is 0, default to 100" (#3129)
* remove warning "maxopenconns is 0, default to 100"

also don't store as pointer since value 0 is not useful

* lint
2024-07-15 11:05:40 +02:00
mmetc
f130ce677d
command "cscli metrics show bouncers" (#3126)
* cscli metrics show bouncers

* db metrics: increase payload size

* func tests
2024-07-15 09:55:52 +02:00
mmetc
1b0104186a
cscli machines/bouncers: dry helper code and move to cscli (#3123) 2024-07-11 12:19:10 +02:00
mmetc
9cebcf96b4
command cscli [machines|bouncers] inspect (#3103)
* command cscli [machines|bouncers] inspect

* lint
2024-07-03 17:20:20 +02:00
mmetc
4635d04b22
lapi detailed metrics: API spec + models (#3100)
* lapi detailed metrics: API spec + models

* models+db: split hubstate by item type
2024-07-02 22:49:47 +02:00
mmetc
b1cf83975e
db refact: drop column machines.status (#3102) 2024-07-02 16:08:41 +02:00
mmetc
1acc35442c
lapi detailed metrics: db schema (#3099) 2024-07-01 12:14:55 +02:00
mmetc
4521a98ecc
db: don't set machine heartbeat until first connection (#3019)
* db: don't set machine heartbeat until first connection

* cscli machines prune: if hearbeat is not set, look at creation date

* lint
2024-06-17 10:39:50 +02:00
mmetc
44a2014f62
db: don't set bouncer last_pull until first connection (#3020)
* db: don't set bouncer last_pull until first connection

* cscli bouncers prune: query creation date if they never connected
2024-06-17 10:16:46 +02:00
mmetc
a529e66cd8
Typos (#3084)
* comment fix

* redundancy

* typo nill -> nil

* remove extra newline from log
2024-06-13 11:07:44 +02:00
mmetc
bd4540b1bf
refactor context (cscli, pkg/database) (#3071)
* cscli: helper require.DBClient()

* refactor pkg/database: explicit context to dbclient constructor

* lint
2024-06-11 12:13:18 +02:00