[http] 'auth-enabled' Broken authentication

Hey guys,

Working on InfluxDB V1.

I was building a dashboard and discovered by accident that I could authenticate to my base with any password (which is problematic…). I looked in the influxdb.conf file and saw that the auth-enabled line was false by default. I set it to true, restarted the service and completely lost access to all the databases:

root@TIG-Database:~# influx -username voganet -password ${INFLUXDB_PASSWORD}
Connected to http://localhost:8086 version 1.8.10
InfluxDB shell version: 1.8.10
> show databases
ERR: authorization failed
Warning: It is possible this error is due to not setting a database.

I got the same error without specifying any user.

I tried to recreate my user but didn’t worked…

Hello @codi640,
Hmmm

When you enable authentication in InfluxDB by setting auth-enabled = true in the influxdb.conf file and then restart the InfluxDB service, InfluxDB will require all clients to authenticate. This means that any previously unauthenticated access will no longer work unless you log in with a valid username and password. If you haven’t set up any users yet, or if your user setup was not complete or correct, you may find yourself locked out, as seems to have happened in your case.

Try temporarily disabling authentication by finding the [http] section and set auth-enabled = false. Then create your user, then set to true again?

Hello @Anaisdg,

I guess I had an error on the password when creating the user…
I tried it and it looks like you can’t create a user using directly environment variable instead of plain text, which is why I got an error:

CREATE USER test_auth WITH PASSWORD 'test' WITH ALL PRIVILEGES -- Good syntax
-- Instead of
CREATE USER test_auth WITH PASSWORD '${INFLUXDB_TEST_PASSWORD}' WITH ALL PRIVILEGES -- Bad syntax

Also tried without simple quotes which leads to an error (as expected).

create user test2 with password ${INFLUXDB_PASSWORD} with all privileges
ERR: error parsing query: found $, expected string at line 1, char 33

Double quote leads to the error:

> create user test2 with password "${INFLUXDB_PASSWORD}" with all privileges
ERR: error parsing query: found ${INFLUXDB_PASSWORD}, expected string at line 1, char 33

Anyway, it seams to work, and also with my Grafana instance, so thank you for the idea :grin:!

Regards

@codi640 YaY! I’m glad its working. Thanks for sharing