@@ -315,17 +315,6 @@ public async Task<PendingAuthorization> PrepareAutomatedChallengeResponse(ILog l
315315 }
316316 }
317317
318- if ( requiredChallenge . ChallengeType == SupportedChallengeTypes . CHALLENGE_TYPE_SNI )
319- {
320- // perform tls-sni-01 challenge response
321- var check = PrepareChallengeResponse_TlsSni01 ( log , iisManager , pendingAuth . Identifier , managedCertificate , pendingAuth ) ;
322- if ( requestConfig . PerformTlsSniBindingConfigChecks )
323- {
324- // set config check OK if all checks return true
325- pendingAuth . AttemptedChallenge . ConfigCheckedOK = check ( ) ;
326- }
327- }
328-
329318 if ( requiredChallenge . ChallengeType == SupportedChallengeTypes . CHALLENGE_TYPE_DNS )
330319 {
331320 // perform dns-01 challenge response
@@ -341,15 +330,6 @@ public async Task<PendingAuthorization> PrepareAutomatedChallengeResponse(ILog l
341330 if ( requiredChallenge . ChallengeType == SupportedChallengeTypes . CHALLENGE_TYPE_TKAUTH )
342331 {
343332 pendingAuth . AttemptedChallenge . ConfigCheckedOK = true ;
344- // perform tkauth-01 challenge response
345- //var check = await PerformChallengeResponse_Dns01(log, domain, managedCertificate, pendingAuth, isTestMode: false, credentialsManager);
346- /*
347- pendingAuth.AttemptedChallenge.IsFailure = !check.Result.IsSuccess;
348- pendingAuth.AttemptedChallenge.ChallengeResultMsg = check.Result.Message;
349- pendingAuth.AttemptedChallenge.IsAwaitingUser = check.IsAwaitingUser;
350- pendingAuth.AttemptedChallenge.PropagationSeconds = check.PropagationSeconds;
351- pendingAuth.IsFailure = !check.Result.IsSuccess;
352- pendingAuth.AuthorizationError = pendingAuth.IsFailure ? check.Result.Message : "";*/
353333 }
354334 }
355335 }
@@ -555,70 +535,6 @@ private async Task<ActionResult> PerformChallengeResponse_Http01(ILog log, ITarg
555535 }
556536 }
557537
558- private Func < bool > PrepareChallengeResponse_TlsSni01 ( ILog log , ITargetWebServer iisManager , CertIdentifierItem domain , ManagedCertificate managedCertificate , PendingAuthorization pendingAuth )
559- {
560- var requestConfig = managedCertificate . RequestConfig ;
561-
562- var tlsSniChallenge = pendingAuth . Challenges . FirstOrDefault ( c => c . ChallengeType == SupportedChallengeTypes . CHALLENGE_TYPE_SNI ) ;
563-
564- if ( tlsSniChallenge == null )
565- {
566- log . Warning ( $ "No tls-sni-01 challenge to complete for { managedCertificate . Name } . Request cannot continue.") ;
567- return ( ) => false ;
568- }
569-
570- var sha256 = System . Security . Cryptography . SHA256 . Create ( ) ;
571-
572- var z = new byte [ tlsSniChallenge . HashIterationCount ] [ ] ;
573-
574- // compute n sha256 hashes, where n=challengedata.iterationcount
575- z [ 0 ] = sha256 . ComputeHash ( Encoding . UTF8 . GetBytes ( tlsSniChallenge . Value ) ) ;
576-
577- for ( var i = 1 ; i < z . Length ; i ++ )
578- {
579- z [ i ] = sha256 . ComputeHash ( z [ i - 1 ] ) ;
580- }
581-
582- // generate certs and install iis bindings
583- var cleanupQueue = new List < Func < Task > > ( ) ;
584-
585- var checkQueue = new List < Func < bool > > ( ) ;
586-
587- foreach ( var hex in z . Select ( b =>
588- BitConverter . ToString ( b ) . Replace ( "-" , "" ) . ToLower ( ) ) )
589- {
590- var sni = $ "{ hex . Substring ( 0 , 32 ) } .{ hex . Substring ( 32 ) } .acme.invalid";
591-
592- log . Information ( $ "Preparing binding at: https://{ domain } , sni: { sni } ") ;
593-
594- var x509 = CertificateManager . GenerateSelfSignedCertificate ( sni ) ;
595-
596- CertificateManager . StoreCertificate ( x509 ) ;
597-
598- var certStoreName = CertificateManager . GetMachineStore ( ) . Name ;
599-
600- // iisManager.InstallCertificateforBinding(certStoreName, x509.GetCertHash(),
601- // managedCertificate.ServerSiteId, sni);
602-
603- // add check to the queue
604- checkQueue . Add ( ( ) => _netUtil . CheckSNI ( domain . Value , sni ) . Result ) ;
605-
606- // add cleanup actions to queue
607- cleanupQueue . Add ( ( ) => iisManager . RemoveHttpsBinding ( managedCertificate . ServerSiteId , sni ) ) ;
608-
609- cleanupQueue . Add ( ( ) => Task . Run ( ( ) => CertificateManager . RemoveCertificate ( x509 ) ) ) ;
610- }
611-
612- // configure cleanup to execute the cleanup queue
613- pendingAuth . Cleanup = async ( ) =>
614- {
615- cleanupQueue . ForEach ( a => a ( ) ) ;
616- } ;
617-
618- // perform our own config checks
619- return ( ) => checkQueue . All ( check => check ( ) ) ;
620- }
621-
622538 private DnsChallengeHelper _dnsHelper = null ;
623539
624540 internal async Task < DnsChallengeHelperResult > PerformChallengeResponse_Dns01 ( ILog log , CertIdentifierItem domain , ManagedCertificate managedCertificate , PendingAuthorization pendingAuth , bool isTestMode , bool isCleanupOnly , ICredentialsManager credentialsManager )
0 commit comments