%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/certbot/plugins/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/certbot/plugins/__pycache__/dns_common_lexicon.cpython-312.pyc

�

M/�e�2�� �dZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddlm
Z
ddlmZdd	lmZdd
lm
Z
ddlmZddlZddlmZdd
lmZddlmZddlmZddlmZ	ddlmZddlmZddlmZej>e �Z!Gd�d�Z"de#dee#efdee#efdeee	e#efffd�Z$Gd�dejJ�Z&Gd�d�Z'eee'ejPe ��ejPe <y#e$r	dZdZdZY��wxYw)z;Common code for DNS Authenticator Plugins built on Lexicon.�N)�
ModuleType)�Any)�cast)�Dict)�List)�Mapping)�Optional)�Tuple)�Union)�	HTTPError)�RequestException)�
configuration)�errors)�
dns_common)�Client)�ConfigResolver)�Providerc��eZdZdZdd�Zdedededdfd�Zdedededdfd	�Zdeddfd
�Zde	dede
ejfd
�Z
dedede
ejfd�Zy)�
LexiconClientz�
    Encapsulates all communication with a DNS provider via Lexicon.

    .. deprecated:: 2.7.0
       Please use certbot.plugins.dns_common_lexicon.LexiconDNSAuthenticator instead.
    �returnNc��|y�N���selfs �D/usr/lib/python3/dist-packages/certbot/plugins/dns_common_lexicon.py�__init__zLexiconClient.__init__0s����domain�record_name�record_contentc��|j|�	|jjd||��y#t$rA}tjd|d��t
jdj|���d}~wwxYw)a�
        Add a TXT record using the supplied information.

        :param str domain: The domain to use to look up the managed zone.
        :param str record_name: The record name (typically beginning with '_acme-challenge.').
        :param str record_content: The record content (typically the challenge validation).
        :raises errors.PluginError: if an error occurs communicating with the DNS Provider API
        �TXT��rtype�name�content�'Encountered error adding TXT record: %sT��exc_info�Error adding TXT record: {0}N)	�_find_domain_id�provider�
create_recordr
�logger�debugr�PluginError�format�rrr r!�es     r�add_txt_recordzLexiconClient.add_txt_record3st��	
���V�$�	O��M�M�'�'�e�+�~�'�^���	O��L�L�B�A�PT�L�U��$�$�%C�%J�%J�1�%M�N�N��	O�s�2�	A<�<A7�7A<c�2�	|j|�	|j
j
d||��y#tj$r"}tj	d|d��Yd}~yd}~wwxYw#t$r"}tj	d|d��Yd}~yd}~wwxYw)a�
        Delete a TXT record using the supplied information.

        :param str domain: The domain to use to look up the managed zone.
        :param str record_name: The record name (typically beginning with '_acme-challenge.').
        :param str record_content: The record content (typically the challenge validation).
        :raises errors.PluginError: if an error occurs communicating with the DNS Provider  API
        �7Encountered error finding domain_id during deletion: %sTr)Nr#r$�)Encountered error deleting TXT record: %s)r,rr1r/r0r-�
