Ë
    M/Åeœ=  ã                   ó¸  — d 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j*                  e«      Z	 d,dej0                  dee   dej4                  dedeej6                     f
d„Z	 d-dej0                  dee   dej4                  dedeej:                     f
d„Z	 d.dej0                  dee   dej4                  dedeej>                     f
d„Z dej0                  dej4                  deej:                     fd„Z! e	dej6                  ¬«      Z"dej0                  dee   dej4                  dedee   dee"   fd„Z#deejH                     dedeejH                     fd„Z%g d¢Z&dej0                  dej4                  d eej>                     d!eej:                     ddf
d"„Z'dej0                  dej4                  d#edeeej:                     eej>                     f   fd$„Z(d%ee   d&ee   dee   fd'„Z)dej0                  deee   ee   f   fd(„Z*d)ed*ee   dej4                  ddfd+„Z+y)/z=Decide which plugins to use for authentication & installationé    N)Úcast)ÚIterable)ÚList)ÚOptional)ÚTuple)ÚType)ÚTypeVar)Úconfiguration)Úerrors)Ú
interfaces)Údisco)Úos)ÚutilÚconfigÚdefaultÚpluginsÚquestionÚreturnc                 ó\   — t        | |||t        j                  t        j                  f«      S )zPick configurator plugin.)Úpick_pluginr   ÚAuthenticatorÚ	Installer©r   r   r   r   s       úE/usr/lib/python3/dist-packages/certbot/_internal/plugins/selection.pyÚpick_configuratorr      s.   € ô
 Ø�˜ (Ü	×	!Ñ	!¤:×#7Ñ#7Ð8ó:ð :ó    c                 ó>   — t        | |||t        j                  f«      S )zPick installer plugin.)r   r   r   r   s       r   Úpick_installerr       s    € ô
 �v˜w¨°¼J×<PÑ<PÐ;RÓSÐSr   c                 ó>   — t        | |||t        j                  f«      S )zPick authentication plugin.)r   r   r   r   s       r   Úpick_authenticatorr    (   s'   € ô Ø�˜ (¬Z×-EÑ-EÐ,GóIð Ir   c                 óv  ‡— t        | «      \  }Š‰sy|j                  ˆfd„«      }|j                  | «       t        |«      dkD  rt	        j
                  d‰z  «      ‚|rCt        |j                  «       «      d   }t        j                  d|«       |j                  | «      S t	        j
                  d‰z  «      ‚)aB  
    Get an unprepared interfaces.Installer object.

    :param certbot.configuration.NamespaceConfig config: Configuration
    :param certbot._internal.plugins.disco.PluginsRegistry plugins:
        All plugins registered as entry points.

    :returns: Unprepared installer plugin or None
    :rtype: Plugin or None
    Nc                 ó&   •— | j                  ‰«      S ©N©Ú
