bitbucket.org/Aishee/synsec@v0.0.0-20210414005726-236fc01a153d/docker/docker_start.sh (about) 1 #!/bin/sh 2 3 # Check if the container has already been started 4 ccscli machines list | grep 127.0.0.1 5 if [ $? == 1 ]; then 6 ccscli machines add --force --auto -f /etc/synsec/local_api_credentials.yaml 7 fi 8 9 # registration to online API for signal push 10 if [ "$DISABLE_ONLINE_API" == "" ] && [ "$CONFIG_FILE" == "" ] ; then 11 CONFIG_EXIST=$(yq eval '.api.server.online_client | has("credentials_path")' /etc/synsec/config.yaml) 12 if [ "$CONFIG_EXIST" != "true" ]; then 13 yq eval '.api.server.online_client = {"credentials_path": "/etc/synsec/online_api_credentials.yaml"}' /etc/synsec/config.yaml > /etc/synsec/config2.yaml 14 mv /etc/synsec/config2.yaml /etc/synsec/config.yaml 15 ccscli capi register > /etc/synsec/online_api_credentials.yaml 16 fi 17 fi 18 19 # synsec sqlite database permissions 20 if [ "$GID" != "" ]; then 21 IS_SQLITE=$(yq eval '.db_config.type == "sqlite"' /etc/synsec/config.yaml) 22 DB_PATH=$(yq eval '.db_config.db_path' /etc/synsec/config.yaml) 23 if [ "$IS_SQLITE" == "true" ]; then 24 chown :$GID $DB_PATH 25 fi 26 fi 27 28 ## Install collections, parsers & scenarios 29 ccscli hub update 30 ccscli collections upgrade breakteam/linux 31 if [ "$COLLECTIONS" != "" ]; then 32 ccscli collections install $COLLECTIONS 33 fi 34 if [ "$PARSERS" != "" ]; then 35 ccscli parsers install $PARSERS 36 fi 37 if [ "$SCENARIOS" != "" ]; then 38 ccscli scenarios install $SCENARIOS 39 fi 40 if [ "$POSTOVERFLOWS" != "" ]; then 41 ccscli postoverflows install $POSTOVERFLOWS 42 fi 43 44 ARGS="" 45 if [ "$CONFIG_FILE" != "" ]; then 46 ARGS="-c $CONFIG_FILE" 47 fi 48 if [ "$FILE_PATH" != "" ]; then 49 ARGS="$ARGS -file $FILE" 50 fi 51 if [ "$JOURNALCTL_FILTER" != "" ]; then 52 ARGS="$ARGS -jfilter $JOURNALCTL_FILTER" 53 fi 54 if [ "$TYPE" != "" ]; then 55 ARGS="$ARGS -type $TYPE" 56 fi 57 if [ "$TEST_MODE" == "true" ] || [ "$TEST_MODE" == "TRUE" ]; then 58 ARGS="$ARGS -t" 59 fi 60 if [ "$DISABLE_AGENT" == "true" ] || [ "$DISABLE_AGENT" == "TRUE" ]; then 61 ARGS="$ARGS -no-cs" 62 fi 63 if [ "$DISABLE_API" == "true" ] || [ "$DISABLE_API" == "TRUE" ]; then 64 ARGS="$ARGS -no-api" 65 fi 66 if [ "$LEVEL_TRACE" == "true" ] || [ "$LEVEL_TRACE" == "TRUE" ]; then 67 ARGS="$ARGS -trace" 68 fi 69 if [ "$LEVEL_DEBUG" == "true" ] || [ "$LEVEL_DEBUG" == "TRUE" ]; then 70 ARGS="$ARGS -debug" 71 fi 72 if [ "$LEVEL_INFO" == "true" ] || [ "$LEVEL_INFO" == "TRUE" ]; then 73 ARGS="$ARGS -info" 74 fi 75 76 exec synsec $ARGS