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
9.08k stars 470 forks source link

Test environment test_env.sh and tests directory not existing when following docs #3296

Closed jaredjadu closed 4 weeks ago

jaredjadu commented 4 weeks ago

What happened?

I am following the docs here https://doc.crowdsec.net/docs/contributing/contributing_test_env/ I used version 1.6.3 in the below steps. My OS is macOS 14.2

Basically following the doc linked above , the tests directory does not exist , and its not verified to exist in the script so the script ends up trying to perform actions on the root of the filesystem

VER=1.6.3 # Please check https://github.com/crowdsecurity/crowdsec/releases/latest for latest version
wget https://github.com/crowdsecurity/crowdsec/releases/download/v$VER/crowdsec-release.tgz
tar xvzf crowdsec-release.tgz
cd crowdsec-v$VER
./test_env.sh
realpath: ./tests: No such file or directory
[24/10/2024:10:36:48][INFO] Creating test tree in
mkdir: : No such file or directory
mkdir: /data: Read-only file system
mkdir: /logs: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /config: Read-only file system
mkdir: /plugins: Read-only file system
[24/10/2024:10:36:49][INFO] Tree created
[24/10/2024:10:36:49][INFO] Copying needed files for tests environment
cp: /config: Read-only file system
cp: /config: Read-only file system
cp: /config: Read-only file system
cp: ./config/patterns: unable to copy extended attributes to /config: Read-only file system
cp: /config/bro: No such file or directory
cp: /config/nagios: No such file or directory
cp: /config/postgresql: No such file or directory
cp: /config/bacula: No such file or directory
cp: /config/exim: No such file or directory
cp: /config/redis: No such file or directory
cp: /config/paths: No such file or directory
cp: /config/java: No such file or directory
cp: /config/mongodb: No such file or directory
cp: /config/cowrie_honeypot: No such file or directory
cp: /config/ssh: No such file or directory
cp: /config/nginx: No such file or directory
cp: /config/mysql: No such file or directory
cp: /config/smb: No such file or directory
cp: /config/modsecurity: No such file or directory
cp: /config/aws: No such file or directory
cp: /config/firewalls: No such file or directory
cp: /config/junos: No such file or directory
cp: /config/tcpdump: No such file or directory
cp: /config/linux-syslog: No such file or directory
cp: /config/mcollective: No such file or directory
cp: /config/ruby: No such file or directory
cp: /config/rails: No such file or directory
cp: /config/haproxy: No such file or directory
cp: /config: Read-only file system
touch: /config/local_api_credentials.yaml: No such file or directory
touch: /config/online_api_credentials.yaml: No such file or directory
./test_env.sh: line 89: /dev.yaml: Read-only file system
cp: /plugins/notification-http: No such file or directory
cp: /config/notifications/http.yaml: No such file or directory
cp: /plugins/notification-slack: No such file or directory
cp: /config/notifications/slack.yaml: No such file or directory
cp: /plugins/notification-splunk: No such file or directory
cp: /config/notifications/splunk.yaml: No such file or directory
cp: /plugins/notification-email: No such file or directory
cp: /config/notifications/email.yaml: No such file or directory
cp: /plugins/notification-sentinel: No such file or directory
cp: /config/notifications/sentinel.yaml: No such file or directory
[24/10/2024:10:36:49][INFO] Files copied
[24/10/2024:10:36:49][INFO] Setting up configurations
./test_env.sh: line 104: /cscli: No such file or directory
./test_env.sh: line 99: /cscli: No such file or directory
./test_env.sh: line 100: /cscli: No such file or directory
[24/10/2024:10:36:49][INFO] Environment is ready in

What did you expect to happen?

Test environment being setup

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

In a clean directory , run my steps above

VER=1.6.3 # Please check https://github.com/crowdsecurity/crowdsec/releases/latest for latest version
wget https://github.com/crowdsecurity/crowdsec/releases/download/v$VER/crowdsec-release.tgz
tar xvzf crowdsec-release.tgz
cd crowdsec-v$VER
./test_env.sh

Anything else we need to know?

No response

Crowdsec version

Tryng to still setup test env for 1.6.3

OS version

```console macOS 14.2 ```

Enabled collections and parsers

n/a

Acquisition config

n/a

Config show

n/a

Prometheus metrics

n/a

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

github-actions[bot] commented 4 weeks ago

@jaredjadu: 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.
LaurenceJJones commented 4 weeks ago

Hi 👋🏻

Currently dont support MacOS as an operating system, if you want to develop or test on this platform you would need to compile the code from source before attempting to create the test directory.

A simpler way would be to create a test virtual machine on your MacOS using virtual box or other virtual machine software.

I will close this issue as not planned as the description above should inform you why the script does not work as shown in the documentation as the documentation is wrote from a Linux system.

I will link an issue that will add a warning to top of page that states the instruction are wrote for a Linux system.