diff --git a/salt/common/tools/sbin/so-influxdb-user b/salt/common/tools/sbin/so-influxdb-user index 9b9e5e57b..ae0d42ebf 100644 --- a/salt/common/tools/sbin/so-influxdb-user +++ b/salt/common/tools/sbin/so-influxdb-user @@ -36,10 +36,12 @@ log() { read_password() { # Read password for new user from stdin + set +e test -t 0 if [[ $? == 0 ]]; then echo "Enter new password:" fi + set -e read -rs USER_PASS check_password_and_exit "$USER_PASS" @@ -49,6 +51,7 @@ check_response() { response=$1 if [[ "$response" =~ "\"code\":" ]]; then log "Failed. Check the response for more details.\n$response" + exit 1 fi } @@ -61,6 +64,7 @@ if [[ "$OP" == "add" ]]; then OP=password fi +log "Looking up user ID" response=$(curl -sk https://localhost:8086/api/v2/users?limit=100 -H "Authorization: Token $TOKEN") check_response "$response" USER_ID=$(echo "$response" | jq -r ".users[] | select(.name == \"$USER_EMAIL\").id") diff --git a/salt/influxdb/init.sls b/salt/influxdb/init.sls index 2fbf88d3a..a3a59db70 100644 --- a/salt/influxdb/init.sls +++ b/salt/influxdb/init.sls @@ -51,7 +51,7 @@ so-influxdb: - DOCKER_INFLUXDB_INIT_MODE=setup - DOCKER_INFLUXDB_INIT_USERNAME=so - DOCKER_INFLUXDB_INIT_PASSWORD={{ PASSWORD }} - - DOCKER_INFLUXDB_INIT_ORG="Security Onion" + - DOCKER_INFLUXDB_INIT_ORG=Security Onion - DOCKER_INFLUXDB_INIT_BUCKET=telegraf/so_short_term - DOCKER_INFLUXDB_INIT_RETENTION=30d - DOCKER_INFLUXDB_INIT_ADMIN_TOKEN={{ TOKEN }} diff --git a/salt/nginx/etc/nginx.conf b/salt/nginx/etc/nginx.conf index 8dce92b75..1dc73d030 100644 --- a/salt/nginx/etc/nginx.conf +++ b/salt/nginx/etc/nginx.conf @@ -194,6 +194,7 @@ http { proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Proxy ""; proxy_set_header X-Forwarded-Proto $scheme; + proxy_cookie_path /api/ /influxdb/api/; } location /kibana/ { diff --git a/salt/telegraf/etc/telegraf.conf b/salt/telegraf/etc/telegraf.conf index b6298a637..61843da5f 100644 --- a/salt/telegraf/etc/telegraf.conf +++ b/salt/telegraf/etc/telegraf.conf @@ -74,7 +74,7 @@ # Configuration for sending metrics to InfluxDB [[outputs.influxdb_v2]] urls = ["https://{{ INFLUXDBHOST }}:8086"] - token = "$TOKEN" + token = "{{ TOKEN }}" organization = "Security Onion" bucket = "telegraf/so_short_term"