Ë
    M/ÅePR  ã                   ód  — d Z ddlZddlZddlZddlmZ ddlmZ ddlmZ ddlmZ ddlm	Z	 ddlm
Z
 dd	lmZ ddlZdd
lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddl m!Z"  ejF                  e$«      Z% G d„ d«      Z&dejN                  dejP                  de)dejT                  fd„Z+deejN                     deeejX                        de
e-df   fd „Z.deejN                     dej^                  fd!„Z0d"eejT                     de)fd#„Z1y)$zACME AuthHandler.é    N)ÚDict)ÚIterable)ÚList)ÚOptional)ÚSequence)ÚTuple)ÚType)ÚResponse)Ú
challenges)Úclient)Úerrors)Úmessages)Úachallenges)Úconfiguration)Ú
interfaces)Úerror_handler)ÚAccount)Úutil)Úcommonc                   ó†  — e Zd ZdZdej
                  deej                     dee	   de
e   ddf
d„Z	 	 	 dd	ej                  d
ej                   dededede
ej(                     fd„Zd	ej                  dee
e
f   fd„Zde
ej(                     dedededdf
d„Zdeej(                     de
ej6                     fd„Zdede
eej>                        fd„Z de
ej6                     ddfd„Z!dej(                  de"e   de
ej6                     fd„Z#de
ej(                     ddfd„Z$de
ej6                     d
ej                   defd„Z%y)Ú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

    ÚauthÚacme_clientÚaccountÚpref_challsÚreturnNc                 ó<   — || _         || _        || _        || _        y ©N)r   Úacmer   r   )Úselfr   r   r   r   s        ú@/usr/lib/python3/dist-packages/certbot/_internal/auth_handler.pyÚ__init__zAuthHandler.__init__0   s   € àˆŒ	ØˆŒ	àˆŒØ&ˆÕó    ÚorderrÚconfigÚbest_effortÚmax_retriesÚmax_time_minsc                 ó,  — |j                   dd }|st        j                  d«      ‚| j                  st        j                  d«      ‚| j                  |«      }|s|S t        j                  | j                  |«      5  	 | j                  j                  |«      }|j                  r*t        j                  d| j                  ||«      z   d¬«       t%        |«      t%        |«      k(  sJ d	«       ‚t'        ||«      D ]+  \  }
}| j                  j)                  |
j*                  |«       Œ- t        j#                  d
«       | j-                  ||||«       |D �cg c]+  }|j.                  j0                  t2        j4                  k(  r|‘Œ- }}|st        j                  d«      ‚|cddd«       S # t        j                  $ r1}	t        j!                  d«       t        j#                  d«       |	‚d}	~	ww xY wc c}w # 1 sw Y   nxY wt        j                  d«      ‚)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
        NzNo 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...z(Some challenges have not been performed.zWaiting for verification...zAll challenges have failed.z?An unexpected error occurred while handling the authorizations.)Úauthorizationsr   ÚAuthorizationErrorr   ÚErrorÚ_choose_challengesr   ÚExitHandlerÚ_cleanup_challengesr   ÚperformÚdebug_challengesÚdisplay_utilÚnotificationÚ_debug_challenges_msgÚloggerÚcriticalÚinfoÚlenÚzipÚanswer_challengeÚchallbÚ_poll_authorizationsÚbodyÚstatusr   ÚSTATUS_VALID)r    r$   r%   r&   r'   r(   ÚauthzrsÚachallsÚrespsÚerrorÚachallÚrespÚauthzrÚauthzrs_validateds                 r!   Úhandle_authorizationsz!AuthHandler.handle_authorizations8   só  € ð" ×'Ñ'©Ð*ˆÙÜ×+Ñ+Ð,IÓJÐJØ�yŠyÜ—,‘,ÐZÓ[Ð[ð ×)Ñ)¨'Ó2ˆÙØˆNô ×&Ñ& t×'?Ñ'?ÀÓIñ 	%ðØŸ	™	×)Ñ)¨'Ó2�ð ×*Ò*Ü ×-Ñ-ØNØ×2Ñ2°7¸FÓCñDØKOõQô �u“:¤ W£Ò-ÐYÐ/YÓYÐ-ô !$ G¨UÓ 3ò @‘�˜Ø—	‘	×*Ñ*¨6¯=©=¸$Õ?ð@ô �K‰KÐ5Ô6Ø×%Ñ% g¨{¸MÈ;ÔWð 7>ö !Q¨FØ$*§K¡K×$6Ñ$6¼(×:OÑ:OÒ$Oò "(ð !QÐð !Qá$Ü×/Ñ/Ð0MÓNÐNà$÷?	%ñ 	%øô ×,Ñ,ò Ü—‘Ð CÔDÜ—‘ÐNÔOØ�ûðüò !Q÷5	%ð 	%úôB �l‰lÐ\Ó]Ð]s>   Á=G5Á?AF)ÃBG5Å0G0ÆG5Æ)G-Æ<,G(Ç(G-Ç-G5Ç5G>c                 óê  — | j                   st        j                  d«      ‚|j                  D �cg c]+  }|j                  j
                  t        j                  k(  r|‘Œ- }}g }g }|D ]/  }	 | j                   j                  |«      }|j                  |«       Œ1 ||fS c c}w # t        j                  $ r<}|j                  |«       t        j                  d|j                  |«       Y d}~Œ…d}~ww xY w)a~  
        Deactivate all `valid` authorizations in the order, so that they cannot be re-used
        in subsequent orders.
        :param messages.OrderResource orderr: must have authorizations filled in
        :returns: tuple of list of successfully deactivated authorizations, and
                  list of unsuccessfully deactivated authorizations.
        :rtype: tuple
        z?No ACME client defined, cannot deactivate valid authorizations.z)Failed to deactivate authorization %s: %sN)r   r   r-   r+   r>   r?   r   r@   Údeactivate_authorizationÚappendÚacme_errorsr6   ÚdebugÚuri)r    r$   rG   Úto_deactivateÚdeactivatedÚfailedÚes          r!   Údeactivate_valid_authorizationsz+AuthHandler.deactivate_valid_authorizationsx   sí   € ð �yŠyÜ—,‘,Ð`ÓaÐaà.4×.CÑ.Cö I FØ"ŸK™K×.Ñ.´(×2GÑ2GÒGò  ð Iˆð IàˆØˆà#ò 	YˆFðYØŸ™×;Ñ;¸FÓC�Ø×"Ñ" 6Õ*ð	Yð ˜VÐ$Ð$ùòIøô ×$Ñ$ò YØ—‘˜fÔ%Ü—‘ÐHÈ&Ï*É*ÐVW×XÑXûðYús   °0BÁ,,B#Â#C2Â62C-Ã-C2rA   Údeadline_minutesc           
      óœ  ‡ — ‰ j                   st        j                  d«      ‚t        |«      D ��ci c]
  \  }}||df“Œ c}}}g }t        j                  j                  «       t	        j                  |¬«      z   }	d}
t        |«      D �]æ  }|
dkD  rt        j                  |
«       |j                  «       D ���ci c]$  \  }\  }}|‰ j                   j                  |«      “Œ& }}}}|j                  «       D ]  \  }\  }}|||<   Œ |j                  «       D ��cg c].  \  }}|j                  j                  t        j                   k(  r|‘Œ0 }}}|D ]6  }t"        j%                  d|j                  j&                  j(                  «       Œ8 |j+                  |«       |j                  «       D ���ci c]4  \  }\  }}|j                  j                  t        j,                  k(  r|||f“Œ6 }}}}|r!t        j                  j                  «       |	kD  r n`t/        ˆ fd„|j                  «       D «       «      }t1        ||	«      }|t        j                  j                  «       z
  j3                  «       }
