crowdsecurity / crowdsec

CrowdSec - the open-source and participative security solution offering crowdsourced protection against malicious IPs and access to the most advanced real-world CTI.
https://crowdsec.net
MIT License
8.59k stars 442 forks source link

[cscli] We added patterns_dir option to config.yaml but isnt used in hubtest #3182

Open LaurenceJJones opened 3 weeks ago

LaurenceJJones commented 3 weeks ago

What happened?

When setting a custom patterns_dir in config.yaml and using cscli hubtest run --all the patterns dir is not used

Running test 'zoneminder-bf' failed: unable to copy 'patterns' from '/etc/crowdsec/patterns'to '/tmp/crowdsec-v1.6.2/hub/.tests/zoneminder-bf/runtime/patterns': open /etc/crowdsec/patterns: no such file or directory

config.yaml

config_paths:
  config_dir: ./config
  data_dir: ./data/
  notification_dir: ./config/notifications/
  plugin_dir: ./plugins/
  pattern_dir: ./config/patterns/

This is used within the test_env.sh script to not need crowdsec to be installed.

What did you expect to happen?

The pattern_dir options to be respected

How can we reproduce it (as minimally and precisely as possible)?

Prep the test folder:

cd $(mktemp -d)
wget https://github.com/crowdsecurity/crowdsec/releases/download/v1.6.2/crowdsec-release.tgz
tar xvzf crowdsec-release.tgz
cd crowdsec-v1.6.2
./test_env.sh
alias csdev="$PWD/cmd/crowdsec-cli/cscli -c $PWD/config/dev.yaml"
git clone https://github.com/crowdsecurity/hub

Edit config/dev.yaml and add the following:

config_paths:
  pattern_dir: ./config/patterns/

Anything else we need to know?

No response

Crowdsec version

```console $ cscli version # paste output here ```

OS version

```console # On Linux: $ cat /etc/os-release # paste output here $ uname -a # paste output here # On Windows: C:\> wmic os get Caption, Version, BuildNumber, OSArchitecture # paste output here ```

Enabled collections and parsers

```console $ cscli hub list -o raw # paste output here ```

Acquisition config

```console # On Linux: $ cat /etc/crowdsec/acquis.yaml /etc/crowdsec/acquis.d/* # paste output here # On Windows: C:\> Get-Content C:\ProgramData\CrowdSec\config\acquis.yaml # paste output here

Config show

```console $ cscli config show # paste output here ```

Prometheus metrics

```console $ cscli metrics # paste output here ```

Related custom configs versions (if applicable) : notification plugins, custom scenarios, parsers etc.

github-actions[bot] commented 3 weeks ago

@LaurenceJJones: Thanks for opening an issue, it is currently awaiting triage.

In the meantime, you can:

  1. Check Crowdsec Documentation to see if your issue can be self resolved.
  2. You can also join our Discord.
  3. Check Releases to make sure your agent is on the latest version.
Details I am a bot created to help the [crowdsecurity](https://github.com/crowdsecurity) developers manage community feedback and contributions. You can check out my [manifest file](https://github.com/crowdsecurity/crowdsec/blob/master/.github/governance.yml) to understand my behavior and what I can do. If you want to use this for your project, you can check out the [BirthdayResearch/oss-governance-bot](https://github.com/BirthdayResearch/oss-governance-bot) repository.