# Oracleプラグイン

{% hint style="warning" %}
パスワードのローテーションには、KeeperPAMによるゼロトラスト方式もあります。ほとんどの用途では、そちらの利用を推奨します。詳細は以下をご参照ください。

* [KeeperPAMを使用したパスワードローテーション](/keeperpam/jp/secrets-manager/password-rotation.md)
* [コマンダーのKeeperPAMコマンド](/keeperpam/jp/commander-cli/command-reference/keeperpam-commands.md)
  {% endhint %}

このプラグインを使用すると、Oracle Databaseサーバーのユーザーのパスワードをローテーションできます

## 前提条件

{% hint style="info" %}
クライアントアプリケーションを有効にするには、Oracle Instant Clientのセットアップが必要です。

次のページをご参照ください。<http://www.oracle.com/technetwork/database/features/instant-client/index-097480.html>
{% endhint %}

#### cx\_Oracleのインストール

```
pip3 install oracledb
```

## ローテーション用のレコードを準備

### ローテーション用のレコードを作成

ローテーションは、従来のレコードにもタイプ指定されたレコードにも対応しています。 タイプ指定されたレコードを使用する場合は、「ログイン」タイプのフィールドが必要です。 ローテーションの種類に応じて、その他のフィールドを追加することもできます。 以下の手順をご参照ください。

{% hint style="info" %}
従来のレコードとタイプ指定のあるレコードの詳細については、[トラブルシューティング](/keeperpam/jp/commander-cli/troubleshooting-commander-cli.md#typed-vs-untyped-records-v3-vs-v2)をご参照ください。
{% endhint %}

### Keeper内でローテーションするレコードに以下のカスタムフィールドを追加します

**DSN文字列を使用した接続:**

| ラベル      | 値                                                                                                        | コメント          |
| -------- | -------------------------------------------------------------------------------------------------------- | ------------- |
| cmdr:dsn | <p>例:<br>"(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521))(CONNECT\_DATA=(SID=XE)))"</p> | Oracle DSN文字列 |

**データベースホストとサービスの名前を使用した接続**

{% hint style="info" %}
`cmdr:dsn`を使用すると、`cmdr:host`と`cmdr:db`のプロパティは無視されます。
{% endhint %}

<table><thead><tr><th width="148">ラベル</th><th width="131.33333333333334">値</th><th>コメント</th></tr></thead><tbody><tr><td>cmdr:host</td><td></td><td>Oracleサーバーのホスト名</td></tr><tr><td>cmdr:db</td><td></td><td>Oracleサーバーに接続するデータベースサービス</td></tr></tbody></table>

#### 以下のオプションのプラグインフィールドを追加して、Oracleローテーションプラグインの使用を強制できます

<table><thead><tr><th width="146.33333333333334">ラベル</th><th width="112">値</th><th>コメント</th></tr></thead><tbody><tr><td>cmdr:plugin</td><td>oracle</td><td>(任意) Oracleローテーションを使用するようにコマンダーに指示します。 これは、レコードに設定するか、またはローテーションコマンドに指定する必要があります</td></tr></tbody></table>

{% hint style="info" %}
コマンダーは、ホスト名が「oracle//」で始まるレコードに対してoracleプラグインを自動的に使用します
{% endhint %}

#### このプラグインは、パスワードをローテーションするときに、パスワードコマンドのユーザー名としてログインフィールドを使用します。

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2F7rf1K8ROjH3WSNdAbAtx%2Fimage.png?alt=media&#x26;token=5e3aba09-959d-4b3c-aae8-f634ca174296" alt=""><figcaption></figcaption></figure>

**レコードの例:**

<figure><img src="https://859776093-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FPL6k1aGsLiFiiJ3Y7zCl%2Fuploads%2FOGumx9XewdMfVR2ZXV9H%2Fimage.png?alt=media&#x26;token=90788017-65b6-46e2-bec2-09515e11d0f1" alt=""><figcaption><p>Oracleのパスワードローテーション用のKeeperのレコードの設定</p></figcaption></figure>

## ローテーション

Oracleのパスワードをローテーションするには、コマンダーで`rotate`コマンドを使用します。 コマンドにレコードタイトルもしくはUIDを渡します (複数のレコードを1度にローテーションさせるには、正規表現で`--match`を使用します)。

```
rotate "Oracle Example" --plugin oracle
```

{% hint style="info" %}
プラグインは、こちらに示すようにコマンドに指定することも、レコードのフィールドに追加することもできます (上記のオプションを参照)。\
レコードにプラグインタイプを追加すると、プラグインの異なる複数のレコードを1度にローテーションできます。
{% endhint %}

#### 出力

ローテーションが完了すると、新しいパスワードがレコードの`パスワード`フィールドに格納されます。


---

# 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/commander-cli/command-reference/plugins/oracle-plugin.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.
