win-acmeを使用しLet'sEncryptで証明書を取得する

Last-modified: Sun, 02 Aug 2026 11:28:23 JST (71d)
Top > win-acmeを使用しLet'sEncryptで証明書を取得する

win-acmeを使用しLet'sEcryptからSSL証明書を取得します。
ここではホスト単体での取得パターンとアスタリスク証明書の2パターンを示します。
なお、SSL証明書を取得するにあたり、自動更新が行われていない等の連絡先として メールアドレス が必要になります。
また、アスタリスク証明書についてはwin-acme単体では 「自動更新に未対応」です。理由はアスタリスク証明書の取得条件としてDNSへのTXTレコード更新が必須であり、この更新が手動であるためです。ここでは自動更新をさせるため「DNSをAmazon Route 53」に設定し、win-acmeのR53プラグインを使用 し証明書更新時のDNSレコード更新を自動化する方法を示します。なお、win-acmeが自動化できるプラグインはR53だけではありません が、本例ではR53を示します。

前提条件

  • Windows Server 2016(x86-64)
    • おそらくほかのバージョンのIISでも同様に設定可能と思われますが、未検証です。
  • IISにホストの設定と外部DNS設定済み。httpでホスト名にてアクセス可能。
  • 公開ホストに対し、IP制限がかかっていないこと(IP制限下である場合プラグイン+APIによるDNSレコード検証パターンになります)
  • 検証用ホストは「test.example.com」になります。実際のホスト名に修正をしてください。

ホスト名指定での証明書取得パターン

「test.example.com」単体でのSSL証明書取得パターンです。

  1. win-acme 公式サイト より最新版をダウンロードします。
  2. ダウンロードしたZipを展開し、c:\win-acmeに展開します。
    img1.png
  3. コマンドプロンプトを「管理者」で実行します。
  4. 以下実行コマンド。#の部分は説明なので実際に入力するものではありません。
    C:\win-acme>wacs  # 管理者にてwin-acmeを対話モードで起動
    
     A simple Windows ACMEv2 client (WACS)
     Software version 2.2.9.1701 (release, pluggable, standalone, 64-bit)
     Connecting to https://acme-v02.api.letsencrypt.org/...
     Connection OK!
     Scheduled task not configured yet
     Please report issues at https://github.com/win-acme/win-acme
    
     N: Create certificate (default settings)
     M: Create certificate (full options)
     R: Run renewals (0 currently due)
     A: Manage renewals (0 total)
     O: More options...
     Q: Quit
    
     Please choose from the menu: n  # ホスト名で証明書を取得するため「N」を選択
    
     Running in mode: Interactive, Simple
    
     Please select which website(s) should be scanned for host names. You may
     input one or more site identifiers (comma-separated) to filter by those
     sites, or alternatively leave the input empty to scan *all* websites.
    
     2: test.example.com (1 binding)  # IISで設定されているホストの一覧が表示される
    
     Site identifier(s) or <Enter> to choose all: 2  # SSL証明書発行対象ホストを選択
    
     1: test.example.com (Site 2)
    
     Listed above are the bindings found on the selected site(s). By default all
     of them will be included, but you may either pick specific ones by typing the
     host names or identifiers (comma-separated) or filter them using one of the
     options from the menu.
    
     P: Pick bindings based on a search pattern
     A: Pick *all* bindings
    
     Binding identifiers(s) or menu option: <Enter>  # 空エンター
    
     1: test.example.com (Site 2)
    
     Continue with this selection? (y*/n) - yes # yesで選択
    
     Source generated using plugin IIS: test.example.com
    
    Terms of service:    C:\ProgramData\win-acme\acme-v02.api.letsencrypt.org\LE-SA-v1.8-July-06-2026.pdf
    
     Open in default application? (y/n*) - <Enter>  # 空エンター
    
     Do you agree with the terms? (y*/n) - <Enter>  # 空エンター
    
     Enter email(s) for notifications about problems and abuse (comma-separated): info@example.com # 連絡先メアドを入力。カンマ区切りで複数設定可能。
    
     Plugin IIS generated source test.example.com with 1 identifiers
     Plugin Single created 1 order
     [test.example.com] Authorizing...
     [test.example.com] Authorizing using http-01 validation (SelfHosting)
     [test.example.com] Authorization result: valid
     Downloading certificate [IIS] test.example.com, (any host)
     Store with CertificateStore...
     Installing certificate in the certificate store
     Adding certificate [IIS] test.example.com, (any host) @ 2026/7/24 in store WebHosting
     Adding certificate CN=YR1, O=Let's Encrypt, C=US in store CA
     Adding certificate CN=Root YR, O=ISRG, C=US in store CA
     Installing with IIS...
     Adding new https binding *:443:test.example.com  # 自動でIISの設定が変更されHTTPSのバインディングが追加される
     Committing 1 https binding changes to IIS while updating site 2
     Adding Task Scheduler entry with the following settings
     - Name win-acme renew (acme-v02.api.letsencrypt.org)
     - Path C:\win-acme
     - Command wacs.exe --renew --baseuri "https://acme-v02.api.letsencrypt.org/"
     - Start at 09:00:00
     - Random delay 04:00:00
     - Time limit 02:00:00
     Adding renewal for [IIS] test.example.com, (any host)
     Next renewal due after 2026/9/17
     Certificate [IIS] test.example.com, (any host) created
    
     N: Create certificate (default settings)
     M: Create certificate (full options)
     R: Run renewals (0 currently due)
     A: Manage renewals (1 total)
     O: More options...
     Q: Quit
    
     Please choose from the menu: q # 無事発行されたのでQで終了
  5. HTTPSでアクセスできることを確認します。
  6. 自動更新スケジュールはタスクスケジューラに自動的に登録されます。
    img2.jpg

アスタリスク証明書取得パターン

  • 例として、hoge.test.example.comとhuga.test.example.comのIISホスト設定があり、それらに対し*.test.example.comのSSL証明書を取得するとします。
  • hoge.test.example.comおよびhuga.test.example.comに対しホスト名にHTTPでアクセス可能である前提です。
  • IP制限自体はかかっていても問題ありませんが、内部からインターネットへ接続できないといけません(R53更新のためのAPIを叩くため)
  • 検証環境ではメアドを求められませんでしたが、すでに同ホスト名で証明書を取得したから出なかった可能性があります。

AWS R53確認および自動更新プラグイン用IAMユーザ作成

  • 取得したいホスト名を管理しているR53のゾーンIDを確認します。
  • ホストしているIISが稼働しているWindowsServerが同一AWS内のEC2であれば「IAMロール」を、そうでない場合は「IAMユーザ」を作成します。ここでは別サーバに適用したいのでIAMユーザを作成します。
  • 設定するIAMポリシーは最低限とし以下のポリシーを設定します。<対象R53ゾーンID>の個所は適切に置き換えてください。
    {
        "Version": "2012-10-17",
        "Id": "win-acme update cert policy",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "route53:ListHostedZones",
                    "route53:GetChange"
                ],
                "Resource": [
                    "*"
                ]
            },
            {
                "Effect": "Allow",
                "Action": [
                    "route53:ChangeResourceRecordSets"
                ],
                "Resource": [
                    "arn:aws:route53:::hostedzone/<対象R53のゾーンID>"
                ]
            }
        ]
    }

