3
گaO @ s d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm
Z
ddlZdd lm
Z
dd
lmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z! ej"e#Z$G dd dZ%ej&ej'e(ej)dddZ*eej& ee
ej+ e ee, df ee, dddZ-eej& ee
ej+ e ee, df ee, dddZ.eej& ee
ej+ ee, d d!d"Z/eej& ej0d#d$d%Z1eej) e(d&d'd(Z2dS ))zACME AuthHandler. N)Dict)Iterable)List)Optional)Tuple)Type)Response)
challenges)client)errors)messages)achallenges)
configuration)
interfaces)
error_handler)Account)util)commonc @ s e Zd ZdZejeej ee e
e ddddZd e
jejeee
e
j dd d
Ze
jee
e
f ddd
Ze
e
j eeddddZee
j e
ej dddZee
eej dddZe
ej ddddZ e
je
e e
ej dddZ!e
e
j ddddZ"dS )!AuthHandlera ACME Authorization Handler for a client.
:ivar auth: Authenticator capable of solving
:class:`~acme.challenges.Challenge` types
:type auth: certbot.interfaces.Authenticator
:ivar acme.client.BackwardsCompatibleClientV2 acme_client: ACME client API.
:ivar account: Client's Account
:type account: :class:`certbot._internal.account.Account`
:ivar list pref_challs: sorted user specified preferred challenges
type strings with the most preferred challenge listed first
N)authacme_clientaccountpref_challsreturnc C s || _ || _|| _|| _d S )N)r acmer r )selfr r r r r "/usr/lib/python3.6/auth_handler.py__init__/ s zAuthHandler.__init__F )orderrconfigbest_effortmax_retriesr c C s> |j dd }|stjd| js,tjd| j|}|s>|S tj| j| y$| j j
|}|jrptj
ddd W n< tjk
r } ztjd tjd |W Y dd}~X nX t|t|kstd x&t||D ]\} }
| jj| j|
qW tjd
| j||| dd |D }|s&tjd
|S Q R X tjddS )a
Retrieve all authorizations, perform all challenges required to validate
these authorizations, then poll and wait for the authorization to be checked.
:param acme.messages.OrderResource orderr: must have authorizations filled in
:param certbot.configuration.NamespaceConfig config: current Certbot configuration
:param bool best_effort: if True, not all authorizations need to be validated (eg. renew)
:param int max_retries: maximum number of retries to poll authorizations
:returns: list of all validated authorizations
:rtype: List
:raises .AuthorizationError: If unable to retrieve all authorizations
NzNo authorization to handle.z9No ACME client defined, authorizations cannot be handled.z\Challenges loaded. Press continue to submit to CA. Pass "-v" for more info about challenges.T)pausez!Failure in setting up challenges.z0Attempting to clean up outstanding challenges...z(Some challenges have not been performed.zWaiting for verification...c S s g | ]}|j jtjkr|qS r )bodystatusr STATUS_VALID).0authzrr r r