�Œé |r(‰ j5                  |«       |st        j6                  d«      ‚|rt        j6                  d	«      ‚yc c}}w c c}}}w c c}}w c c}}}w )
a#  
        Poll the ACME CA server, to wait for confirmation that authorizations have their challenges
        all verified. The poll may occur several times, until all authorizations are checked
        (valid or invalid), or a maximum of retries, or the polling deadline is reached.
        z3No ACME client defined, cannot poll authorizations.N)Úminutesé   r   zChallenge failed for domain %sc              3   ó`   •K  — | ]%  \  }}|�‰j                   j                  |d«      –— Œ' y ­w)Né   )r   Úretry_after)Ú.0Ú_rF   r    s      €r!   ú	<genexpr>z3AuthHandler._poll_authorizations.<locals>.<genexpr>Ç   s4   øè ø€ ò 3Ù") ! TØ!%Ð!1ð #Ÿi™i×3Ñ3°D¸!×<ñ 3ùs   ƒ+.zSome challenges have failed.z0All authorizations were not finalized by the CA.)r   r   r-   Ú	enumerateÚdatetimeÚnowÚ	timedeltaÚrangeÚtimeÚsleepÚitemsÚpollÚvaluesr>   r?   r   ÚSTATUS_INVALIDr6   r8   Ú
identifierÚvalueÚextendÚSTATUS_PENDINGÚmaxÚminÚtotal_secondsÚ_report_failed_authzrsr,   )r    rA   r'   rU   r&   ÚindexrG   Úauthzrs_to_checkÚauthzrs_failed_to_reportÚdeadlineÚsleep_secondsr]   Úauthzrs_failedÚauthzr_failedrF   r[   s   `               r!   r=   z AuthHandler._poll_authorizations“   sÖ  ø€ ð �yŠyÜ—,‘,ÐTÓUÐUô 2;¸7Ó1C÷BEÙ -  vð CHÈ&ÐRVÈÑBWó BEð 	ð $&Ð Ü×$Ñ$×(Ñ(Ó*¬X×-?Ñ-?ÐHXÔ-YÑYˆà ˆÜ�{Ó#ó )	TˆAà˜qÒ Ü—
‘
˜=Ô)ð $4×#9Ñ#9Ó#;÷ =ð  =ÑBTÀ%ÉÈ&ÐRS  t§y¡y§~¡~°fÓ'=Ñ =ð  =Ðò  =ð '7×&<Ñ&<Ó&>ò (Ñ"�‘{˜ Ø!'�˜’ð(ð 7G×6MÑ6MÓ6O÷ P©¨°Ø!'§¡×!3Ñ!3´x×7NÑ7NÒ!Nò %ð PˆNñ Pà!/ò D�Ü—‘Ð<Ø,×1Ñ1×<Ñ<×BÑBõDðDð
 %×+Ñ+¨NÔ;ð
 $4×#9Ñ#9Ó#;÷ Rð  RÑ:O¸%ÁÀ&È$à#)§;¡;×#5Ñ#5¼×9PÑ9PÒ#Pð !&¨° ~Ñ 5ð  RÐò  Rñ $¤x×'8Ñ'8×'<Ñ'<Ó'>ÀÒ'Iáô ó 3Ø-=×-DÑ-DÓ-Fô3ó 3ˆKô
 ˜k¨8Ó4ˆKØ(¬8×+<Ñ+<×+@Ñ+@Ó+BÑB×QÑQÓSŠMðS)	TñX $Ø×'Ñ'Ð(@ÔAÙä×/Ñ/Ð0NÓOÐOáä×+Ñ+Ð,^Ó_Ð_ð ùóqBEùô =ùóPùô Rs   ±J4Â:)J:
Ä3KÆ09K
c                 óÞ  — | j                   st        j                  d«      ‚|D �cg c]+  }|j                  j                  t
        j                  k7  r|‘Œ- }}g }|rt        j                  d«       |D ]r  }|j                  j                  }t        || j                  |j                  j                  j                  «      «      }|j                  | j                  ||«      «       Œt |S c c}w )zÒ
        Retrieve necessary and pending challenges to satisfy server.
        NB: Necessary and already validated challenges are not retrieved,
        as they can be reused for a certificate issuance.
        z5No ACME client defined, cannot choose the challenges.z$Performing the following challenges:)r   r   r-   r>   r?   r   r@   r6   r8   r   Úgen_challenge_pathÚ_get_chall_prefrj   rk   rl   Ú_challenge_factory)r    rA   rG   Úpending_authzrsrB   Úauthzr_challengesÚpaths          r!   r.   zAuthHandler._choose_challengesÚ   sÜ   € ð �yŠyÜ—,‘,ÐVÓWÐWà07ö K fØ$Ÿk™k×0Ñ0´H×4IÑ4IÒIò "ð Kˆð Kà8:ˆÙÜ�K‰KÐ>Ô?Ø%ò 	BˆFØ &§¡× 6Ñ 6Ðä%Ø!Ø×$Ñ$ V§[¡[×%;Ñ%;×%AÑ%AÓBóDˆDð �N‰N˜4×2Ñ2°6¸4Ó@ÕAð	Bð ˆùòKs   ¦0C*Údomainc                 ól  — g }| j                   j                  |«      }| j                  rt|D �ch c]  }|j                  ’Œ }}| j                  D ]3  }||v sŒ|j	                  t
        j                  j                  |   «       Œ5 |r|S t        j                  d«      ‚|j                  |«       |S c c}w )z{Return list of challenge preferences.

        :param str domain: domain for which you are requesting preferences

        zENone of the preferred challenges are supported by the selected plugin)r   Úget_chall_prefr   ÚtyprL   r   Ú	ChallengeÚTYPESr   r,   rl   )r    r€   Úchall_prefsÚplugin_prefÚchallÚplugin_pref_typesrƒ   s          r!   r{   zAuthHandler._get_chall_prefô   s¼   € ð ˆà—i‘i×.Ñ.¨vÓ6ˆØ×ÒØ8CÖ D¨u §£Ð DÐÐ DØ×'Ñ'ò H�ØÐ+Ò+Ø×&Ñ&¤z×';Ñ';×'AÑ'AÀ#Ñ'FÕGðHñ Ø"Ð"Ü×+Ñ+ð7ó8ð 8ð 	×Ñ˜;Ô'ØÐùò !Es   ®B1rB   c                 ód   — t         j                  d«       | j                  j                  |«       y)z§Cleanup challenges.

        :param achalls: annotated challenges to cleanup
        :type achalls: `list` of :class:`certbot.achallenges.AnnotatedChallenge`

        zCleaning up challengesN)r6   r8   r   Úcleanup)r    rB   s     r!   r0   zAuthHandler._cleanup_challenges
  s#   € ô 	�‰Ð,Ô-Ø�	‰	×Ñ˜'Õ"r#   rG   r   c                 ó(  — | j                   st        j                  d«      ‚g }|D ]i  }|j                  j                  |   }|j                  t        || j                   j                  |j                  j                  j                  «      «       Œk |S )at  Construct Namedtuple Challenges

        :param messages.AuthorizationResource authzr: authorization

        :param list path: List of indices from `challenges`.

        :returns: achalls, list of challenge type
            :class:`certbot.achallenges.AnnotatedChallenge`
        :rtype: list

        :raises .errors.Error: if challenge type is not recognized

        úAccount is not set.)
