HEX
Server: LiteSpeed
System: Linux cluster02.load-balancer.x2.network 4.18.0-553.51.1.lve.1.el8.x86_64 #1 SMP Wed May 14 14:34:57 UTC 2025 x86_64
User: kbdhpghp (1098)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: //lib/python3.6/site-packages/certbot/_internal/plugins/__pycache__/selection.cpython-36.pyc
3

گay;�@sjdZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l
mZddl
mZddl
m
Z
dd
lmZddlmZddlmZeje�ZdEejeeejeee
jd�dd�ZdFejeeejeee
jd�dd�ZdGejeeejeee
jd�dd�Z ejejee
jd�dd�Z!e	de
jd�Z"ejeeejeeeee"d�d d!�Z#eej$eeej$d"�d#d$�Z%d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5gZ&ejejee
jee
jdd6�d7d8�Z'ejejeeee
jee
jfd9�d:d;�Z(eeeeeed<�d=d>�Z)ejeeeeefd?�d@dA�Z*eeeejddB�dCdD�Z+dS)Hz=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�/usr/lib/python3.6/selection.py�pick_configuratorsr�+How would you like to install certificates?cCst||||tjf�S)zPick installer plugin.)rrr)rrrrrrr�pick_installer sr�4How would you like to authenticate with the ACME CA?cCst||||tjf�S)zPick authentication plugin.)rrr)rrrrrrr�pick_authenticator(sr)rrrcs�t|�\}��sdS|j�fdd��}|j|�|jtjf�}t|�dkrXtjd���|r�t	|j
��d}tjd|�|j|�Stjd���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
|j��S)N)�
check_name)�p_ep)�req_instrr�<lambda>Bsz*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�verifyrr�lenr
�PluginSelectionError�list�values�logger�debug)rr�_Z
installers�instr)r!r�get_unprepared_installer2s 


r0�P)Zbound)rrrr�ifacesrc
s��dk	r|j�fdd��}n|jr,tjd��|j�j|�}|j|�|j|�}|j�|j	�}t
|�dkr�tjd|�t
t|j��|�}|dkr�dStt|j��St
|�dkr�t|j��d}	tjd|	�|	jr�dS|	j�Stj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
|j��S)N)r)r )rrrr"gszpick_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
�MissingCommandlineFlagZvisibler2r&r'�prepareZ	availabler(r,r-�
choose_pluginr*r+rr1�
misconfigured)
rrrrr2ZfilteredZverified�preparedZ
plugin_ep1Z
plugin_ep2r)rrrTs0


r)r7rrcCshdd�|D�}xTtj||dd�\}}|tjkr\||}|jrVtjdj|j��dd�q`|SqdSqWdS)	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_namer6)�.0�	plugin_eprrr�
<listcomp>�sz!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_utilZmenuZOKr6Znotification�formatr4)r7rZopts�code�indexr:rrrr5�s
r5�webroot�manual�
standalonezdns-cloudflarezdns-cloudxnszdns-digitaloceanzdns-dnsimplezdns-dnsmadeeasyz
dns-gehirnz
dns-googlez
dns-linodez
dns-luadnsz	dns-nsonezdns-ovhzdns-rfc2136zdns-route53zdns-sakuracloud)rr�authr/rcCsVd|_|r |j|�}|r |j|_d|_|r@|j|�}|r@|j|_tjd|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)rrrDr/Zauth_epZinst_eprrr�record_chosen_plugins�s

rI)rr�verbrc
Cs\t|�\}}d}|dkrd}|dkrbd}}ddlm}|tkrj|rjdj|tj|�}	tj|	��nd	}}|d
krxd}n|dkr�d}|j	r�t
jd|�d
}
d
}|dkr�||kr�t|||�}t
ttj|�}
t
ttj|�}n(|s�|r�t||||�}|�rt|||�}
t
jd|
|�|�r,|�r,td||�|�rF|
�rFtd||�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
    r8�enhancezMWhich installer would you like to use to configure the selected enhancements?ZrunTr)�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�installzRSpecifying an authenticator doesn't make sense when running Certbot with verb "%s"Nz*Selected authenticator %s and installer %srGrE)rMrK)r$�certbot._internal.clirL�noninstaller_pluginsr>r
�linesepr
r3rEr,Zwarningrrrrrrrrr-�diagnose_configurator_problemrI)
rrrJ�req_authr!Zinstaller_questionZ	need_instZ	need_authrL�msgrErG�configuratorrrr�choose_configurator_plugins�sHrU)�
previously�nowrcCs6|s|S|r2||kr2d}tj|jt|�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)r>�repr)rVrWrSrrr�set_configuratorsrY)rrcCs�|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�}|j�rtt|d�}tjd||�||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
    �nginx�apacherCrArBzdns-cloudflarezdns-cloudxnszdns-digitaloceanzdns-dnsimplezdns-dnsmadeeasyz
dns-gehirnz
dns-googlez
dns-linodez
dns-luadnsz	dns-nsonezdns-ovhzdns-rfc2136zdns-route53zdns-sakuracloudz+Requested authenticator %s and installer %s)rTrYrGrErZr[rCrArBZdns_cloudflareZdns_cloudxnsZdns_digitaloceanZdns_dnsimpleZdns_dnsmadeeasyZ
dns_gehirnZ
dns_googleZ
dns_linodeZ
dns_luadnsZ	dns_nsoneZdns_ovhZdns_rfc2136Zdns_route53Zdns_sakuracloudr,r-)rr!rRrrrr$sZ





















r$)�cfg_type�	requestedrrcCsd|r,||krdj|�}qVdj|||j�}n*|dkrLddlm}dj|�}n
dj|�}tj|��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}rGr)rLz�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)r>ZproblemrNrLr
r))r\r]rrSrLrrrrQPs
rQ)r)r)r),�__doc__ZloggingZtypingrrrrrrrZcertbotr	r
rZcertbot._internal.pluginsrZcertbot.compatr
Zcertbot.displayrr=Z	getLogger�__name__r,ZNamespaceConfig�strZPluginsRegistryZPluginrrrrrr0r1rZPluginEntryPointr5rOrIrUrYr$rQrrrr�<module>sZ
	
6


B7