HOME


Mini Shell 1.0
Redirecting to https://devs.lapieza.net/iniciar-sesion Redirecting to https://devs.lapieza.net/iniciar-sesion.
DIR: /lib/python3/dist-packages/certbot/plugins/__pycache__/
Upload File :
Current File : //lib/python3/dist-packages/certbot/plugins/__pycache__/dns_common.cpython-311.pyc
�

E��c�5���dZddlZddlZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZddlZdd
l
mZddlmZddlmZdd
lmZddlmZddlmZddlmZddlmZddlmZddlmZeje��ZGd�dej ej!ej"���Z#Gd�d��Z$de%ddfd�Z&de%ddfd�Z'de%dee%fd�Z(dS)z*Common code for DNS Authenticator Plugins.�N)�sleep)�Callable)�Iterable)�List)�Mapping)�Optional)�Type)�
challenges)�achallenges)�
configuration)�errors)�
interfaces)�
filesystem)�os)�ops)�util)�commonc����eZdZdZdejdeddf�fd�Ze	d%de	d	d
e
ddfd���Zdee
jdefd
�Zdedeeejfd�Zd&d�Zdefd�Zdee
jdeejfd�Zdee
jddfd�Zejd&d���Zejdedededdfd���Zejdedededdfd���Zdededdfd�Z	d'dedede e	egdfddfd�Z!		d(deded e e"eefde e	d!gdfdd!f
d"�Z#e$dedefd#���Z%e$d'dede e	egdfdefd$���Z&�xZ'S))�DNSAuthenticatorz!Base class for DNS Authenticators�config�name�returnNc�Z��t���||��d|_dS)NF)�super�__init__�_attempt_cleanup)�selfrr�	__class__s   ��</usr/lib/python3/dist-packages/certbot/plugins/dns_common.pyrzDNSAuthenticator.__init__s+���
�������&�&�&� %������
�add).N�default_propagation_secondsc�.�|d|td���dS)N�propagation-secondszjThe number of seconds to wait for DNS to propagate before asking the ACME server to verify the DNS record.)�default�type�help)�int)�clsr"r#s   r�add_parser_argumentsz%DNSAuthenticator.add_parser_arguments$s5��	��!�/��-�	.�	.�	.�	.�	.�	.r �failed_achallsc�v�|�d��}d�|j||dkrdnd���S)z,See certbot.plugins.common.Plugin.auth_hint.r%z�The Certificate Authority failed to verify the DNS TXT records created by --{name}. Ensure the above domains are hosted by this DNS provider, or try increasing --{name}-propagation-seconds (currently {secs} second{suffix}).��s�)r�secs�suffix)�conf�formatr)rr,�delays   r�	auth_hintzDNSAuthenticator.auth_hint-sB���	�	�/�0�0��
N��V����e�q�j�j�s�s�b�V�
Q�
Q�		
r �
unused_domainc��tjgS�N)r
�DNS01)rr7s  r�get_chall_prefzDNSAuthenticator.get_chall_pref7s��� �!�!r c��dSr9��rs r�preparezDNSAuthenticator.prepare:s���r c��t���r9��NotImplementedErrorr>s r�	more_infozDNSAuthenticator.more_info=s��!�#�#�#r �achallsc���|���d|_g}|D]|}|j}|�|��}|�|j��}|�|||��|�|�|j�����}tj
d|�d��z��t|�d����|S)NTz/Waiting %d seconds for DNS changes to propagater%)
�_setup_credentialsr�domain�validation_domain_name�
validation�account_key�_perform�append�response�display_util�notifyr3r)rrD�	responses�achallrGrHrIs       r�performzDNSAuthenticator.perform@s������!�!�!� $����	��	B�	B�F��]�F�%+�%B�%B�6�%J�%J�"��*�*�6�+=�>�>�J��M�M�&�"8�*�E�E�E����V�_�_�V�-?�@�@�A�A�A�A�
	��M��I�I�3�4�4�5�	6�	6�	6�
�d�i�i�-�.�.�/�/�/��r c��|jrR|D]Q}|j}|�|��}|�|j��}|�|||���PdSdSr9)rrGrHrIrJ�_cleanup)rrDrQrGrHrIs      r�cleanupzDNSAuthenticator.cleanupXs���� �	J�!�
J�
J�����)/�)F�)F�v�)N�)N�&�#�.�.�v�/A�B�B�
��
�
�f�&<�j�I�I�I�I�
	J�	J�
