---
schema_version: "1"
id: c6a902914dc5b73d17eb74c631e0289b01132444cdb3d7feda37feb378e4302d
title: amc_setup パラメーターによる REST 接続の設定
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/runtime-manager/rtm-agent-REST-connections.md
canonical_url: https://docs.mulesoft.com/jp/runtime-manager/rtm-agent-REST-connections
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c3a33c83469b837be54aca208880ee991678a2ac7cc79da8413ddd9f978c9aa2
description: MuleSoft Documentation Site
latest: true
---
# amc\_setup パラメーターによる REST 接続の設定

 [![logo server active](/mulesoft/current/ja-jp/_/img/icons/server-cloud.svg "Anypoint Platform PCE")Private Cloud Edition](deployment-strategies#anypoint-platform-private-cloud-edition)

REST 接続 ​`amc_setup`​ パラメーターは、Anypoint Platform の両方のバージョン (クラウドとオンプレミス) で動作し、Mule Runtime Engine と任意の外部クライアントとの直接の REST 接続が可能です。これによって、外部クライアントは ​[Runtime Manager エージェントの REST API](https://docs.mulesoft.com/jp/runtime-manager/runtime-manager-agent-api)​ を使用して直接 Mule Runtime Engine にアクセスし、管理できます。

Runtime Manager エージェントを設定して、非セキュア接続またはセキュア接続のいずれかを許可できます。

セキュア REST 設定では、有効なデジタル証明書を使用して Runtime Manager エージェントを設定します。非セキュア REST 設定では、このステップをスキップできます。

## [](#非セキュア接続チャネル)非セキュア接続チャネル

暗号化されていない接続を使用するように Runtime Manager エージェントを設定するには、インストールコマンドラインで ​`-I`​ パラメーターを指定します。これは、REST トランスポートでのみ有効です。ブラウザーや、HTTP 要求を実行するその他のツールを使用して、API とのやりとりを行うことができます。

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 80%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">パラメーター</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><code>-I</code>​</p>
</div>
<div class="paragraph">
<p><code>--insecure</code></p>
</div></div></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>Runtime Manager エージェントが暗号化されていない接続を使用するように設定します。</p>
</div>
<div class="paragraph">
<p>デフォルトの TCP ポートは 9999 です。そのため、ベース URL ​<code>http://localhost:9999/mule/agent/</code>​ で Runtime Manager エージェントに接続できます。</p>
</div></div></td>
</tr>
</tbody>
</table>

`-I`​ パラメーターによって生成された ​`mule-agent.yml`​ ファイルの例を次に示します。

```yaml
transports:
  websocket.transport:
    enabled: false

  rest.agent.transport:
    port: 9999

services:
  mule.agent.jmx.publisher.service:
    enabled: true
    frequency: 15
    frequencyTimeUnit: MINUTES
```

## [](#セキュア接続チャネル)セキュア接続チャネル

インストールコマンドラインで ​`-S`​ 引数を使用することで、TLS 接続を確立するように Runtime Manager エージェントを設定できます。このオプションでは、REST 通信用の TLS チャネルのみが有効になります。

このオプションは、エージェントを手動で管理する場合に使用できます。詳細な手順については、「​[コントロールプレーンを使用しない Mule Runtime Engine の双方向 TLS の設定](#コントロールプレーンを使用しない-mule-runtime-engine-の双方向-tls-の設定)​」を参照してください。

Anypoint Platform Runtime Manager クラウドコンソールを使用してエージェントを管理している場合は、「​[コントロールプレーンで管理される Mule Runtime Engine の双方向 TLS の設定](#コントロールプレーンで管理される-mule-runtime-engine-の双方向-tls-の設定)​」を参照してください。

<table class="tableblock frame-all grid-all stretch">
<colgroup>
<col style="width: 20%;">
<col style="width: 80%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">パラメーター</th>
<th class="tableblock halign-left valign-top">説明</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p><code>-S</code>​</p>
</div>
<div class="paragraph">
<p><code>--secure</code></p>
</div></div></td>
<td class="tableblock halign-left valign-top"><div class="content"><div class="paragraph">
<p>Runtime Manager エージェントがオンプレミス管理コンソールと TLS 接続を確立するように設定します。</p>
</div>
<div class="paragraph">
<p>キーストア (公開/非公開キーペア) とトラストストアのファイルを JKS 形式で提供します。</p>
</div></div></td>
</tr>
</tbody>
</table>

セキュア接続チャネルモードを選択すると、次のメニューが表示されます。

The communication channel for the agent will be encrypted using
public/private key certificates. The following steps prompt you
for the keystore and truststore.
Both keystore and truststore format must be JKS.

Keystore location (?):
Truststore location (?):
Keystore Password (?):
Keystore Alias (?):
Keystore Alias Password (?):
INFO: Mule agent was successfully configured to use a TLS channel for REST communications.

- **Keystore location (キーストアの場所)**​ (必須)
    
    通信チャネルを暗号化するためのキーストアファイルの場所を指定します。キーストアファイルは JKS 形式である必要があります。
- **Truststore location (トラストストアの場所)**
    
    管理コンソールからの要求を受信するためのトラストストアの場所を指定します。トラストストアは JKS 形式である必要があります。またパスワードは設定しないでください。
- **Keystore Password (キーストアパスワード)**
    
    エージェントがキーストアを読むために使用するパスワードを指定します。エージェントは、キーストアを開くときにもこのパスワードを使用します。
- **Keystore Alias (キーストアの別名)**
    
    キーストア内に保存された鍵の別名を指定します。
- **Keystore Alias Password (キーストアの別名のパスワード)**
    
    キーストア内の別名のパスワード。

`-S`​ パラメーターによって生成された ​`mule-agent.yml`​ ファイルの例を次に示します。

```yaml
transports:
  websocket.transport:
    enabled: false

  rest.agent.transport:
    restSecurity:
      keyStoreFile: server.jks
      keyStorePassword: P@ssword
      keyStoreAlias: serverkey
      keyStoreAliasPassword: P@ssword
    port: 9999

services:
  mule.agent.jmx.publisher.service:
    enabled: true
    frequency: 15
    frequencyTimeUnit: MINUTES
```

### [](#コントロールプレーンを使用しない-mule-runtime-engine-の双方向-tls-の設定)コントロールプレーンを使用しない Mule Runtime Engine の双方向 TLS の設定

Mule がコントロールプレーンに接続されていない場合に双方向 TLS を設定するには、​`amc_setup -S`​ オプションを使用します。

1. Runtime Manager エージェント (サーバー) を識別するキーストア (公開/非公開キーペア) を生成します。
    
    Runtime Manager エージェントのホスト名または IP アドレスに一致する CN を設定します。
    
    ```console
    echo "Generate a new keystore to identify the Runtime Manager agent. Use CN=localhost"
    
    keytool -keystore rmakeystore.jks -genkey -keyalg RSA -keypass mulesoft -storepass mulesoft -noprompt \
    -alias rma \
    -dname "CN=localhost, OU=Runtime Manager Agent, O=MuleSoft, L=San Francisco, S=Califorina, C=US"
    ```
2. Runtime Manager エージェントの証明書 (公開キーのみ) を DES 形式の証明書ファイルにエクスポートします。
    
    ```console
    echo "Export the rma alias' certificate from the rmakeystore.jks key store"
    keytool -export -alias rma -file rma.crt -keystore rmakeystore.jks -storepass mulesoft
    ```
3. Runtime Manager エージェントに接続する各 REST クライアントに対して、REST クライアントを識別するキーストア (公開/非公開キーペア) を生成します。
    
    ```console
    echo "Generate a new keystore to be used by client requestors. Use CN=localhost"
    keytool -keystore clientkeystore.jks -storepass mulesoft -genkey -keyalg RSA -keypass mulesoft -noprompt \
    -alias client \
    -dname "CN=localhost, OU=RMA Client, O=MuleSoft, L=San Francisco, S=California, C=US"
    ```
4. REST クライアントの証明書 (公開キーのみ) を DES 形式の証明書ファイルにエクスポートします。
    
    ```console
    echo "Export the client alias' certificate from the clientkeystore.jks key store"
    keytool -export -alias client -file client.crt -keystore clientkeystore.jks -storepass mulesoft
    ```
5. トラストストアファイルを作成します。
    
    ```console
    echo "Import client and server public keys into a common cacerts.jks truststore file"
    
    keytool -import -v -trustcacerts -alias rma -file rma.crt -keystore cacerts.jks -keypass mulesoft -storepass mulesoft -noprompt
    
    keytool -import -v -trustcacerts -alias client -file client.crt -keystore cacerts.jks -keypass mulesoft -storepass mulesoft -noprompt
    ```
    
    証明書ファイルは自己署名されているため、クライアントは認証機関 (CA) で証明書を検証することはできません。証明書に署名する CA をエミュレートするには、クライアント証明書と RMA 証明書 (公開キー) の両方が入ったトラストストアファイルを作成する必要があります。本番環境では、サーバーとクライアントの両方の証明書は信頼された CA によって署名され、クライアントマシンとサーバーマシンに対して公開または共有されます。
6. `rmakeystore.jks`​ ファイルと ​`cacerts.jks`​ トラストストアを使用して Mule Runtime Engine を設定します。
    
    `$MULE_HOME/bin`​ フォルダーで ​`./amc_setup -S`​ を実行します。
7. 生成した値の入力を促されたら、入力します。
    
    たとえば、これまでのコマンドを ​`/security`​ フォルダーから実行した場合は、次の値を入力します。
    
    ```console
    -> Mule Agent Unpacked
    
    
    
    The communication channel for the agent will be encrypted using public/private key certificates.
    The following steps prompt you for the keystore and truststore.
    Both keystore and truststore formats must be JKS.
    
    
    Keystore location (?):/security/rmakeystore.jks
    Keystore Password (?): mulesoft
    Truststore location (?):/security/cacerts.jks
    Keystore Alias (?):rma
    Keystore Alias Password (?): mulesoft
    
            INFO: Mule agent was successfully configured to use a TLS channel for REST communications.
    
    
    > more ..\conf\mule-agent.yml
    
    transports:
      websocket.transport:
        enabled: false
    
      rest.agent.transport:
        restSecurity:
          keyStoreFile: clientkeystore.jks
          keystorePassword: mulesoft
          keyStoreAlias: client
          keyStoreAliasPassword: mulesoft
        port: 9999
    
    services:
      mule.agent.jmx.publisher.service:
        enabled: true
        frequency: 15
        frequencyTimeUnit: MINUTES
    ```
    
    このコマンドは、​`/security/cacerts.jks`​ トラストストアファイルを ​`$MULE_HOME/conf`​ フォルダーにインポートして、名前を ​`anypoint-truststore.jks`​ に変更します。
    
    <table><tbody><tr><td class="icon"><i class="fa icon-note" title="Note"></i></td><td class="content">Runtime Manager エージェントバージョン 1.11.0 以降では、デフォルトのトラストストアの名前は ​<code>anypoint-truststore.jks</code>​ になります。Runtime Manager エージェントの以前のバージョンでは、デフォルトの名前は ​<code>truststore.jks</code>​ でした。</td></tr></tbody></table>
8. Mule Runtime Engine を再起動し、Runtime Manager エージェントの REST インターフェースが正常に起動したことを確認します。
9. Mule Runtime Engine のログに SSL デバッグを追加します。
    
    `./mule -M-Djavax.net.debug=all`

### [](#コントロールプレーンで管理される-mule-runtime-engine-の双方向-tls-の設定)コントロールプレーンで管理される Mule Runtime Engine の双方向 TLS の設定

Mule がコントロールプレーンに接続されている場合に双方向 TLS を設定する手順は、次のとおりです。

1. Runtime Manager エージェント (サーバー) を識別するキーストア (公開/非公開キーペア) を生成します。
    
    Runtime Manager エージェントのホスト名または IP アドレスに一致する CN を設定します。
    
    ```console
    echo "Generate a new keystore to identify the Runtime Manager agent. Use CN=localhost"
    
    keytool -keystore rmakeystore.jks -genkey -keyalg RSA -keypass mulesoft -storepass mulesoft -noprompt \
    -alias rma \
    -dname "CN=localhost, OU=Runtime Manager Agent, O=MuleSoft, L=San Francisco, S=Califorina, C=US"
    ```
2. Runtime Manager エージェントの証明書 (公開キーのみ) を DES 形式の証明書ファイルにエクスポートします。
    
    ```console
    echo "Export the rma alias' certificate from the rmakeystore.jks key store"
    keytool -export -alias rma -file rma.crt -keystore rmakeystore.jks -storepass mulesoft
    ```
3. Runtime Manager エージェントに接続する各 REST クライアントに対して、REST クライアントを識別するキーストア (公開/非公開キーペア) を生成します。
    
    ```console
    echo "Generate a new keystore to be used by client requestors. Use CN=localhost"
    keytool -keystore clientkeystore.jks -storepass mulesoft -genkey -keyalg RSA -keypass mulesoft -noprompt \
    -alias client \
    -dname "CN=localhost, OU=RMA Client, O=MuleSoft, L=San Francisco, S=California, C=US"
    ```
4. REST クライアントの証明書 (公開キーのみ) を DES 形式の証明書ファイルにエクスポートします。
    
    ```console
    echo "Export the client alias' certificate from the clientkeystore.jks key store"
    keytool -export -alias client -file client.crt -keystore clientkeystore.jks -storepass mulesoft
    ```
5. クライアント証明書と RMA 証明書の両方が入ったトラストストアファイルを作成します。
    
    ```console
    echo "Import client and server public keys into a common cacerts.jks truststore file"
    
    keytool -import -v -trustcacerts -alias rma -file rma.crt -keystore cacerts.jks -keypass mulesoft -storepass mulesoft -noprompt
    
    keytool -import -v -trustcacerts -alias client -file client.crt -keystore cacerts.jks -keypass mulesoft -storepass mulesoft -noprompt
    ```
    
    証明書ファイルは自己署名されているため、クライアントは認証機関 (CA) で証明書を検証することはできません。証明書に署名する CA をエミュレートするには、クライアント証明書と RMA 証明書 (公開キー) の両方が入ったトラストストアファイルを作成する必要があります。本番環境では、サーバーとクライアントの両方の証明書は信頼された CA によって署名され、クライアントマシンとサーバーマシンに対して公開または共有されます。
6. `anypoint-truststore.jks`​ ファイルと ​`mule-agent.yml`​ ファイルをバックアップします。
    
    ```console
    cp anypoint-truststore.jks anypoint-truststore.jks.bkp
    cp mule-agent.yml mule-agent.yml.bkp
    ```
7. Anypoint Platform 証明書を DES 形式の証明書ファイルにエクスポートします。
    
    パスワードが求められた場合は Enter を押します。
    
    ```console
    keytool -export -alias hybrid -file hybrid.crt -keystore anypoint-truststore.jks
    ```
8. クライアント、RMA、および Anypoint Platform の証明書が入ったトラストストアファイルを作成します。
    
    keytool -import -v -trustcacerts -alias rma -file rma.crt -keystore cacerts.jks -keypass mulesoft -storepass mulesoft -noprompt
    keytool -import -v -trustcacerts -alias client -file client.crt -keystore cacerts.jks -keypass mulesoft -storepass mulesoft -noprompt
    keytool -import -v -trustcacerts -alias hybrid -file hybrid.crt -keystore cacerts.jks -keypass mulesoft -storepass mulesoft -noprompt
    
    証明書ファイルは自己署名されているため、クライアントは認証機関 (CA) で証明書を検証することはできません。これらの証明書に署名する CA をエミュレートするには、クライアント証明書と RMA 証明書の両方が入ったトラストストアファイルを作成する必要があります。コントロールプレーンとの接続を維持するには、トラストストアファイルに Anypoint Platform 証明書も入っている必要があります。本番環境では、サーバーとクライアントの両方の証明書は信頼された CA によって署名され、クライアントマシンとサーバーマシンに対して公開または共有されます。
9. Mule Runtime Engine をシャットダウンし、​`mule-agent.yml`​ ファイルを修正してセキュア REST API エンドポイントを設定します。
    
    transports:
      rest.agent.transport:
        restSecurity:
          keyStoreFile: rmakeystore.jks
          keyStorePassword: mulesoft
          keyStoreAlias: rma
          keyStoreAliasPassword: mulesoft
        port: 9995
10. 新しく作成した​`cacerts.jks`​ ファイルの名前を ​`anypoint-truststore.jks`​ に変更します。このファイルが、Runtime Manager エージェントと Anypoint Platform 接続で使用する新しいトラストストアになります。
    
    mv cacerts.jks anypoint-truststore.jks
    
    <table><tbody><tr><td class="icon"><i class="fa icon-note" title="Note"></i></td><td class="content">Runtime Manager エージェントバージョン 1.10.0 以降では、デフォルトのトラストストアの名前は ​<code>anypoint-truststore.jks</code>​ になります。Runtime Manager エージェントの以前のバージョンでは、デフォルトの名前は ​<code>truststore.jks</code>​ でした。</td></tr></tbody></table>
11. Mule Runtime Engine を起動して、Runtime Manager エージェント REST インターフェースが正常に立ち上がることと、まだ Anypoint Platform の Runtime Manager に接続されていることを確認します。
12. Mule のログに SSL デバッグを追加します。
    
    `./mule -M-Djavax.net.debug=all`

### [](#双方向-tls-rest-要求の送信)双方向 TLS REST 要求の送信

双方向 TLS REST 要求を送信するには、次の手順を実行します。

1. JKS キーストアを P12 キーストアに変換します。
    
    ```console
    echo "Export client keystore PKCS12 format from JKS"
    keytool -importkeystore -srckeystore clientkeystore.jks -srcstoretype JKS -srcstorepass mulesoft \
    -destkeystore clientkeystore.p12 -deststoretype PKCS12 -deststorepass mulesoft \
    -srcalias client -destalias client
    ```
2. `openssl`​ ツールを使用して、base64 でエンコードされた完全なクライアント証明書 (公開キーと非公開キー) のテキストファイルをエクスポートします。
    
    ```console
    echo "Export full PEM (public and private keys) for use by client requests (cURL)"
    openssl pkcs12 -in clientkeystore.p12 -passin pass:mulesoft \
    -out clientkeystore.pem -passout pass:mulesoft
    ```
    
    `clientkeystore.pem`​ ファイルを表示して、公開キーと非公開キーの両方がこのファイルにエクスポートされたことを確認できます。
3. クライアントホストから Runtime Manager エージェントホストに REST 要求を送信します。
    
    SSL エラーが表示されないことと、Runtime Manager エージェントから応答を受信したことを確認します。
    
    `--insecure`​ オプションを使用して、サーバー (Runtime Manager エージェント) の証明書の検証をスキップします。
    
    ```console
    $ curl -X GET https://localhost:9999/mule/agent/components --cert clientkeystore.pem --insecure
    
    Enter PEM pass phrase:
    
    [{"componentId":"components.configure.request.handler","enabled":true},{"componentId":"clustering.request.handler","enab
    led":true},{"componentId":"applications.request.handler","enabled":true},{"componentId":"domains.request.handler","enabl
    ed":true},{"componentId":"flows.request.handler","enabled":true},{"componentId":"installer.request.handler","enabled":tr
    ue},{"componentId":"logging.request.handler","enabled":true},{"componentId":"monitoring.request.handler","enabled":true}
    ,{"componentId":"properties.request.handler","enabled":true},{"componentId":"tracking.request.handler","enabled":true},{
    "componentId":"application.deployment.notification.internal.message.handler","enabled":true},{"componentId":"domain.depl
    oyment.notification.internal.message.handler","enabled":true},{"componentId":"flow.status.notification.internal.message.
    handler","enabled":true},{"componentId":"membership.change.notification.internal.message.handler","enabled":true},{"comp
    onentId":"primary.node.notification.internal.message.handler","enabled":true},{"componentId":"tracking.notification.inte
    rnal.message.handler","enabled":false},{"componentId":"mule.agent.tracking.handler.log","enabled":false},{"componentId":
    "mule.agent.gw.http.handler.log","enabled":false},{"componentId":"mule.agent.nagios.jmx.internal.handler","enabled":fals
    e},{"componentId":"mule.agent.tracking.handler.splunk","enabled":false},{"componentId":"mule.agent.gw.http.handler.splun
    k","enabled":false},{"componentId":"mule.agent.application.service","enabled":true},{"componentId":"mule.agent.clusterin
    g.service","enabled":true},{"componentId":"mule.agent.domain.service","enabled":true},{"componentId":"mule.agent.gw.http
    .service","enabled":false},{"componentId":"mule.agent.installer.service","enabled":true},{"componentId":"mule.agent.logg
    ing.service","enabled":true},{"componentId":"mule.agent.application.metrics.publisher.service","enabled":true},{"compone
    ntId":"mule.agent.jmx.publisher.service","enabled":true},{"componentId":"mule.agent.properties.service","enabled":true},
    {"componentId":"mule.agent.tracking.service","enabled":true}]
    ```