1

I am using the docker image influxdb:1.8 and I want to connect to my influx database using Python from within another container. I figured out how to do it without too much looking around. However, I noticed I was able to connect to my database (and even query data !) no matter which username or password I used.

My experiment was to connect to Influx using an InfluxDBClient and some random username and password. Not only did it work, but printing client_variable._username or client_variable._password worked as well. However, the revoke_admin_privileges method raised “InfluxDBClientError: user not found”.

using default parameters using random strings

Why isn’t this error raised when I initiate the client object ?

In order to better understand, I connected to the Influx container and started Influx locally. There, the “show users” command returned no known user, which also surprised me because in my docker-compose.yml file I specified a username and a password that I wanted to use.

Any thoughts on all this ?

PS : Here is the part of my docker-compose.yml that creates the container.

  influxdb:
image: influxdb:1.8
restart: always
ports:
  - "8086:8086"
environment:
  - INFLUXDB_DB=first
  - INFLUXDB_ADMIN_USER=some_user
  - INFLUXDB_ADMIN_PASSWORD=your_password_hehe
  - INFLUXDB_HTTP_AUTH_ENABLED=false
networks:
  - mynetwork
volumes:
  - ./volumes/influxdb-volume:/var/lib/influxdb
cpus: 0.80
logging:
  driver: "none"
PleaseHelp
  • 133
  • 9

1 Answers1

0

To activate authentication system, you have to set INFLUXDB_HTTP_AUTH_ENABLED to true.

As, according to https://github.com/influxdata/influxdb/blob/1.8/docker/init-influxdb.sh

...
AUTH_ENABLED="$INFLUXDB_HTTP_AUTH_ENABLED"

if [ -z "$AUTH_ENABLED" ]; then
    AUTH_ENABLED="$(grep -iE '^\s*auth-enabled\s*=\s*true' /etc/influxdb/influxdb.conf | grep -io 'true' | cat)"
else
    AUTH_ENABLED="$(echo ""$INFLUXDB_HTTP_AUTH_ENABLED"" | grep -io 'true' | cat)"
fi
...
Zada Zorg
  • 2,778
  • 1
  • 21
  • 25