delete_recordr
r3s     r�del_txt_recordzLexiconClient.del_txt_recordDs���	�� � ��(�	X��M�M�'�'�e�+�~�'�^��
�!�!�	��L�L�R�TU�"&�
�
(���	�� �	X��L�L�D�a�RV�L�W�W��	X�s,�3�A+�A(�A#�#A(�+	B�4B�Bc���tj|�}|D]_}	t|jd�r||jjd<n||j_|jj
�ytjdj||���#t$r }|j||�}|r|�Yd}~��d}~wt$r }|j||�}|r|�Yd}~��d}~wwxYw)z�
        Find the domain_id for a given domain.

        :param str domain: The domain for which to find the domain_id.
        :raises errors.PluginError: if the domain_id cannot be found.
        �optionsrN�AUnable to determine zone identifier for {0} using zone names: {1})r�base_domain_name_guesses�hasattrr-r<r�authenticater�_handle_http_error�	Exception�_handle_general_errorrr1r2�rr�domain_name_guesses�domain_namer4�result1�result2s       rr,zLexiconClient._find_domain_idYs���)�A�A�&�I��.�	"�K�
"��4�=�=�)�4�6A�D�M�M�)�)�(�3�,7�D�M�M�(��
�
�*�*�,��	"�.� � �!d�"(�&��1D�"E�G�	G���
"��1�1�!�[�A���!�M����
"��4�4�Q��D���!�M���
"�s$�AB�	C/�(C�C/�C*�*C/r4rFc�L�tjdj||��S�Nz/Error determining zone identifier for {0}: {1}.�rr1r2�rr4rFs   rrAz LexiconClient._handle_http_error}�$���!�!�"S�#)�6�+�q�#9�;�	;rc��t|�jd�s%tjdj	||��Sy�NzNo domain foundz9Unexpected error determining zone identifier for {0}: {1}��str�
startswithrr1r2rLs   rrCz#LexiconClient._handle_general_error��:���1�v� � �!2�3��%�%�&a�'-�v�k�1�'=�?�
?�r�rN)�__name__�
__module__�__qualname__�__doc__rrQr5r:r,rr	rr1rArBrCrrrrr(s���� �O�S�O�s�O�C�O�TX�O�"X�S�X�s�X�C�X�TX�X�*"G�c�"G�d�"G�H;�I�;�C�;�H�V�M_�M_�D`�;��y��s��x�PV�Pb�Pb�Gc�rr�lexicon_provider_name�lexicon_options�provider_optionsrc���d|i}|j|�t�|j|�|Si}|j|�|||<t�j|�j�S)a�
    Convenient function to build a Lexicon 2.x/3.x config object.

    :param str lexicon_provider_name: the name of the lexicon provider to use
    :param dict lexicon_options: options specific to lexicon
    :param dict provider_options: options specific to provider
    :return: configuration to apply to the provider
    :rtype: ConfigurationResolver or dict

    .. deprecated:: 2.7.0
       Please use certbot.plugins.dns_common_lexicon.LexiconDNSAuthenticator instead.
    �
provider_name)�updater�	with_dict�with_env)rYrZr[�config_dict�provider_configs     r�build_lexicon_configrc�sv��$3�4I�"J�K�����'������+�,���+-�����/�0�-<��)�*���)�)�+�6�?�?�A�Arc�V��eZdZdZdej
def�fd�Zee	jdefd���Zedefd��Z
ded	ed
eddfd�Zd
edefd�Zdd�Zd
edededdfd�Zd
edededdfd�Zd
edefd�Zdededeej0fd�Zdededeej0fd�Z�xZS)�LexiconDNSAuthenticatorzr
    Base class for a DNS authenticator that uses Lexicon client
    as backend to execute DNS record updates
    �configr&c�8��t�|�||�g|_|yr)�superr�_provider_options)rrfr&�	__class__s   �rrz LexiconDNSAuthenticator.__init__�s���
�����&�=?���rrc��y)z9
        The name of the Lexicon provider to use
        Nrrs r�_provider_namez&LexiconDNSAuthenticator._provider_name�s�rc��y)zX
        Time to live to apply to the DNS records created by this Authenticator
        �<rrs r�_ttlzLexiconDNSAuthenticator._ttl�s��
r�creds_var_name�creds_var_label�lexicon_provider_option_nameNc�@�|jj|||f�yr)ri�append)rrprqrrs    r�_add_provider_optionz,LexiconDNSAuthenticator._add_provider_option�s"�����%�%�
�_�.J�K�	Mrrc�V�t|d�s|j�d|d|d|jd|j|j|jD�cic]$}|d|j
j
|d���&c}i}t�j|�j�Scc}w)N�_credentialsr�	delegatedr]�ttl�r)
r?�_setup_credentialsrlrorirw�confrr_r`)rr�item�dict_configs    r�_build_lexicon_configz-LexiconDNSAuthenticator._build_lexicon_config�s����t�^�,��#�#�%�
�f�
���T�0�0��4�9�9����.2�.D�.D�"F�&*�#'�q�'�4�+<�+<�+A�+A�$�q�'�+J�"J�"F�

����)�)�+�6�?�?�A�A��"Fs�)B&c
��|jdd|j�d�|jD�cic]}|d|d��
c}��|_ycc}w)N�credentialszCredentials INI file for z DNS authenticatorr�)�key�label�required_variables)�_configure_credentialsrlrirw)rr}s  rr{z*LexiconDNSAuthenticator._setup_credentials�sX�� �7�7��-�d�.A�.A�-B�BT�U�=A�=S�=S�T�T��Q���a�� 0�T�8�
���� Us�A�validation_name�
validationc�H�|j|�}	t|j|��5}|jd||��ddd�y#1swYyxYw#t$rA}t
j
d|d��tjdj|���d}~wwxYw)Nr#r$r(Tr)r+)
�_resolve_domainrrr.r
r/r0rr1r2)rrr�r��resolved_domain�
operationsr4s       r�_performz LexiconDNSAuthenticator._perform�s����.�.�v�6��	O���2�2�?�C�D�
`�
��(�(�u�?�T^�(�_�
`�
`�
`���	O��L�L�B�A�PT�L�U��$�$�%C�%J�%J�1�%M�N�N��	O�s4�A�A�A�A�A�A�	B!� <B�B!c�|�	|j|�}	t|j
|��5}|jd||��ddd�y#tj$r"}tj	d|d��Yd}~yd}~wwxYw#1swYyxYw#t$r"}tj	d|d��Yd}~yd}~wwxYw)Nr7Tr)r#r$r8)	r�rr1r/r0rrr9r
)rrr�r�r�r4r�s       r�_cleanupz LexiconDNSAuthenticator._cleanup�s���	�"�2�2�6�:�O�	X���2�2�?�C�D�
`�
��(�(�u�?�T^�(�_�
`�
`��
�!�!�	��L�L�R�TU�"&�
�
(���	��
`�
`���	X��L�L�D�a�RV�L�W�W��	X�sK�A�B�B�B�B�A<�<B�B
�	B�
B�	B;�B6�6B;c��tj|�}|D]*}	t|j|��5|cddd�cStjdj||���#1swYnxYw�_#t$r }|j||�}|r|�Yd}~��d}~wt$r }|j||�}|r|�Yd}~��d}~wwxYw)Nr=)rr>rrrrArBrCrr1r2rDs       rr�z'LexiconDNSAuthenticator._resolve_domain�s���(�A�A�&�I��.�	"�K�
"��D�6�6�{�C�D�'�&�'�'�		"�"� � �!d�"(�&��1D�"E�G�	G�'�'��'���
"��1�1�!�[�A���!�M����
"��4�4�Q��D���!�M���
"�s9�A7�A*�	A7�*A3	�/A7�7	C�B�C�'C�Cr4rFc�L�tjdj||��SrJrKrLs   rrAz*LexiconDNSAuthenticator._handle_http_error
rMrc��t|�jd�s%tjdj	||��SyrOrPrLs   rrCz-LexiconDNSAuthenticator._handle_general_errorrSrrT)rUrVrWrXr�NamespaceConfigrQr�property�abc�abstractmethodrl�introrurrr{r�r�r�rr	rr1rArBrC�
__classcell__)rjs@rrere�sU����
?�}�<�<�?�C�?�
����������
��c����M�3�M��M�;>�M�CG�M�
B�C�B�N�B�"
�O�s�O�S�O�c�O�d�O�X�s�X�S�X�c�X�d�X�G�c�G�c�G�.;�I�;�C�;�H�V�M_�M_�D`�;��y��s��x�PV�Pb�Pb�Gc�rrec�b�eZdZdZdefd�Zdedefd�Zdededdfd	�Z	dedefd
�Z
deefd�Zy)�_DeprecationModulez�
    Internal class delegating to a module, and displaying warnings when attributes
    related to deprecated attributes in the current module.
    �modulec�"�||jd<y�N�_module)�__dict__)rr�s  rrz_DeprecationModule.__init__s��#)��
