HEX
Server: Apache/2.4.67 (Debian)
System: Linux vps-b2547eb4 6.1.0-41-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.158-1 (2025-11-09) x86_64
User: root (0)
PHP: 8.2.31
Disabled: NONE
Upload Files
File: //lib/python3/dist-packages/certbot/_internal/plugins/__pycache__/selection.cpython-311.pyc
�

E��c�=�
�>�dZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l
mZddl
mZddl
m
Z
dd
lmZddlmZddlmZeje��Z	d/dejdeedejdedee
jf
d�Z	d0dejdeedejdedee
jf
d�Z	d1dejdeedejdedee
jf
d�Z dejdejdee
jfd�Z!e	de
j���Z"dejdeedejdedeedee"fd�Z#d eej$dedeej$fd!�Z%gd"�Z&dejdejd#ee
jd$ee
jddf
d%�Z'dejdejd&edeee
jee
jffd'�Z(d(eed)eedeefd*�Z)dejdeeeeeffd+�Z*d,ed-eedejddfd.�Z+dS)2z=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�returnc�T�t||||tjtjf��S)zPick configurator plugin.)�pick_pluginr�
Authenticator�	Installer�rrrrs    �E/usr/lib/python3/dist-packages/certbot/_internal/plugins/selection.py�pick_configuratorrs-��
����(�	�	!�:�#7�8�:�:�:��+How would you like to install certificates?c�>�t||||tjf��S)zPick installer plugin.)rrrrs    r�pick_installerr  s ��
�v�w���J�<P�;R�S�S�Sr�4How would you like to authenticate with the ACME CA?c�>�t||||tjf��S)zPick authentication plugin.)rrrrs    r�pick_authenticatorr#(s*������(�Z�-E�,G�I�I�Irc���t|��\}��sdS|��fd���}|�|��t|��dkrt	jd�z���|rWt
|�����d}t�	d|��|�|��St	jd�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�.��|����S�N��
check_name)�p_ep�req_insts �r�<lambda>z*get_unprepared_installer.<locals>.<lambda>Bs���T�_�_�X�-F�-F�r�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�_�
installers�instr*s     @r�get_unprepared_installerr92s����&�f�-�-�K�A�x����t���� F� F� F� F�G�G�J��O�O�F����
�:�������)�
4�6>�
?�@�@�	@��!��J�%�%�'�'�(�(��+�����+�T�2�2�2��y�y�� � � �
�
%�D�x�O�Q�Q�Qr�P)�bound�ifacesc�d����|��fd���}nB|jrtjd���|����|��}|�|��|���|���}t|��dkrut�d|��tt|�����|��}|�dStt |�����St|��dkr_t|�����d}t�d|��|jrdS|���St�d��dS)	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�.��|����Sr&r')r)rs �rr+zpick_plugin.<locals>.<lambda>fs���t���w�/G�/G�raMissing 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.�noninteractive_moder�MissingCommandlineFlag�visibler<r/�prepare�	availabler0r4r5�
choose_pluginr2r3rr:�
misconfigured)	rrrrr<�filtered�prepared�
plugin_ep1�
plugin_ep2s	 `       rrrSs����"���>�>�"G�"G�"G�"G�H�H����%�		7��/�6�7�7�
7��?�?�$�$�+�+�F�3�3���M�M�&�����������!�!�#�#�H�
�8�}�}�q������5�x�@�@�@�"�4����(9�(9�#:�#:�H�E�E�
����4��A�z���(�(�)�)�)�	�X���!�	�	��(�/�/�+�+�,�,�Q�/�
����2�J�?�?�?��#�	��4���� � � ����*�+�+�+��trrGc��d�|D��}	tj||d���\}}|tjkrM||}|jr<tjd�|�����d���n|SdS�z)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`

    c�4�g|]}|j|jrdndz��S)z [Misconfigured]�)�description_with_namerE)�.0�	plugin_eps  r�
<listcomp>z!choose_plugin.<locals>.<listcomp>�sB��'�'�'��
�+�#,�#:�
B�
�
��
D�'�'�'rT)�force_interactivezxThe selected plugin encountered an error while parsing your server configuration and cannot be used. The error was:

{0}F)�pauseN)�display_util�menu�OKrE�notification�formatrB)rGr�opts�code�indexrOs      rrDrD�s���'�'�%�'�'�'�D�
�"�'��$�$�O�O�O���e��<�?�"�"� ���I��&�
!��)�"�"(�&��):�):�)<�)<�"=�"=�U�L�L�L�L�L�
!� ��4�
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�authr8c��d|_|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)�
authenticator�	find_init�name�	installerr4�info)rrrkr8�auth_ep�inst_eps      r�record_chosen_pluginsrt�s��� �F���0��#�#�D�)�)���	0�#*�<�F� ��F���,��#�#�D�)�)���	,�&�|�F��
�K�K�B��$�f�&6�8�8�8�8�8r�verbc��t|��\}}d}|dkrd}|dkrKdx}}ddlm}|tvr7|s5d�|t
j|��}	tj|	���nd	x}}|d
krd}n(|dvr$d}|j	rt�d|��d
}
d
}|dkrb||kr\t|||��}tttj|��}
tttj|��}n)|s|rt%||||��}|rt'|||��}
|r|st)d||��|r|
st)d||��|d
krF|
�D|jp|j}
|d
uo|
jdv}|
s|r%tttj|
��}t�d|
|��t3|||
|��||
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
    rL�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)�installrwzRSpecifying an authenticator doesn't make sense when running Certbot with verb "%s"Nrprm)�nginx�apachez*Selected authenticator %s and installer %s)r-�certbot._internal.clirz�noninstaller_pluginsrWr�lineseprr@rmr4�warningrrrrrrr r#�diagnose_configurator_problemr}r~ror5rt)rrru�req_authr*�installer_question�	need_inst�	need_authrz�msgrmrp�configurator�selected_configurator�interactively_selecteds               r�choose_configurator_pluginsr��s���-�V�4�4��H�h����y���E���u�}�}� $�$�	�I�5�5�5�5�5�5��+�+�+�H�+�E�FL�V����[�F:�F:�
