Coder Social home page Coder Social logo

Comments (20)

rerime avatar rerime commented on July 28, 2024 1

Thx, it is working, but without single quotes ;)

      - selector: redis
        template: |
          - module: redis
            name: redis-{{.TUID}}
            address: redis://:{{ get .Env "NETDATA_SD_AUTH_PASS" }}@{{.Address}}

But for consistency, better

      - selector: redis
        template: |
          - module: redis
            name: redis-{{.TUID}}
            address: redis://{{ get .Env "NETDATA_SD_AUTH_USER" }}:{{ get .Env "NETDATA_SD_AUTH_PASS" }}@{{.Address}}

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024 1

@rerime thanks for help/testing, not really sure why it doesn't work with single quotes 🤔 If you want you can make a PR with Redis btw (after #280 is merged).

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

Hi, @rerime. How do you set credentials for RabbitMQ container?

from helmchart.

rerime avatar rerime commented on July 28, 2024

Via definitions.json
example:

{
 "rabbit_version": "3.6.6",
 "users": [
  {
   "name": "user1",
   "password_hash": "pass1",
   "hashing_algorithm": "rabbit_password_hashing_sha256",
   "tags": ""
  },
  {
   "name": "adminuser",
   "password_hash": "adminpass",
   "hashing_algorithm": "rabbit_password_hashing_sha256",
   "tags": "administrator"
  }
 ],
 "vhosts": [
  {
   "name": "\/vhost1"
  },
  {
   "name": "\/vhost2"
  }
 ],
 "permissions": [
  {
   "user": "user1",
   "vhost": "\/vhost1",
   "configure": ".*",
   "write": ".*",
   "read": ".*"
  }
 ],
 "parameters": [],
 "policies": [],
 "queues": [],
 "exchanges": [],
 "bindings": []
}

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

And this file is mounted to the rabbitmq container or do you pass some values via env variables?

from helmchart.

rerime avatar rerime commented on July 28, 2024

Only as file, I can pass as env also if it helps netdata

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

Passing user/pass as env var will do. You can create a secret and set env vars from it. The service discovery thing collects all env vars keys/values and we can use them in netdata-child-sd-config-map.

from helmchart.

rerime avatar rerime commented on July 28, 2024

So I provide, but it didn't change anything.

      env:
        - name: RABBITMQ_DEFAULT_USER
          valueFrom:
            secretKeyRef:
              name: rabbitmq
              key: RABBITMQ_DEFAULT_USER
        - name: RABBITMQ_DEFAULT_PASS
          valueFrom:
            secretKeyRef:
              name: rabbitmq
              key: RABBITMQ_DEFAULT_PASS

Would be nice, if you add more information about service discovery mechanics
https://github.com/netdata/helmchart#configure-service-discovery

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

@rerime yes, it doesn't work right now. We need to agree on env var names and I will update https://github.com/netdata/helmchart/blob/master/charts/netdata/sdconfig/child.yml

We need to agree on env var names

I think we need generic names we could use for all applications that support user/pass auth.

from helmchart.

rerime avatar rerime commented on July 28, 2024

@ilyam8 Thx for update!
I'm always create user netdata for server monitoring. May be add it and update docs.

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

@rerime can you test #280?

  • NETDATA_SD_AUTH_USER env var value is used as username for HTTP basic auth.
  • NETDATA_SD_AUTH_PASS env var value is used as password for HTTP basic auth.

If it works I will update other jobs that support HTTP basic auth.

from helmchart.

rerime avatar rerime commented on July 28, 2024

@ilyam8
Works like a charm)
I've added:

        - name: NETDATA_SD_AUTH_USER
          valueFrom:
            secretKeyRef:
              name: rabbitmq
              key: RABBITMQ_DEFAULT_USER
        - name: NETDATA_SD_AUTH_PASS
          valueFrom:
            secretKeyRef:
              name: rabbitmq
              key: RABBITMQ_DEFAULT_PASS

Also tested that it is not broken if auth is not needed.

But still not very happy that netdata grub all secrets.

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

But still not very happy that netdata grub all secrets.

Secrets are basically ConfigMaps with encoded values, using them to store sensitive info is not secure in general.

Using this method is an option, I think it is acceptable. If there are better ways we can add them.

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

Works like a charm)

Great, I will:

  • update other collectors' jobs to use those variables.
  • update documentation.

from helmchart.

rerime avatar rerime commented on July 28, 2024

@ilyam8 Off topic... whats about redis module in sd config? Should I create another issue?

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

Ahh, the config has no Redis. Actually nice things you mention the problem, I will add it and you will help with testing 😄

If we go with the current approach of identifying applications that is guessing by the image name... Can you share the image name of your Redis container?

from helmchart.

rerime avatar rerime commented on July 28, 2024

I've added:

containers:
    - name: redis
      image: artifactory.org/redis:6-alpine
      command:
        - redis-server
        - '--requirepass'
        - $(REDIS_PWD)
      ports:
        - name: redis
          containerPort: 6379
          protocol: TCP
      envFrom:
        - secretRef:
            name: redis
      env:
        - name: NETDATA_SD_AUTH_PASS
          valueFrom:
            secretKeyRef:
              name: redis
              key: REDIS_PWD

and in netdata-child-sd-config-map

      - tags: redis
        expr: '{{ and (eq .Port "6379") (glob .Image "redis*" "**/redis*") }}'
        
# ....

      - selector: redis
        template: |
          - module: redis
            name: redis-{{.TUID}}
            url: http://{{.Address}}
            password: "{{ get .Env "NETDATA_SD_AUTH_PASS" }}"

No success.

Seems, it accept password in url string
https://github.com/netdata/go.d.plugin/blob/master/config/go.d/redis.conf

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

Try

          - module: redis
            name: redis-{{.TUID}}
            address: 'redis://:{{ get .Env "NETDATA_SD_AUTH_PASS" }}@{{.Address}}'

from helmchart.

rerime avatar rerime commented on July 28, 2024

@ilyam8 Will wait merge and make PR.
I guess #280 should be expanded to all http basic auth modules.

from helmchart.

ilyam8 avatar ilyam8 commented on July 28, 2024

I think all that support user/pass authentication - I gave a generic name to those env var on purpose.

from helmchart.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.