OXIESEC PANEL
- Current Dir:
/
/
usr
/
lib
/
python3
/
dist-packages
/
certbot
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/25/2021 01:14:26 PM
rwxr-xr-x
📄
__init__.py
20 bytes
02/07/2019 09:20:30 PM
rw-r--r--
📁
__pycache__
-
05/25/2021 01:14:27 PM
rwxr-xr-x
📄
account_test.py
14.45 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
acme_util.py
3.18 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
auth_handler_test.py
24 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
cert_manager_test.py
28.07 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
cli_test.py
19.94 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
client_test.py
28.76 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
compat_test.py
736 bytes
02/07/2019 09:20:30 PM
rw-r--r--
📄
configuration_test.py
6.82 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
crypto_util_test.py
13.56 KB
02/07/2019 09:20:30 PM
rw-r--r--
📁
display
-
05/25/2021 01:14:27 PM
rwxr-xr-x
📄
eff_test.py
5.94 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
error_handler_test.py
5.31 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
errors_test.py
1.8 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
hook_test.py
16.67 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
lock_test.py
3.84 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
log_test.py
14.95 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
main_test.py
82.52 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
notify_test.py
2.07 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
ocsp_test.py
6.27 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
renewal_test.py
4.18 KB
12/18/2020 08:47:58 PM
rw-r--r--
📄
renewupdater_test.py
5.32 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
reporter_test.py
2.73 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
reverter_test.py
18.7 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
storage_test.py
42.89 KB
02/07/2019 09:20:30 PM
rw-r--r--
📁
testdata
-
05/25/2021 01:14:26 PM
rwxr-xr-x
📄
util.py
14.12 KB
02/07/2019 09:20:30 PM
rw-r--r--
📄
util_test.py
21.58 KB
02/07/2019 09:20:30 PM
rw-r--r--
Editing: acme_util.py
Close
"""ACME utilities for testing.""" import datetime import josepy as jose import six from acme import challenges from acme import messages from certbot import auth_handler from certbot.tests import util JWK = jose.JWK.load(util.load_vector('rsa512_key.pem')) KEY = util.load_rsa_private_key('rsa512_key.pem') # Challenges HTTP01 = challenges.HTTP01( token=b"evaGxfADs6pSRb2LAv9IZf17Dt3juxGJ+PCt92wr+oA") TLSSNI01 = challenges.TLSSNI01( token=jose.b64decode(b"evaGxfADs6pSRb2LAv9IZf17Dt3juxGJyPCt92wrDoA")) DNS01 = challenges.DNS01(token=b"17817c66b60ce2e4012dfad92657527a") DNS01_2 = challenges.DNS01(token=b"cafecafecafecafecafecafe0feedbac") CHALLENGES = [HTTP01, TLSSNI01, DNS01] def gen_combos(challbs): """Generate natural combinations for challbs.""" # completing a single DV challenge satisfies the CA return tuple((i,) for i, _ in enumerate(challbs)) def chall_to_challb(chall, status): # pylint: disable=redefined-outer-name """Return ChallengeBody from Challenge.""" kwargs = { "chall": chall, "uri": chall.typ + "_uri", "status": status, } if status == messages.STATUS_VALID: kwargs.update({"validated": datetime.datetime.now()}) return messages.ChallengeBody(**kwargs) # pylint: disable=star-args # Pending ChallengeBody objects TLSSNI01_P = chall_to_challb(TLSSNI01, messages.STATUS_PENDING) HTTP01_P = chall_to_challb(HTTP01, messages.STATUS_PENDING) DNS01_P = chall_to_challb(DNS01, messages.STATUS_PENDING) DNS01_P_2 = chall_to_challb(DNS01_2, messages.STATUS_PENDING) CHALLENGES_P = [HTTP01_P, TLSSNI01_P, DNS01_P] # AnnotatedChallenge objects HTTP01_A = auth_handler.challb_to_achall(HTTP01_P, JWK, "example.com") TLSSNI01_A = auth_handler.challb_to_achall(TLSSNI01_P, JWK, "example.net") DNS01_A = auth_handler.challb_to_achall(DNS01_P, JWK, "example.org") DNS01_A_2 = auth_handler.challb_to_achall(DNS01_P_2, JWK, "esimerkki.example.org") ACHALLENGES = [HTTP01_A, TLSSNI01_A, DNS01_A] def gen_authzr(authz_status, domain, challs, statuses, combos=True): """Generate an authorization resource. :param authz_status: Status object :type authz_status: :class:`acme.messages.Status` :param list challs: Challenge objects :param list statuses: status of each challenge object :param bool combos: Whether or not to add combinations """ # pylint: disable=redefined-outer-name challbs = tuple( chall_to_challb(chall, status) for chall, status in six.moves.zip(challs, statuses) ) authz_kwargs = { "identifier": messages.Identifier( typ=messages.IDENTIFIER_FQDN, value=domain), "challenges": challbs, } if combos: authz_kwargs.update({"combinations": gen_combos(challbs)}) if authz_status == messages.STATUS_VALID: authz_kwargs.update({ "status": authz_status, "expires": datetime.datetime.now() + datetime.timedelta(days=31), }) else: authz_kwargs.update({ "status": authz_status, }) # pylint: disable=star-args return messages.AuthorizationResource( uri="https://trusted.ca/new-authz-resource", body=messages.Authorization(**authz_kwargs) )