Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add dns-account-01 integration test in chisel #7319

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
16 changes: 16 additions & 0 deletions test/chisel2.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ def auth_and_issue(domains, chall_type="dns-01", email=None, cert_output=None, c
cleanup = do_http_challenges(client, authzs)
elif chall_type == "dns-01":
cleanup = do_dns_challenges(client, authzs)
elif chall_type == "dns-account-01":
cleanup = do_dns_account_challenges(client, authzs)
elif chall_type == "tls-alpn-01":
cleanup = do_tlsalpn_challenges(client, authzs)
else:
Expand Down Expand Up @@ -153,6 +155,20 @@ def cleanup():
challSrv.remove_dns01_response(host)
return cleanup

def do_dns_account_challenges(client, authzs):
cleanup_hosts = []
for a in authzs:
c = get_chall(a, challenges.DNSACCOUNT01)
name, value = (c.validation_domain_name(client.net.account.uri, a.body.identifier.value),
c.validation(client.net.key))
cleanup_hosts.append(name)
challSrv.add_dns01_response(name, value)
client.answer_challenge(c, c.response(client.net.key))
def cleanup():
for host in cleanup_hosts:
challSrv.remove_dns01_response(host)
return cleanup

def do_http_challenges(client, authzs):
cleanup_tokens = []
challs = [get_chall(a, challenges.HTTP01) for a in authzs]
Expand Down
22 changes: 21 additions & 1 deletion test/v2_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,24 @@
import challtestsrv
challSrv = challtestsrv.ChallTestServer()

def test_dns_account_challenge_multidomain():
"""
Test issuance for two random domains using DNS-ACCOUNT-01.
"""
# Only config-next has a dns-account-01 challenge
if not CONFIG_NEXT:
return
chisel2.auth_and_issue([random_domain(), random_domain()], chall_type="dns-account-01")

def test_dns_account_challenge_wildcardmultidomain():
"""
Test issuance for a random domain and a random wildcard domain using DNS-ACCOUNT-01.
"""
# Only config-next has a dns-account-01 challenge
if not CONFIG_NEXT:
return
chisel2.auth_and_issue([random_domain(), "*."+random_domain()], chall_type="dns-account-01")

def test_multidomain():
chisel2.auth_and_issue([random_domain(), random_domain()])

Expand Down Expand Up @@ -102,8 +120,10 @@ def check_challenge_dns_err(chalType):
c = chisel2.get_chall(authzr, challenges.DNS01)
elif chalType == "tls-alpn-01":
c = chisel2.get_chall(authzr, challenges.TLSALPN01)
elif chalType == "dns-account-01":
c = chisel2.get_chall(authzr, challenges.DNSACCOUNT01)
else:
raise(Exception("Invalid challenge type requested: {0}".format(challType)))
raise(Exception("Invalid challenge type requested: {0}".format(chalType)))

# The failed challenge's error should match expected
error = c.error
Expand Down
Loading