Commit graph

121 commits

Author SHA1 Message Date
blotus
cce41a1e6c
do not attempt to set db log level if no db config (#3510) 2025-03-13 17:38:07 +01:00
blotus
16d0677938
Add support for centralized allowlists (#3355) 2025-02-19 15:04:47 +01:00
mmetc
bd7e1b50c3
cscli: cliconfig - remove global variables and gratuitous pointer (#3414) 2025-01-20 10:30:36 +01:00
Laurence Jones
f938b0c602
enhancement: Hubtest respect patterndir option set via config.yaml (#3386)
* enhancement: Hubtest respect patterndir option set via config.yaml

* pass patternDir to Run()

---------

Co-authored-by: marco <marco@crowdsec.net>
2025-01-02 14:21:03 +00: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
b1e2b9523c
cscli: print errors in plain text with -o json (#2973) 2024-12-13 15:45:07 +01:00
mmetc
e2196bdd66
remove dependency from pkg/cwversion to pkg/acquisition (#3242)
* register built-in components without dependencies
* package comment
2024-09-20 10:34:53 +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
mmetc
f0d6046c59
cscli refact: package cliitem (#3204) 2024-09-02 14:30:25 +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
b880df9a68
cscli refact: package 'clihub' (#3198)
* cscli refact: package 'clihub'

* check for errors
2024-08-28 11:52:25 +02:00
mmetc
2e970b3eb9
cscli refact: package 'clihubtest' (#3174)
* cscli refact: package 'clihubtest'

* split hubtest.go subcommands in files

* extract function getCoverage()

* common function hubTestCoverageTable()

* update cyclomatic lint

* lint
2024-08-27 15:42:24 +02:00
mmetc
c4431b6385
cscli refact: notifications, simulation, papi, setup (#3190)
* package 'clinotifications'

* package 'clisimulation'

* package 'clipapi'

* package 'cslisetup'
2024-08-26 16:33:35 +02:00
mmetc
9c0422f75b
cscli refact: package 'clicapi', 'clilapi' (#3185)
* extract functions to own files

* package clilapi

* package clicapi

* package crowdsec-cli/reload
2024-08-26 09:39:36 +02:00
mmetc
429418ffc6
cscli refact: package 'cliexplain' (#3151) 2024-08-21 10:24:18 +02:00
mmetc
08fdfc4fb0
cscli refact: package 'cliconsole' (#3149)
* cscli refact: package 'cliconsole'

* dry

* lint

* lint
2024-08-20 16:20: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
7cc33b5854
cscli refact: extract metrics to own package (#3106) 2024-07-04 14:43:35 +02:00
mmetc
9823ed61b6
cscli: log.Fatal -> return err (#3049)
* cscli: log.Fatal -> return err

* lint
2024-06-03 12:21:00 +02:00
mmetc
c1e858cbca
cscli: refactor alerts/console/decisions/setup (#3003)
* cscli alerts: extract list(), inspect()

* cscli console: extract enroll()

* cscli decisions: extract list()

* support dump: don't use global

* cscli setup: split command constructors

* lint
2024-05-31 19:15:05 +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
97e6588a45
cscli hub items: avoid global (#2960)
* cscli hub items: avoid global

* lint (whitespace, errors)

* lint
2024-04-24 10:05:55 +02:00
mmetc
b48b728317
cscli support: include stack traces (#2935) 2024-04-22 23:54:51 +02:00
mmetc
e34af358d7
refact cscli (globals) (#2854)
* cscli capi: avoid globals, extract methods
* cscli config restore: avoid global
* cscli hubtest: avoid global
* lint (whitespace, wrapped errors)
2024-02-23 10:37:04 +01:00
mmetc
3e3df5e4c6
refact "cscli config", remove flag "cscli restore --old-backup" (#2832)
* refact "cscli config show"
* refact "cscli config backup"
* refact "cscli confgi show-yaml"
* refact "cscli config restore"
* refact "cscli config feature-flags"
* cscli restore: remove 'old-backup' option
* lint (whitespace, wrapped errors)
2024-02-22 11:04:36 +01:00
mmetc
a6a4d460d7
refact "cscli console" (#2834) 2024-02-12 11:45:58 +01:00
mmetc
eada3739e6
refact "cscli notifications" (#2833) 2024-02-12 11:40:59 +01:00
mmetc
5c83695177
refact "cscli explain" (#2835) 2024-02-12 11:23:17 +01:00
mmetc
2853410576
refact "cscli alerts" (#2827) 2024-02-09 17:51:29 +01:00
mmetc
58a1d7164f
refact "cscli lapi" (#2825) 2024-02-09 17:39:50 +01:00
mmetc
4e724f6c0a
refact "cscli" root cmd (#2811)
* refact "cscli" root cmd
* lint (naming, imports, whitespace)
2024-02-06 10:50:28 +01:00
mmetc
fdc525164a
refact "cscli metrics" part 3 (#2807) 2024-02-06 10:07:05 +01:00
mmetc
5ff8a03195
refact "cscli metrics" par 1 (#2805) 2024-02-02 09:45:03 +01:00
mmetc
4160bb8102
refact "cscli decisions" (#2804)
* refact "cscli decisions"
* CI: relax mysql test timing
* lint
2024-02-01 22:36:21 +01:00
mmetc
f5fbe4a200
refact "cscli dashboard" (#2803) 2024-02-01 17:27:15 +01:00
mmetc
45c669fb65
refact "cscli papi" (#2802) 2024-02-01 17:27:00 +01:00
mmetc
825c08aa9d
refact "cscli simulation" (#2801) 2024-02-01 17:26:46 +01:00
mmetc
e6f5d157b8
refact "cscli hub" (#2800) 2024-02-01 17:25:29 +01:00
mmetc
17db4cb970
refact "cscli machines" (#2777) 2024-02-01 17:22:52 +01:00
mmetc
4192af30d5
refact "cscli bouncers" (#2776) 2024-01-31 12:40:41 +01:00
mmetc
f306d59016
logging: full timestamp with timezone in crowdsec.log (#2707)
RFC3339 = "2006-01-02T15:04:05Z07:00" (same as /var/log/syslog)
2024-01-08 21:20:25 +01:00
mmetc
67cdf91f94
Short build tag in version number (#2658)
* use short commit hash in version number
* var -> const
* cscli: extract version.go, doc.go
* don't repeat commit hash in version number
2023-12-14 09:16:38 +01:00
mmetc
c10aad79d9
cscli refact / encapsulate methods for capi, hubtest, dashboard, alerts, decisions, simulation (#2650) 2023-12-11 10:32:54 +01:00
blotus
04f3dc09f9
remove PAPI feature flag (#2601) 2023-12-08 14:55:45 +01:00
mmetc
4acb4f8df3
cwhub: context type (#2631)
* add hub type "context"
* cscli lapi: log.Fatal -> fmt.Errorf; lint
* tests for context.yaml
* load console context from hub
* original & compiled context
* deprecate "cscli lapi context delete"
$ cscli lapi context delete
Command "delete" is deprecated, please manually edit the context file.
* cscli completion: add appsec-rules, appsec-configs, explain, hubtest
2023-12-07 16:20:13 +01:00
mmetc
3e86f52250
cscli refact - encapsulation with types (#2643)
* refactor type cliHub, cliBouncers, cliMachines, cliPapi, cliNotifications, cliSupport, type cliExplain
2023-12-07 14:36:35 +01:00
Thibault "bui" Koechlin
8cca4346a5
Application Security Engine Support (#2273)
Add a new datasource that:
- Receives HTTP requests from remediation components
- Apply rules on them to determine whether they are malicious or not
- Rules can be evaluated in-band (the remediation component will block the request directly) or out-band (the RC will let the request through, but crowdsec can still process the rule matches with scenarios)

The PR also adds support for 2 new hub items:
- appsec-configs: Configure the Application Security Engine (which rules to load, in which phase)
- appsec-rules: a rule that is added in the Application Security Engine (can use either our own format, or seclang)

---------

Co-authored-by: alteredCoder <kevin@crowdsec.net>
Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
Co-authored-by: mmetc <92726601+mmetc@users.noreply.github.com>
Co-authored-by: Marco Mariani <marco@crowdsec.net>
2023-12-07 12:21:04 +01:00
mmetc
ffcab0b2bc
Refactor hub management and cscli commands (#2545) 2023-11-24 15:57:32 +01:00