check_name)Úp_epÚreq_insts    €r   ú<lambda>z*get_unprepared_installer.<locals>.<lambda>B   s   ø€ ¨T¯_©_¸XÓ-F€ r   é   zfFound multiple installers with the name %s, Certbot is unable to determine which one to use. Skipping.r   zSelecting plugin: %sz:Could not select or initialize the requested installer %s.)
Úcli_plugin_requestsÚfilterÚinitÚlenr   ÚPluginSelectionErrorÚlistÚvaluesÚloggerÚdebug)r   r   Ú_Ú
installersÚinstr'   s        @r   Úget_unprepared_installerr6   2   sº   ø€ ô & fÓ-�K€A€xÙØØ—‘Ó FÓG€JØ‡O�O�FÔÜ
ˆ:ƒ˜ÒÜ×)Ñ)ð4Ø6>ñ?ó@ð 	@ñ Ü�J×%Ñ%Ó'Ó(¨Ñ+ˆÜ�‰Ð+¨TÔ2Ø�y‰y˜Ó Ð Ü
×
%Ñ
%ØDÀxÑOóQð Qr   ÚP)ÚboundÚifacesc                 óÎ  ‡— ‰�|j                  ˆfd„«      }n1| j                  rt        j                  d«      ‚|j	                  «       }|j                  |«      }|j                  | «       |j                  «        |j                  «       }t        |«      dkD  rZt        j                  d|«       t        t        |j                  «       «      |«      }|€yt        t         |j                  «       «      S t        |«      dk(  rOt        |j                  «       «      d   }t        j                  d|«       |j"                  ry|j                  «       S t        j                  d«       y)	añ  Pick plugin.

    :param certbot.configuration.NamespaceConfig config: Configuration
    :param str default: Plugin name supplied by user or ``None``.
    :param certbot._internal.plugins.disco.PluginsRegistry plugins:
        All plugins registered as entry points.
    :param str question: Question to be presented to the user in case
        multiple candidates are found.
    :param list ifaces: Interfaces that plugins must provide.

    :returns: Initialized plugin.
    :rtype: Plugin

    Nc                 ó&   •— | j                  ‰«      S r#   r$   )r&   r   s    €r   r(   zpick_plugin.<locals>.<lambda>f   s   ø€ ¨t¯©¸wÓ/G€ r   a  Missing command line flags. For non-interactive execution, you will need to specify a plugin on the command line.  Run with '--help plugins' to see a list of options, and see https://eff.org/letsencrypt-plugins for more detail on what the plugins do and how to use them.r)   zMultiple candidate plugins: %sr   zSingle candidate plugin: %szNo candidate plugin)r+   Únoninteractive_moder   ÚMissingCommandlineFlagÚvisibler9   r,   ÚprepareÚ	availabler-   r1   r2   Úchoose_pluginr/   r0   r   r7   Úmisconfigured)	r   r   r   r   r9   ÚfilteredÚpreparedÚ