��/��4�4�4�� %�%�	�I��z����	�	�	
�'�	'�	'��	���	E��N�N�>�?C�
E�
E�
E�9=�M�04�I��u�}�}��X�-�-�)���7�C�C���X�j�&>�?��N�N�
���*�"6�7��F�F�	�	��	V��	V�&�v�x��BT�U�U�I��	J�.�v�x��I�I�M��F��F�%�k�8�W�E�E�E��J��J�%�o�x��I�I�I�
�z���m�7� &�� =��
��"*�T�!1�!_�m�6H�L_�6_�� �	L�$:�	L��X�j�&:�;�]�K�K�I�
�L�L�=�}�i�X�X�X��&�'�=�)�D�D�D��m�#�#r�
previously�nowc��|s|S|rJ||krDd}tj|�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})rr1rW�repr)r�r�r�s   r�set_configuratorr�s^�������W�����]�C��-�c�j�j��j�9I�9I�4�PS�9�9�.U�.U�V�V�V��Jrc�$�|jx}}t||j��}t||j��}|jr t|d��}t|d��}|jr t|d��}t|d��}|jrt|d��}|jrt|d��}|jrt|d��}|j	rt|d��}|j
rt|d��}|jrt|d��}|jrt|d	��}|j
rt|d
��}|jrt|d��}|jrt|d��}|jrt|d
��}|jrt|d��}|jrt|d��}|jrt|d��}|jrt|d��}|jrt|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
    r}r~r]r[r\r^r_r`rarbrcrdrerfrgrhrirjz+Requested authenticator %s and installer %s)r�r�rprmr}r~r]r[r\�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_sakuracloudr4r5)rr*r�s   rr-r-#sL��!�-�-�H�x���&�*:�;�;�H���&�*>�?�?�H�
�|�7�#�H�g�6�6��#�H�g�6�6��
�}�8�#�H�h�7�7��#�H�h�7�7��
��<�#�H�l�;�;��
�~�9�#�H�i�8�8��
�}�8�#�H�h�7�7��
��@�#�H�.>�?�?��
��B�#�H�.@�A�A��
��>�#�H�n�=�=��
��A�#�H�.?�@�@��
��<�#�H�l�;�;��
��<�#�H�l�;�;��
��<�#�H�l�;�;��
��<�#�H�l�;�;��
��;�#�H�k�:�:��
�~�9�#�H�i�8�8��
��=�#�H�m�<�<��
��=�#�H�m�<�<��
��A�#�H�.?�@�@��
�L�L�>��(�S�S�S��X��r�cfg_type�	requestedc��|r<||vrd�|��}nYd�|||j��}n7|dkrddlm}d�|��}nd�|��}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}rprryz�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)rW�problemrrzrr1)r�r�rr�rzs     rr�r�Ys����Q��G�#�#�L�S�S�T]�^�^�C�C�H��F�9�g�i�&8�&@�A�A�
�C�
�[�	 �	 �5�5�5�5�5�5��!�&��-�-�		��@�F�F�x�P�P��
�
%�c�
*�
*�*r)r)r)r!),�__doc__�logging�typingrrrrrrr	�certbotr
rr�certbot._internal.pluginsr
�certbot.compatr�certbot.displayrrS�	getLogger�__name__r4�NamespaceConfig�str�PluginsRegistry�Pluginrrr rr#r9r:r�PluginEntryPointrDr�rtr�r�r-r��rr�<module>r�s���C�C�����������������������������������������������!�!�!�!�!�!�������������+�+�+�+�+�+�������0�0�0�0�0�0�	��	�8�	$�	$��
'6�:�:�m�;�:�h�s�m�:�$�4�:� #�:�;C�:�CT�:U�:�:�:�:�$Q�T�T�=�8�T�8�C�=�T�!�1�T� �T�!��!5�6�T�T�T�T�(P�I�I�}�<�I�x�PS�}�I� %� 5�I�!$�I�%�Z�%=�>�	I�I�I�I�Q�]�%B�Q�&+�&;�Q�@H��I]�@^�Q�Q�Q�Q�<�G�C�z�(�)�)�)��4�
�5�4���
�4��.�4�:=�4� ���4�+3�A�;�4�4�4�4�n�D��!7�8����$,�U�-C�$D�����>I�I�I��8�-�"?�8�%�J_�8� (��)A� B�8� (��)=� >�8�CG�8�8�8�8�$O$�
�(E�O$�).�)>�O$�&)�O$�.3�H�Z�=Q�4R�4<�Z�=U�4V�5W�/X�O$�O$�O$�O$�d
��#��
�X�c�]�
�x�PS�}�
�
�
�
� 3�
� =�3�"�8�C�=�(�3�-�#?�@�3�3�3�3�l+�C�+�H�S�M�+�+0�+@�+�EI�+�+�+�+�+�+r