mirror of
https://github.com/crowdsecurity/crowdsec.git
synced 2025-05-10 20:05:55 +02:00
parent
5f339ab312
commit
dbb420f79e
563 changed files with 64363 additions and 10714 deletions
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh
|
||||
|
||||
./cscli -c dev.yaml list parsers -a -o json | jq -r ".[].name" > installed_parsers.txt
|
||||
./cscli -c dev.yaml list parser list -a -o json | jq -r ".[].name" > installed_parsers.txt
|
||||
cat installed_parsers.txt | while read parser; do
|
||||
echo "install ${parser}" ;
|
||||
./cscli -c dev.yaml install parser ${parser} ;
|
||||
./cscli -c dev.yaml parsers install ${parser} ;
|
||||
done
|
||||
|
|
|
@ -38,17 +38,7 @@ PARSER_S01="$PARSER_DIR/s01-parse"
|
|||
PARSER_S02="$PARSER_DIR/s02-enrich"
|
||||
SCENARIOS_DIR="$CONFIG_DIR/scenarios"
|
||||
POSTOVERFLOWS_DIR="$CONFIG_DIR/postoverflows"
|
||||
PLUGIN_BACKEND_DIR="$CONFIG_DIR/plugins/backend/"
|
||||
DB_PLUGIN_FILE="$PLUGIN_BACKEND_DIR/database.yaml"
|
||||
|
||||
gen_sqlite_config() {
|
||||
echo "name: database" >> "$DB_PLUGIN_FILE"
|
||||
echo "path: ./plugins/backend/database.so" >> "$DB_PLUGIN_FILE"
|
||||
echo "config:" >> "$DB_PLUGIN_FILE"
|
||||
echo " type: sqlite" >> "$DB_PLUGIN_FILE"
|
||||
echo " db_path: ./test.db" >> "$DB_PLUGIN_FILE"
|
||||
echo " flush: true" >> "$DB_PLUGIN_FILE"
|
||||
}
|
||||
HUB_DIR="$CONFIG_DIR/hub"
|
||||
|
||||
log_info() {
|
||||
msg=$1
|
||||
|
@ -68,7 +58,7 @@ create_arbo() {
|
|||
mkdir -p "$SCENARIOS_DIR"
|
||||
mkdir -p "$POSTOVERFLOWS_DIR"
|
||||
mkdir -p "$CSCLI_DIR"
|
||||
mkdir -p "$PLUGIN_BACKEND_DIR"
|
||||
mkdir -p "$HUB_DIR"
|
||||
}
|
||||
|
||||
copy_files() {
|
||||
|
@ -78,13 +68,19 @@ copy_files() {
|
|||
cp "./cmd/crowdsec/crowdsec" "$BASE"
|
||||
cp "./cmd/crowdsec-cli/cscli" "$BASE"
|
||||
cp -r "./config/patterns" "$CONFIG_DIR"
|
||||
cp -r "./plugins/" "$BASE"
|
||||
cp "./config/acquis.yaml" "$CONFIG_DIR"
|
||||
touch "$CONFIG_DIR"/local_api_credentials.yaml
|
||||
touch "$CONFIG_DIR"/online_api_credentials.yaml
|
||||
}
|
||||
|
||||
|
||||
setup() {
|
||||
$BASE/cscli -c "$CONFIG_FILE" update
|
||||
$BASE/cscli -c "$CONFIG_FILE" install collection crowdsecurity/linux
|
||||
$BASE/cscli -c "$CONFIG_FILE" hub update
|
||||
$BASE/cscli -c "$CONFIG_FILE" collections install crowdsecurity/linux
|
||||
}
|
||||
|
||||
setup_api() {
|
||||
$BASE/cscli -c "$CONFIG_FILE" machines add test -p testpassword -f $CONFIG_DIR/local_api_credentials.yaml --force
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,9 +94,9 @@ main() {
|
|||
log_info "Setting up configurations"
|
||||
CURRENT_PWD=$(pwd)
|
||||
cd $BASE
|
||||
setup_api
|
||||
setup
|
||||
cd $CURRENT_PWD
|
||||
gen_sqlite_config
|
||||
log_info "Environment is ready in $BASE"
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue