web-dev-qa-db-ja.com

コマンドプロンプトからIIS7サイトにSSL証明書を割り当てる方法

APPCMDアプリケーションを使用してIIS7のWebサイトにSSL証明書を割り当てることが可能かどうかを教えてもらえますか?

HTTPSバインディングを設定するコマンドに精通している

appcmd set site /site.name:"A Site" /+bindings.[protocol='https',bindingInformation='*:443:www.mysite.com']

および現在のマッピングを取得する方法

%windir%\system32\inetsrv\Appcmd

しかし、サイトを証明書にマップする方法を見つけることができないようです(たとえば、証明書のハッシュなど)

51

答えは、NETSHを使用することです。例えば

netsh http add sslcert ipport=0.0.0.0:443 certhash='baf9926b466e8565217b5e6287c97973dcd54874' appid='{ab3c58f7-8316-42e3-bc6e-771d4ce4b201}'
52

Sukesh Ashok Kumarによる、IISコマンドラインからのSSLのセットアップに関する簡単なガイド。certutil/makecertを使用した証明書のインポート/生成が含まれます。

http://www.awesomeideas.net/post/How-to-configure-SSL-on-IIS7-under-Windows-2008-Server-Core.aspx

編集:元のURLがダウンしている場合、それはまだ利用可能です- ウェイバックマシンを介して

17
orip

PowerShellとWebAdministrationモジュールを使用すると、次のようにしてSSL証明書をIISサイトに割り当てることができます。

# ensure you have the IIS module imported
Import-Module WebAdministration

cd IIS:\SslBindings
Get-Item cert:\LocalMachine\My\7ABF581E134280162AFFFC81E62011787B3B19B5 | New-Item 0.0.0.0!443

注意すること...値「7ABF581E134280162AFFFC81E62011787B3B19B5」は、インポートする証明書のthumb印です。そのため、最初に証明書ストアにインポートする必要があります。 New-Itemコマンドレットは、IPアドレス(すべてのIPに対して0.0.0.0)とポートを受け取ります。

詳細については、 http://learn.iis.net/page.aspx/491/powershell-snap-in-configuring-ssl-with-the-iis-powershell-snap-in/ を参照してください。

これは、Windows Server 2008 R2およびWindows Server 2012プレリリースでテストしました。

9
David Mohundro

@Davidと@oripはそれを正しく持っています。

ただし、例(0.0.0.0:443)で指定されているipportパラメーターは、MSDNが「未指定アドレス( IPv4:0.0.0.0またはIPv6:[::])」。

調べてみたので、他の人の時間を節約するためにここに文書化すると思いました。この記事ではSQL Serverに焦点を当てていますが、情報は引き続き関連しています。

http://msdn.Microsoft.com/en-us/library/ms186362.aspx

4
fordareh

この投稿からの回答を使用して、トリックを実行するスクリプトを1つ作成しました。 pfxファイルから開始しますが、そのステップはスキップできます。

ここにあります:

cd C:\Windows\System32\inetsrv

certutil -f -p "pa$$Word" -importpfx "C:\temp\mycert.pfx"

REM The thumbprint is gained by installing the certificate, going to cert manager > personal, clicking on it, then getting the Thumbprint.
REM Be careful copying the thumbprint. It can add hidden characters, esp at the front.
REM appid can be any valid guid
netsh http add sslcert ipport=0.0.0.0:443 certhash=5de934dc39cme0234098234098dd111111111115 appid={75B2A5EC-5FD8-4B89-A29F-E5D038D5E289}

REM bind to all ip's with no domain. There are plenty of examples with domain binding on the web
appcmd set site "Default Web Site" /+bindings.[protocol='https',bindingInformation='*:443:']
1
HockeyJ