Influxdb不要求身份验证

时间:2017-01-17 11:34:14

标签: linux authentication access influxdb

我已经在一个运行在raspberrypi上的Linux发行版中安装了Influxdb ...

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

然后我创建一个数据库,然后是一个带

的管理员用户
CREATE USER admin WITH PASSWORD 'password' WITH ALL PRIVILEGES

在此之后我编辑位于以下位置的Influx.conf文件:

/etc/influxdb/influxdb.conf

因为我想要在访问时使用用户身份验证(http外部或内部和控制台?是否可能是控制台?)我浏览并查找文件上的[[http]]块....这就是我所拥有的。

###
### [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"

更改第1和第3个子组条目。

Finnaly我使用以下命令重启了Influxdb服务:

sudo service influxdb restart

问题

1 - 从网络上的另一台计算机创建数据库(没有登录令牌)是成功的(它不应该):

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

返回:

{

"results": [
    {}
  ]
}

在raspberry cmdline上调用Influxdb不会要求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
>

有谁知道我做错了什么?

修改

此外,检查/ var / log / syslog我可以看到: 1-它正在从当前目录

加载文件
[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-启动验证失败(auth停用)

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

1 个答案:

答案 0 :(得分:1)

罪魁祸首在 [http] 这里:

###
### [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