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
mmetc
6ef2396c91
enable linter: revive (blank-imports) ( #3062 )
...
* lint: revive (blank-imports) require a comment to justify blank imports
* typo
2024-06-06 16:03:32 +02:00
mmetc
9e859c0c8c
refactor pkg/database, pkg/models ( #3022 )
...
* pkg/models: Source.String()
* pkg/models: Alert.FormatAsStrings()
* cscli alerts list: sort remediation keys
avoid printing
"ban: ... captcha: ..."
in one line, and
"captcha: ... ban: ..."
in another
* remove unused methods; drop else branch
* lint
2024-06-05 12:01:13 +02:00
mmetc
9101de95d8
pkg/database: refactor & rename "soft delete" to "expire" ( #3025 )
...
* pkg/database: replace parameter with explicit methods
* merge methods with recusion
* rename "soft delete" -> "expire"
* lint
2024-06-04 13:19:46 +02:00
mmetc
b8ee31ade2
pkg/database: simplify flush agents/bouncers ( #3026 )
...
* pkg/database: simplify flush agents/bouncers
* lint
2024-05-31 15:44:30 +02:00
mmetc
6dbc5fd522
db: mark immutable columns / remove unused ( #3024 )
...
* db: mark immutable columns
* db: drop unused column
* lint
2024-05-31 15:19:48 +02:00
mmetc
02e2c8aed7
deps: use ent 0.13.1 ( #3023 )
2024-05-31 15:00:38 +02:00
blotus
1b894a292b
GetActiveDecisionsCount()
and GetActiveDecisionsTimeLeft()
expr helpers (#3013 )
2024-05-15 15:33:43 +02:00
mmetc
11da728b51
cscli support: collect profiling data and logs ( #2987 )
...
* extract methods, avoid globals
* collect logs to file dump.log
* include pprof data
* include latest logs
2024-05-07 12:59:38 +02:00
mmetc
a2dcc0ef9a
cscli: remove global dbClient ( #2985 )
...
* cscli: remove global dbClient
* lint (whitespace, errors)
2024-05-06 12:33:54 +02:00
mmetc
659feec496
cscli: don't print timestamps ( #2984 )
...
* cscli: don't print timestamps
* lint (whitespace, errors)
2024-05-06 10:43:54 +02:00
mmetc
529d3b2079
minor lint/readability ( #2976 )
...
* simplify a couple loops
* if/else -> switch
* drop redundant else
* comment + drop var declaration + explicit zero return
* lint (whitespace/fmt.Errorf)
2024-05-02 13:42:47 +02:00
mmetc
91fbc63533
db: review update timestamps, immutable columns ( #2981 )
...
* orm: correct behavior of created_at, updated_at, define immutable fields
* remove updatedefault for last_push, last_heartbeat
* re-generate db schema
* update last_push in CreateAlert()
* lint
2024-05-02 12:56:41 +02:00
Thibault "bui" Koechlin
f4ed7b3520
Truncate meta data ( #2966 )
...
* truncate meta-data if they are too big
2024-04-25 13:43:38 +02:00
mmetc
718d1c54b2
pkg/database/decisiosn: remove filter parameter, which is always passed empty ( #2954 )
2024-04-23 11:15:27 +02:00
Thibault "bui" Koechlin
b63e64ee9f
Fix locking logic for HA + add list unsubscribe for PAPI ( #2904 )
...
* add list unsubscribe operation for papi
* fix the locking logic for HA
2024-03-19 10:29:16 +01:00
blotus
6daaab1789
support both scope and scopes parameter in decisions filter ( #2882 )
2024-03-11 10:54:40 +01:00
mmetc
8108e4156d
CI: "make generate" target; use ent 0.12.5 ( #2871 )
...
* CI: "make generate" target; pin tool versions
* use ent 0.12.5
* fix make help
* fix model generation target; re-run swagger
2024-03-07 14:25:25 +01:00
mmetc
e611d01c90
cscli: hide hashed api keys ( #2874 )
...
* cscli: hide hashed api keys
* lint
2024-03-06 14:27:05 +01:00
he2ss
97c441dab6
implement highAvailability feature ( #2506 )
...
* implement highAvailability feature
---------
Co-authored-by: Marco Mariani <marco@crowdsec.net>
2024-02-14 12:26:42 +01:00
mmetc
2bbf0b4762
re-generate ent code ( #2844 )
2024-02-14 11:19:13 +01:00
mmetc
f75cdeb239
lint: enalble linter "wastedassign" ( #2772 )
2024-01-24 17:31:11 +01:00
mmetc
455acf7c90
lapi/papi: when receiving alerts, log and discard invalid addr/range ( #2708 )
...
https://github.com/crowdsecurity/crowdsec/issues/2687
2024-01-22 12:24:26 +01:00
mmetc
08694adf1b
lint (errorlint) ( #2644 )
2023-12-18 09:35:28 +01:00
mmetc
23968e472d
Refact bouncer auth ( #2456 )
...
Co-authored-by: blotus <sebastien@crowdsec.net>
2023-12-04 23:06:01 +01:00
mmetc
15542b78fb
refact BulkDeleteDecisions ( #2308 )
...
Code cleanup and de-duplication.
2023-11-26 22:30:03 +01:00
Thibault "bui" Koechlin
e4dcdd2572
fix include_capi filter ( #2478 )
2023-09-20 11:56:00 +02:00
Thibault "bui" Koechlin
4c08e1e68c
exclude 'lists' too if we exclude CAPI ( #2474 )
2023-09-19 13:56:22 +02:00
Thibault "bui" Koechlin
0040569fa9
if 'include capi' is false, only exclude capi alerts instead of assuming they necessarily have attached decisions ( #2435 )
2023-09-12 11:19:36 +02:00
mmetc
d45bec4047
minor log message improvements ( #2455 )
2023-09-12 11:04:56 +02:00
mmetc
fd94e2c056
refactor alert/decisions insert/update to avoid database locking in bulk operations ( #2446 )
2023-09-04 14:21:45 +02:00
mmetc
25868f27de
option db_client.decision_bulk_size ( #2440 )
2023-08-25 17:05:17 +02:00
mmetc
e36df40ba7
pkg/types cleanup ( #2398 )
...
* move function GetLineCountForFile from pkg/types to cscli
* move ParseDuration from pkg/types to pkg/database
* remove unused types.Profile, types.RemediationProfile
2023-08-24 09:44:46 +02:00
Laurence Jones
a18df9c3bb
Add bouncers prune command ( #2379 )
...
* Add bouncers prune command
* No point overloading functions
* Add prune to list of commands
* change all short desc to be similar, and made it really really clear when pruning it is not recoverable
* Dont use log. and dont return error on user input to abort
2023-07-28 15:37:39 +01:00
mmetc
ffadd42779
update dependency on go-cs-lib; drop the pkg/ part ( #2393 )
2023-07-28 16:35:08 +02:00