JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/certbot/_internal/plugins/__pycache__/selection.cpython-39.pyc

a

}|�g�=�@sLdZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l
mZddl
mZddl
m
Z
dd
lmZddlmZddlmZe�e�Zd5ejeeejeee
jd�dd�Zd6ejeeejeee
jd�dd�Zd7ejeeejeee
jd�dd�Z ejejee
jd�dd�Z!e	de
jd�Z"ejeeejeeeee"d�d d!�Z#eej$eeej$d"�d#d$�Z%gd%�Z&ejejee
jee
jdd&�d'd(�Z'ejejeeee
jee
jfd)�d*d+�Z(eeeeeed,�d-d.�Z)ejeeeeefd/�d0d1�Z*eeeejdd2�d3d4�Z+dS)8z=Decide which plugins to use for authentication & installation�N)�cast)�Iterable)�List)�Optional)�Tuple)�Type)�TypeVar)�
configuration)�errors)�
interfaces)�disco)�os)�util�<How would you like to authenticate and install certificates?)�config�default�plugins�question�returncCst||||tjtjf�S)zPick configurator plugin.)�pick_pluginr�
Authenticator�	Installer�rrrr�r�G/usr/lib/python3.9/site-packages/certbot/_internal/plugins/selection.py�pick_configurators
�r�+How would you like to install certificates?cCst||||tjf�S)zPick installer plugin.)rrrrrrr�pick_installer sr�4How would you like to authenticate with the ACME CA?cCst||||tjf�S)zPick authentication plugin.)rrrrrrr�pick_authenticator(s�r)rrrcs�t|�\}��sdS|��fdd��}|�|�t|�dkrJt�d���|rtt|���d}t�	d|�|�|�St�d���dS)	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
    Ncs
|���S�N�Z
check_name�Zp_ep��req_instrr�<lambda>B�z*get_unprepared_installer.<locals>.<lambda>�zfFound multiple installers with the name %s, Certbot is unable to determine which one to use. Skipping.rzSelecting plugin: %sz:Could not select or initialize the requested installer %s.)
�cli_plugin_requests�filter�init�lenr
�PluginSelectionError�list�values�logger�debug)rr�_Z
installers�instrr#r�get_unprepared_installer2s$

��
�r3�P)�bound)rrrr�ifacesrc	s��dur|��fdd��}n|jr,t�d��|��}|�|�}|�|�|��|��}t	|�dkr�t
�d|�tt
|���|�}|dur�dStt|���St	|�dkr�t
|���d}t
�d|�|jr�dS|��St
�d	�dSdS)
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

    Ncs
|���Sr r!r"�rrrr%fr&zpick_plugin.<locals>.<lambda>aMissing 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'zMultiple candidate plugins: %srzSingle candidate plugin: %szNo candidate plugin)r)Znoninteractive_moder
�MissingCommandlineFlagZvisibler6r*�prepareZ	availabler+r/r0�
choose_pluginr-r.rr4�
misconfigured)	rrrrr6Zfiltered�preparedZ
plugin_ep1Z
plugin_ep2rr7rrSs2�


r)r<rrcCsddd�|D�}tj||dd�\}}|tjkrZ||}|jrTtjd�|���dd�q^|SqdSqdS)	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`

    cSs g|]}|j|jrdnd�qS)z [Misconfigured]�)Zdescription_with_namer;)�.0�	plugin_eprrr�
<listcomp>�s��z!choose_plugin.<locals>.<listcomp>T)Zforce_interactivezxThe selected plugin encountered an error while parsing your server configuration and cannot be used. The error was:

{0}F)�pauseN)�display_utilZmenuZOKr;Znotification�formatr9)r<rZopts�code�indexr?rrrr:�s�
��r:)�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)rr�authr2rcCsVd|_|r |�|�}|r |j|_d|_|r@|�|�}|r@|j|_t�d|j|j�dS)zFUpdate the config entries to reflect the plugins we actually selected.Nz0Plugins selected: Authenticator %s, Installer %s)�
authenticatorZ	find_init�name�	installerr/�info)rrrVr2Zauth_epZinst_eprrr�record_chosen_plugins�s

�r[)rr�verbrcCs�t|�\}}d}|dkrd}|dkr`d}}ddlm}|tvrh|shd�|tj|�}	t�|	��nd	}}|d
krvd}n|dvr�d}|j	r�t
�d|�d
}
d
}|dkr�||kr�t|||�}t
ttj|�}
t
ttj|�}n(|s�|r�t||||�}|�rt|||�}
|�r|�std||�|�r2|
�s2td||�|d
k�r�|
d
u�r�|j�pR|j}
|d
u�of|
jdv}|
�st|�r�t
ttj|
�}t
�d|
|�t|||
|�||
fS)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
    r=�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.)FZcertonly)�installr]zRSpecifying an authenticator doesn't make sense when running Certbot with verb "%s"NrYrW)�nginx�apachez*Selected authenticator %s and installer %s)r(�certbot._internal.clir`�noninstaller_pluginsrCr