�
�i� r�attrrc��|dvr&tj|�dt�d�td��t	|j
|�S)N)rrcz attribute in z/ module is deprecated and will be removed soon.rz)�
stacklevel)�warnings�warnrU�DeprecationWarning�getattrr��rr�s  r�__getattr__z_DeprecationModule.__getattr__ sC���<�<��M�M�T�F�.��
�;6�6�,��
<��t�|�|�T�*�*r�valueNc�2�t|j||�yr)�setattrr�)rr�r�s   r�__setattr__z_DeprecationModule.__setattr__'s������d�E�*rc�0�t|j|�yr)�delattrr�r�s  r�__delattr__z_DeprecationModule.__delattr__*s������d�#rc�4�dgt|j�zSr�)�dirr�rs r�__dir__z_DeprecationModule.__dir__-s���{�S����.�.�.r)
rUrVrWrXrrrQrr�r�r�rr�rrrr�r�sc���*�z�*�+��+��+�+��+�C�+�D�+�$��$��$�/��c��/rr�))rXr��logging�sys�typesr�typingrrrrrr	r
rr��requests.exceptionsrr
�certbotrr�certbot.pluginsr�lexicon.clientr�lexicon.configr�lexicon.interfacesr�ImportError�	getLoggerrUr/rrQrc�DNSAuthenticatorrer��modulesrrr�<module>r�s#��A�
��
�����������)�0�!��&��%�-�+�
��	�	�8�	$��]�]�@B��B�*1�#�s�(�*;�B�OV�WZ�\_�W_�O`�B�#�N�D��c��N�$B�C�B�:m�j�9�9�m�f/�/�4�Z�);�C�K�K��<Q�)R�S����H���e��
�F��N��H��s�(C?�?D
�D


Zerion Mini Shell 1.0