Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

This article is a Private article. Only a writer and users who know the URL can access it.
Please change open range to public in publish setting if you want to share this article with other users.

Windows Server 2025 標準機能でオレオレ証明書を作って配布する

0
Posted at

はじめに

Windows Server 2025 標準機能でオレオレ証明書を作って配布する備忘録です。

改訂履歴

  • 2026/08/30 : 初版公開。

本文

1. 環境

  • VMware Workstation Pro 25H2u1
  • Windows Server 2025 Datacenter Evaluation 24H2

2. 手順

2-1. 証明書の作成

管理者権限で PowerShell を起動し、以下のコマンドを実行します。今回のサーバーのホスト名は WS2025-APP01、IP アドレスは 192.168.2.6、有効期限は 3 年です。

PowerShell
$cert = New-SelfSignedCertificate `
    -Subject "CN=WS2025-APP01" `
    -TextExtension @("2.5.29.17={text}DNS=WS2025-APP01&IPAddress=192.168.2.6") `
    -CertStoreLocation "Cert:\LocalMachine\My" `
    -FriendlyName "WS2025-APP01 HTTPS" `
    -KeyAlgorithm RSA `
    -KeyLength 2048 `
    -HashAlgorithm SHA256 `
    -NotAfter (Get-Date).AddYears(3)

作成した証明書は、コンピューター証明書 (certlm.msc) の「個人」に登録されます。

2-2. 証明書のエクスポート

作成したオレオレ証明書を配布するために CER 形式でエクスポートしていきます。前項で作成した証明書を右クリックし、エクスポートを選択します。

次へ進みます。

秘密キーをエクスポートしない設定で、次へ進みます。

配布先が Windows のため、DER encoded binary X.509 を選択し、次へ進みます。ちなみに Base 64 encoded X.509 は Linux でよく使われるそうです。

ファイル名を入力し、次へ進みます。今回は WS2025-APP01.cer としました。

完了をクリックします。

どうやら正しくエクスポートされたようです。

確かにユーザーフォルダにエクスポートされています。

2-3. 証明書のインポート

クライアント PC へのインポートです。前項で作成したオレオレ証明書 (WS2025-APP01.cer) をダブルクリックします。

証明書のインストールをクリックします。

ローカルコンピューターを選択し、次へ進みます。

信頼されたルート証明機関を指定し、次へ進みます。

完了をクリックします。

どうやら正しくインポートされたようです。

コンピューター証明書 (certlm.msc) の「信頼されたルート証明機関」に登録されていることが確認できます。

3. 動作確認

動作確認用に IIS の Default Web Site に HTTPS のバインドを追加しました。証明書はもちろんオレオレ証明書 (WS2025-APP01) です。

https://WS2025-APP01/、https://192.168.2.6/ のどちらでもアクセスできます。

おわりに

工場の生産ラインのようなクローズドなネットワークで Web サーバーが 1 台だけなら、オレオレ証明書も無しではありません。

0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?