InfluxDB authentication and authorization
Last updated: Jun 01, 2022
Colleagues hello to all.
In today's article, we'll talk about how accounts are authenticated and authorized in the InfluxDB DBMS. In InfluxDB authentication occurs only in the scope of the HTTP request. It is also very important to set up authentication in InfluxDB because by default all security is turned off and it is very easy for someone to connect to the database.
- Create an administrator account.
- Enable authentication in the configuration file.
- Restarting the database.
- Authentication check.
- How to connect to the DBMS now.
1. Create an admin account.
The InfluxDB DBMS does not have any accounts by default, this needs to be fixed. First, let's make sure how many accounts are actually in the database.
View accounts command:
influx> SHOW USERS;
As you can see, there are no accounts!
Now let's create an administrator account, for this we will use the command:
influx> CREATE USER admin WITH PASSWORD 'Qwerty123' WITH ALL PRIVILEGES;
The admin account has been successfully created.
2. Enable authentication in the configuration file.
The InfluxDB configuration file is in /etc/influxdb/influxdb.conf.
In this file, we need to uncomment certain options in the [http]
- enabled = true
- bind-address = ":8086"
- auth-enabled = true
- log-enabled = true
- write-tracing = false
- ping-auth-enabled = true
Save the file and restart the database.
3. Restarting the database.
To restart InfluxDB, use the command:
$. service influxdb restart
4. Authentication check.
Now that we've done everything let's check if it will let us into the DBMS without entering a password.
In the DBMS, it seems to be allowed, but it doesn’t allow any commands to be executed, which means we did everything right.
5. How to connect to the DBMS now.
Earlier, we used only the influx command to connect to the DBMS, but now we will use:
$. influx -username admin -password 'Qwerty123';
Thank you all, I hope that my article helped you in some way.