J�
Jr c��t���)z@
        Establish credentials, prompting if necessary.
        rAr>s rrFz#DNSAuthenticator._setup_credentialsas��
"�#�#�#r rG�validation_namerIc��t���)aX
        Performs a dns-01 challenge by creating a DNS TXT record.

        :param str domain: The domain being validated.
        :param str validation_domain_name: The validation record domain name.
        :param str validation: The validation record content.
        :raises errors.PluginError: If the challenge cannot be performed
        rA�rrGrWrIs    rrKzDNSAuthenticator._performhs��"�#�#�#r c��t���)aX
        Deletes the DNS TXT record which would have been created by `_perform_achall`.

        Fails gracefully if no such record exists.

        :param str domain: The domain being validated.
        :param str validation_domain_name: The validation record domain name.
        :param str validation: The validation record content.
        rArYs    rrTzDNSAuthenticator._cleanupus��"�#�#�#r �key�labelc��|�|��}|s@|�|��}t|j|�|��|��dSdS)a
        Ensure that a configuration value is available.

        If necessary, prompts the user and stores the result.

        :param str key: The configuration key.
        :param str label: The user-friendly label for this piece of information.
        N)r3�_prompt_for_data�setattrr�dest)rr[r\�configured_value�	new_values     r�
_configurezDNSAuthenticator._configure�s]�� �9�9�S�>�>���	<��-�-�e�4�4�I��D�K����3����;�;�;�;�;�	<�	<r �	validatorc	�*�|�|��}|s{|�||��}t|j|�|��t
j�t
j�|������dSdS)a
        Ensure that a configuration value is available for a path.

        If necessary, prompts the user and stores the result.

        :param str key: The configuration key.
        :param str label: The user-friendly label for this piece of information.
        N)	r3�_prompt_for_filer_rr`r�path�abspath�
expanduser)rr[r\rdrarbs      r�_configure_filez DNSAuthenticator._configure_file�s��� �9�9�S�>�>���	a��-�-�e�Y�?�?�I��D�K����3���������AS�AS�T]�A^�A^�1_�1_�`�`�`�`�`�	a�	ar �required_variables�CredentialsConfigurationc������dtddf���fd�}��|||��t��|���j��}�r|�����r�|��|S)a�
        As `_configure_file`, but for a credential configuration file.

        If necessary, prompts the user and stores the result.

        Always stores absolute paths to avoid issues during renewal.

        :param str key: The configuration key.
        :param str label: The user-friendly label for this piece of information.
        :param dict required_variables: Map of variable which must be present to error to display.
        :param callable validator: A method which will be called to validate the
            `CredentialsConfiguration` resulting from the supplied input after it has been validated
            to contain the `required_variables`. Should throw a `~certbot.errors.PluginError` to
            indicate any issue.
        �filenamerNc�~��t|�j��}�r|�����r
�|��dSdSr9)rlr`�require)rn�applied_configurationrkrrds  ���r�__validatorz<DNSAuthenticator._configure_credentials.<locals>.__validator�s\���$<�X�t�y�$Q�$Q�!�!�
B�%�-�-�.@�A�A�A��
1��	�/�0�0�0�0�0�
1�
1r )�strrjrlr3r`rp)rr[r\rkrd�_DNSAuthenticator__validator�credentials_configurations`  ``  r�_configure_credentialsz'DNSAuthenticator._configure_credentials�s������(	1�#�	1�$�	1�	1�	1�	1�	1�	1�	1�	1�	
���S�%��5�5�5�$<�T�Y�Y�s�^�^�T�Y�$W�$W�!��	B�%�-�-�.@�A�A�A��	1��I�/�0�0�0�(�(r c����dtddf�fd�}tj|d����d���\}}|tjkr|St
jd�������)	z�
        Prompt the user for a piece of information.

        :param str label: The user-friendly label for this piece of information.
        :returns: The user's response (guaranteed non-empty).
        :rtype: str
        �irNc�Z��|s'tjd�������dS)NzPlease enter your {0}.)r
�PluginErrorr4)rxr\s �rrrz6DNSAuthenticator._prompt_for_data.<locals>.__validator�s8����
Q��(�)A�)H�)H��)O�)O�P�P�P�
Q�
Qr zInput your {0}T��force_interactive�{0} required to proceed.)rsr�validated_inputr4rN�OKr
rz)r\rt�coderMs`   rr^z!DNSAuthenticator._prompt_for_data�s����	Q�3�	Q�4�	Q�	Q�	Q�	Q�	Q�	Q��,���#�#�E�*�*�"�$�$�$���h�
�<�?�"�"��O�� �!;�!B�!B�5�!I�!I�J�J�Jr c�����dtddf��fd�}tj|d����d���\}}|tjkr|St
jd�������)	a�
        Prompt the user for a path.

        :param str label: The user-friendly label for the file.
        :param callable validator: A method which will be called to validate the supplied input
            after it has been validated to be a non-empty path to an existing file. Should throw a
            `~certbot.errors.PluginError` to indicate any issue.
        :returns: The user's response (guaranteed to exist).
        :rtype: str
        rnrNc����|s'tjd�������tj�|��}t
