HOME


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

E��c�C�
���dZddlmZddlmZddlZddlZddlZddlZddlZddl	m
Z
ddl	mZddl	mZddl	m
Z
dd	l	mZdd
l	mZddl	mZddl	mZdd
l	mZddlZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlmZddlm Z ddlm!Z!ddl"m#Z$ddl"m%Z&ddl'm(Z(ej)e*��Z+de,de,fd�Z-de,de,fd�Z.ej/d��Z0ej/d ej1��Z2Gd!�d"e&e�#��Z%Gd$�d%e$e%e�#��Z#Gd&�d'e#ej3e�#��Z4ed(d)�*��Z5Gd+�d)��Z6Gd,�d-��Z7d.e,d/e,d0e,d1ee,ddf
d2�Z8d3e,d4e,dee,e,e,ffd5�Z9dS)6zPlugin common functions.�)�ABCMeta)�abstractmethodN)�Any)�Callable)�Iterable)�List)�Optional)�Set)�Tuple)�Type)�TypeVar)�
challenges)�achallenges)�
configuration)�crypto_util)�
interfaces)�errors)�reverter)�	constants)�
filesystem)�os)�	Installer)�Plugin)�
PluginStorage�name�returnc��|dzS)�9ArgumentParser options namespace (prefix of all options).�-��rs �8/usr/lib/python3/dist-packages/certbot/plugins/common.py�option_namespacer#'s���#�:��c�4�|�dd��dzS)�;ArgumentParser dest namespace (prefix of all destinations).r�_)�replacer!s r"�dest_namespacer),s���<�<��S�!�!�C�'�'r$zX(^127\.0\.0\.1)|(^10\.)|(^172\.1[6-9]\.)|(^172\.2[0-9]\.)|(^172\.3[0-1]\.)|(^192\.168\.)z3^(([a-z0-9]|[a-z0-9][a-z0-9\-]*[a-z0-9])\.)*[a-z]+$c�2��eZdZdZdejdeddf�fd�Zee	de
dddfd	�����Zed
ej
deddfd���Zedefd���Zdedefd
�Zedefd���Zdedefd�Zdedefd�Zdeejdefd�Z�xZS)rzGeneric plugin.�configrrNc�h��t���||��||_||_dS�N)�super�__init__r+r)�selfr+r�	__class__s   �r"r/zPlugin.__init__;s/���
�������&�&�&������	�	�	r$�add).Nc��dS)z�Add plugin arguments to the CLI argument parser.

        :param callable add: Function that proxies calls to
            `argparse.ArgumentParser.add_argument` prepending options
            with unique plugin name prefix.

        Nr )�clsr2s  r"�add_parser_argumentszPlugin.add_parser_arguments@s���r$�parserc�l���dtdtdtddf��fd�}|�|��S)zkInject parser options.

        See `~.certbot.interfaces.Plugin.inject_parser_options` for docs.

        �arg_name_no_prefix�args�kwargsrNc�l���jd�t���|��g|�Ri|��dS)Nz--{0}{1})�add_argument�formatr#)r8r9r:rr6s   ��r"r2z)Plugin.inject_parser_options.<locals>.addSs[����F���!�!�"2�4�"8�"8�:L�M�M�
!��
!�
!�
!��
!�
!�
!�
!�
!r$)�strrr5)r4r6rr2s `` r"�inject_parser_optionszPlugin.inject_parser_optionsKsY����	!�C�	!��	!�s�	!�t�	!�	!�	!�	!�	!�	!�	!��'�'��,�,�,r$c�*�t|j��S)r)r#r�r0s r"r#zPlugin.option_namespaceYs�� ��	�*�*�*r$c��|j|zS)z'Option name (include plugin namespace).)r#)r0rs  r"�option_namezPlugin.option_name^s���$�t�+�+r$c�*�t|j��S)r&)r)rrAs r"r)zPlugin.dest_namespacebs���d�i�(�(�(r$�varc�>�|j|�dd��zS)z.Find a destination for given variable ``var``.rr')r)r(�r0rEs  r"�destzPlugin.destgs ���"�S�[�[��c�%:�%:�:�:r$c�R�t|j|�|����S)z0Find a configuration value for variable ``var``.)�getattrr+rHrGs  r"�confzPlugin.confms���t�{�D�I�I�c�N�N�3�3�3r$�failed_achallsc��d�td�|D������}d�|j|���S)a9Human-readable string to help the user troubleshoot the authenticator.

        Shown to the user if one or more of the attempted challenges were not a success.

        Should describe, in simple language, what the authenticator tried to do, what went
        wrong and what the user should try as their "next steps".

        TODO: auth_hint belongs in Authenticator but can't be added until the next major
        version of Certbot. For now, it lives in .Plugin and auth_handler will only call it
        on authenticators that subclass .Plugin. For now, inherit from `.Plugin` to implement
        and/or override the method.

        :param list failed_achalls: List of one or more failed challenges
                                    (:class:`achallenges.AnnotatedChallenge` subclasses).

        :rtype str:
        z and c��h|]	}|j��
