influxdata / influxdata/influxdb

Unable to create a password protected influxDB

Open
#19,576 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

I am working on a C# application with InfluxDB and Grafana. I am using InfluxData.Net (https://github.com/pootzko/InfluxData.Net#createdatabaseasync). I have to create a password protected Influx database. My code is:

```
var httpClientHandler = new HttpClientHandler();
httpClientHandler.ServerCertificateCustomValidationCallback = OnHandleSSl;
var client = new HttpClient(httpClientHandler);

InfluxDbClient _influxDbClient = new InfluxDbClient(Server, Username, Password, InfluxDbVersion.v_1_3, QueryLocation.FormData, client);
var response = await _influxDbClient.Database.CreateDatabaseAsync(DatabaseName);
```

Issue is that when i go to Grafana on the server and add new data source with this database, data source works fine and does not show any error regarding username/password. Even the data in the database is shown in the grafana. I am using InfluxDB image. I have also tried to enable INFLUXDB_HTTP_AUTH_ENABLED in DockerFile of InfluxDB. My DockerFile is:

```
FROM influxdb:1.7.6

ENV TZ=America/Los_Angeles
ENV INFLUXDB_HTTP_AUTH_ENABLED true

RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
```

When i run the image created from this DockerFile, i don't get INFLUXDB_HTTP_AUTH_ENABLED entry in influxdb.conf file. As per InfluxDB documentation, setting INFLUXDB_HTTP_AUTH_ENABLED in environment variable will enable the authentication on the influx server but, in my case its not working.

How can i make a password protected influx database through influxDB image ? What can be the possible issue ? I am stuck and unable to create the password protected database. Any help would be much appreciated.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the supplied Dockerfile and the influxdb:1.7.6 image configuration, then check how INFLUXDB_HTTP_AUTH_ENABLED is read during container startup. Reproduce the setup and verify whether unauthenticated requests are rejected while the supplied credentials work; compare that behavior with the Grafana data-source configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, docker
Domain
authentication, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.