r   r   r-   r>   r   rL   Úchallb_to_achallÚkeyrj   rk   )r    rG   r   rB   rr   r<   s         r!   r|   zAuthHandler._challenge_factory  sƒ   € ð �|Š|Ü—,‘,Ð4Ó5Ð5Øˆàò 	IˆEØ—[‘[×+Ñ+¨EÑ2ˆFØ�N‰NÔ+Ø˜Ÿ™×(Ñ(¨&¯+©+×*@Ñ*@×*FÑ*FóHõ Ið	Ið
 ˆr#   Úfailed_authzrsc           
      óZ  — | j                   st        j                  d«      ‚i }|D ��cg c]h  }|j                  j                  D ]M  }|j
                  r?t        || j                   j                  |j                  j                  j                  «      ‘ŒO Œj }}}|D ]7  }|j                  |j
                  j                  g «      j                  |«       Œ9 d| j                  j                  › d�g}t        |j!                  «       d„ ¬«      D ]  \  }}	|j                  t#        |	«      «       Œ! |rRt%        | j                  t&        j(                  «      r.|j                  d| j                  j+                  |«      › d�«       t-        j.                  dj1                  |«      «       y	c c}}w )
z.Notifies the user about failed authorizations.r�   z=
Certbot failed to authenticate some domains (authenticator: z5). The Certificate Authority reported these problems:c                 ó   — | d   S )Nr   © )Úitems    r!   ú<lambda>z4AuthHandler._report_failed_authzrs.<locals>.<lambda>>  s
   € ÀDÈÁG€ r#   )r�   z
