# Teller

<figure><img src="https://docs.keeper.io/~gitbook/image?url=https%3A%2F%2F762006384-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252F-MJXOXEifAmpyvNVL1to%252Fuploads%252FXXs3iDxSwPACWT36JH5O%252Fkeeper%252Bteller.jpg%3Falt%3Dmedia%26token%3Dc7948170-0739-4e87-b27f-6b67130f4953&#x26;width=768&#x26;dpr=4&#x26;quality=100&#x26;sign=e8b89a4a&#x26;sv=1" alt=""><figcaption></figcaption></figure>

## 特徴 <a href="#features" id="features"></a>

* [Teller](https://github.com/tellerops/teller)環境内でKeeperボルトからシークレットを取得する
* Teller内でシークレット資格情報を環境変数として設定する

{% hint style="info" %}
Keeperシークレットマネージャーの機能について、詳しくは[概要ページ](/keeperpam/jp/secrets-manager/overview.md)をご覧ください。
{% endhint %}

## 要件 <a href="#prerequisites" id="prerequisites"></a>

本ページでは、シークレットマネージャーとTellerの統合について取り扱います。この統合を利用するには、以下が必要となります。

* Keeperシークレットマネージャーへのアクセス (詳細については[クイックスタートガイド](/keeperpam/jp/secrets-manager/quick-start-guide.md)のページをご参照ください)
  * Keeperアカウントでシークレットマネージャーのアドオンが有効である
  * シークレットマネージャー強制適用ポリシーが有効になっているロールのメンバーシップ
* シークレットが共有された[Keeperシークレットマネージャーアプリケーション](/keeperpam/jp/secrets-manager/about/terminology.md)
  * アプリケーションの作成手順については、[クイックスタートガイド](/keeperpam/jp/secrets-manager/quick-start-guide.md)をご参照ください。
  * 初期化された[Keeperシークレットマネージャー構成](/keeperpam/jp/secrets-manager/about/secrets-manager-configuration.md)
    * この統合ではBase64形式の設定を使用します

## セットアップ <a href="#setup" id="setup"></a>

### シークレットマネージャーの構成を取得 <a href="#getting-a-secrets-manager-configuration" id="getting-a-secrets-manager-configuration"></a>

Keeperコマンダーを使用して、アプリケーションに新しいクライアントを追加し、構成をBase64文字列に初期化します。この文字列は、「Initialized Config:」ラベルの後に表示される長いテキストハッシュとなります。

```
My Vault> sm client add --app MyApp --config-init b64

Successfully generated Client Device
====================================

Initialized Config: eyJob3N0bmFtZSI6ICJr....OUk1ZTV1V2toRucXRsaWxqUT0ifQ==
IP Lock: Enabled
Token Expires On: 2021-10-19 15:31:31
App Access Expires on: Never
```

その値を、 **KSM\_CONFIG**という名前の環境変数に割り当てる必要があります。

### Teller構成の作成 <a href="#creating-a-teller-configuration" id="creating-a-teller-configuration"></a>

TellerがKeeperボルトから変数を取得し、現在の作業セッションに入力することで、安全かつ生産的に作業できるようになります。

Tellerにはtellerfileと呼ばれる構成ファイルが必要となります。これは、リポジトリ内にある `.teller.yml` ファイル、または `teller -c your-conf.yml` を使用する場合のファイルです。 新たに作成する場合は `teller new` を実行してウィザードに従い、希望するプロバイダを選択すると `.teller.yml` が生成されます。

あるいは、以下の最小限のテンプレートを使用することもできます。

```sh
project: project_name
opts:
  stage: development

providers:
  # 必要となる構成: KSM_CONFIG=base64_config
  # またはファイルパス: KSM_CONFIG_FILE=ksm_config.json
  keeper_secretsmanager:
    # 1件の記録から複数のKey-valueの対を取得
    # 空白でないフィールドは全てそのラベルにマッピング
    # 空白の場合はフィールドタイプにマッピングされ、重複するものには数字 (1,2,...N) の接尾辞がつきます。
    env_sync:
      path: [recordUID]

    # Keeper表記法を使用して個別のフィールド値を選択
    # https://docs.keeper.io/secrets-manager/secrets-manage
    env:
      USER:
        path: [recordUID]/field/login
      PSWD:
        path: [recordUID]/field/password
```

## コマンドラインから実行 <a href="#running-from-command-line" id="running-from-command-line"></a>

現在のディレクトリ内の`.teller.yml`ファイル、または`teller -c your-conf.yml`を使用する際のファイルを使用し、以下のコマンドでプロセスを実行できます。

```sh
$ teller run node src/server.js
Service is up.
Loaded configuration: Mailgun, SMTP
Port: 5050
```

## GitHubアクションの使用 <a href="#using-a-github-action" id="using-a-github-action"></a>

Tellerの手順を追加します。

```sh
# set up teller step
- name: Setup Teller
  uses: spectralops/setup-teller@v2
- name: Run a Teller task (show, scan, run, etc.)
  run: teller run [args]
```

以下の例では、デフォルトの構成ファイルの `.teller.yml` を使用していますが、このファイルは、`run` コマンドにおいて`teller -c your-conf.yml` で指定するカスタムファイルに置き換えることができます。

```
name: run with teller
on:
  push:
    branches:
      - master
      - main
  pull_request:

jobs:
  build:
    name: Build your code
    runs-on: ubuntu-latest

    steps:
      - name: Clone repo
        uses: actions/checkout@master


      # Tellerをセットアップ
      - name: Setup Teller
        uses: spectralops/setup-teller@v2

      - name: Run a Teller task (show, scan, run, etc.)
        run: teller run npm run build
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.keeper.io/keeperpam/jp/secrets-manager/integrations/teller.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
