Commit graph

165 commits

Author SHA1 Message Date
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
mmetc
b12ade27f4
cscli: review/update argument number checking (#3490)
* cscsli: remove unused Command.Args setting

* cscli: review/update argument number checking

cscli will consistently print the help text if the number of arguments is
wrong for the command, but not for other types of errors.

* fix func tests

* lint
2025-03-04 12:21:27 +01:00
mmetc
02d4793657
tests: remove modeline (#3486) 2025-02-28 15:24:13 +01:00
blotus
c5f5896625
crowdsec: allow -t to work if using appsec and allowlists (#3484) 2025-02-27 14:26:38 +01:00
mmetc
105801d1f9
cscli: allow non-local symlinks to have a different name than hub items (#3475) 2025-02-21 12:44:30 +01:00
mmetc
2b70dbf3e5
cscli hub/items: always show action plan; fix --interactive in pipes (#3451) 2025-02-21 00:17:01 +01:00
blotus
16d0677938
Add support for centralized allowlists (#3355) 2025-02-19 15:04:47 +01:00
mmetc
c4ff4228be
use go 1.24, enable unencrypted http2 (#3470) 2025-02-19 14:05:17 +01:00
mmetc
c5e0003b59
silence "cscli hub update" if noop in cron jobs (#3460) 2025-02-10 11:24:59 +01:00
mmetc
a001e1d760
cscli: replace '--yes' option with '--interactive' (#3448) 2025-02-06 11:43:29 +01:00
mmetc
b582730d06
remove commands "cscli config backup/restore" (#3158)
* remove "cscli config backup/restore"
* remove backup/restore calls from deb,rpm pre/postinst and wizard
* remove from prerm too
2025-01-16 14:02:39 +01:00
mmetc
5df56844d9
log warning if local items have conflicting names (#3399) 2025-01-13 13:28:48 +01:00
mmetc
866b0ad60c
Hubops tests (#3393) 2025-01-07 16:39:32 +01:00
mmetc
5c7b957a34
cscli: restyle table titles; autocomplete "cscli metrics show" (#3391)
* cscli: restyle table titles; autocomplete "cscli metrics show"
* lint
2025-01-02 16:58:03 +01:00
mmetc
a1d26bdc5b
cscli: improved hub management (#3352) 2024-12-26 15:21:52 +01:00
victoredvardsson
466f39b880
Add possibility to configure log format #799 (#2941)
* make it possible to enable json log

* fix

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* Add error handling

* Add log_format to default config

* Fix syntax error in if statement

* Fix typo

* Fix typo

* Fix some typos and change naming from native to text, makes more sense

* Set same timestamp format for json logging

* Fix formatting

* Move in if statement under previous

* Fix some formatting that got messed up

* Default to text formatter, if log_format is not configured.

* defining logFormatter outside if statement so that log.SetFormatter(logFormatter) is not undefined when function is called

* Add variables that were undefined

* Argument were missing when calling SetDefaultLoggerConfig function

* Fix order of arguments passed

* Fix order of arguments passed

* Fix typo

* Implicit log_format = "text"

* functional test

* ignore log_format in FatalHook

* make it possible to enable json log

* fix

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* fix typo

* Add error handling

* Add log_format to default config

* Fix syntax error in if statement

* Fix typo

* Fix typo

* Fix some typos and change naming from native to text, makes more sense

* Set same timestamp format for json logging

* Fix formatting

* Move in if statement under previous

* Fix some formatting that got messed up

* Default to text formatter, if log_format is not configured.

* defining logFormatter outside if statement so that log.SetFormatter(logFormatter) is not undefined when function is called

* Add variables that were undefined

* Argument were missing when calling SetDefaultLoggerConfig function

* Fix order of arguments passed

* Fix order of arguments passed

* Fix typo

* Implicit log_format = "text"

* functional test

* ignore log_format in FatalHook

* lint

* fix func test

* lint

* remove < > characters from log

---------

Co-authored-by: Victor Edvardsson <victor.edvardsson@loopia.se>
Co-authored-by: marco <marco@crowdsec.net>
Co-authored-by: Thibault "bui" Koechlin <thibault@crowdsec.net>
2024-12-23 11:08:33 +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
mmetc
99552f4a53
update dependency on docker (#3175)
* update dependency on docker

since docker doesn't have a go.mod, the opentelemetry dependencies
in go.sum must be updated by hand according to the vendor.mod file
of the related docker release

ex. https://github.com/docker/cli/blob/v27.1.1/vendor.mod
2024-12-18 16:35:00 +01:00
mmetc
b1e2b9523c
cscli: print errors in plain text with -o json (#2973) 2024-12-13 15:45:07 +01:00
mmetc
08296d9cfa
acquisition: add some test and warning for wrong source type (#3362) 2024-12-13 11:00:41 +01:00
mmetc
88c5f85064
sigmahq: fix functional test (#3359) 2024-12-10 13:19:56 +01:00
blotus
fb733ee43a
Allow bouncers to share API keys (#3323) 2024-11-19 14:47:59 +01:00
Laurence Jones
b3810c7e75
enhance: add fedora 41 (40, with provision to upgrade to 41 since there no image so far on vagrant cloud) (#3328) 2024-11-13 14:17:15 +00:00
Laurence Jones
4be84b8a0a
enhance: add opensuse leap 15 vagrant (#3329) 2024-11-13 14:15:01 +00:00
Laurence Jones
3ba71f412e
fix: Ansible fedora 40 to use 40 (#3327) 2024-11-12 16:42:19 +00:00
mmetc
92662ed461
refact cscli: decisions, lapi, bouncers, machines (#3306)
* refact "cscli decisions import"

* cobra.ExactArgs(0) -> cobra.NoArgs

* refact cscli bouncers

* refact cscli machines

* refact "cscli lapi"

* lint
2024-10-30 10:59:20 +01:00
mmetc
f97b9c84da
CI: update golangci-lint to v1.61, yq to 4.44.3 (#3241) 2024-09-17 15:19: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
cae76baa3a
refact acquisition: build profiles (optionally exclude datasources from final binary) (#3217)
example

$ make BUILD_PROFILE=minimal

or

$ make EXCLUDE=datasource_s3,datasource_kinesis
2024-09-12 17:26:39 +02:00
mmetc
4d10e9df00
refact: cscli papi (#3222)
* cscli papi status - fix nil deref + func test

* cscli papi: extract methods status(), sync()

* papi status -> stdout

* fix nil deref

* cscli support dump: include papi status

* lint
2024-09-10 17:32:13 +02:00
mmetc
ace942a36d
tests: prevent "make bats-fixture" to run if instance-data is locked (#3201)
* tests: prevent "make bats-fixture" to run if instance-data is locked

* lint
2024-09-06 10:31:00 +02:00
mmetc
bc6be99b97
cscli refact: package clialert, clidecision (#3203)
* cscli refact: package clialert, clidecision

* refact: function SanitizeScope()

* lint
2024-09-03 12:37:38 +02:00
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