InfluxDB authentication and authorization

  • Last updated: Nov 3, 2023
  • Views: 1950
  • Author: Admin
InfluxDB authentication and authorization

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.

 

Article content:

  1. Create an administrator account.
  2. Enable authentication in the configuration file.
  3. Restarting the database.
  4. Authentication check.
  5. 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;

influxdb_authentication

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;

influxdb_authentication

The admin account has been successfully created.


 

2. Enable authentication in the configuration file.

The InfluxDB configuration file is in /etc/influxdb/influxdb.conf.

influxdb_authentication

 

In this file, we need to uncomment certain options in the [http]

section

  • enabled = true
  • bind-address = ":8086"
  • auth-enabled = true
  • log-enabled = true
  • write-tracing = false
  • pprof-enabled=true
  • pprof-auth-enabled=true
  • debug-pprof-enabled=false
  • ping-auth-enabled = true

influxdb_authentication

Save the file and restart the database.


 

3. Restarting the database.

To restart InfluxDB, use the command:

$. service influxdb restart

influxdb_authentication


 

4. Authentication check.

Now that we've done everything let's check if it will let us into the DBMS without entering a password.

influxdb_authentication

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';

influxdb_authentication

Everything works!


 

Thank you all, I hope that my article helped you in some way.

SIMILAR ARTICLES

MariaDB/MySQL Monitoring, Telegraf installation. Part 1

MariaDB/MySQL Monitoring, Telegraf installation. Part 1

Installing Influxdb on Centos 8

Installing Influxdb on Centos 8

Installing Grafana on Centos 8

Installing Grafana on Centos 8