Hint: ú
Ú N)r   r   r-   r>   r   rD   rŽ   r�   rj   rk   Ú
setdefaultrƒ   rL   r   ÚnameÚsortedrf   Ú_generate_failed_chall_msgÚ
isinstanceÚplugin_commonÚPluginÚ	auth_hintr3   ÚnotifyÚjoin)
r    r�   ÚproblemsrG   r<   Úfailed_achallsrE   Úmsgr]   rB   s
             r!   rq   z"AuthHandler._report_failed_authzrs.  sn  € à�|Š|Ü—,‘,Ð4Ó5Ð5ØDFˆà&4÷)Ø"À6Ç;Á;×CYÑCYò)Ø9?Ø!Ÿ<š<ô +¨6°4·<±<×3CÑ3CÀVÇ[Á[×E[ÑE[×EaÑEaÕbð )Ðbð )ˆñ )ð %ò 	EˆFØ×Ñ §¡× 0Ñ 0°"Ó5×<Ñ<¸VÕDð	Eð"Ø"&§)¡)§.¡.Ð!1ð 2EðEð Fˆô ! §¡Ó!1Ñ7KÔLò 	<‰JˆAˆwØ�J‰JÔ1°'Ó:Õ;ð	<ñ
 œj¨¯©´M×4HÑ4HÔIØ�J‰J˜ $§)¡)×"5Ñ"5°nÓ"EÐ!FÀbÐIÔJä×Ñ˜BŸG™G C›LÕ)ùó')s   ©A-F'c                 óü  — |j                   dkD  �rlg }i }i }|D ]É  }t        |j                  t        j                  «      rD|j                  |j                  «      dz   ||j                  j                  |j                  «      <   t        |j                  t        j                  «      sŒ�|j                  |j                  «      dz   ||j                  |j                  «      <   ŒË |r@|j                  d«       |j                  «       D ]  \  }}|j                  d|› d|› �«       Œ |r@|j                  d«       |j                  «       D ]  \  }	}
