Add user/pass authentication from Telegraf


I have a working Telegraf system that obtain data from MQTT broker and send it to InlfuxDB.

I have configured this way the InfluxDB output:

  urls = ["http://influxdb:8086"]
  database = "sensors"
  skip_database_creation = false
  username = "myuser"
  password = "mypass"
  user_agent = "telegraf"

The problem is that in the influxdb side, there no username configured:

# influx
Connected to http://localhost:8086 version 1.8.0
InfluxDB shell version: 1.8.0
> show databases;
name: databases
> use sensors
Using database sensors
> show users
user admin
---- -----

The problem is that the traffic from Telegraf to InfluxDB goes across Internet.

I want to secure as much as possible the traffic, how could I add user/pass authentication? Could I add a TLS connection between Telegraf and InfluxDB?

Thanks for your help.

Have you read: