Commit graph

473 commits

Author SHA1 Message Date
Laurence Jones a1d5a02646
Cscli explain use temp dir (#1598)
* Write to temp dir instead of CWD
2022-06-22 10:27:43 +02:00
mmetc d71279f023
added flag crowdsec --warning (#1461) 2022-06-22 09:38:23 +02:00
mmetc c78c833400
CI: colored test output, colored crowdsec and crowdsec-api logs, full final db dump for mysql and sqlite (#1596)
* github-ci: color unit test output and logs
* new config option: force_color_logs (useful in CI)
* bats: show sqlite/mysql dump at the end
* removed "-v" (print package names) from "go build"
* general workflow cleanup
2022-06-17 16:12:49 +02:00
mmetc 10585bfecc
enabled linters and fixes for: misspell, predeclared, unconvert, ineffassign, gosimple, govet (#1595) 2022-06-16 14:41:54 +02:00
Thibault "bui" Koechlin 1c0fe09576
Add support for certificate authentication for agents and bouncers (#1428) 2022-06-08 16:05:52 +02:00
blotus 4b311684ab
Add more JSON expr helpers (#1576) 2022-06-08 12:15:29 +02:00
blotus b7f1c5455f
do not rely on /proc/sys/kernel/random/uuid as fallback as it does not exists everywhere (#1575) 2022-06-06 18:20:10 +02:00
mmetc 799cc82bb5
functional tests, minor refactoring and lint/cleanup (#1570)
* cmd/crowdsec: removed log.Fatal()s, added tests and print error for unrecognized argument
* updated golangci-lint to v1.46
* lint/deadcode: fix existing issues
* tests: cscli config backup/restore
* tests: cscli completion powershell/fish
* err check: pflags MarkHidden()
* empty .dockerignore (and explain the reason)
* tests, errors.Wrap
* test for CS_LAPI_SECRET and minor refactoring
* minor style changes
* log cleanup
2022-06-06 15:24:48 +02:00
mmetc df7c51f34e
fixed coverage reporting for functional tests; added cscli (#1568) 2022-05-31 10:01:30 +02:00
mmetc 1fc9587919
fix #1283: update and enable error reports from golangci (#1523) 2022-05-25 22:27:50 +02:00
mmetc 1a293a2a27
cwhub: export SetHubBranch (#1559) 2022-05-24 15:46:48 +02:00
Thibault "bui" Koechlin fe09737d80
Add support for machine heartbeat (#1541)
* add the last_heartbeat field

* add heartbeat controller

* add endpoint of heartbeat

* heartbeat integration

* add last_heartbeat to cscli machines list
2022-05-19 15:47:27 +02:00
mmetc 4b843d145a
cscli: avoid double output (error + log fatal) and automatic --help after each error (#1536) 2022-05-19 13:42:44 +02:00
mmetc 131ed1b0a7
error reporting (#1501)
* unified error reporting, removed redundancy, tests
2022-05-19 10:48:08 +02:00
mmetc e6a2a7386c
changed option 'alerts-tainted' (which does not exist) to 'tainted' (#1538) 2022-05-19 09:55:49 +02:00
Manuel Sabban 18030e6c58
add notifications command (#1537)
* add notifications command

Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
2022-05-18 16:13:33 +02:00
Laurence Jones 6d6d82b3af
Memory check for cscli dashboard setup (#1513)
* Add 1gb recmem variable and use memory module

Since checking the RAM is not required to get the container up and running we can change this to a warn level
2022-05-18 11:05:01 +02:00
Laurence Jones c2b298c93a
Add single quotes (#1527) 2022-05-17 16:57:04 +02:00
mmetc b8547da4c3
"make localstack" target, link to docs/contributing (#1522) 2022-05-17 15:54:52 +02:00
blotus 0449ec1868
Windows Support (#1159) 2022-05-17 12:14:59 +02:00
blotus 8f111680bf
Allow to override statics in hubtest. (#1495) 2022-04-29 14:24:41 +02:00
Manuel Sabban 2e37d5ce97
update machineid lib (#1489)
* update machineid lib

Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
2022-04-28 12:18:16 +02:00
Greg Myers 0f4ab71f01
Fix typos in docs, comments, code (#1483) 2022-04-27 11:04:12 +02:00
AlteredCoder 8074a233e8
Fix typo in cscli metrics and debug message (#1473)
* Fix typo in cscli metrics and debug message
2022-04-22 11:29:55 +02:00
AlteredCoder 4273a0f243
cscli: add autocompletions for hubitems (#1465)
* Add autocompletion for hub items in cscli
2022-04-20 15:44:48 +02:00
he2ss 615895da9d
cscli: add force enroll feature (#1430)
* cscli: add force enroll feature
2022-04-20 13:34:17 +02:00
Shivam Sandbhor 8060f54f27
Cwhub testing (#1438)
* Add tests in cwhub and fix collection upgrade(#1431)

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com

Co-authored-by: bui <thibault@crowdsec.net>
Co-authored-by: Thibault "bui" Koechlin <orixxx@gmail.com>
2022-04-19 12:07:35 +02:00
mmetc 4b9a0c4ef7
typos (#1453) 2022-04-19 11:25:27 +02:00
AlteredCoder 71165bcd30
Send all installed scenario to LAPI (#1277) 2022-04-13 17:48:29 +02:00
mmetc 5f2797c83c
more func test coverage; capture exit code for bincover (#1425) 2022-04-13 15:44:23 +02:00
mmetc bf4bc0c9fc
single workflow for all tests, with bats coverage (#1413) 2022-04-05 11:00:11 +02:00
mmetc 1e63727064
int64 for metric units (#1419) 2022-04-04 21:50:19 +02:00
mmetc dad22a6aba
instrument main() for tests (#1399) 2022-04-01 11:17:45 +02:00
mmetc b202e387cf
fix "cscli" without arguments (#1406) 2022-03-31 16:50:38 +02:00
Thibault "bui" Koechlin d8dc01cd94
Revamp unit tests (#1368)
* Revamp unit tests
* Increase coverage
* Use go-acc to get cross packages coverage

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2022-03-29 14:20:26 +02:00
mmetc caf1dc71fb
allow capi register in functional tests (#1384) 2022-03-24 11:07:54 +01:00
AlteredCoder 411baa4dcf
Improve cscli metrics units (#1374)
* Improve cscli metrics units
2022-03-21 12:13:36 +01:00
AlteredCoder e4cc5fc997
Add -m flag for decisions list to display the machine (#1361)
* Add -m flag for decisions list to display the machine
2022-03-16 17:29:31 +01:00
Shivam Sandbhor 023ac9e138
Add trusted IPs which have admin API access (#1352)
* Add trusted IPs which have admin API access
2022-03-16 17:28:34 +01:00
AlteredCoder b57eb92bbc
Allow to ignore errors when installing multiple configuration items (#1359)
* Allow to ignore errors when installing multiple configuration items
2022-03-16 17:27:30 +01:00
AlteredCoder 24797c1534
Allow cscli remove to remove with --all (#1360) 2022-03-16 17:26:31 +01:00
Shivam Sandbhor 76e97303a5
Deprecate pid_file config (#1346)
* Deprecate pid_file config

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>

* Fix unit test

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>

* Impl review suggestions.

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2022-03-16 09:23:49 +01:00
AlteredCoder 0dd37240a5
Display acquisition dir in cscli config show (#1349) 2022-03-14 18:28:31 +01:00
mmetc b6aca81ebd
allow "cscli completion..." without configuration file (#1340) 2022-03-10 14:57:14 +01:00
mmetc aca37a38e7
return 1 with incomplete command line; always check error when calling cmd.Help (#1335) 2022-03-10 13:55:25 +01:00
Thibault "bui" Koechlin 52132ce398
fix #1157 (#1327) 2022-03-10 13:23:21 +01:00
mmetc 7c0593c659
noop code removal, typos and lint fixes (#1329) 2022-03-09 16:15:18 +01:00
Shivam Sandbhor 0f5e922851
Warn when log file in explain command is large. (#1293)
* Warn when log file in explain command is large.

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2022-02-28 14:57:59 +01:00
Shivam Sandbhor 1928d385b0
Fix typo in explain help (#1290) 2022-02-24 13:32:18 +01:00
Thibault "bui" Koechlin 9a42190e13
fix #1274 (#1285) 2022-02-24 10:24:04 +01:00
mmetc 556892cf86
make test (#1249) 2022-02-14 22:21:19 +01:00
AlteredCoder 8b90f4b2b2
Upgrade download datafiles if doesn't exist (#1254) 2022-02-14 16:51:06 +01:00
mmetc ef4bf6a8ab
grammar (#1257) 2022-02-14 13:47:15 +01:00
Thibault "bui" Koechlin 4fc7335112
fix help message (#1228) 2022-02-02 10:06:08 +01:00
mmetc ad28a979e9
local control flow cleanup (#1215)
removed redundant/unreachable returns, else branches, type declarations, unused variables
2022-02-01 22:08:06 +01:00
mmetc 35eea39db7
allow Makefile to override /etc/crowdsec and /var/lib/crowdsec/data (#1221) 2022-02-01 10:34:53 +01:00
mmetc 383eebf2b6
Makefile cleanup (#1211)
* rm -f => $(RM)
* PHONY targets
* remove email plugin binary on cleanup
* unused make variables
2022-02-01 09:22:47 +01:00
Thibault "bui" Koechlin dbde90d24c
fix #1200 (#1203) 2022-01-24 17:22:16 +01:00
Thibault "bui" Koechlin cc1ab8c50d
switch to utc time everywhere (#1167)
* switch to utc time everywhere


Co-authored-by: alteredCoder <kevin@crowdsec.net>
2022-01-19 14:56:05 +01:00
Thibault "bui" Koechlin 6e92da76ad
lapi to capi : allow push of tainted/custom/manual decisions (#1154)
* add console command to control signal sharing
* modify metrics endpoint to add lastpush

Co-authored-by: alteredCoder <kevin@crowdsec.net>
2022-01-13 16:46:16 +01:00
Thibault "bui" Koechlin 3bca25fd6d
lists support from central api (#1074)
* lists support from central api

Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
2022-01-11 14:31:51 +01:00
Shivam Sandbhor c109e0e7dd
Add option to print machine creds (#1149)
* Add option to print machine creds

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2022-01-07 16:53:56 +01:00
Shivam Sandbhor ba71c55492
Fix cscli inpsect json output (#1145)
* Fix cscli inpsect json output
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2022-01-05 10:42:27 +01:00
Shivam Sandbhor 6c4ec64ca9
Fix json output of cscli hub list (#1143)
* Fix json output of cscli hub list
* Fix functional tests.

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2022-01-04 11:49:23 +01:00
mmetc cf175ab07e
fixed "help collections list" message (#1142)
* fixed "help collections list" message

* corrected usage of "as well"
2022-01-03 17:09:07 +01:00
he2ss ed38ca3a73
cscli: raise error on unknown collection remove (#1133) 2021-12-30 11:32:05 +01:00
AlteredCoder 9c8ca5c73a
Alert inspect improvement / Use correct CSV output when listing in raw format (#1127) 2021-12-29 14:08:47 +01:00
blotus 3105897f37
Allow to configure log rotation (#1130) 2021-12-28 11:59:03 +01:00
mmetc 7126f8f0ff
replaced &nbsp; (#1129) 2021-12-28 10:32:46 +01:00
Thibault "bui" Koechlin 6b13d73fca
fix #1057 (#1120) 2021-12-22 15:45:41 +01:00
mmetc 6b3e22e99a
add LD_OPTS to "go test" (#1115) 2021-12-21 10:21:34 +01:00
Thibault "bui" Koechlin 106254f020
support for cancel_on (#1105)
* cancel_on filter

* tests
2021-12-17 09:56:02 +01:00
AlteredCoder 88d06260d7
add cscli decisions import (#1038)
* add cscli decisions import

Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
Co-authored-by: bui <thibault@crowdsec.net>
2021-12-15 11:39:37 +01:00
AlteredCoder ab93cec736
return an error if we can't add a bouncer (#1085) 2021-12-14 11:09:57 +01:00
AlteredCoder 01130a5e17
add headers when using raw output (#1087)
* add headers when output raw with cscli
2021-12-14 11:09:26 +01:00
AlteredCoder 4c306187a6
fix hubtest --no-clean when failure (#1088) 2021-12-14 11:08:06 +01:00
Shivam Sandbhor 44d701a9dd
Fix null point error if server cfg is empty while doing cscli explain (#1096)
Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2021-12-14 10:31:22 +01:00
Thibault "bui" Koechlin e5204bc1b1
fix #1083 : do not update/overwrite 'not installed' collections sub-items on 'cscli XX upgrade' (#1089)
* fix #1083 : do not update/overwrite 'not installed' collections sub-items on 'cscli XX upgrade'
2021-12-13 19:31:16 +01:00
mmetc c7fb6a1428
enabled -> enabling (#1090) 2021-12-13 13:14:29 +01:00
mmetc ca67be8fca
fatal if cannot add bouncer: fix for #1066 (#1067) 2021-12-13 10:30:55 +01:00
mmetc 7dee103b6e
typos of various nature (#1072) 2021-12-06 17:29:23 +01:00
AlteredCoder 4917aa23c9
Docker datasource (#1064)
* add docker datasource
2021-12-02 15:55:50 +01:00
he2ss 0652e9ed08
feature cscli|crowdsec add additional labels on crowdsec dsn run (#1053)
* feature cscli|crowdsec add additional labels on crowdsec dsn run
2021-11-17 10:08:46 +01:00
Thibault "bui" Koechlin 7362828a3b
add --failures to explain feature : only display failed lines (#1048)
* add --failures to explain feature : only display failed lines

* no error no problem
2021-11-08 18:01:43 +01:00
Thibault "bui" Koechlin d1ce543440
Improve explain (#1039)
* improve explain feature

* nicer display for details, --verbose in favor of --debug for details
2021-11-02 12:06:01 +01:00
mmetc f10187bd6d
typos (#1036) 2021-11-02 09:19:22 +01:00
Shivam Sandbhor 9034bb7919
Allow user to specify key for bouncers. (#1026)
* Allow user to specify key for bouncers.

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2021-11-02 08:37:51 +01:00
Thibault "bui" Koechlin 02886140a7
add a --key to cscli config show (#1029)
* add a --key to cscli config show
2021-10-28 09:32:59 +02:00
AlteredCoder cf57c89177
add name and alias in cscli console enroll (#950)
* add name and alias in cscli console enroll
2021-10-26 15:33:17 +02:00
blotus 0d46890d6b
add --limit parameter to cscli decisions list (#1025) 2021-10-26 13:33:59 +02:00
blotus 25a2d528b0
Alerts flush: Optimization of the flush mechanism (batch and limit to one job) + add cscli alerts flush command (#1024)
- Don't allow running more than one alert flush job at a time to prevent runaway CPU usage in some case. (fix High CPU after Upgrade to 1.2.0 #1022)
 - Add a cscli alerts flush command to manually flush the alerts in the database (fixes Improvement/Manual flush mechanism #1023 ).
 - Enable cascading deletion on alerts as we upgraded ent: Deleting an alert in the database will automatically delete all related decisions, events and meta
 - Add an index on alerts.id to try to improve flush performance with very big sqlite database.
- Flush alert now operates in batch
2021-10-26 13:33:45 +02:00
Thibault "bui" Koechlin 76a80380e7
don't wait on tomb if no datasources were started (#1019) 2021-10-24 11:07:45 +02:00
Shivam Sandbhor a7b1c02bd5
Fix bugs in cloudwatch acq (#991)
* Fix bugs in cloudwatch acq

- Fix concurrent writes to map streamIndexes
- Fix multiple cases of modifying while iterating on slice.
- Fix order of fetching cloudwatch events.
- Remove `startup` hack.

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>

* Fix cloudwatch tests

Signed-off-by: Shivam Sandbhor <shivam.sandbhor@gmail.com>
2021-10-22 10:35:05 +02:00
AlteredCoder 203be9bfbf
fix typo in cscli help command (#1001)
* fix typo in cscli help command

* Update hubtest.go
2021-10-08 16:53:02 +02:00
AlteredCoder 37eedce72e
add functionnal test for hubtest (#996)
* add hubtest in functionnal test
2021-10-05 09:52:55 +02:00
Thibault "bui" Koechlin af4bb350c0
hubtests revamp + cscli explain (#988)
* New hubtest CI for scenarios/parsers from the hub
 * New `cscli explain` command to visualize parsers/scenarios pipeline

Co-authored-by: alteredCoder <kevin@crowdsec.net>
Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
Co-authored-by: he2ss <hamza.essahely@gmail.com>
Co-authored-by: Cristian Nitescu <cristian@crowdsec.net>
2021-10-04 17:14:52 +02:00
blotus 9b680ae455
refuse to start if plugins are enabled and their config is missing (#954) 2021-09-09 16:07:33 +02:00
AlteredCoder 078c994159
don't install all items from hub when upgrade --force (#948) 2021-09-08 11:58:51 +02:00
Shivam Sandbhor b8e24a1e0b
Make plugin runner configurable and run only registered plugins (#944)
* Make plugin runner configurable and run only registered plugins
2021-09-08 11:36:42 +02:00
blotus 2f937cb53a
update doc generation (#926) 2021-09-03 12:56:17 +02:00
blotus ea640dfb6d
fix datasource prometheus metrics not being registered (#927) 2021-09-02 12:35:12 +02:00
AlteredCoder 4aca9941cb
allow deleting multiple machines (#930)
* allow deleting multiple machines

* allow multiple bouncers deletion

Co-authored-by: AlteredCoder <AlteredCoder>
2021-09-02 12:23:06 +02:00
blotus e54b5beb8d
Update cscli doc for docusaurus (#924) 2021-08-31 15:03:47 +02:00
ThinkChaos 448a227079
Minor changes to specific logs (#900)
- Minor changes to specific logs
- Fix LAPI to not push signals to CAPI when disabled #907
2021-08-25 18:30:05 +02:00
Thibault "bui" Koechlin 950759f6d6
Output plugins (#878)
* Add plugin system for notifications (#857)
2021-08-25 11:43:29 +02:00
Manuel Sabban 4dbbd4b3c4
Download datafile (#895)
* add the ability to download datafile on cscli hub upgrade on files are missing
* fix stuff + lint
* fix error management

Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
2021-08-19 09:08:20 +02:00
blotus 53f9837e6a
set hubBranch to master if not provided in the configuration and if crowdsec has been built without version information (#884) 2021-08-11 14:55:51 +02:00
Thibault "bui" Koechlin 2a6369658a
add a hook on fatal/panic to ensure we're logging to stderr as well (#879) 2021-08-05 08:50:08 +02:00
Thibault "bui" Koechlin 34a4371dde
check if api:client is present (#867) 2021-07-23 15:10:43 +02:00
Thibault "bui" Koechlin 657b765021
simplify, and only kill/wait on tomb when relevant (#866) 2021-07-23 11:09:56 +02:00
AlteredCoder d8b8795619
update completion doc (#850)
Co-authored-by: AlteredCoder <AlteredCoder>
2021-07-02 12:16:57 +02:00
Thibault "bui" Koechlin ca3e9ea487
load hub file properly when restoring config from tmpdir (#847) 2021-07-01 18:38:45 +02:00
Thibault "bui" Koechlin 033c8e17e8
fix #842 #837 (#845)
* fix #842 and move preflight checks tgth

* handle new container name

Co-authored-by: AlteredCoder <AlteredCoder>
2021-07-01 18:15:22 +02:00
he2ss 1b39893fcf
cscli: update completion doc (fix #841) (#846)
* cscli: update completion doc (fix #841)
2021-07-01 15:03:48 +02:00
blotus 556f93827a
refuse to run the dashboard if not on amd64 (#843) 2021-07-01 13:41:16 +02:00
blotus 3994aec7fe
add console enroll command to cscli (#828) 2021-06-28 17:34:19 +02:00
Thibault "bui" Koechlin ce6a61df1c
Refactor Acquisition Interface (#773)
* Add new acquisition interface + new modules (cloudwatch, syslog)

Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
2021-06-11 09:53:53 +02:00
Shivam Sandbhor f25d02a7c8
Allow bouncers to filter decisions by scope (#817)
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
2021-05-31 15:07:09 +02:00
Shivam Sandbhor 98277f5bb7
Gen passwd until it satisfies metabase policy (#792)
Signed-off-by: Shivam Sandbhor <shivam@crowdsec.net>
2021-05-17 11:43:53 +02:00
AlteredCoder fd830b4293
Fix some bugs (#788)
* fix config restore

* fix panic on middleware

Co-authored-by: AlteredCoder <AlteredCoder>
2021-05-07 18:40:01 +02:00
AlteredCoder a19f13ab45
fix cscli alerts delete -all (#769)
Co-authored-by: AlteredCoder <AlteredCoder>
2021-04-27 11:59:18 +02:00
AlteredCoder 60740f6279
fix makefile for static binaries (#764)
* Fix LD_OPTS for static build

Co-authored-by: AlteredCoder <AlteredCoder>
Co-authored-by: Sebastien Blot <sebastien@crowdsec.net>
2021-04-26 14:45:52 +02:00
blotus 5e2412cc5d
cscli: sort meta by key in alerts inspect output (#762) 2021-04-23 13:42:14 +02:00
Thibault "bui" Koechlin 88e1095478
cscli machines|bouncers|dashboard error message clarification (#754) 2021-04-16 10:50:08 +02:00
Thibault "bui" Koechlin 2679867061
ensure to flush acquis config while reloading (#748) 2021-04-13 13:55:33 +02:00
Thibault "bui" Koechlin 59a9a6b6bf
ensure to load db config for dashboard commands (#731) 2021-03-31 11:32:38 +02:00
Thibault "bui" Koechlin 20ef67a699
cscli hub mgmt improvements (#710)
* avoid this confusing behaviour where 'cscli parsers/scenarios/... upgrade' won't tell a thing if no arguments are given (and won't do anything neither)

* avoid repeating warnings about available update to the user
2021-03-29 10:33:23 +02:00
AlteredCoder 20ccb32124
FreeBSD changes (#718) (#721)
* FreeBSD changes (#718)

* Update build Makefile to be able to build on other platforms

Split Makefiles to isolate every specifics per platform if specific file
is not found, the include will default to linux.

* Isolate linux specific messages emitted by crowdsec command line

On other platforms, we shouldn't write messages with `systemctl`
occurrences. This commit isolate the specific messages and ensure the
messages are relevant for the given platform according result of `GOOS`.

* remove the test

Co-authored-by: Sofian Brabez <sbz@6dev.net>
Co-authored-by: AlteredCoder <AlteredCoder>
2021-03-26 17:42:56 +01:00
AlteredCoder 73a10ef0e5
add autocompletion for cscli (#717) 2021-03-24 19:07:58 +01:00
AlteredCoder 1e899c2211
Refactor configuration management (#698) 2021-03-24 18:16:17 +01:00
AlteredCoder f1d23b51f6
fix null deref in cscli config (#694) 2021-03-16 16:09:11 +01:00
AlteredCoder 111e17e884
don't hide cscli version (#686)
Co-authored-by: AlteredCoder <AlteredCoder>
2021-03-12 16:17:28 +01:00
AlteredCoder f2d14c8ca2
update the config.yaml file (#674) 2021-03-11 11:18:09 +01:00
Thibault "bui" Koechlin c2d4fb037a
clarify help message, fix #659 (#672) 2021-03-10 14:58:19 +01:00
registergoofy 5b7ac4a473
[Rebased] fix races (#633)
* get rid of dead code
* have LeakRoutined started in a tomb
* fix race and multiple small issues in the way we handle tombs
* yet another race fix
* another race
* get rid of leaky.KillSwitch for proper tomb use
* fix deadlock
* empty overflow before exiting
* fix an obvious typo
* proper use of waitgroup
* have a smart signalisation for allowing LeakRoutine being killed
* ugly workaround
* fix lint error
* fix compilation
* fix panic
* shorten lock
* up lock both copy
* wait for crowdsec to die
* fix coding style and lint issue
* go mod tidy

Co-authored-by: bui <thibault@crowdsec.net>
2021-02-25 11:26:46 +01:00
AlteredCoder 8b504e9f67
improve logging in cscli and wizard (#643) 2021-02-25 11:20:36 +01:00
Thibault "bui" Koechlin 4565d82f79
don't try to login with zero scenarios (#627) 2021-02-18 09:59:28 +01:00
Thibault "bui" Koechlin 22ada59393
Allow for acquisition files to be specified from a directory as well (#619)
* allow a acquisition_dir in crowdsec's config + change the behaviour of config loading so that it's working with a list instead. keep backward compat with acquisition_path

* remove the default behaviour of 'guessing' acquis path if param isn't present, and error
2021-02-17 13:55:36 +01:00
Thibault "bui" Koechlin 7d93302e05
add a prometheus_uri option for cscli's config (#625)
* add a prometheus_uri option for cscli's config, and update documentation

* specify min version
2021-02-17 13:53:57 +01:00
AlteredCoder dae4458a6f
create crowdsec group for metabase and crowdsec.db (#606) 2021-02-10 09:23:33 +01:00
AlteredCoder 22c4962768
don't load lapi creds when running only api (#608)
Co-authored-by: AlteredCoder <AlteredCoder>
2021-02-09 17:59:35 +01:00
AlteredCoder e8709074f0
fix stack trace when missing cscli in config file (#607)
Co-authored-by: AlteredCoder <AlteredCoder>
2021-02-07 15:50:27 +01:00
Thibault "bui" Koechlin e74f221044
Fix default configurations (#597)
* fix default perms on SQLite file

* seed the prng securely

* fix defaults to enforce certificates verification

* ensure file is within path

* ensure the directory doesn't exist beforehand

* verify certificate by default

* disable http ip forward headers
2021-02-02 14:15:13 +01:00
AlteredCoder 81e7db71ed
Fix bugs in wizard and cscli (#577)
* fix id generation bug

* fix api client response

Co-authored-by: AlteredCoder <AlteredCoder>
2021-01-15 18:14:50 +01:00
Thibault "bui" Koechlin 986a0be812
fix wizard behaviour when detecting appropriate action (#573)
* fix wizard behaviour when detecting appropriate action

* fix filter handling with cscli

* add ipv6 tests

Co-authored-by: AlteredCoder <AlteredCoder>
2021-01-15 09:48:39 +01:00
AlteredCoder 5544000d38
lapi: fix ipv6 operations (#567) 2021-01-14 16:27:45 +01:00
Pͥetͣeͫr Zuidˢeͬmͨaͬ 1778ee840e
Sanitize id from either source (#568)
On FreeBSD the uuid has dashes. So moved line 74 outside the if loop to have it sanitize either id source of dashes.
2021-01-14 13:03:24 +01:00
Thibault "bui" Koechlin b79c897d99
fix the config restore feature for tainted configurations (#541) 2020-12-15 12:07:43 +01:00
Thibault "bui" Koechlin bb679310c7
deal with LAPI down : ensure client will reauthenticate (#527)
* to avoid keeping apiclient in broken state, reset the token on error
2020-12-14 11:54:16 +01:00
AlteredCoder 79080d4e36
Fix cscli hub (#534) 2020-12-14 11:53:30 +01:00
AlteredCoder 0ed92b20a0
fix prometheus URL used by cscli (#520) 2020-12-07 17:35:30 +01:00
erenJag a9353e3016
cscli: fix bug in restore command (#510) 2020-12-04 13:00:13 +01:00
AlteredCoder 7831dabaa8
rename username by machine (#506)
Co-authored-by: AlteredCoder <AlteredCoder>
2020-12-03 17:38:27 +01:00
AlteredCoder d057d811b2
allow to specify username when register to lapi (#505)
Co-authored-by: AlteredCoder <AlteredCoder>
2020-12-03 17:07:02 +01:00
erenJag 9d016f262f
fix & improve cscli remove action + improve cscli args vars (#498) 2020-12-02 18:47:17 +01:00
AlteredCoder 8707140fb2
Fix documentation errors (#496) 2020-12-01 17:04:13 +01:00
Thibault "bui" Koechlin b7190c9ecc
improve error management of cscli bouncers add (#495) 2020-12-01 16:16:01 +01:00
erenJag a16fb1475d
add info message when there is no hub index (#492) 2020-12-01 12:33:14 +01:00
Thibault "bui" Koechlin dbb420f79e
local api (#482)
Co-authored-by: AlteredCoder
Co-authored-by: erenJag
2020-11-30 10:37:17 +01:00
Thibault "bui" Koechlin c38b086349
minor improvements : makefile + cscli api register (#338)
* make it more obvious where to put credentials after register

* properly check the go version before trying to build, inspired the way mattermost does it
2020-10-29 10:07:03 +01:00
Thibault "bui" Koechlin 2fdf7624da
properly honor the --force flag of upgrade (#327) 2020-10-23 13:48:04 +02:00
Peter 92c5b8c263
Update config.go (#294)
Fixed 'config show' example.
2020-10-06 16:58:02 +02:00
registergoofy f0ea8312db
set default hub branch to master in cscli (#279) 2020-10-01 15:02:53 +02:00
registergoofy c6aab9893a
add randomness to machine-id when registering. (#261)
* add randomness to machine-id when registering.

* add some regexp check for machine_id

* typo fix

* fix cwapi unit tests
2020-09-29 13:17:33 +02:00
AlteredCoder 57aa1c6b24
use hub master if we are in pre-release (#196)
Co-authored-by: AlteredCoder <AlteredCoder>
2020-09-01 15:28:47 +02:00
AlteredCoder b7286d6a85
make cscli use crowdsec version for hub (#194) 2020-09-01 14:32:45 +02:00
Thibault "bui" Koechlin b2ef6a555c
add support for 'prometheus_mode' configuration directive that can be set to 'aggregation' to limit the cardinality of prometheus metrics (#192) 2020-08-24 11:51:50 +02:00
Thibault "bui" Koechlin f8abb01bbc
Advise user to perform a reload when appropriate (#163) 2020-07-30 12:15:15 +02:00
AlteredCoder 0f2733418a fix version release 2020-07-29 17:36:59 +02:00
AlteredCoder 2da55f411b
remove data folder from release and fix binary size (#160) 2020-07-29 17:14:32 +02:00
erenJag 89c8d1a527
rename metrics and update metrics helps (#152)
* rename metrics and update metrics helps

* add meta info about crowdsec

Co-authored-by: erenJag <erenJag>
2020-07-29 15:03:15 +02:00
AlteredCoder 794d3221d0
add tests in pkg/csconfig and improve pkg/exprhelpers tests (#150)
* add tests for csconfig & improve exprhelpers tests
2020-07-28 15:38:48 +02:00
Thibault "bui" Koechlin 151af2d0d8
No sql transaction + proper time-machine wait (#148) 2020-07-27 13:42:30 +02:00
Thibault "bui" Koechlin 6b4674104c
Update documentation for crowdsec v0.3.0 (#141) 2020-07-22 10:25:23 +02:00
AlteredCoder 0864f13cb8
fix post merge (#138)
* fix post merge (#138)
2020-07-17 15:26:46 +02:00
Thibault "bui" Koechlin 177480cff7
updated mysql plugin support (#135)
* add support for plugin, support mysql & so on

* fix queries

Co-authored-by: erenJag <erenJag>
Co-authored-by: AlteredCoder <AlteredCoder>
2020-07-16 16:05:03 +02:00
Thibault "bui" Koechlin 7fe6741df3
Simulation support (#136)
* support simulation mode
2020-07-16 15:59:09 +02:00
AlteredCoder 87a90583fe
Fix#80 (#133)
* fix #80 

Co-authored-by: AlteredCoder <AlteredCoder>
Co-authored-by: Thibault bui Koechlin <thibault@crowdsec.net>
2020-07-16 15:48:46 +02:00
Thibault "bui" Koechlin bc2566f3e5
support multiple args for all cscli upgrade/install/remove commands (#132) 2020-07-10 10:43:22 +02:00
AlteredCoder 4ef080e7bd
Add possibility to filter the size of cscli ban list returned array (#129)
* Be able to filter/limit the `ban list` output
2020-07-10 10:33:39 +02:00
Thibault "bui" Koechlin 3dd42bc9fd
add ability to filter 'ban list' output (--ip --range --as --country --reason) (#115)
* add ability to filter 'ban list' output
2020-07-03 11:40:12 +02:00
Thibault "bui" Koechlin 7691e5b663
re-enable postoverflows (#117)
* re-enable postoverflows

* debug

* yoloooo

* remove debug

* remove error print

* fix test

* fix leakybucket test

* fix

Co-authored-by: AlteredCoder <AlteredCoder>
2020-07-02 17:56:39 +02:00
Thibault "bui" Koechlin b9ae94b874
Sqlite : Support automatic db flushing (#91)
* add support for sqlite retention : max_records, max_records_age

* reduce verbosity of cwhub
2020-07-01 17:04:29 +02:00
AlteredCoder 81ef26f406
add output raw for ban list (#108)
Co-authored-by: AlteredCoder <AlteredCoder>
2020-07-01 10:27:50 +02:00
Thibault "bui" Koechlin 44076dd3d5
fix multi runners : only run several parsers for now (#98) 2020-06-29 15:44:33 +02:00
AlteredCoder 29df9704a2
Fix empty machineid (#95)
* fix

* fix

Co-authored-by: AlteredCoder <AlteredCoder>
2020-06-29 12:46:10 +02:00
erenJag bdda08223e
Fix hub CI (#86) 2020-06-24 15:00:30 +02:00
Thibault "bui" Koechlin 5446857377
Add crowdsec reload + cscli metrics minor improvements (#79) 2020-06-19 13:57:44 +02:00
Thibault "bui" Koechlin d6987ae8f1
avoid error when prometheus gives scientific notation (#76) 2020-06-16 17:53:10 +02:00
Thibault "bui" Koechlin 64c5fa7360
CI: add a CI to test parsers (#67) 2020-06-10 12:14:27 +02:00
Thibault "bui" Koechlin ea3b9d9de0
fix #55 : now that we have split the code for external shutdown (service) and one-shot, we don't need the 5s sleep anymore (#56) 2020-06-02 11:24:50 +02:00
Thibault "bui" Koechlin f2e38b0d28
fix #47 #35 (#49) 2020-06-01 12:56:32 +02:00
Thibault "bui" Koechlin cda7beddbf add support in cscli to switch branches of hub (#43) 2020-05-28 11:32:00 +02:00
Thibault bui Koechlin a06f8373ae move the setLogger config and ConfigureLogger to be part of types for reuse accross modules 2020-05-28 11:28:49 +02:00
Thibault "bui" Koechlin 1abdfc9b10 make message better 2020-05-28 11:28:49 +02:00
erenJag 9f946ca4a4 add missing IPs calculation 2020-05-25 15:22:06 +02:00
AlteredCoder 1b54bbb909 add data folder parameter to hubMgmt 2020-05-24 19:53:05 +02:00
AlteredCoder 3dfc9de409 fix 2020-05-24 19:19:56 +02:00
AlteredCoder 1f91bd8af0 make var public 2020-05-24 19:17:03 +02:00
AlteredCoder 38a750d3df fix 2020-05-24 18:30:47 +02:00
AlteredCoder 6757fa3cee merge 2020-05-24 18:15:59 +02:00
AlteredCoder 176d5197f6 debug 2020-05-22 18:31:46 +02:00
AlteredCoder ae191f3426 debug 2020-05-22 18:29:13 +02:00
AlteredCoder 74dd723ebf fix 2020-05-22 18:24:54 +02:00
AlteredCoder 68ccbd1f69 fix 2020-05-22 18:23:37 +02:00
AlteredCoder f8821b8982 fix dev config 2020-05-22 18:22:43 +02:00
AlteredCoder ec7aaac9d0 fix 2020-05-22 17:46:22 +02:00
AlteredCoder 019c8d3e18 fix package config name 2020-05-22 17:45:08 +02:00
Thibault bui Koechlin 0076727c29 don't discard error, don't try to unmarshal empty string, don't return if it happen 2020-05-22 11:23:47 +02:00
Thibault bui Koechlin ada5d3fcfe explain linter bypasses 2020-05-22 10:12:35 +02:00
Thibault bui Koechlin 356ce3e7f9 yep all good 2020-05-22 09:59:35 +02:00
Thibault bui Koechlin 5971b9ab40 ensure linter is still ok 2020-05-22 09:54:08 +02:00
Thibault bui Koechlin c37714f4a5 remove dead code 2020-05-21 10:38:06 +02:00
Thibault bui Koechlin 193f2fd5d6 force error in diff 2020-05-21 10:33:40 +02:00
Thibault bui Koechlin e86b163ba5 linter fixes 2020-05-20 18:05:05 +02:00
Thibault bui Koechlin e643bb5b31 linter fixes, inefficient assignments 2020-05-20 17:50:56 +02:00
Thibault bui Koechlin fe68914628 more linter fixes (simplicity mostly) 2020-05-20 11:00:25 +02:00
Thibault bui Koechlin db9e1e280d fix linter warnings : dead code, simplification 2020-05-20 10:49:17 +02:00
Thibault bui Koechlin 604b97a519 LGMT fixes + avoid capitalizing fmt.Errorf strings 2020-05-19 21:31:06 +02:00
Thibault bui Koechlin d542966f13 rename cscli -> cwcli 2020-05-15 14:35:51 +02:00
Thibault bui Koechlin 4d306fc52b doc 2020-05-15 14:33:01 +02:00
Thibault bui Koechlin 3d2d39e77d up 2020-05-15 12:13:57 +02:00
Thibault bui Koechlin 2016167654 initial import 2020-05-15 11:39:16 +02:00