�linesepr
r8rWr/Zwarningrrrrrrrr�diagnose_configurator_problemrbrcrXr0r[)rrr\�req_authr$Zinstaller_questionZ	need_instZ	need_authr`�msgrWrY�configuratorZselected_configuratorZinteractively_selectedrrr�choose_configurator_plugins�sV��rk)�
previously�nowrcCs6|s|S|r2||kr2d}t�|�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,rC�repr)rlrmrirrr�set_configuratorsro)rrcCsx|j}}t||j�}t||j�}|jr<t|d�}t|d�}|jrVt|d�}t|d�}|jrft|d�}|jrvt|d�}|jr�t|d�}|j	r�t|d�}|j
r�t|d�}|jr�t|d�}|jr�t|d	�}|j
r�t|d
�}|jr�t|d�}|jr�t|d�}|j�rt|d
�}|j�rt|d�}|j�r,t|d�}|j�r>t|d�}|j�rPt|d�}|j�rbt|d�}t�d||�||fS)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
    rbrcrHrFrGrIrJrKrLrMrNrOrPrQrRrSrTrUz+Requested authenticator %s and installer %s)rjrorYrWrbrcrHrFrGZdns_cloudflareZdns_digitaloceanZdns_dnsimpleZdns_dnsmadeeasyZ
dns_gehirnZ
dns_googleZ
dns_linodeZ
dns_luadnsZ	dns_nsoneZdns_ovhZdns_rfc2136Zdns_route53Zdns_sakuracloudr/r0)rr$rhrrrr($sV




















r()�cfg_type�	requestedrrcCsd|r,||vrd�|�}qVd�|||j�}n*|dkrLddlm}d�|�}n
d�|�}t�|��dS)	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}rYrr_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 installedN)rCZproblemrdr`r
r,)rprqrrir`rrrrgZs
��
rg)r)r)r),�__doc__Zlogging�typingrrrrrrrZcertbotr	r
rZcertbot._internal.pluginsrZcertbot.compatr
Zcertbot.displayrrBZ	getLogger�__name__r/ZNamespaceConfig�strZPluginsRegistryZPluginrrrrrr3r4rZPluginEntryPointr:rer[rkror(rgrrrr�<module>s|
����
��
�
�8
�
���R�6�
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓk yP7U*omQIs,K`)6\G3t?pgjrmۛجwluGtfh9uyP0D;Uڽ"OXlif$)&|ML0Zrm1[HXPlPR0'G=i2N+0e2]]9VTPO׮7h(F*癈'=QVZDF,d߬~TX G[`le69CR(!S2!P <0x<!1AQ "Raq02Br#SCTb ?Ζ"]mH5WR7k.ۛ!}Q~+yԏz|@T20S~Kek *zFf^2X*(@8r?CIuI|֓>^ExLgNUY+{.RѪ τV׸YTD I62'8Y27'\TP.6d&˦@Vqi|8-OΕ]ʔ U=TL8=;6c| !qfF3aů&~$l}'NWUs$Uk^SV:U# 6w++s&r+nڐ{@29 gL u"TÙM=6(^"7r}=6YݾlCuhquympǦ GjhsǜNlɻ}o7#S6aw4!OSrD57%|?x>L |/nD6?/8w#[)L7+6〼T ATg!%5MmZ/c-{1_Je"|^$'O&ޱմTrb$w)R$& N1EtdU3Uȉ1pM"N*(DNyd96.(jQ)X 5cQɎMyW?Q*!R>6=7)Xj5`J]e8%t!+'!1Q5 !1 AQaqё#2"0BRb?Gt^## .llQT $v,,m㵜5ubV =sY+@d{N! dnO<.-B;_wJt6;QJd.Qc%p{ 1,sNDdFHI0ГoXшe黅XۢF:)[FGXƹ/w_cMeD,ʡcc.WDtA$j@:) -# u c1<@ۗ9F)KJ-hpP]_x[qBlbpʖw q"LFGdƶ*s+ډ_Zc"?%t[IP 6J]#=ɺVvvCGsGh1 >)6|ey?Lӣm,4GWUi`]uJVoVDG< SB6ϏQ@ TiUlyOU0kfV~~}SZ@*WUUi##; s/[=!7}"WN]'(L! ~y5g9T̅JkbM' +s:S +B)v@Mj e Cf jE 0Y\QnzG1д~Wo{T9?`Rmyhsy3!HAD]mc1~2LSu7xT;j$`}4->L#vzŏILS ֭T{rjGKC;bpU=-`BsK.SFw4Mq]ZdHS0)tLg