|j                  d|	› d|
› �«       Œ ddj                  |«      z   S y)	aE  Construct message for debug challenges prompt

        :param list achalls: A list of
            :class:`certbot.achallenges.AnnotatedChallenge`.
        :param certbot.configuration.NamespaceConfig config: current Certbot configuration
        :returns: Message containing challenge debug info
        :rtype: str

        r   r–   zZThe following URLs should be accessible from the internet and return the value mentioned:
zURL: z
Expected value: zRThe following FQDNs should return a TXT resource record with the value mentioned:
zFQDN: z)Pass "-v" for more info about challenges.)Úverbose_countrœ   rˆ   r   ÚHTTP01Ú
validationÚaccount_keyrO   r€   ÚDNS01Úvalidation_domain_namerL   rf   r¡   )r    rB   r%   r¤   Úhttp01_achallsÚdns01_achallsrE   rO   Ú	key_authzÚfqdnÚkey_authz_hashs              r!   r5   z!AuthHandler._debug_challenges_msgH  sx  € ð ×Ñ !Ó#ØˆCØˆNØˆMØ!ò �Ü˜fŸl™l¬J×,=Ñ,=Ô>à×)Ñ)¨&×*<Ñ*<Ó=ÀÑDð # 6§<¡<×#3Ñ#3°F·M±MÓ#BÑCô ˜fŸl™l¬J×,<Ñ,<Õ=à×)Ñ)¨&×*<Ñ*<Ó=ÀÑDð " &×"?Ñ"?ÀÇÁÓ"NÒOðñ Ø—
‘
ð Hô Ià&4×&:Ñ&:Ó&<ò K‘N�C˜Ø—J‘J  s eÐ+=¸i¸[ÐIÕJðKáØ—
‘
ð @ô Aà,9×,?Ñ,?Ó,Aò RÑ(�D˜.Ø—J‘J ¨ vÐ-?ÀÐ?OÐPÕQðRà˜$Ÿ)™) C›.Ñ(Ð(à>r#   )Fé   r±   )&Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚAuthenticatorr   r   ÚClientV2r   r   Ústrr"   r   ÚOrderResourcer   ÚNamespaceConfigÚboolÚintÚfloatÚAuthorizationResourcerI   r   rT   r=   r   r   ÚAnnotatedChallenger.   r	   r   r„   r{   r0   r   r|   rq   r5   r“   r#   r!   r   r       s  „ ñð'˜Z×5Ñ5ð 'ÀHÈVÏ_É_ÑD]ð 'Ø" 7Ñ+ð'Ø:>¸s¹)ð'ØHLó'ð Z_Ø13Ø57ñ>^¨H×,BÑ,Bð >^Ø&3×&CÑ&Cð>^ØRVð>^à+.ð>^ð .3ð>^ð =AÀ×A_ÑA_Ñ<`ó>^ð@%°h×6LÑ6Lð %ÐQVÐW[Ð]aÐWaÑQbó %ð6E`¨D°×1OÑ1OÑ,Pð E`Ð_bð E`Ø/4ðE`ØCGðE`ØLPóE`ðN¨(°8×3QÑ3QÑ*Rð Ø $ [×%CÑ%CÑ Dóð4 cð ¨d°4¸
×8LÑ8LÑ3MÑ.Nó ð,#¨4°×0NÑ0NÑ+Oð #ÐTXó #ð¨×)GÑ)Gð Ø!)¨#¡ðØ37¸×8VÑ8VÑ3Wóð4*°T¸(×:XÑ:XÑ5Yð *Ð^bó *ð4$?¨T°+×2PÑ2PÑ-Qð $?Ø&3×&CÑ&Cð$?ØHKô$?r#   r   r<   r©   r€   r   c                 óP  — | j                   }t        j                  d|j                  |«       t	        |t
        j                  «      rt        j                  | ||¬«      S t	        |t
        j                  «      rt        j                  | |¬«      S t        j                  | |¬«      S )a:  Converts a ChallengeBody object to an AnnotatedChallenge.

    :param .ChallengeBody challb: ChallengeBody
    :param .JWK account_key: Authorized Account Key
    :param str domain: Domain of the challb

    :returns: Appropriate AnnotatedChallenge
    :rtype: :class:`certbot.achallenges.AnnotatedChallenge`

    z%s challenge for %s)r<   r€   r©   )r<   r€   )rˆ   r6   r8   rƒ   rœ   r   ÚKeyAuthorizationChallenger   Ú"KeyAuthorizationAnnotatedChallengeÚDNSÚOther)r<   r©   r€   rˆ   s       r!   rŽ   rŽ   o  s€   € ð �L‰L€EÜ