|���r
�|��dSdS)Nz&Please enter a valid path to your {0}.)r
rzr4rrgri�
validate_file)rnr\rds ��rrrz6DNSAuthenticator._prompt_for_file.<locals>.__validator�sx����
a��(�)Q�)X�)X�Y^�)_�)_�`�`�`��w�)�)�(�3�3�H��(�#�#�#��
$��	�(�#�#�#�#�#�
$�
$r zInput the path to your {0}Tr{r})rsr�validated_directoryr4rNrr
rz)r\rdrtr�rMs``   rrfz!DNSAuthenticator._prompt_for_file�s�����		$�#�		$�$�		$�		$�		$�		$�		$�		$�		$��0��(�/�/��6�6�"�$�$�$���h�
�<�?�"�"��O�� �!;�!B�!B�5�!I�!I�J�J�Jr )r!)rNr9)NN)(�__name__�
__module__�__qualname__�__doc__r�NamespaceConfigrsr�classmethodrr)r+rr�AnnotatedChallenger6rr	r
�	Challenger;r?rC�ChallengeResponserRrU�abc�abstractmethodrFrKrTrcrrjrrv�staticmethodr^rf�
__classcell__)rs@rrrs��������+�+�&�}�<�&�C�&�D�&�&�&�&�&�&�
�@B�.�.�x�	�':�.�:=�.�GK�.�.�.��[�.�
��[�-K�(L�
�QT�
�
�
�
�"�C�"�H�T�*�BV�=W�4X�"�"�"�"�
�
�
�
�$�3�$�$�$�$��t�K�$B�C���*�6�7�����0J�t�K�$B�C�J��J�J�J�J�	��$�$�$���$�	��
$�s�
$�S�
$� �
$�%)�
$�
$�
$���
$�	��$�s�$�S�$� �$�%)�$�$�$���$�<�c�<�#�<�$�<�<�<�<�"FJ�a�a�3�a�s�a�#+�H�c�U�D�[�,A�#B�a�NR�a�a�a�a�$W[�LP�&)�&)��&)�"�&)�8@���c��AR�8S�&)��H�&@�%A�4�%G�H�I�&)�
$�&)�&)�&)�&)�P�K��K��K�K�K��\�K�,�K�K��K���3�%��+�9N�0O�K�[^�K�K�K��\�K�K�K�K�Kr r)�	metaclassc��eZdZdZd�fdedeegefddfd�Zdeeefddfd	�Zd
edefd�Z	d
ede
fd�Zd
edefd
�ZdS)rlz>Represents a user-supplied filed which stores API credentials.c��|Sr9r=)�xs r�<lambda>z!CredentialsConfiguration.<lambda>s��q�r rn�mapperrNc��t|��	tj|��|_n[#tj$rI}t
�d|d���tjd�	|�����d}~wwxYw||_
dS)z�
        :param str filename: A path to the configuration file.
        :param callable mapper: A transformation to apply to configuration key names
        :raises errors.PluginError: If the file does not exist or is not a valid format.
        z+Error parsing credentials configuration: %sT)�exc_infoz,Error parsing credentials configuration: {0}N)�validate_file_permissions�	configobj�	ConfigObj�confobj�ConfigObjError�logger�debugr
rzr4r�)rrnr��es    rrz!CredentialsConfiguration.__init__s���	"�(�+�+�+�	_�$�.�x�8�8�D�L�L���'�	_�	_�	_��L�L�F��TX�L�Y�Y�Y��$�%S�%Z�%Z�[\�%]�%]�^�^�^�����	_��������s�+�B�AA>�>Brkc	�,�g}|D]�}|�|��sC|�d�|�|��||�����Z|�|��sB|�d�|�|��||������|r[tjd�t|��dkrdnd|jj	d�
|�������dS)	z�Ensures that the supplied set of variables are all present in the file.

        :param dict required_variables: Map of variable which must be present to error to display.
        :raises errors.PluginError: If one or more are missing.
        z)Property "{0}" not found (should be {1}).z'Property "{0}" not set (should be {1}).z9Missing {0} in credentials configuration file {1}:
 * {2}r.�property�
propertiesz
 * N)�_hasrLr4r��_getr
rz�lenr�rn�join)rrk�messages�vars    rrpz CredentialsConfiguration.requires+����%�	T�	T�C��9�9�S�>�>�
T���� K�!'�����C�(8�(8�:L�S�:Q�!R�!R�T�T�T�T��Y�Y�s�^�^�
T���� I�!'�����C�(8�(8�:L�S�:Q�!R�!R�T�T�T���	��$�L�S�S�&)�(�m�m�q�&8�&8�
�
�l���-����X�.�.�����
�	�	r r�c�,�|�|��S)z�Find a configuration value for variable `var`, as transformed by `mapper`.

        :param str var: The variable to get.
        :returns: The value of the variable.
        :rtype: str
        )r��rr�s  rr3zCredentialsConfiguration.conf1s���y�y��~�~�r c�:�|�|��|jvSr9)r�r�r�s  rr�zCredentialsConfiguration._has;s���{�{�3���4�<�/�/r c�\�|j�|�|����Sr9)r��getr�r�s  rr�zCredentialsConfiguration._get>s$���|������C� 0� 0�1�1�1r )
r�r�r�r�rsrrrrpr3�boolr�r�r=r rrlrls�������H�H�EP�[�����h��u�c�z�.B��UY����� �'�#�s�(�*;�������2��������0��0��0�0�0�0�2��2��2�2�2�2�2�2r rlrnrc��tj�|��s'tjd�|�����tj�|��r'tjd�|�����dS)z&Ensure that the specified file exists.zFile not found: {0}zPath is a directory: {0}N)rrg�existsr
rzr4�isdir�rns rr�r�Bs~���7�>�>�(�#�#�I�� �!6�!=�!=�h�!G�!G�H�H�H�	�w�}�}�X���N�� �!;�!B�!B�8�!L�!L�M�M�M�N�Nr c��t|��tj|��rt�d|��dSdS)zHEnsure that the specified file exists and warn about unsafe permissions.z8Unsafe permissions on credentials configuration file: %sN)r�r�has_world_permissionsr��warningr�s rr�r�LsN���(�����'��1�1�]����Q�S[�\�\�\�\�\�]�]r rGc���|�d����fd�tdt�����D��S)a�Return a list of progressively less-specific domain names.

    One of these will probably be the domain name known to the DNS provider.

    :Example:

    >>> base_domain_name_guesses('foo.bar.baz.example.com')
    ['foo.bar.baz.example.com', 'bar.baz.example.com', 'baz.example.com', 'example.com', 'com']

    :param str domain: The domain for which to return guesses.
    :returns: The a list of less specific domain names.
    :rtype: list
    �.c�J��g|]}d��|d����� S)r�N)r�)�.0rx�	fragmentss  �r�
<listcomp>z,base_domain_name_guesses.<locals>.<listcomp>es-���F�F�F��C�H�H�Y�q�r�r�]�#�#�F�F�Fr r)�split�ranger�)rGr�s @r�base_domain_name_guessesr�Us@������S�!�!�I�F�F�F�F�U�1�c�)�n�n�-E�-E�F�F�F�Fr ))r�r��logging�timer�typingrrrrrr	r��acmer
�certbotrrr
r�certbot.compatrr�certbot.displayrrrN�certbot.pluginsr�	getLoggerr�r��Plugin�
Authenticator�ABCMetarrlrsr�r�r�r=r r�<module>r�sk��0�0�
�
�
�
���������������������������������������������������������������!�!�!�!�!�!�������������%�%�%�%�%�%�������������0�0�0�0�0�0�"�"�"�"�"�"�	��	�8�	$�	$��fK�fK�fK�fK�fK�v�}�j�&>�#�+�fK�fK�fK�fK�R:2�:2�:2�:2�:2�:2�:2�:2�zN�C�N�D�N�N�N�N�]��]��]�]�]�]�G�S�G�T�#�Y�G�G�G�G�G�Gr