Let's Encrypt証明書を使用して、WCFサービスがhttpsで通信できるようにすることができます。 letsencrypt.orgウェブサイトに掲載されているWindowsクライアントのいずれかを使用して設定できます。
ACMESharp clientを使用する場合、1つの基本機能がまだ完全に実装されていないことに気づくでしょう:certificate renewal。
ただし、この問題はMarc Durdinが提供するスクリプトを使用してon his blogを送信することで対処できます。
ACMESharpクライアントをセットアップしてスクリプトに変数を定義したら、60日ごとに実行され、スクリプトを実行するスケジュールされたタスクを作成する必要があります。
WCFサービスでhttpsバインディングを使用するには、そのサービスの構成でそのバインディングを定義する必要があります。
security
要素を作成します。次にendpoint
elementのbindingConfiguration
属性の要素name
の親のbinding
を参照してください。同じendpoint
要素のaddress
属性では、サービスを利用できるhttpsアドレスを指定する必要があります。
443以外のポートを使用する場合は、明示的に定義する必要があります(https://hostname.tld:port/ServiceName/
)。
これをすべて設定したら、letsencryptによって提供された証明書をそのバインディングにバインドする必要があります。これはnetsh http add sslcert
コマンドで実行できます。私はあなたが上記の証明書の更新と併せて、このプロセスを自動化するために使用することができ、次のスクリプトを書きました:
$domain = 'hostname.tld' # insert your hostname
$ipport = '0.0.0.0:portnumber' # insert the proper binding
$getThumb = Get-ChildItem -path cert:\LocalMachine\My | where { $_.Subject -match $domain }
$certHash = $getThumb.Thumbprint
$activeBinding = netsh http show sslcert ipport=$ipport
$activeBindingHash = $activeBinding[5]
$guid = '{' + [guid]::NewGuid() + '}'
If(-Not $activeBindingHash)
{
netsh http add sslcert ipport=$ipport certhash=$certHash appid=$guid
return
}
$hashesMatch = $activeBindingHash | Select-String -Pattern $certHash -Quiet
If(-Not $hashesMatch)
{
netsh http delete sslcert ipport=$ipport
netsh http add sslcert ipport=$ipport certhash=$certHash appid=$guid
}
スクリプトで変数を定義し、あまりにもスケジュールされたタスクとしてあることを実行した場合、あなたはWCFサービスはLet's EncryptのSSL証明書を使用し、自動的に更新されてリバウンドされます。