mmetc
52995b8fa4
prevent nil deref when loading cti config ( #3176 )
...
* correct variable names
* prevent nil deref when loading cti config
2024-08-12 10:15:00 +02:00
Manuel Sabban
36d15fedce
Use the new hub api url ( #3132 )
...
* new hapi url
* mock url in tests has to be updated
---------
Co-authored-by: marco <marco@crowdsec.net>
2024-07-24 12:20:23 +02:00
mmetc
64e4ecde90
LAPI: detailed metrics endpoint ( #2858 )
2024-07-24 10:29:18 +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
206211ce53
lint: import statement order ( #3085 )
...
* lint: import statement order
* lint
2024-06-26 12:16:17 +02:00
mmetc
8a259fd25b
lint (copyloopvar) ( #2971 )
2024-06-20 22:13:26 +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
e859a751e9
lint: disable redundant linters, update revive configuration and code metrics ( #3081 )
2024-06-12 13:04:47 +02:00
mmetc
73e03ef556
lint: enable revive/if-return, revive/error-strings ( #3057 )
...
* lint: enable revive/if-return, revive/error-strings
* lint
2024-06-05 11:37:57 +02:00
mmetc
fba4237fbd
lint: revive/useless-break ( #3050 )
2024-06-04 09:48:21 +02:00
Laurence Jones
b5e5078fc7
fix: add sslmode check and apend flag to conn string ( #3009 )
2024-05-14 17:31:15 +01:00
mmetc
3788610aff
cscli: avoid global vars ( #2977 )
...
* cscli: avoid global usage
This is required to make it possible to split the package
* lint (fmt.Errorf)
2024-05-02 10:25:04 +02:00
mmetc
60431804d8
db config: don't exit setup if can't detect fs, improve detection for freebsd ( #2963 )
2024-04-25 11:11:57 +02:00
Christian Kampka
f6bb8412c5
Add patterns_dir configuration option ( #2868 )
...
* Add patterns_dir configuration option
* Update config.yaml
---------
Co-authored-by: mmetc <92726601+mmetc@users.noreply.github.com>
2024-03-25 16:20:16 +01:00
mmetc
6c042f18f0
LAPI: local api unix socket support ( #2770 )
2024-03-14 10:43:02 +01:00
Thibault "bui" Koechlin
b1c09f7512
acquisition : take prometheus level into account ( #2885 )
...
* properly take into account the aggregation level of prometheus metrics in acquisition
2024-03-13 14:57:19 +01:00
blotus
5731491b4e
Auto detect if reading logs or storing sqlite db on a network share ( #2241 )
2024-03-07 14:04:50 +01:00
mmetc
d8877a71fc
lp metrics: collect datasources and console options ( #2870 )
2024-03-05 14:56:14 +01:00
mmetc
e7ecea764e
pkg/csconfig: use yaml.v3; deprecate yaml.v2 for new code ( #2867 )
...
* pkg/csconfig: use yaml.v3; deprecate yaml.v2 for new code
* yaml.v3: handle empty files
* Lint whitespace, errors
2024-03-04 14:22:53 +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
4192af30d5
refact "cscli bouncers" ( #2776 )
2024-01-31 12:40:41 +01:00
mmetc
6507e8f4cd
cscli: don't print use_wal warning ( #2794 )
2024-01-30 11:07:53 +01:00
mmetc
91b0fce955
option to override hub url template. for testers only. ( #2785 )
2024-01-25 12:53:20 +01:00
Thibault "bui" Koechlin
19d36c0fb2
Support console options
in console enroll
( #2760 )
...
* make dev.yaml has a valid/default console path
* simplify and make more consistent help message about console opts
* allow enroll to specify options to enable
* allow 'all' shortcut for --enable
2024-01-19 15:49:00 +01:00
mmetc
24b5e8f100
Fix #2733 "cscli hang forever when i try to delete a decision" ( #2745 )
2024-01-16 09:16:21 +01:00
mmetc
fca8883cd9
cscli capi status -> message for missing credentials ( #2730 )
...
* cscli capi status -> message for missing credentials
* lint
2024-01-12 14:41:36 +01:00
mmetc
6960419a2e
Remove redundant file check for capi_whitelists_path ( #2728 )
2024-01-12 14:17:01 +01:00
mmetc
89f704ef18
light pkg/api{client,server} refact ( #2659 )
...
* tests: don't run crowdsec if not necessary
* make listen_uri report the random port number when 0 is requested
* move apiserver.getTLSAuthType() -> csconfig.TLSCfg.GetAuthType()
* move apiserver.isEnrolled() -> apiclient.ApiClient.IsEnrolled()
* extract function apiserver.recoverFromPanic()
* simplify and move APIServer.GetTLSConfig() -> TLSCfg.GetTLSConfig()
* moved TLSCfg type to csconfig/tls.go
* APIServer.InitController(): early return / happy path
* extract function apiserver.newGinLogger()
* lapi tests
* update unit test
* lint (testify)
* lint (whitespace, variable names)
* update docker tests
2023-12-14 14:54:11 +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
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
1ab4487b65
cscli hub list: show only non-empty tables with -o human
...
* agent config: remove unused LintOnly bool
* Item.IsLocal() -> Item.State.IsLocal(); split method InstallStatus()
* cscli hub list: show only non-empty tables with -o human
2023-12-05 13:38:52 +01:00
mmetc
ffcab0b2bc
Refactor hub management and cscli commands ( #2545 )
2023-11-24 15:57:32 +01:00
mmetc
5cd4406f5e
typos/grammar ( #2561 )
2023-11-07 15:07:36 +01:00
mmetc
a6b55f2b5e
cscli config feeature-flags: point user to the right location of feature.yaml ( #2539 )
2023-10-13 09:52:51 +02:00
mmetc
3b1563a538
Refact cscli hub / pkg/cwhub (part 6) ( #2524 )
...
* hub.ConfigDir -> hub.InstallDir; hub.DataDir -> hub.InstallDataDir
* cleanup GetInstalledItemsAsString()
* lint: ReferenceMissingError -> ErrMissingReference
* lint: parent_dir -> parentDir
* link: export Walker type
* lint: return error last
* lint: shadow
* move around and group variable definitions
2023-10-09 21:33:35 +02:00
mmetc
9ae8bd79c5
Refact pkg/csconfig tests ( #2526 )
...
* remove unused method
* whitespace, redundant comments
* use test helpers
* move DumpConsoleConfig() from pkg/csconfig to cscli
* package doc header
* var -> const
* rename ./tests -> ./testdata
* shorter tests with more error checks
* lint/formatting
* use helpers; fix tests that didn't actually test
* lint; rename expectedResult -> expected
2023-10-09 11:10:51 +02:00
mmetc
338141f067
Refact cscli hub / pkg/cwhub (part 5) ( #2521 )
...
* remove unused yaml tags
* cscli/cwhub: deduplicate, remove dead code
* log.Fatal -> fmt.Errorf
* deflate utils.go by moving functions to respective files
* indexOf() -> slices.Index()
* ItemStatus() + toEmoji() -> Item.status()
* Item.versionStatus()
* move getSHA256() to loader.go
2023-10-06 13:59:51 +02:00
mmetc
bfda483c0a
fix issue #2499 - nil dereference while using capi whitelists ( #2501 )
2023-10-02 11:42:17 +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
afeb541eac
apic: minor refactoring ( #2415 )
...
* apic: minor refactoring
* Add whitelist length check
If user configures the file but fails to define and actual whitelist we should check length to save allocs
* Init with length from file
* extract loop method from ApplyApicWhitelists
* pass pointer
* extract loop method updateBlocklist
---------
Co-authored-by: Laurence Jones <laurence.jones@live.co.uk>
2023-08-10 13:03:47 +02:00
mmetc
ffadd42779
update dependency on go-cs-lib; drop the pkg/ part ( #2393 )
2023-07-28 16:35:08 +02:00
mmetc
ae53c0f1cc
fix "crowdsec-cli/require" log verbosity ( #2390 )
2023-07-28 09:56:20 +02:00
mmetc
5cb7013575
Check cscli preconditions with crowdsec-cli/require package ( #2388 )
2023-07-27 17:02:20 +02:00
mmetc
9beb5388cb
errors.Wrap -> fmt.Errorf; clean up imports ( #2301 )
2023-06-23 14:04:58 +02:00
mmetc
3cc6b2c0d0
CI: add tests for metrics configuration ( #2251 )
2023-06-05 23:17:30 +02:00
mmetc
396dcf8e6e
dependencies: replaced function calls to pkg/types, errors.Wrap ( #2235 )
...
we now use a generic pointer function, and slowly remove the deprecated pkg/errors
2023-06-01 16:31:56 +02:00
mmetc
b2d3520519
decouple bouncer dependencies: use go-cs-lib in test code ( #2229 )
2023-05-25 15:37:44 +02:00
Laurence Jones
0416a41d58
Log info capi whitelists ( #2220 )
...
* add infof command if err was nil
* Fix golint
* Make message more readable and log individual stats
* Missed a d
* Remove '
* simplify if/else logic
---------
Co-authored-by: Marco Mariani <marco@crowdsec.net>
2023-05-25 10:28:08 +01:00