Commit graph

133 commits

Author SHA1 Message Date
blotus
d2616766de
Allow auto registration of machines in LAPI (#3202)
Co-authored-by: marco <marco@crowdsec.net>
2024-09-02 13:13:40 +02:00
mmetc
0fb64682fd
cscli refact: package cli{support, machine, bouncer} (#3199)
* cscli refact: clisupport (reuse lapi status, capi status)

* cscli refact: package clibouncer, climachine

* cscli refact: package clisupport
2024-08-29 15:21:29 +02:00
mmetc
ec415ed069
cscli hub update: option --with-content to keep embedded items in index; use it in docker (#3192) 2024-08-27 13:07:05 +02:00
mmetc
89aec7cf6b
pkg/cwhub: simpler accessor methods (#3165)
* pkg/cwhub: simpler accessor methods

 - prefer higher level GetItemsByType, GetInstalledByType over GetItemMap
 - always send both appsec-rules and scenarios to api
 - explicit parameter for (case insensitive) sorted list of items
 - shorter code
 - assume itemType parameter makes sense, don't error

* lint (gofumpt)
2024-08-22 12:12:40 +02:00
mmetc
3d27e83bf5
pkg/cwhub: improve support for k8s config maps with custom items (#3154)
* pkg/cwhub: improve support for k8s config maps as custom items

 - allow links to links
 - ignore hidden ..data directories, but allow links to their content

* allow any number of subdirectories in /etc/crowdsec/{hubtype}

* item name as subdir/file.yaml

* improve func test

* lint
2024-08-20 17:36:07 +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
1bc3b0870b
command "cscli doc --target /path/to/dir" (#3169)
* command "cscli doc --target /path/to/dir"

* typos and improved messages

* CI: remove obsolete parameters for golangi-lint action

* lint
2024-08-07 12:45:54 +02:00
mmetc
136dba61d9
reduce log verbosity, minor CI fixes, lint (#3157)
* pkg/cwhub: redundant log messages

* CI: fixture output and elapsed time

* CI: preload only essential hub items

* report full version (including -rc2 etc.) with cscli hub update --debug

* lint
2024-08-01 10:55:04 +02:00
mmetc
6f5d75c5f1
cscli metrics: explicit message "no bouncer metrics found" (#3155) 2024-07-29 14:13:06 +02:00
mmetc
20067a85a0
cscli/hub: don't return error if some file can't be recognized (#3150)
In k8s there can be extra directories while mounting config maps, which
leads to a failure while parsing the hub state. The PR changes these
kind of errors to warnings.
2024-07-24 16:29:38 +02:00
mmetc
64e4ecde90
LAPI: detailed metrics endpoint (#2858) 2024-07-24 10:29:18 +02:00
marco
61d19cff84 update table test 2024-07-22 14:58:43 +02:00
mmetc
5b4f924d5f
allow .index.json to embed item content (#3145) 2024-07-22 10:54:39 +02:00
mmetc
35f97d4855
bats: curl helpers to mock log processors and bouncers (#3141) 2024-07-18 11:13:18 +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
6f5e970f50
func tests: update curl wrapper (#3121) 2024-07-10 12:57:16 +02:00
mmetc
31195ddf36
update vagrant config for opensuse (#3119) 2024-07-09 15:30:38 +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
27935f6d4c
fix "cscli [machines|bouncers] delete" autocompletion (#3101)
* fix "cscli [machines|bouncers] delete" autocompletion

* func test
2024-07-01 16:35:34 +02:00
mmetc
a3bd9baec1
improved tls middleware revocation checks (#3034) 2024-06-26 10:41:30 +02:00
mmetc
a1ebe18221
config: expand env variables in local_api_credentials.yaml and .yaml.local (#3093)
* config: expand env variables in local_api_credentials.yaml and .yaml.local

* fix func test
2024-06-20 17:18:41 +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
c39c9cf8b7
cscli: fix deprecation message for "context delete" (#3078)
missing newline, proper return code, same msg as dashboard, test
2024-06-11 09:28:10 +02:00
mmetc
cad760e605
pkg/cwhub: use explicit context for version check, index update (#3064)
* cscli refactor: explicit context for hub (version lookup)

* change order of version checks

* pkg/cwhub: split NewHub() + Update() + Load()

* cscli refactor: explicit context for hub (index update)

* updated pkg/cwhub docs

* lint
2024-06-07 16:56:02 +02:00
Manuel Sabban
1378e16578
fix test 01_cscli by avoiding discrepancies in cscli explain (#3059)
* fix hub installed items in pacakge tests
2024-06-06 11:19:05 +02:00
mmetc
114a966129
refactor "cscli decisions" (#3061)
* cscli decisions: extract method add()

* cscli decisions: extract method delete()

* cscli lapi: avoid apiclient global

* cscli capi: avoid apiclient global

* cscli decisions: error cleanup, avoid global for api client

* update test

* cscli alerts: extract method delete()

* lint
2024-06-06 10:21:03 +02:00
Manuel Sabban
2865b69855
fix tests in 01_crowdsec.bats for packages testing (#3054) 2024-06-05 08:26:32 +02:00
Manuel Sabban
f0f27ee5cb
add decently new version of python for centos 7 and 8 for testing (#3053)
* add decently new version of python for centos 7 and 8
* update ansible requirements
2024-06-04 22:39:13 +02:00
mmetc
d614ecbdcf
CI/bats: test remediation api via socket (#3052) 2024-06-04 15:09:19 +02:00
Manuel Sabban
95bc5880f4
update vagrant image for fc39, fc40 and ubuntu24.04 (#3042)
* update test distribution
* add skip file to avoid mysql tests
* add ubuntu 24.04
2024-05-31 15:56:13 +02:00
mmetc
0ba05acc03
tests: replace "docker-compose" -> "docker compose" (#3000)
* replace "docker-compose" -> "docker compose"

* obsolete doc note

* bats: clean up extra output
2024-05-17 10:07:28 +02:00
mmetc
b6253d567b
simulation for local scenarios (#3010) 2024-05-16 11:13:39 +02:00
mmetc
ccf08e56d9
bats: no need for openssl, netcat; allow to prevent tests from running with a lock (#3016)
* bats: lock/unlock instance data; replace openssl w/ cfssl; update dep list

* concat pem without openssl :-/

* unused/unreachable code

* lint

* redundant {} (shellharden)
2024-05-16 10:58:00 +02:00
mmetc
cc63729b2c
version: write to stdout, add missing newline (#3012)
* pkg/cwversion cleanup

 - add missing newline between version and codename
 - add more information to "support dump"
 - write "cscli version" and "crowdsec -version" to stdout, not stderr

* fix func test

* lint
2024-05-15 10:52:43 +02:00
mmetc
ccab6e9910
bats: clean up extra output (#3008) 2024-05-15 10:38:36 +02:00
blotus
6b978b09b3
docker: conditionally update hub (#2948) 2024-05-15 10:04:42 +02:00
mmetc
e3c6a5ba70
LAPI: support CRL files with multiple PEM blocks (#3002) 2024-05-13 17:09:30 +02:00
mmetc
26b3410ef1
CI: improve test "cscli machines prune" (#2992) 2024-05-13 09:48:08 +02:00
mmetc
defa076794
CI: disable log formatting for consistency (#2989)
* CI: disable log formatting for consistency

* lint (shellharden)
2024-05-07 15:09:22 +02:00
mmetc
0d9e000543
use go-cs-lib/downloader for data files, hub index, item YAML (#2926) 2024-05-07 13:44:17 +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
fb393f1c57
tests: bump yq, cfssl (#2952) 2024-04-22 17:19:00 +02:00
blotus
c6e40191dd
Revert "docker: pre-download all hub items and data, opt-in hub updat… (#2947) 2024-04-18 15:33:51 +02:00
mmetc
0e8a1c681b
docker: pre-download all hub items and data, opt-in hub update/upgrade (#2933)
* docker: pre-download all hub items and data, opt-in hub update/upgrade

* docker/bars: don't purge anything before pre-downloading hub

* Docker: README update
2024-04-08 14:53:12 +02:00
mmetc
6c042f18f0
LAPI: local api unix socket support (#2770) 2024-03-14 10:43:02 +01:00
mmetc
49e0735b53
cscli tests + fix bouncer/machine prune (#2883)
* func tests: "cscli config feature-flags"
* func tests: "cscli bouncers list"
* func tests + fix: "cscli bouncers/machines prune"
* lint
2024-03-11 13:14:01 +01:00
mmetc
d8877a71fc
lp metrics: collect datasources and console options (#2870) 2024-03-05 14:56:14 +01:00
mmetc
d34fb7e8a8
log processor: share apiclient in output goroutines (#2836) 2024-02-13 14:22:19 +01:00
mmetc
4561eb787b
bats: color formatter in CI (#2838) 2024-02-12 20:15:16 +01:00