plugin_ep1Ú
plugin_ep2s	    `       r   r   r   S   s)  ø€ ð" Ðà—>‘>Ó"GÓH‰à×%Ò%ô ×/Ñ/ð6ó7ð 7ð —?‘?Ó$ˆà�‰˜vÓ&€HØ‡M�M�&ÔØ×ÑÔØ×!Ñ!Ó#€Hä
ˆ8ƒ}�qÒÜ�‰Ð5°xÔ@Ü"¤4¨¯©Ó(9Ó#:¸HÓEˆ
ØÐØÜ”A�z—‘Ó(Ó)Ð)Ü	ˆX‹˜!Ò	Ü˜(Ÿ/™/Ó+Ó,¨QÑ/ˆ
Ü�‰Ð2°JÔ?Ø×#Ò#ØØ�‰Ó Ð ä�‰Ð*Ô+Ør   rD   c                 óR  — | D �cg c]  }|j                   |j                  rdndz   ‘Œ! }}	 t        j                  ||d¬«      \  }}|t        j                  k(  rH| |   }|j                  r5t        j
                  dj                  |j                  «       «      d¬«       n|S yŒxc c}w )	zûAllow the user to choose their plugin.

    :param list prepared: List of `~.PluginEntryPoint`.
    :param str question: Question to be presented to the user.

    :returns: Plugin entry point chosen by the user.
    :rtype: `~.PluginEntryPoint`

    z [Misconfigured]Ú T)Úforce_interactivezxThe selected plugin encountered an error while parsing your server configuration and cannot be used. The error was:

{0}F)ÚpauseN)Údescription_with_namerB   Údisplay_utilÚmenuÚOKÚnotificationÚformatr?   )rD   r   Ú	plugin_epÚoptsÚcodeÚindexs         r   rA   rA   ‹   s´   € ð &ö'àð ×+Ñ+Ø#,×#:Ò#:ÑÀóDð '€Dð 'ð Ü"×'Ñ'¨°$È$ÔO‰ˆˆeà”<—?‘?Ò"Ø  ™ˆIØ×&Ò&Ü×)Ñ)ð"ç"(¡&¨×):Ñ):Ó)<Ó"=ÀUöLð
 !Ð àð ùò	's   …$B$)ÚwebrootÚmanualÚ
standaloneúdns-cloudflareúdns-digitaloceanúdns-dnsimpleúdns-dnsmadeeasyú
dns-gehirnú
dns-googleú
dns-linodeú
dns-luadnsú	dns-nsoneúdns-ovhúdns-rfc2136údns-route53údns-sakuracloudÚauthr5   c                 ó  — d| _         |r$|j                  |«      }|r|j                  | _         d| _        |r$|j                  |«      }|r|j                  | _        t        j                  d| j                   | j                  «       y)zFUpdate the config entries to reflect the plugins we actually selected.Nz0Plugins selected: Authenticator %s, Installer %s)ÚauthenticatorÚ	find_initÚnameÚ	installerr1   Úinfo)r   r   re   r5   Úauth_epÚinst_eps         r   Úrecord_chosen_pluginsrn   °   sx   € ð  €FÔÙØ×#Ñ# DÓ)ˆÙØ#*§<¡<ˆFÔ Ø€FÔÙØ×#Ñ# DÓ)ˆÙØ&Ÿ|™|ˆFÔÜ
‡K�KÐBØ×$Ñ$ f×&6Ñ&6õ8r   Úverbc                 ó~  — t        | «      \  }}d}|dk(  rd}|dk(  rJdx}}ddlm} |t        v r<|s:dj	                  |t
        j                  |«      }	t        j                  |	«      ‚d	x}}|d
k(  rd}n(|dv r$d}| j                  rt        j                  d|«       d}
d}|dk(  rU||k(  rPt        | ||«      }t        t        t        j                      |«      }
t        t        t        j"                     |«      }n!|s|rt%        | |||«      }|rt'        | ||«      }
|r|st)        d||«       |r|
st)        d||«       |d
k(  rU|
�S| j*                  xs | j,                  }|du xr |
j.                  dv }|s|r!t        t        t        j"                     |
«      }t        j1                  d|
|«       t3        | ||
|«       ||
fS )a<  
    Figure out which configurator we're going to use, modifies
    config.authenticator and config.installer strings to reflect that choice if
    necessary.

    :raises errors.PluginSelectionError if there was a problem

    :returns: tuple of (`Installer` or None, `Authenticator` or None)
    :rtype: tuple
    rH   ÚenhancezMWhich installer would you like to use to configure the selected enhancements?ÚrunTr   ©Úcli_commandzéWith the {0} plugin, you probably want to use the "certonly" command, eg:{1}{1}    {2} certonly --{0}{1}{1}(Alternatively, add a --installer flag. See https://eff.org/letsencrypt-plugins{1} and "--help plugins" for more information.)FÚcertonly)Úinstallrq   zRSpecifying an authenticator doesn't make sense when running Certbot with verb "%s"Nrj   rg   )ÚnginxÚapachez*Selected authenticator %s and installer %s)r*   Úcertbot._internal.clirt   Únoninstaller_pluginsrP   r   Úlinesepr   r=   rg   r1   Úwarningr   r   r   r   r   r   r   r    Údiagnose_configurator_problemrw   rx   ri   r2   rn   )r   r   ro   Úreq_authr'   Úinstaller_questionÚ	need_instÚ	need_authrt   Úmsgrg   rj   ÚconfiguratorÚselected_configuratorÚinteractively_selecteds                  r   Úchoose_configurator_pluginsr†   Â   sð  € ô -¨VÓ4Ñ€HˆhØÐàˆyÒðEÐð ˆu‚}Ø $Ð$ˆ	�IÝ5ØÔ+Ñ+±HðE÷ FLÁVØ¤§¡¨[óF:ð ô ×/Ñ/°Ó4Ð4à %Ð%ˆ	�IØˆzÒØ‰	Ø	Ð'Ñ	'Øˆ	Ø×ÒÜ�N‰Nð >Ø?CôEð 9=€MØ04€IØˆu‚}˜ XÒ-ô )¨°¸7ÓCˆÜœX¤j×&>Ñ&>Ñ?ÀÓNˆÜœ¤*×"6Ñ"6Ñ7¸ÓF‰	á™Ü& v¨x¸ÐBTÓUˆIÙÜ.¨v°xÀÓIˆMñ ™Ü% k°8¸WÔEÙ™Ü% o°xÀÔIð
 ˆzÒ˜mÐ7à &§¡Ò =°·±Ðð "*¨TÐ!1Ò!_°m×6HÑ6HÐL_Ð6_Ðá Ñ$:ÜœX¤j×&:Ñ&:Ñ;¸]ÓKˆIÜ
‡L�LÐ=¸}ÈiÔXä˜& '¨=¸)ÔDØ�mÐ#Ð#r   Ú
previouslyÚnowc                 óŽ   — |s| S | r>| |k7  r9d}t        j                  |j                  t        | «      t        |«      «      «      ‚|S )zã
    Setting configurators multiple ways is okay, as long as they all agree
    :param str previously: previously identified request for the installer/authenticator
    :param str now: the request currently being processed
    zIToo many flags setting configurators/installers/authenticators {0} -> {1})r   r.   rP   Úrepr)r‡   rˆ   r‚   s      r   Úset_configuratorr‹     sH   € ñ àÐÙØ˜ÒØ]ˆCÜ×-Ñ-¨c¯j©j¼¸jÓ9IÌ4ÐPSË9Ó.UÓVÐVØ€Jr   c                 ó<  — | j                   x}}t        || j                  «      }t        || j                  «      }| j                  rt        |d«      }t        |d«      }| j
                  rt        |d«      }t        |d«      }| j                  rt        |d«      }| j                  rt        |d«      }| j                  rt        |d«      }| j                  rt        |d«      }| j                  rt        |d«      }| j                  rt        |d«      }| j                  rt        |d	«      }| j                  rt        |d
«      }| j                  rt        |d«      }| j                  rt        |d«      }| j                   rt        |d«      }| j"                  rt        |d«      }| j$                  rt        |d«      }| j&                  rt        |d«      }| j(                  rt        |d«      }| j*                  rt        |d«      }t,        j/                  d||«       ||fS )z¿
    Figure out which plugins the user requested with CLI and config options

    :returns: (requested authenticator string or None, requested installer string or None)
    :rtype: tuple
    rw   rx   rW   rU   rV   rX   rY   rZ   r[   r\   r]   r^   r_   r`   ra   rb   rc   rd   z+Requested authenticator %s and installer %s)rƒ   r‹   rj   rg   rw   rx   rW   rU   rV   Údns_cloudflareÚdns_digitaloceanÚdns_dnsimpleÚdns_dnsmadeeasyÚ