‡K�KÐ% u§y¡y°&Ô9ä�%œ×=Ñ=Ô>Ü×=Ñ=Ø &°kôCð 	Cä	�Eœ:Ÿ>™>Ô	*Ü�‰ f°VÔ<Ð<ä× Ñ ¨°vÔ>Ð>r#   ÚchallbsÚpreferences.c                 ó@  — i }d}t        |«      D ]  \  }}|||<   ||z  }Œ d}|}t        d„ t        t        | «      «      D «       «      }d}	|D ]@  }
|
D ].  }|	|j	                  | |   j
                  j                  |«      z  }	Œ0 |	|k  r|
}|	}d}	ŒB |st        | «      ‚|S )a‹  Generate a plan to get authority over the identity.

    :param tuple challbs: A tuple of challenges
        (:class:`acme.messages.Challenge`) from
        :class:`acme.messages.AuthorizationResource` to be
        fulfilled by the client in order to prove possession of the
        identifier.

    :param list preferences: List of challenge preferences for domain
        (:class:`acme.challenges.Challenge` subclasses)

    :returns: list of indices from ``challenges``.
    :rtype: list

    :raises certbot.errors.AuthorizationError: If a
        path cannot be created that satisfies the CA given the preferences and
        combinations.

    rX   Nc              3   ó"   K  — | ]  }|f–— Œ	 y ­wr   r“   )r\   Úis     r!   r^   z%gen_challenge_path.<locals>.<genexpr>¨  s   è ø€ Ò; !˜!œÑ;ùs   ‚r   )r_   Útuplerc   r9   Úgetrˆ   Ú	__class__Ú_report_no_chall_path)rÅ   rÆ   Ú