win-acmeの設定

  1. win-acme 公式サイト より最新版をダウンロードします。
  2. ダウンロードしたZipを展開し、c:\win-acmeに展開します。
    img3.png
  3. 公式プラグインをダウンロードし、Zip展開します。
  4. c:\win-acmeディレクトリに展開したプラグインのDLLを入れます。
    img4.jpg
  5. 格納したプラグインDLLすべてにおいて、右クリックしブロックの解除を実施します。
    img5.jpg
  6. コマンドプロンプトを「管理者」で実行します。
  7. win-acmeをverboseオプションを付けて実行し、プラグインが正しく読み込まれているかを確認します。#の部分は説明なので実際に入力するものではありません。
    C:\win-acme>wacs.exe --verbose
     [DBUG] Logging at level Verbose
     [VERB] Loaded validation plugin Route53 from C:\win-acme\PKISharp.WACS.Plugins.ValidationPlugins.Route53.dll  # R53プラグインが正常に読み込まれていることを確認。
     [VERB] W3SVC detected and running
     [VERB] No FTPSVC detected
  8. プラグインの読み込みが確認できましたらいったん終了させます。
  9. 再度win-acmeを実行します。今度はオプション無しです。
    C:\win-acme>wacs.exe
    
     A simple Windows ACMEv2 client (WACS)
     Software version 2.2.9.1701 (release, pluggable, standalone, 64-bit)
     Connecting to https://acme-v02.api.letsencrypt.org/...
     Connection OK!
     Scheduled task looks healthy
     Please report issues at https://github.com/win-acme/win-acme
    
     N: Create certificate (default settings)
     M: Create certificate (full options)
     R: Run renewals (0 currently due)
     A: Manage renewals (1 total)
     O: More options...
     Q: Quit
    
     Please choose from the menu: m  # アスタリスク証明書はメニューにないのでfull optionsを選択
    
     Running in mode: Interactive, Advanced
    
     Please specify how the list of domain names that will be included in the
     certificate should be determined. If you choose for one of the "all bindings"
     options, the list will automatically be updated for future renewals to
     reflect the bindings at that time.
    
     1: Read bindings from IIS
     2: Manual input
     3: CSR created by another program
     C: Abort
    
     How shall we determine the domain(s) to include in the certificate?: 2 # アスタリスク証明書はマニュアルで入力する必要があるので、2の Manual input を選択
    
    Description:         A host name to get a certificate for. This may be a
                         comma-separated list.
    
     Host: *.test.example.com  # 取得するアスタリスク証明書のホスト名を入力
    
     Source generated using plugin Manual: *.test.example.com
    
     Friendly name '[Manual] *.test.example.com'. <Enter> to accept or type desired name: <Enter> # 取得したSSL証明書を証明書ストア格納時に識別可能なフレンドリー名を入力。今回デフォルトでよいので「空エンター」
    
     By default your source identifiers are covered by a single certificate. But
     if you want to avoid the 100 domain limit, want to prevent information
     disclosure via the SAN list, and/or reduce the operational impact of a single
     validation failure, you may choose to convert one source into multiple
     certificates, using different strategies.
    
     1: Separate certificate for each domain (e.g. *.example.com)
     2: Separate certificate for each host (e.g. sub.example.com)
     3: Separate certificate for each IIS site
     4: Single certificate
     C: Abort
    
     Would you like to split this source into multiple certificates?: <Enter> # 空エンター
    
     Validation plugin SelfHosting not available: HTTP validation cannot be used for wildcard identifiers (e.g. *.example.com)
     Validation plugin FileSystem not available: HTTP validation cannot be used for wildcard identifiers (e.g. *.example.com)
    
     The ACME server will need to verify that you are the owner of the domain
     names that you are requesting the certificate for. This happens both during
     initial setup *and* for every future renewal. There are two main methods of
     doing so: answering specific http requests (http-01) or create specific dns
     records (dns-01). For wildcard identifiers the latter is the only option.
     Various additional plugins are available from
     https://github.com/win-acme/win-acme/.
    
     1: [http] Save verification files on (network) path
     2: [http] Serve verification files from memory
     3: [http] Upload verification files via FTP(S)
     4: [http] Upload verification files via SSH-FTP
     5: [http] Upload verification files via WebDav
     6: [dns] Create verification records in AWS Route 53
     7: [dns] Create verification records manually (auto-renew not possible)
     8: [dns] Create verification records with acme-dns (https://github.com/joohoi/acme-dns)
     9: [dns] Create verification records with your own script
     10: [tls-alpn] Answer TLS verification request from win-acme
     <Enter>: Abort
    
     How would you like prove ownership for the domain(s)?: 6 # R53プラグインを入れているので6の Create verification records in AWS Route 53 を選択します。
    
    Description:         AWS IAM role for the current EC2 instance to login into
                         Amazon Route 53. Note that you should provide the IAM
                         name instead of the ARN.
    
     IAM role name (leave blank to use access key): <Enter> # 今回の検証ではIAMロールではなくIAMユーザを使用するので空エンター。EC2でありIAMロール適用可能であればその方が良い。
    
    Description:         Access key ID to login into Amazon Route 53.
    
     Access key ID: AKIAIOSFODNN7EXAMPLE # あらかじめ作成済みR53更新用IAMユーザのアクセスキー入力
    
    Description:         Secret access key to login into Amazon Route 53.
    
     1: Type/paste in console
     2: Search in vault
    
     Choose from the menu: 1 # IAMユーザのシークレットキーを入力。今回は初回設定なので1のコンソール入力を選択
    
     Secret access key: **************************************** # シークレットキーを入力
    
     Save to vault for future reuse? (y/n*) - yes # 入力したクレデンシャル情報をvaultに保存します。
    
     Please provide a unique name to reference this secret: update r53 for test.example.com # valultに格納する識別可能なユニーク名を入力
    
     After ownership of the domain(s) has been proven, we will create a
     Certificate Signing Request (CSR) to obtain the actual certificate. The CSR
     determines properties of the certificate like which (type of) key to use. If
     you are not sure what to pick here, RSA is the safe default.
    
     1: Elliptic Curve key
     2: RSA key
     C: Abort
    
     What kind of private key should be used for the certificate?: 2 # 取得するSSL証明書の形式。RSAを選択。
    
     When we have the certificate, you can store in one or more ways to make it
     accessible to your applications. The Windows Certificate Store is the default
     location for IIS (unless you are managing a cluster of them).
    
     1: IIS Central Certificate Store (.pfx per host)
     2: PEM encoded files (Apache, nginx, etc.)
     3: PFX archive
     4: Windows Certificate Store (Local Computer)
     5: No (additional) store steps
    
     How would you like to store the certificate?: 4 # 取得したSSL証明書の格納先を設定します。IISであれば通常証明書ストア経由となるので、4の Windows Certificate Store を選択します。ちなみに1のIIS Central Certificate Store は証明書ストアとは別物です。
    
     1: [WebHosting] - Dedicated store for IIS
     2: [My] - General computer store (for Exchange/RDS)
     3: [Default] - Use global default, currently WebHosting
    
     Choose store to use, or type the name of another unlisted store: <Enter> # どの証明書ストアに格納するか?デフォルトでよいので空エンター
    
     1: IIS Central Certificate Store (.pfx per host)
     2: PEM encoded files (Apache, nginx, etc.)
     3: PFX archive
     4: Windows Certificate Store (Local Computer)
     5: No (additional) store steps
    
     Would you like to store it in another way too?: <Enter> # 他の場所にも格納するか?今回はIISのみ対象なので空エンター
    
     With the certificate saved to the store(s) of your choice, you may choose one
     or more steps to update your applications, e.g. to configure the new
     thumbprint, or to update bindings.
    
     1: Create or update bindings in IIS
     2: Start external script or program
     3: No (additional) installation steps
    
     Which installation step should run first?: 1 # IISのバインディング設定を更新(https)したいので 1 を選択
    
     This plugin will update *all* binding using the previous certificate in both
     Web and FTP sites, regardless of whether those bindings were created manually
     or by the program itself. Therefor you'll never need to run this installation
     step twice.
    
     During initial setup, it will try to make as few changes as possible to IIS
     to cover the source identifiers. If new bindings are needed, by default it
     will create those at the same site where the HTTP binding for that host was
     found.
    
     3: hoge.test.example.com
     4: huga.test.example.com
     2: test.example.com
    
     Choose site to create new bindings: 3    # どれか一つを選ぶ。残りのバインディング設定は手動で実施する必要があります。
    
     1: Create or update bindings in IIS
     2: Start external script or program
     3: No (additional) installation steps
    
     Add another installation step?: <Enter> # 空エンター
    
     Plugin Manual generated source *.test.example.com with 1 identifiers
     Plugin Single created 1 order
     [*.test.example.com] Authorizing...
     [*.test.example.com] Authorizing using dns-01 validation (Route53)
     Creating TXT record _acme-challenge.test.example.com with value whr3xoqaE4c4xJ0WGGLF9gD6AfSamw6xJOxTZLu9Y_E
     [*.test.example.com] Record whr3xoqaE4c4xJ0WGGLF9gD6AfSamw6xJOxTZLu9Y_E successfully created
     Waiting for DNS changes propagation # プラグインがR53のレコードを更新し、ドメインの保持者かチェックされる。
     [*.test.example.com] Preliminary validation succeeded
     [*.test.example.com] Authorization result: valid
     [*.test.example.com] Record whr3xoqaE4c4xJ0WGGLF9gD6AfSamw6xJOxTZLu9Y_E deleted
     Downloading certificate [Manual] *.test.example.com # 無事アスタリスク証明書が取得できた
     Store with CertificateStore...
     Installing certificate in the certificate store
     Adding certificate [Manual] *.test.example.com @ 2026/7/24 in store WebHosting
     Installing with IIS...
     Adding new https binding *:443:hoge.test.example.com
     Committing 1 https binding changes to IIS while updating site 3 # 自動でIISのバインディング設定が更新される。
     Scheduled task looks healthy
     Adding renewal for [Manual] *.test.example.com # タスクスケジューラに自動更新タスクが追加される
     Next renewal due after 2026/9/17
     Certificate [Manual] *.test.example.com created
    
     N: Create certificate (default settings)
     M: Create certificate (full options)
     R: Run renewals (0 currently due)
     A: Manage renewals (2 total)
     O: More options...
     Q: Quit
    
    Please choose from the menu: q # 無事発行されたのでQで終了
  10. 自動設定されたホストに対しHTTPSでアクセスができることを確認します。
  11. 自動設定されなかったホストについては手動でHTTPSへのバインディング設定を追加する必要があります。その際には証明書ストア内にあるLet's Encryptの証明書を設定してください。これにより証明書ストア内の証明書が更新された際にバインドされたすべてのホストに対し更新された証明書が反映されます。
    img6.jpg

Counter: 102, today: 1, yesterday: 1

このページの参照回数は、102です。