> For the complete documentation index, see [llms.txt](https://docs.scepman.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.scepman.com/ja/zheng-ming-shu-guan-li/active-directory/scenarios/rdp-server-certificate.md).

# RDP サーバー証明書

次の `RdpServer` テンプレートを使用すると、Remote Desktop Protocol 経由でアクセスするクライアントに提供される管理対象証明書を利用するように、コンピューターとサーバーを構成できます。

{% stepper %}
{% step %}

### Active Directory にテンプレート オブジェクトを作成する

証明書の登録とマッピングの間、 `SessionEnv` サービスは、証明書テンプレートがすでに SCEPman の構成済み CEP サービスから使用される場合でも、Active Directory で構成された証明書テンプレートを検索します。この検索を満たすために、想定される場所に空の証明書テンプレート オブジェクトを作成します。これには、フォレスト内の Public Key Services コンテナーへの書き込み権限が必要です。たとえば Enterprise Admin の役割です。

{% hint style="info" %}
このオブジェクトを作成するには Enterprise Admin が必要です。Public Key Services コンテナーに対してさらに役割の権限を割り当てていない限りは例外です。
{% endhint %}

{% code lineNumbers="true" %}

```powershell
$ConfigPath = (Get-ADRootDSE).configurationNamingContext
$TemplateContainer = "CN=Certificate Templates,CN=Public Key Services,CN=Services,$ConfigPath"
$Name = "SCEPmanRdpServer"

New-ADObject -Name $Name `
             -Type pKICertificateTemplate `
             -Path $TemplateContainer `
             -OtherAttributes @{
                "displayName" = $Name;
                "msPKI-Cert-Template-OID" = "1.3.6.1.4.1.311.21.8.$(Get-Random 9999999).$(Get-Random 9999999)";
                "msPKI-Template-Schema-Version" = 1;
                "msPKI-Template-Minor-Revision" = 1;
                "msPKI-RA-Signature" = 0;
                "flags" = 0
             }
```

{% endcode %}
{% endstep %}

{% step %}

### SCEPman で証明書テンプレートを有効にする

他の証明書テンプレートと同様に、SCEPman アプリ サービスに次の環境変数を追加することで、このテンプレートを構成できます:

| 設定                                              | Value    | 説明                                                |
| ----------------------------------------------- | -------- | ------------------------------------------------- |
| AppConfig:ActiveDirectory:RdpServer:Enabled     | true     | 証明書テンプレートを有効にする                                   |
| AppConfig:ActiveDirectory:RdpServer:GroupFilter | グループ SID | 省略可: このグループのメンバーのみが、このテンプレートを使用して証明書を登録できるようにします。 |
| {% endstep %}                                   |          |                                                   |

{% step %}

### グループ ポリシーを構成する

グループ ポリシーでは、証明書テンプレート名を構成し、さらに、マシンに指示中に特定のセキュリティ レイヤーを適用するよう指示します。

<pre data-title="グループ ポリシー管理エディター (gpmc.msc) での設定場所"><code>コンピューターの構成

└-ポリシー
  └-管理用テンプレート
    └-Windows コンポーネント
      └-リモート デスクトップ サービス
        └-リモート デスクトップ セッション ホスト
          └-セキュリティ
<strong>            └-サーバー認証用証明書テンプレート
</strong><strong>            └-リモート (RDP) 接続で特定のセキュリティ レイヤーの使用を必須にする
</strong></code></pre>

#### サーバー認証用証明書テンプレート

RDP サーバー認証に使用する証明書テンプレートの名前を入力します。既定では、これは `SCEPmanRdpServer`.

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FmpJ8s6BFWLU0neZcPATi%2Fimage.png?alt=media&amp;token=445ab5bf-e14e-404e-b9b4-027a6f254cf6" alt=""><figcaption></figcaption></figure>

#### リモート (RDP) 接続で特定のセキュリティ レイヤーの使用を必須にする

使用する証明書の使用を強制するには、ここで SSL を選択します。

<figure><img src="https://114237723-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LoGejQeUQcw7lqnQ3WX%2Fuploads%2FnX8naFbQxVf95t3mXj8Y%2Fimage.png?alt=media&amp;token=21629add-e7c8-4fb0-b0b6-23ee3dde5fee" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

構成が完了したら、 `SessionEnv` サービスを再起動して、証明書の登録とマッピングを強制できます。

コンピューター自体で、次のコマンドを実行して使用中の証明書を確認できます:

{% code overflow="wrap" %}

```powershell
(Get-CimInstance -Class Win32_TSGeneralSetting -Namespace root\cimv2\terminalservices -Filter "TerminalName='RDP-tcp'").SSLCertificateSHA1Hash
```

{% endcode %}

これにより、アクティブな RDP 証明書のサムプリントが出力されます。

イベント ログにも、新しい証明書が使用されたことが表示されます:

{% code title="関連するイベント ログのエントリを表示する" overflow="wrap" %}

```powershell
Get-WinEvent -LogName "System" | Where-Object { $_.ProviderName -eq "Microsoft-Windows-TerminalServices-RemoteConnectionManager" } | Select-Object -First 10 | Format-List Message, TimeCreated
```

{% endcode %}

> RD Session Host サーバーで Transport Layer Security (TLS) 1.0\Secure Sockets Layer (SSL)\
> 認証と暗号化に使用される、新しいテンプレートベースの証明書がインストールされました。この\
> 証明書の名前は svr01.Conitoso.local です。証明書の SHA1 ハッシュは\
> イベント データに含まれています。


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.scepman.com/ja/zheng-ming-shu-guan-li/active-directory/scenarios/rdp-server-certificate.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