dns_gehirnÚ
dns_googleÚ
dns_linodeÚ
dns_luadnsÚ	dns_nsoneÚdns_ovhÚdns_rfc2136Údns_route53Údns_sakuracloudr1   r2   )r   r'   r~   s      r   r*   r*   $  sà  € ð !×-Ñ-Ð-€HˆxÜ ¨&×*:Ñ*:Ó;€HÜ ¨&×*>Ñ*>Ó?€Hà‡|‚|Ü# H¨gÓ6ˆÜ# H¨gÓ6ˆØ‡}‚}Ü# H¨hÓ7ˆÜ# H¨hÓ7ˆØ×ÒÜ# H¨lÓ;ˆØ‡~‚~Ü# H¨iÓ8ˆØ‡}‚}Ü# H¨hÓ7ˆØ×ÒÜ# HÐ.>Ó?ˆØ×ÒÜ# HÐ.@ÓAˆØ×ÒÜ# H¨nÓ=ˆØ×ÒÜ# HÐ.?Ó@ˆØ×ÒÜ# H¨lÓ;ˆØ×ÒÜ# H¨lÓ;ˆØ×ÒÜ# H¨lÓ;ˆØ×ÒÜ# H¨lÓ;ˆØ×ÒÜ# H¨kÓ:ˆØ‡~‚~Ü# H¨iÓ8ˆØ×ÒÜ# H¨mÓ<ˆØ×ÒÜ# H¨mÓ<ˆØ×ÒÜ# HÐ.?Ó@ˆÜ
‡L�LÐ>ÀÈ(ÔSØ�XÐÐr   Úcfg_typeÚ	requestedc                 óø   — |r6||vrdj                  |«      }nNdj                  |||   j                  «      }n.| dk(  rddlm} dj                  |«      }ndj                  | «      }t	        j
                  |«      ‚)a>  
    Raise the most helpful error message about a plugin being unavailable

    :param str cfg_type: either "installer" or "authenticator"
    :param str requested: the plugin that was requested
    :param .PluginsRegistry plugins: available plugins

    :raises error.PluginSelectionError: if there was a problem
    z8The requested {0} plugin does not appear to be installedzkThe {0} plugin is not working; there may be problems with your existing configuration.
