Commit graph

262 commits

Author SHA1 Message Date
mmetc 104f5d1fe6
lint: error handling cleanup (#1877) 2022-11-29 09:16:07 +01:00
mmetc 99513f64fd
cscli config show: print host/port/user/dbname when driver=pgx (fix #1866) (#1870) 2022-11-17 11:07:37 +00:00
mmetc 3beb84bcfe
print missing "AS" values as empty strings instead of "0 " (#1867) 2022-11-14 09:55:53 +01:00
mmetc 895691dad1
enabled linters: gocritic, nilerr (#1853) 2022-11-07 10:36:50 +01:00
Thibault "bui" Koechlin 23ffa1e04f
add cscli alerts delete --id (#1843)
* add cscli alerts delete by id

* test added for cscli delete alert --id

Co-authored-by: Marco Mariani <marco@crowdsec.net>
2022-10-27 09:07:53 +02:00
Thibault "bui" Koechlin ae6bf39495
support decisions deletion via scenario + alerts delete via ID (#1798) 2022-10-19 14:37:27 +02:00
mmetc 2b7e3ff1e7
warn if no acquisition files are found, acquisition_test refactoring, tests (#1816) 2022-10-17 17:32:08 +02:00
mmetc a96b3e077d
rename pkg/cstest -> pkg/hubtest (#1811)
keep cstest for generic helper functions
this also avoids circular imports in test files
2022-10-17 09:24:07 +02:00
mmetc 8fecc2c00b
enable staticcheck linter; fixes (#1806)
- explicitly ignore returned parameters
 - replace Walk with faster WalkDir
 - log path error during hub dir sync
 - colorize static unit tests
 - removed duplicate import in crowdsec/main.go
 - typos
 - func tests: default datasource in tests/var/log instead of /tmp
 - action setup-go v3
2022-10-14 16:12:21 +02:00
mmetc 708fa8280a
add test and fix for configuration reload (#1808)
fix reload issue by returning new configuration to the signal loop

example: run crowdsec, disable agent in the config file, reload config.
Now there is no agent but the signal loop believes there is, so
triggering a reload configuration again will make the process hang
forever.
This commit updates the configuration in the signal loop with the one
returned by the signal handler.
2022-10-14 15:48:41 +02:00
blotus 7144dca68a
Fix missing metrics cscli (#1809) 2022-10-13 15:49:41 +02:00
mmetc 4b3c9c2806
print cscli usage in color, fix windows terminal detection (#1801) 2022-10-13 12:28:24 +02:00
Shivam Sandbhor 74659a82ab
Fast bulk alert delete (#1791) 2022-10-07 12:40:30 +02:00
mmetc ddd75eae9a
cscli: new tables, --color yes|no|auto option (#1763) 2022-10-07 11:05:35 +02:00
mmetc c920a301e0
make: accept BUILD_VENDOR_FLAGS variable (#1771) 2022-10-04 09:51:35 +02:00
Shivam Sandbhor 52447f6999
Don't suggest an item which user already mentioned. (#1702) 2022-09-28 13:26:47 +02:00
Sean Kelly 568eb1d4e0
Fix misspelling of instantiate participles (#1759) 2022-09-27 17:13:43 +02:00
mmetc 52fbda1a5e
simpler makefiles for static targets (#1744) 2022-09-14 14:22:57 +02:00
Manuel Sabban f3317f78d5
acually postoverflow _before_ reprocessing (#1739)
Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
2022-09-07 14:16:47 +02:00
mmetc 414282a2c9
golangci-lint 1.49 and related fixes (#1736) 2022-09-06 13:55:03 +02:00
Manuel Sabban 7d0f89df29
Implement reinject command to send notifications of alerts (#1638)
* implement reinject command to send notifications of alerts using a profile

Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
2022-08-30 15:45:52 +02:00
Manuel Sabban 21255b6391
fix #1724 (#1725)
* fix #1724

Co-authored-by: sabban <15465465+sabban@users.noreply.github.com>
2022-08-30 12:38:28 +02:00
blotus e46ca38cbb
add cscli support dump (#1634) 2022-08-18 11:54:01 +02:00
AlteredCoder fe5f9bfc28
add suggestion on cscli install items (#1686) 2022-08-04 10:09:56 +02:00
blotus dacf6ebc64
Fix cscli notifications list crash (#1697) 2022-08-02 20:44:19 +02:00
AlteredCoder 1002affc16
cscli machines delete: return an error if machines doesn't exist (#1689)
* cscli machines delete: return an error if machines doesn't exist
2022-07-28 17:32:12 +02:00
AlteredCoder 16b1ab06a9
Add -a options in cscli alerts list (#1690)
* Add -a options in cscli alerts list
2022-07-28 17:31:53 +02:00
blotus 865ff5c88d
windows: log fatal and panic errors to event log (#1667) 2022-07-19 09:48:02 +02:00
AlteredCoder 24b1a99c42
Run cscli hubtest without being root (#1658) 2022-07-13 12:00:26 +02:00
blotus 8decbe7670
Properly handle service shutdown on windows (#1662) 2022-07-13 11:54:12 +02:00
AlteredCoder 5c8e2a8510
Fix 1652 (#1654) 2022-07-13 10:57:07 +02:00
Thibault "bui" Koechlin 920f3d2a7d
fix #1643 : deal with null heartbeat (#1645) 2022-07-07 15:29:30 +02:00
AlteredCoder 5f62d738fc
Add no-capi flag and review some logs (#1628)
* Add no-capi flag and review some logs
2022-07-01 16:56:13 +02:00
mmetc 8e7e799304
[wip] serve metrics only after agent and/or lapi are ready; fixed some func tests (#1613) 2022-06-24 15:55:21 +02:00
Laurence Jones 342e7f5272
Cscli Explain Stdin (#1597)
Allow `cscli explain` to rely on stdin
2022-06-23 11:51:43 +02:00
mmetc 628d7be1d8
simplify err.Error() to err when used in printf context (#1603) 2022-06-22 15:53:53 +02:00
he2ss 3d6f015211
Add duration expr to add duration formula (#1556)
* add duration expr to add duration formula
2022-06-22 11:29:52 +02:00
Thibault "bui" Koechlin a6ed08b239
Add alerts and decisions metrics, LAPI and agent timing prom metrics (#1546) 2022-06-22 11:14:34 +02:00
AlteredCoder 0a39066f9d
Fix #1552 (#1569) 2022-06-22 10:29:02 +02:00
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