Sr )�typ)�.0�achalls  r"�	<setcomp>z#Plugin.auth_hint.<locals>.<setcomp>�s��%N�%N�%N�V�f�j�%N�%N�%Nr$z�The Certificate Authority couldn't externally verify that the {name} plugin completed the required {challs} challenges. Ensure the plugin is configured correctly and that the changes it makes are accessible from the internet.)r�challs)�join�sortedr=r)r0rLrSs   r"�	auth_hintzPlugin.auth_hintqsL��(���f�%N�%N�~�%N�%N�%N�O�O�P�P��\���T�Y�v��6�6�	8r$)�__name__�
__module__�__qualname__�__doc__r�NamespaceConfigr>r/�classmethodrrr5�argparse�ArgumentParserr?�propertyr#rCr)rHrrKrr�AnnotatedChallengerV�
__classcell__�r1s@r"rr8s�����������}�<��C��D�������
���x�	�':��t�����^��[���-�8�+B�-�#�-�RV�-�-�-��[�-��+�#�+�+�+��X�+�,��,��,�,�,�,��)��)�)�)��X�)�;��;��;�;�;�;�4��4��4�4�4�4�8��[�-K�(L�8�QT�8�8�8�8�8�8�8�8r$r)�	metaclassc	����eZdZdZdededdf�fd�Z	ddeed	ed
eddfd�Z	deddfd
�Z
dd�Zdd�Zdde
ddfd�Zedefd���Zedefd���Zdd�Z�xZS)rz�An installer base class with reverter and ssl_dhparam methods defined.

    Installer plugins do not have to inherit from this class.

    r9r:rNc���t��j|i|��t|j|j��|_t
j|j��|_dSr-)r.r/rr+r�storager�Reverter)r0r9r:r1s   �r"r/zInstaller.__init__�sL��������$�)�&�)�)�)�$�T�[�$�)�<�<��� �)�$�+�6�6��
�
�
r$F�
save_files�
save_notes�	temporaryc���|r
|jj}n|jj}	|||��dS#tj$r&}tjt
|�����d}~wwxYw)a�Add files to a checkpoint.

        :param set save_files: set of filepaths to save
        :param str save_notes: notes about changes during the save
        :param bool temporary: True if the files should be added to a
            temporary checkpoint rather than a permanent one. This is
            usually used for changes that will soon be reverted.

        :raises .errors.PluginError: when unable to add to checkpoint

        N)r�add_to_temp_checkpoint�add_to_checkpointr�
ReverterError�PluginErrorr>)r0rhrirj�checkpoint_func�errs      r"rmzInstaller.add_to_checkpoint�sx���	>�"�m�B�O�O�"�m�=�O�	/��O�J�
�3�3�3�3�3���#�	/�	/�	/��$�S��X�X�.�.�.�����	/���s�+�A �!A�A �titlec��	|j�|��dS#tj$r&}tjt|�����d}~wwxYw)z�Timestamp and save changes made through the reverter.

        :param str title: Title describing checkpoint

        :raises .errors.PluginError: when an error occurs

        N)r�finalize_checkpointrrnror>)r0rrrqs   r"rtzInstaller.finalize_checkpoint�s\��	/��M�-�-�e�4�4�4�4�4���#�	/�	/�	/��$�S��X�X�.�.�.�����	/������A�!A�Ac��	|j���dS#tj$r&}tjt|�����d}~wwxYw)z�Revert all previously modified files.

        Reverts all modified files that have not been saved as a checkpoint

        :raises .errors.PluginError: If unable to recover the configuration

        N)r�recovery_routinerrnror>�r0rqs  r"rwzInstaller.recovery_routine�sZ��	/��M�*�*�,�,�,�,�,���#�	/�	/�	/��$�S��X�X�.�.�.�����	/������A�!A