The error was: {1!r}rj   r   rs   zûCertbot doesn't know how to automatically configure the web server on this system. However, it can still get a certificate for you. Please run "{0} certonly" to do so. You'll need to manually configure your web server to use the resulting certificate.z/{0} could not be determined or is not installed)rP   Úproblemry   rt   r   r.   )rš   r›   r   r‚   rt   s        r   r}   r}   Z  s‰   € ñ Ø˜GÑ#ØL×SÑSÐT]Ó^‰CðHç‘F˜9 g¨iÑ&8×&@Ñ&@ÓAñ ð 
�[Ò	 Ý5ð÷ !™& Ó-ñ	 	ð @×FÑFÀxÓPˆÜ
×
%Ñ
% cÓ
*Ð*r   )z<How would you like to authenticate and install certificates?)z+How would you like to install certificates?)z4How would you like to authenticate with the ACME CA?),Ú__doc__ÚloggingÚtypingr   r   r   r   r   r   r	   Úcertbotr
   r   r   Úcertbot._internal.pluginsr   Úcertbot.compatr   Úcertbot.displayr   rL   Ú	getLoggerÚ__name__r1   ÚNamespaceConfigÚstrÚPluginsRegistryÚPluginr   r   r   r   r    r6   r7   r   ÚPluginEntryPointrA   rz   rn   r†   r‹   r*   r}   © r   r   ú<module>r­      s8  ðÙ Cã Ý Ý Ý Ý Ý Ý Ý å !Ý Ý Ý +Ý Ý 0à	ˆ×	Ñ	˜8Ó	$€ð
'6ñ:˜m×;Ñ;ð :ÀhÈsÁmð :Ø$×4Ñ4ð:à #ð:ð ;CÀ:×CTÑCTÑ:Uó:ð $QñT˜=×8Ñ8ð TÀ8ÈCÁ=ð TØ!×1Ñ1ðTà ðTð ! ×!5Ñ!5Ñ6óTð(PñI˜}×<Ñ<ð IÀxÐPSÁ}ð IØ %× 5Ñ 5ðIà!$ðIð % Z×%=Ñ%=Ñ>ó	IðQ ]×%BÑ%Bð QØ&+×&;Ñ&;ðQØ@HÈ×I]ÑI]Ñ@^óQñ< ˆC�z×(Ñ(Ô)€ð5˜×5Ñ5ð 5ÀÈÁð 5Ø×.Ñ.ð5Ø:=ð5à  ™ð5à+3°A©;ó5ðp˜D ×!7Ñ!7Ñ8ð ØðØ$,¨U×-CÑ-CÑ$Dóò>IÐ ð8 -×"?Ñ"?ð 8È%×J_ÑJ_ð 8Ø (¨×)AÑ)AÑ Bð8à (¨×)=Ñ)=Ñ >ð8àCGó8ð$O$¨×(EÑ(Eð O$Ø).×)>Ñ)>ðO$à&)ðO$à.3°H¸Z×=QÑ=QÑ4RØ4<¸Z×=UÑ=UÑ4Vð5Wñ /XóO$ðd ¨#¡ð °X¸c±]ð ÀxÐPSÁ}ó ð 3 × =Ñ =ð 3Ø" 8¨C¡=°(¸3±-Ð#?Ñ@ó3ðl+¨Cð +¸HÀS¹Mð +Ø+0×+@Ñ+@ð+ØEIô+r   