Basicauth 拡張

ベーシック認証を使用してクライアントとサーバーを認証するには、basicauth 拡張を使用します。

basicauth 拡張は、configauth.ServerAuthenticatorconfigauth.ClientAuthenticator の両方を実装し、Basic 認証でクライアントとサーバーを認証します。認証タイプを basicauth に設定する必要があります。

サーバーの認証に使用すると、認証が成功した場合、client.Info.Auth 、以下の属性が公開されます:

  • username:認証されたユーザーのユーザー名。

  • raw:Base64エンコードされた生の認証情報。

注意: この拡張機能を使用して、サーバーまたはクライアントを認証できます。両方のオプションを構成すると、拡張機能はエラーを表示します。詳しくは、「Settings」を参照してください。

はじめに

以下の手順に従って、コンポーネントの設定とアクティベーションを行ってください:

  1. Splunk Distribution of the OpenTelemetry Collector をホストまたはコンテナプラットフォームにデプロイします:

  2. 次のセクションで説明するように、basicauth エクステンションを設定します。

  3. Collector を再起動します。

サンプル構成

このコンポーネントを有効にするには、次の例のように、設定ファイルのextensionsセクションにbasicauthを追加します:

YAML
extensions:
  basicauth/server:
    htpasswd:
      file: .htpasswd
      inline: |
        ${env:BASIC_AUTH_USERNAME}:${env:BASIC_AUTH_PASSWORD}

  basicauth/client:
    client_auth:
      username: username
      password: password

receivers:
  otlp:
    protocols:
      http:
        auth:
          authenticator: basicauth/server

processors:

exporters:
  otlp:
    auth:
      authenticator: basicauth/client

構成を完了するには、構成ファイルの service セクションの任意のパイプラインに拡張機能を含めます。 例:

YAML
service:
  extensions: [basicauth/server, basicauth/client]
  pipelines:
    traces:
      receivers: [otlp]
      processors: []
      exporters: [otlp]

設定例:シンプルなPrometheusレシーバー

次の例は、Simple Prometheus レシーバbasicauth 拡張機能を設定する方法を示しています。

YAML
receivers:
  lightprometheus/myjob:
    auth:
      authenticator: basicauth
    collection_interval: 1s
    endpoint: "http://localhost:8000/metrics"

exporters:
  otlp:
    endpoint: "${OTLP_ENDPOINT}"
    tls:
      insecure: true

extensions:
  basicauth:
    client_auth:
      username: foo
      password: bar

service:
  extensions: [ basicauth ]
  pipelines:
    metrics:
      receivers: [ lightprometheus/myjob ]
      exporters: [ otlp ]

設定

次の表は、basicauth エクステンションの設定オプションを示しています:

サーバーまたはクライアントの認証

この拡張機能を使用して、サーバーまたはクライアントを認証できます。両方のオプションを構成すると、拡張機能はエラーを表示します。

  • 拡張機能をサーバー認証機能として設定するには、htpasswd.file あるいは htpasswd.inline を設定してください。両方を設定した場合は、htpasswd.inline 資格情報が優先されます。

  • 拡張機能をクライアント認証機能として設定するには、client_auth を設定します。

トラブルシューティング

If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.

Available to Splunk Observability Cloud customers

Available to prospective customers and free trial users

  • Ask a question and get answers through community support at Splunk Answers.

  • Join the Splunk community #observability Slack channel to communicate with customers, partners, and Splunk employees worldwide.