Diogo Guerra
Diogo Guerra

Reputation: 129

Influxdb not asking for authentication

I Have installed influxdb on a linux distro running on a raspberrypi...

pi@raspberrypi:~ $ influx -version
InfluxDB shell version: 1.1.1

Then i create a DB, followed by an Admin user with

CREATE USER admin WITH PASSWORD 'password' WITH ALL PRIVILEGES

After this i edit the influx.conf file located at:

/etc/influxdb/influxdb.conf

As i want the influxdb to ask for user auth when it is accessed (http external or internal and console?is it possible console?) i browse and look for the [[http]] block on the file.... this is what i have.

###
### [http]
###
### Controls how the HTTP endpoints are configured. These are the primary
### mechanism for getting data into and out of InfluxDB.
###
# [http]
  # Determines whether HTTP endpoint is enabled.
   enabled = true

  # The bind address used by the HTTP service.
  # bind-address = ":8086"

  # Determines whether HTTP authentication is enabled.
   auth-enabled = true

  # The default realm sent back when issuing a basic auth challenge.
  # realm = "InfluxDB"

  # Determines whether HTTP request logging is enable.d
  # log-enabled = true

  # Determines whether detailed write logging is enabled.
  # write-tracing = false

  # Determines whether the pprof endpoint is enabled.  This endpoint is used for
  # troubleshooting and monitoring.
  pprof-enabled = true

  # Determines whether HTTPS is enabled.
  https-enabled = false

  # The SSL certificate to use when HTTPS is enabled.
  https-certificate = "/etc/ssl/influxdb.pem"

  # Use a separate private key location.
  https-private-key = ""

  # The JWT auth shared secret to validate requests using JSON web tokens.
  shared-sercret = ""

  # The default chunk size for result sets that should be chunked.
  # max-row-limit = 10000

  # The maximum number of HTTP connections that may be open at once.  New connections that
  # would exceed this limit are dropped.  Setting this value to 0 disables the limit.
  # max-connection-limit = 0

  # Enable http service over unix domain socket
  # unix-socket-enabled = false

  # The path of the unix domain socket.
  # bind-socket = "/var/run/influxdb.sock"

Changing the 1st and 3rd sub-group entries.

Finnaly i restart the influxdb service with:

sudo service influxdb restart

Problems

1 - Creating a database from another computer on the network (without login tokens) is successful (and it shouldn't):

http://192.168.7.125:8086/query?q=CREATE DATABASE test

returns:

{

"results": [
    {}
  ]
}

calling influxdb on raspberry cmdline does not ask for auth:

pi@raspberrypi:~ $ influx
Visit https://enterprise.influxdata.com to register for updates, InfluxDB server management, and monitoring.
Connected to http://localhost:8086 version 1.1.1
InfluxDB shell version: 1.1.1
>

Does anyone know what am i doing wrong?

EDIT

Furthermore, checking the /var/log/syslog i can see that: 1- It is loading the file from the currect directory

[run] 2017/01/17 11:27:36 InfluxDB starting, version 1.1.1, branch master, commit e47c
f1f2e83a02443d7115c54f838be8ee959644
Jan 17 11:27:36 raspberrypi influxd[901]: [run] 2017/01/17 11:27:36 Go version go1.7.4, GOMAXPROCS set to 4
Jan 17 11:27:36 raspberrypi influxd[901]: [run] 2017/01/17 11:27:36 Using configuration at: /etc/influxdb/influxdb.conf
Jan 17 11:27:36 raspberrypi influxd[901]: [store] 2017/01/17 11:27:36 Using data dir: /var/lib/influxdb/data

2- It fails in starting with authentication (auth is deactivated)

Jan 17 11:27:37 raspberrypi influxd[901]: [httpd] 2017/01/17 11:27:37 Starting HTTP service
Jan 17 11:27:37 raspberrypi influxd[901]: [httpd] 2017/01/17 11:27:37 Authentication enabled: false
Jan 17 11:27:37 raspberrypi influxd[901]: [httpd] 2017/01/17 11:27:37 Listening on HTTP: [::]:8086

Upvotes: 1

Views: 3210

Answers (1)

Diogo Guerra
Diogo Guerra

Reputation: 129

The culprit is on the [http] here:

###
### [http]
###
### Controls how the HTTP endpoints are configured. These are the primary
### mechanism for getting data into and out of InfluxDB.
###
[http]
  # Determines whether HTTP endpoint is enabled.
   enabled = true

  # The bind address used by the HTTP service.
  # bind-address = ":8086"

  # Determines whether HTTP authentication is enabled.
   auth-enabled = true

Upvotes: 1

Related Questions