示例#1
0
        private async Task <bool> AuthorizeForDomain(string domain)
        {
            var authorization = await client.NewDnsAuthorizationAsync(domain);

            var challenge = await challengeProvider.AcceptChallengeAsync(domain, options.IISWebSite, authorization);

            if (challenge == null)
            {
                return(false);
            }

            System.Console.WriteLine(challenge.Instructions);
            if (!options.AcceptInstructions)
            {
                System.Console.WriteLine("Press ENTER to continue");
                System.Console.ReadLine();
            }
            else
            {
                System.Console.WriteLine("Automatically accepting instructions.");
            }
            var challengeResult = await challenge.Complete();

            return(challengeResult?.Status == "valid");
        }
示例#2
0
        private async Task <bool> AuthorizeForDomain(string domain)
        {
            var authorization = await client.NewDnsAuthorizationAsync(domain);

            var challenge = await challengeProvider.AcceptChallengeAsync(domain, options.IISWebSite, authorization);

            if (challenge == null)
            {
                return(false);
            }

            System.Console.WriteLine(challenge.Instructions);
            System.Console.WriteLine("Press ENTER to continue");
            System.Console.ReadLine();
            var challengeResult = await challenge.Complete();

            return("valid".Equals(challengeResult?.Status, StringComparison.OrdinalIgnoreCase));
        }
示例#3
0
        async Task <bool> AuthorizeForDomain(string domain)
        {
            var authorization = await _client.NewDnsAuthorizationAsync(domain);

            var challenge = authorization?.Challenges.FirstOrDefault(c => c.Type == "http-01");

            if (challenge == null)
            {
                Log.Error("the server does not accept challenge type http-01");
                return(false);
            }

            Log.Info($"accepting challenge {challenge.Type}");

            var keyAuthorization = _client.GetKeyAuthorization(challenge.Token);

            _challengeProof($"/.well-known/acme-challenge/{challenge.Token}", Encoding.ASCII.GetBytes(keyAuthorization));
            var challengeResult = await _client.CompleteChallengeAsync(challenge);

            _challengeProof(null, null);
            return("valid".Equals(challengeResult?.Status, StringComparison.OrdinalIgnoreCase));
        }