�
Ac��	|j���dS#tj$r&}tjt|�����d}~wwxYw)zkRollback temporary checkpoint.

        :raises .errors.PluginError: when unable to revert config

        N)r�revert_temporary_configrrnror>rxs  r"r{z!Installer.revert_temporary_config�sZ��	/��M�1�1�3�3�3�3�3���#�	/�	/�	/��$�S��X�X�.�.�.�����	/���ry��rollbackc��	|j�|��dS#tj$r&}tjt|�����d}~wwxYw)z�Rollback saved checkpoints.

        :param int rollback: Number of checkpoints to revert

        :raises .errors.PluginError: If there is a problem with the input or
            the function is unable to correctly revert the configuration

        N)r�rollback_checkpointsrrnror>)r0r}rqs   r"rzInstaller.rollback_checkpoints�s\��	/��M�.�.�x�8�8�8�8�8���#�	/�	/�	/��$�S��X�X�.�.�.�����	/���ruc�j�tj�|jjt
j��S)z(Full absolute path to ssl_dhparams file.)r�pathrTr+�
config_dirr�SSL_DHPARAMS_DESTrAs r"�ssl_dhparamszInstaller.ssl_dhparams�s"���w�|�|�D�K�2�I�4O�P�P�Pr$c�j�tj�|jjt
j��S)z:Full absolute path to digest of updated ssl_dhparams file.)rr�rTr+r�r�UPDATED_SSL_DHPARAMS_DIGESTrAs r"�updated_ssl_dhparams_digestz%Installer.updated_ssl_dhparams_digest�s"���w�|�|�D�K�2�I�4Y�Z�Z�Zr$c�f�t|j|jtjtj��dS)zJCopy Certbot's ssl_dhparams file into the system's config dir if required.N)�install_version_controlled_filer�r�r�SSL_DHPARAMS_SRC�ALL_SSL_DHPARAMS_HASHESrAs r"�install_ssl_dhparamszInstaller.install_ssl_dhparams�s6��'����,��&��-�		/�	/�	/�	/�	/r$�F�rN)r|)rWrXrYrZrr/r
r>�boolrmrtrwr{�intrr_r�r�r�rarbs@r"rr�sy���������
7�c�7�S�7�T�7�7�7�7�7�7�-2�/�/�C��H�/�#�/�%)�/�6:�/�/�/�/�./��/��/�/�/�/�/�/�/�/�	/�	/�	/�	/�/�/�S�/��/�/�/�/��Q�c�Q�Q�Q��X�Q��[�S�[�[�[��X�[�/�/�/�/�/�/�/�/r$rc��eZdZdZdS)�Configuratorzt
    A plugin that extends certbot.plugins.common.Installer
    and implements certbot.interfaces.Authenticator
    N)rWrXrYrZr r$r"r�r��s���������r$r��GenericAddr�Addr)�boundc�$�eZdZdZddeeefdefd�Zede	e
dedee
fd	���Zdefd
�Z
deeeffd�Zdedefd
�Zdefd�Zdefd�Zdefd�Zde
dede
fd�Zdedeefd�Zdefd�Zdedeefd�ZdS)r�z�Represents an virtual host address.

    :param str addr: addr part of vhost address
    :param str port: port number or \*, or ""

    F�tup�ipv6c�"�||_||_dSr-)r�r�)r0r�r�s   r"r/z
Addr.__init__s�������	�	�	r$r4�str_addrrc�R�|�d��re|�d��}|d|dz�}d}t|��|dzkr||dzdkr
||dzd�}|||fd�	��S|�d��}||d
|df��S)zInitialize Addr from string.�[�]Nr|���:T)r�r)�
startswith�rfind�len�	partition)r4r��endIndex�host�portr�s      r"�
fromstringzAddr.fromstring	s������s�#�#�
	)��~�~�c�*�*�H��M�X��\�M�*�D��D��8�}�}�x�!�|�+�+���A��0F�#�0M�0M���1��
�
�.���3��d�|�$�/�/�/�/��$�$�S�)�)�C��3��A���A��'�(�(�(r$c�J�|jdr
d|jzS|jdS)Nr|z%s:%sr�r�rAs r"�__str__zAddr.__str__s)���8�A�;�	&��T�X�%�%��x��{�r$c�`�|jr!|���|jdfS|jS)z5Normalized representation of addr/port tuple
        r|)r��get_ipv6_explodedr�rAs r"�normalized_tuplezAddr.normalized_tuples2���9�	9��)�)�+�+�T�X�a�[�8�8��x�r$�otherc��t||j��r*|���|���kSdS)NF)�
