Web Apps で Let’s Encrypt Site Extension の Renewが失敗する

Azure Web AppsでLe’ts Encryptのサイトエクステンションを使用してサーバー証明書を設定している場合に証明書の更新でコケていたので回避方法など。

環境: Azure Web Appsでプラットフォームをx64にしている、かつLet’s Encryptのx64版サイトエクステンションを使用している
エラー内容: Functions.RenewCertificateなWebJobsで以下の例外が発生してRenewに失敗する

Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Microsoft.Azure.WebJobs.Host.FunctionInvocationException: Exception while executing function: Functions.RenewCertificate —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. —> System.TypeInitializationException: The type initializer for ‘ACMESharp.PKI.Providers.OpenSslLibBaseProvider’ threw an exception. —> System.TypeInitializationException: The type initializer for ‘OpenSSL.Core.Native’ threw an exception. —> System.DllNotFoundException: Unable to load DLL ‘x64\libeay32’: The specified module could not be found. (Exception from HRESULT: 0x8007007E)
at OpenSSL.Core.Native.SSLeay()
at OpenSSL.Core.Version.get_Library()
at OpenSSL.Core.Native..cctor()
— End of inner exception stack trace —
at OpenSSL.Core.Native.BN_new()
at OpenSSL.Core.BigNumber.op_Implicit(UInt32 value)
at ACMESharp.PKI.Providers.OpenSslLibBaseProvider..cctor()
— End of inner exception stack trace —
at ACMESharp.PKI.Providers.OpenSslLibBaseProvider..ctor(IReadOnlyDictionary2 initParams) at ACMESharp.PKI.Providers.OpenSslLib64Provider..ctor(IReadOnlyDictionary2 initParams)
— End of inner exception stack trace —
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.ConstructorInfo.Invoke(Object[] parameters)
at ACMESharp.PKI.Providers.OpenSslLibProvider..ctor(IReadOnlyDictionary2 newParams) — End of inner exception stack trace — at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor) at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.ConstructorInfo.Invoke(Object[] parameters) at ACMESharp.PKI.CertificateProvider.GetProvider(String name, IReadOnlyDictionary2 initParams)
at LetsEncrypt.SiteExtension.Core.CertificateManager.GetCertificate(Target binding)
at LetsEncrypt.SiteExtension.Core.CertificateManager.Auto(Target binding)
at LetsEncrypt.SiteExtension.Core.CertificateManager.RequestAndInstallInternal(Target target)
at LetsEncrypt.SiteExtension.Core.CertificateManager.d__7.MoveNext()
at System.Linq.Enumerable.Count[TSource](IEnumerable1 source) at LetsEncrypt.SiteExtension.Functions.RenewCertificate(TimerInfo timerInfo) at lambda_method(Closure , Functions , Object[] ) at Microsoft.Azure.WebJobs.Host.Executors.VoidMethodInvoker1.InvokeAsync(TReflected instance, Object[] arguments)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionInvoker`1.d__0.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__31.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__2c.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__13.MoveNext()
— End of inner exception stack trace —
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__13.MoveNext()
— End of stack trace from previous location where exception was thrown —
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.d__1.MoveNext()

回避策:
Kuduなどを使用してD:\home\SiteExtensions\letsencrypt64\bin\x64フォルダにあるDLL2つを D:\home\site\wwwroot\App_Data\jobs\continuous\letsencrypt64(letsencrypt.siteextension.job)\x64 フォルダへコピーする

本家に一応Issue上げておきましたけど、メンテされるのかなこれ。

コメントを残す

以下に詳細を記入するか、アイコンをクリックしてログインしてください。

WordPress.com ロゴ

WordPress.com アカウントを使ってコメントしています。 ログアウト /  変更 )

Facebook の写真

Facebook アカウントを使ってコメントしています。 ログアウト /  変更 )

%s と連携中