chall_costÚmax_costrÉ   Ú	chall_clsÚ
best_comboÚbest_combo_costÚcombinationsÚcombo_totalÚcomboÚchallenge_indexs               r!   rz   rz   ‡  sÚ   € ð* €JØ€HÜ! +Ó.ò ‰ˆˆ9Ø !ˆ
�9ÑØ�A‰‰ðð -1€Jà€OäÑ;¤u¬S°«\Ó':Ô;Ó;€Là€KØò 	ˆØ$ò 	<ˆOØ˜:Ÿ>™>¨'Øñ+!ß!&¡§y¡y°(ó<ñ <‰Kð	<ð ˜Ò(ØˆJØ)ˆOà‰ð	ñ Ü# GÓ,Ð,àÐr#   c                 óÎ   — d}t        | «      dk(  r,t        | d   j                  t        j                  «      r|dz  }t
        j                  |«       t        j                  |«      S )zúLogs and return a raisable error reporting that no satisfiable chall path exists.

    :param challbs: challenges from the authorization that can't be satisfied

    :returns: An authorization error
    :rtype: certbot.errors.AuthorizationError

    zyClient with the currently selected authenticator does not support any combination of challenges that will satisfy the CA.rX   r   zM You may need to use an authenticator plugin that can do challenges over DNS.)	r9   rœ   rˆ   r   rª   r6   r7   r   r,   )rÅ   r¤   s     r!   rÍ   rÍ   ¼  s]   € ðE€Cä
ˆ7ƒ|�qÒœZ¨°©
×(8Ñ(8¼*×:JÑ:JÔKØð6ñ	7ˆô ‡O�O�CÔÜ×$Ñ$ SÓ)Ð)r#   r£   c           
      ó   — | d   j                   }|j                  }t        j                  |«      r|j                  }g }| D ];  }|j                  d|j                  ›d|›d|j                   j                  ›d�«       Œ= dj                  |«      S )a  Creates a user friendly error message about failed challenges.

    :param list failed_achalls: A list of failed
        :class:`certbot.achallenges.AnnotatedChallenge` with the same error
        type.
    :returns: A formatted error message for the client.
    :rtype: str

    r   z
  Domain: z
  Type:   z
  Detail: r–   r—   )	rD   rƒ   r   Úis_acme_errorÚcoderL   r€   Údetailr¡   )r£   rD   rƒ   r¤   rE   s        r!   r›   r›   Ï  s~   € ð ˜1Ñ×#Ñ#€EØ
�)‰)€CÜ×Ñ˜eÔ$Ø�j‰jˆØ
€Cà ò 6ˆØ�
Š
Ø�M‹Mš3 §¡× 3Ó 3ð5õ 	6ð6ð �7‰7�3‹<Ðr#   )2rµ   r`   Úloggingrd   Útypingr   r   r   r   r   r   r	   ÚjosepyÚrequests.modelsr
   r   r   r   r   rM   r   Úcertbotr   r   r   Úcertbot._internalr   Úcertbot._internal.accountr   Úcertbot.displayr   r3   Úcertbot.pluginsr   r�   Ú	getLoggerr²   r6   r   ÚChallengeBodyÚJWKr¸   r¿   rŽ   r„   r¼   rz   r,   rÍ   r›   r“   r#   r!   ú<module>rè      s&  ðÙ Û Û Û Ý Ý Ý Ý Ý Ý Ý ã Ý $å Ý Ý &Ý Ý Ý !Ý Ý Ý +Ý -Ý 0Ý 3à	ˆ×	Ñ	˜8Ó	$€÷L?ñ L?ð^
?˜X×3Ñ3ð ?À&Ç*Á*ð ?Ø ð?Ø%0×%CÑ%Có?ð02  X×%;Ñ%;Ñ <ð 2Ø$(¨¨j×.BÑ.BÑ)CÑ$Dð2ØINÈsÐTWÈxÉó2ðj* 4¨×(>Ñ(>Ñ#?ð *ÀF×D]ÑD]ó *ð&¨t°K×4RÑ4RÑ/Sð ÐX[ô r#   