isinstancer1r�)r0r�s  r"�__eq__zAddr.__eq__$sA���e�T�^�,�,�	G��(�(�*�*�e�.D�.D�.F�.F�F�F��ur$c�*�t|j��Sr-)�hashr�rAs r"�__hash__z
Addr.__hash__,s���D�H�~�~�r$c��|jdS)z Return addr part of Addr object.rr�rAs r"�get_addrz
Addr.get_addr/����x��{�r$c��|jdS)zReturn port.r|r�rAs r"�get_portz
Addr.get_port3r�r$r0r�c�R�|�|jd|f|j��S)z6Return new address object with same addr and new port.r)r1r�r�)r0r�s  r"�get_addr_objzAddr.get_addr_obj7s#���~�~�t�x��{�D�1�4�9�=�=�=r$�addrc��|�d��}|�d��}|�|��S)z7Return IPv6 address in normalized form, helper functionr�r�)�lstrip�rstrip�
_explode_ipv6)r0r�s  r"�_normalize_ipv6zAddr._normalize_ipv6;s8���{�{�3�����{�{�3�����!�!�$�'�'�'r$c�z�|jr3d�|�|jd����SdS)zReturn IPv6 in normalized formr�rr�)r�rTr�r�rAs r"r�zAddr.get_ipv6_explodedAs7���9�	?��8�8�D�0�0���!��=�=�>�>�>��rr$c��gd�}|�d��}t|��t|��kr|dt|���}d}t|��D]i\}}|sd}�
t|��dkr|�d��}|st	|��||<�Gt	|��||t|��z
<�j|S)z#Explode IPv6 address for comparison)�0r�r�r�r�r�r�r�r�rFTr|r�)�splitr��	enumerater�r>)r0r��result�	addr_list�
append_to_end�i�blocks       r"r�zAddr._explode_ipv6Gs���9�9�9���J�J�s�O�O�	��y�>�>�C��K�K�'�'�!�!�C��K�K�-�0�I��
�!�)�,�,�
	6�
	6�H�A�u��
�!%�
���5�z�z�A�~�~����S�)�)�� �
6���J�J��q�	�	�,/�u�:�:��q��Y���'�(�(��
r$Nr�)rWrXrYrZrr>r�r/r\rr�r	r�r�r�rr�r�r�r�r�r�rr�r�r�r r$r"r�r��s�����������E�#�s�(�O��4������)��[�)�)�S�)�X�k�=R�)�)�)��[�)�������
�%��S��/������C��D������#������#������#�����>�;�>�c�>�k�>�>�>�>�(�C�(�D��I�(�(�(�(��3������#��$�s�)������r$c�n�eZdZdZdefd�Z	d
dejdee	ddfd�Z
deej
fd	�ZdS)�ChallengePerformeravAbstract base for challenge performers.

    :ivar configurator: Authenticator and installer plugin
    :ivar achalls: Annotated challenges
    :vartype achalls: `list` of `.KeyAuthorizationAnnotatedChallenge`
    :ivar indices: Holds the indices of challenges from a larger array
        so the user of the class doesn't have to.
    :vartype indices: `list` of `int`

    �configuratorc�0�||_g|_g|_dSr-)r��achalls�indices)r0r�s  r"r/zChallengePerformer.__init__ls��(���MO���"$����r$NrQ�idxrc�v�|j�|��|�|j�|��dSdS)z�Store challenge to be performed when perform() is called.

        :param .KeyAuthorizationAnnotatedChallenge achall: Annotated
            challenge.
        :param int idx: index to challenge in a larger array

        N)r��appendr�)r0rQr�s   r"�	add_challzChallengePerformer.add_challqsB��	
����F�#�#�#��?��L����$�$�$�$�$��?r$c��t���)z�Perform all added challenges.

        :returns: challenge responses
        :rtype: `list` of `acme.challenges.KeyAuthorizationChallengeResponse`


        )�NotImplementedErrorrAs r"�performzChallengePerformer.perform~s��"�#�#�#r$r-)rWrXrYrZr�r/r�"KeyAuthorizationAnnotatedChallenger	r�r�rr�!KeyAuthorizationChallengeResponser�r r$r"r�r�`s�������	�	�%�\�%�%�%�%�(,�%�%�� N�%���}�%�04�%�%�%�%�$��j�J�K�$�$�$�$�$�$r$r��	dest_path�digest_path�src_path�
all_hashesc������	�tj����	d�	�fd��d���fd�}tj����s|��dStj���}|�	krdS||vr|��dStj����rDt�d��5}|���}ddd��n#1swxYwY|�	krdS���t�d�����dS)a�Copy a file into an active location (likely the system's config dir) if required.

       :param str dest_path: destination path for version controlled file
       :param str digest_path: path to save a digest of the file in
       :param str src_path: path to version controlled file found in distribution
       :param list all_hashes: hashes of every released version of the file
    rNc���t�d��5}|����ddd��dS#1swxYwYdS)N�w)�open�write)�file_h�current_hashr�s ��r"�_write_current_hashz<install_version_controlled_file.<locals>._write_current_hash�s����
�+�s�
#�
#�	'�v��L�L��&�&�&�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'�	'����	'�	'�	'�	'�	'�	's�5�9�9c�F��tj�������dSr-)�shutil�copyfile)r�r�r�s���r"�_install_current_filez>install_version_controlled_file.<locals>._install_current_file�s*������)�,�,�,�������r$�rzh%s has been manually modified; updated file saved to %s. We recommend updating %s for security purposes.r�)	r�	sha256sumrr��isfiler��read�logger�warning)
r�r�r�r�r��active_file_digest�f�saved_digestr�r�s
```     @@r"r�r��s���������(��2�2�L�'�'�'�'�'�'�'���������
�7�>�>�)�$�$���������%�.�y�9�9���\�)�)����Z�'�'���������7�>�>�+�&�&�	��k�3�'�'�
(�1� �v�v�x�x��
(�
(�
(�
(�
(�
(�
(�
(�
(�
(�
(����
(�
(�
(�
(��|�+�+���	��������K��x��	,�	,�	,�	,�	,s�/C�C�C�test_dir�pkgc��dtdtfd�}|d��}|d��}|d��}tj|tj��tj|tj��tj|tj��tj|tj�	d|����}tj|tj�	||��d�	��|||fS)
z5Setup the directories necessary for the configurator.�prefixrc�N�tjtj|����S)a�Return the real path of a temp directory with the specified prefix

        Some plugins rely on real paths of symlinks for working correctly. For
        example, certbot-apache uses real paths of configuration files to tell
        a virtual host from another. On systems where TMP itself is a symbolic
        link, (ex: OS X) such plugins will be confused. This function prevents
        such a case.
        )r�realpath�tempfile�mkdtemp)r�s r"�expanded_tempdirz#dir_setup.<locals>.expanded_tempdir�s ���"�8�#3�F�#;�#;�<�<�<r$�tempr+�work�testdataT)�symlinks)r>r�chmodr�CONFIG_DIRS_MODE�
pkg_resources�resource_filenamerr�rTr��copytree)r�r�r��temp_dirr��work_dir�test_configss       r"�	dir_setupr
�s��	=��	=��	=�	=�	=�	=� ���'�'�H�!�!�(�+�+�J����'�'�H���X�y�9�:�:�:���Z��!;�<�<�<���X�y�9�:�:�:� �2��R�W�\�\�*�h�
/�
/�1�1�L��O��b�g�l�l�8�X�6�6��G�G�G�G��Z��)�)r$):rZ�abcrrr]�logging�rer�r��typingrrrrr	r
rrr
r�acmer�certbotrrrrrr�certbot._internalr�certbot.compatrr�certbot.interfacesr�AbstractInstallerr�AbstractPlugin�certbot.plugins.storager�	getLoggerrWr�r>r#r)�compile�private_ips_regex�
IGNORECASE�hostname_regex�
Authenticatorr�r�r�r�r�r
r r$r"�<module>rs������������������������	�	�	�	�
�
�
�
���������������������������������������������������������������������������!�!�!�!�!�!�������������������������'�'�'�'�'�'�%�%�%�%�%�%�������=�=�=�=�=�=�7�7�7�7�7�7�1�1�1�1�1�1�	��	�8�	$�	$���3��3�����
(��(��(�(�(�(�
�B�J�7�8�8�����:�B�M�K�K��Q8�Q8�Q8�Q8�Q8�^�w�Q8�Q8�Q8�Q8�he/�e/�e/�e/�e/�!�6�W�e/�e/�e/�e/�P�����9�j�6�'������g�m�6�2�2�2��_�_�_�_�_�_�_�_�D&$�&$�&$�&$�&$�&$�&$�&$�R,,�s�,,��,,�PS�,,�08��
�,,�BF�,,�,,�,,�,,�f*��*�#�*�%��S�#�
�*>�*�*�*�*�*�*r$