a
}|gPR @ s d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddlm
Z
dd lmZ ddlZdd
l
mZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ dd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z" e#e$Z%G dd dZ&ej'ej(e)ej*dddZ+eej' eeej, e
e-df dddZ.eej' ej/dd d!Z0eej* e)d"d#d$Z1dS )%zACME AuthHandler. N)Dict)Iterable)List)Optional)Sequence)Tuple)Type)Response)
challenges)client)errors)messages)achallenges)
configuration)
interfaces)
error_handler)Account)util)commonc @ s* e Zd ZdZejeej ee e
e ddddZd#e
jejeeee
e
j dd d
Ze
jee
e
f ddd
Ze
e
j eeeddddZee
j e
ej dddZee
eej dddZ e
ej ddddZ!e
je"e e
ej dddZ#e
e
j ddddZ$e
ej ejed d!d"Z%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.ClientV2 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 B/usr/lib/python3.9/site-packages/certbot/_internal/auth_handler.py__init__0 s zAuthHandler.__init__F )orderrconfigbest_effortmax_retries
max_time_minsr c
C sL |j dd }|std| js,td| |}|s>|S t| j| z0| j
|}|jr|tj
d| || dd W n> tjy } z$td td | W Y d} ~ n
d} ~ 0 0 t||D ]\}
}| j|
j| qtd | |||| d
d |D }|std|W d S 1 s40 Y td
dS )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
:param float max_time_mins: maximum time (in minutes) 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.z3Challenges loaded. Press continue to submit to CA.
T)pausez!Failure in setting up challenges.z0Attempting to clean up outstanding challenges...zWaiting for verification...c S s g | ]}|j jtjkr|qS r bodystatusr
ZSTATUS_VALID.0authzrr r r