【问题标题】:Influxdb not asking for authenticationInfluxdb 不要求身份验证
【发布时间】:2017-01-17 11:34:13
【问题描述】:

我已经在 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

因为我希望 influxdb 在访问时询问用户身份验证(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 子组条目。

最后我重新启动了 influxdb 服务:

sudo service influxdb restart

问题

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

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

返回:

{

"results": [
    {}
  ]
}

在 raspberry cmdline 上调用 influxdb 不会要求身份验证:

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- 无法启动身份验证(身份验证已停用)

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

【问题讨论】:

    标签: linux authentication influxdb


    【解决方案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
    

    【讨论】:

    • 解决方案是什么?我真的说不出来。
    • [http] 有一个 # 并且不应该
    • 这回答了为什么http请求没有功能认证,现在我们仍然需要回答如何通过cli在本地使用'influx'命令时启用认证。
    • 对于仍在访问此内容并想知道@valentt 评论的任何人。它解析运行命令的身份验证,但不解析连接。您将能够在启用身份验证的情况下进行连接,如果不先进行身份验证,您将无法运行任何查询
    • 很好的提示 Imre_G!我只是不明白为什么我仍然能够通过 CLI 登录,但你是对的:那时无法执行命令......
    猜你喜欢
    • 2019-12-02
    • 2021-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-11
    • 1970-01-01
    相关资源
    最近更新 更多