> For the complete documentation index, see [llms.txt](https://docs.keeper.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.keeper.io/keeperpam/jp/privileged-access-manager/password-rotation/post-rotation-scripts/parameters.md).

# 入力と出力

## 概要

PAMレコードの認証情報のローテーションが成功すると、関連レコード、認証情報、ユーザーに関する情報を含むパラメータとともに、添付されたポストローテーションスクリプトが実行されます。

## 入力 <a href="#inputs" id="inputs"></a>

KeeperゲートウェイでPAMスクリプトが実行され、stdinパラメータを通じてスクリプトへ入力が渡されます。これらのパラメータはBase64エンコードされたJSONオブジェクトとしてスクリプトへパイプされます。

たとえば、Linuxマシン上ではKeeperゲートウェイにより、スクリプトは概ね以下のように実行されます。

```sh
history -c && echo "BASE64==......" | /path/to/script.sh
```

Windowsでは以下のとおりです。

```
"BASE64==......" | .\script.ps1; Clear-History
```

このBase64エンコードされたJSONオブジェクトには、以下のキーが含まれます。

<table><thead><tr><th width="250.37325349301392">キー</th><th>説明</th></tr></thead><tbody><tr><td><code>providerRecordUid</code></td><td>PAM構成レコードのUID</td></tr><tr><td><code>resourceRecordUid</code></td><td>PAMリソースレコードのUID</td></tr><tr><td><code>userRecordUid</code></td><td>PAMユーザーレコードのUID</td></tr><tr><td><code>newPassword</code></td><td>ユーザー向けに新しく生成されたパスワード</td></tr><tr><td><code>oldPassword</code></td><td>ユーザーの以前のパスワード</td></tr><tr><td><code>user</code></td><td>ユーザーのユーザー名</td></tr><tr><td><code>records</code></td><td>レコードディクショナリのBase64エンコード済みJSON配列</td></tr></tbody></table>

### **`records` フィールドに関する追加情報**

`records` キーの値は、レコードディクショナリのBase64エンコード済みJSON配列です。この配列には以下が含まれます。

* PAM構成情報
* 関連するPAMマシン、PAMデータベース、PAMディレクトリのレコードデータ
* ポストローテーションスクリプトのアップロード時に指定された追加レコード
* ユーザーレコードデータ

各ディクショナリオブジェクトには以下が含まれます。

* `uid` - ボルトレコードのUID
* `title` - ボルトレコードのタイトル
* ディクショナリの残りは、レコードデータのキー/値ペア。キーはフィールドのラベル (ラベルがない場合はフィールドタイプ)。同一キーが存在する場合は、キー名に番号が付与される

## 出力

PAMスクリプトの実行後、実行された各スクリプトに対応する `RotationResult` インスタンスの配列が返されます。`RotationResult` クラスには以下の属性があります。

* `uid` - スクリプトが添付されたKeeperボルトレコードのUID
* `command` - シェルへ発行されたコマンド
* `system` - スクリプトの実行先オペレーティングシステム
* `title` - Keeperボルトレコードに添付されたスクリプトファイルのタイトル
* `name` - Keeperボルトレコードに添付されたスクリプトの名前
* `success` - スクリプト実行の成否
  * LinuxおよびmacOS: リターンコード0
  * Windows: Trueステータス
* `stdout` - スクリプト実行結果の標準出力
* `stderr` - スクリプト実行結果の標準エラー

スクリプト実行の成否は、以下のメソッドでも判定できます。

<table><thead><tr><th width="200.38578680203045">メソッド</th><th>説明</th></tr></thead><tbody><tr><td><code>was_failure</code></td><td>ブール値。失敗時 True、成功時 False</td></tr><tr><td><code>was_success</code></td><td>ブール値。成功時 True、失敗時 False</td></tr></tbody></table>

これを利用して、ログ出力をカスタマイズできます。

{% code title="Pythonでの例" %}

```python
for r in results:
    if r.was_failure:
        print(f"For record {r.uid}, the script {r.title} failed: {r.stderr}")
```

{% endcode %}

## エラー

`RotationResult` クラスには、スクリプト実行時のエラーを記録する `stderr` 属性があります。

## 注意事項

ポストローテーションスクリプトの結果と情報は `RotationResult` クラスから取得できますが、スクリプトのエラーと出力は実行シェルの種類によって異なります。スクリプトはユーザー側で制御されるため、Keeperはエラーの定義を把握できず、標準出力も標準エラーもチェックしません。

たとえば、BASHスクリプトに `set -e` が設定されていない場合、一部の処理が失敗してもスクリプトは続行されます。リターンコード `0` で終了した場合、スクリプトは成功扱いになります。

そのため、スクリプトの出力とエラーの適切な処理は、ユーザー側の責任となります。


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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/privileged-access-manager/password-rotation/post-rotation-scripts/parameters.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.
