Current File : //proc/self/root/lib/python3/dist-packages/certbot/_internal/__pycache__/storage.cpython-312.pyc
�

M/�e����J�dZddlZddlZddlZddlZddlZddlZddlmZddlm	Z	ddlm
Z
ddlmZddlmZddlm
Z
dd	lmZdd
lmZddlmZddlZddlmZdd
lmZddlmZddlmZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl#m%Z%ddl&m'Z(ddl)m*Z*ddl)m+Z+ddl,m-Z.ddl/m0Z0ejbe2�Z3dZ4dZ5e0ejl�Z7dZ8d ejrd!ee:fd"�Z;d ejrd#e:d!e:fd$�Z<d ejrd%e:d!e:fd&�Z=dLd eejrd!ej|fd'�Z?ej��fd(ejd)e:d*ej�d!ejfd+�ZAd,e:d-e:d.e:d/e
e:e:fd0e
e:efd!ej|fd1�ZBd2e:d3e:d4ejrd!dfd5�ZCd6e:d.e:d/e
e:e:fd4ejrd!ej|f
d7�ZDd8e:d!e:fd9�ZEdMd:e:d;eFd!dfd<�ZGd=ee:d>e:d!eFfd?�ZHd ejrd!e
e:effd@�ZIdAe:d!e:fdB�ZJd ejrd6e:d!e:fdC�ZKd.e:dDe:d!e:fdE�ZLdFej|d4ejrd6e:d!e:fdG�ZMd4ejrd6e:d!e:fdH�ZNd ejrd#e:d!dfdI�ZOGdJ�dKe j��ZPy)NzRenewable certificates storage.�N)�Any)�cast)�Dict)�Iterable)�List)�Mapping)�Optional)�Tuple)�Union)�default_backend)�EllipticCurvePrivateKey)�
RSAPrivateKey)�load_pem_private_key��
configuration)�crypto_util)�errors)�
interfaces)�ocsp)�util)�	constants)�
error_handler)�disco)�
filesystem)�os)�common)�parse_loose_version)�cert�privkey�chain�	fullchain�READMEi��config�returnc��tjtjj|jd��}|j�|S)z�Build a list of all renewal configuration files.

    :param configuration.NamespaceConfig config: Configuration object

    :returns: list of renewal configuration files
    :rtype: `list` of `str`

    z*.conf)�globr�path�join�renewal_configs_dir�sort)r#�results  �;/usr/lib/python3/dist-packages/certbot/_internal/storage.py�renewal_conf_filesr-4s5���Y�Y�r�w�w�|�|�F�$>�$>��I�
J�F�
�K�K�M��M��certnamec���tjj|j|�d��}tjj	|�stjd|�d|�d���|S)z;Return /path/to/certname.conf in the renewal conf directory�.confzNo certificate found with name z (expected z).)rr'r(r)�existsr�CertStorageError)r#r/r's   r,�renewal_file_for_certnamer4Bs_��
�7�7�<�<��2�2�x�j��4F�G�D�
�7�7�>�>�$���%�%�-�h�Z�{�4�&��K�M�	M��Kr.�	cert_namec�P�t||�}tj|dd��dS)z� If `--cert-name` was specified, but you need a value for `--cert-path`.

    :param configuration.NamespaceConfig config: parsed command line arguments
    :param str cert_name: cert name.

    �utf-8��encoding�default_encodingr!)r4�	configobj�	ConfigObj)r#r5�cert_name_implied_confs   r,�cert_path_for_cert_namer>Ks6��7�v�y�I�������7�L�LW�Y�Yr.c��tjtjdd��}|j	|�|�|Stjdd���|S)z?Merge supplied config, if provided, on top of builtin defaults.r7r8)r;r<r�RENEWER_DEFAULTS�merge)r#�
defaults_copys  r,�config_with_defaultsrCWs^���'�'��"�"�W�w�P�M����&�"4��5���;D�:M�:M��7�;4�5��r.�	base_time�interval�
textparserc��|j�j�r|dz
}|jxstj}|j|||��dS)a�Parse the time specified time interval, and add it to the base_time

    The interval can be in the English-language format understood by
    parsedatetime, e.g., '10 days', '3 weeks', '6 months', '9 hours', or
    a sequence of such intervals like '6 months 1 week' or '3 days 12
    hours'. If an integer is found with no associated unit, it is
    interpreted by default as a number of days.

    :param datetime.datetime base_time: The time to be added with the interval.
    :param str interval: The time interval to parse.

    :returns: The base_time plus the interpretation of the time interval.
    :rtype: :class:`datetime.datetime`z days)�tzinfor)�strip�isdigitrH�pytz�UTC�parseDT)rDrErFrHs    r,�add_time_intervalrNasT��"�~�~����!��G����
�
�
)����F����h�	�&��A�!�D�Dr.�
o_filename�
n_filename�archive_dir�target�
relevant_datac��tj|dd��}tj|d<||d<tD]
}||||<�d|vri|d<ddg|j
d<|dj
|�|dD]
}||vs�|d|=�d|vrtjd}d	|zg|_	tjd
|�t|d�5	ddd�tjj|�rHt!j"tj$|�j&�}	t)j*||	�t|d
�5}
|j-|
��ddd�|S#1swY��xYw#1swY|SxYw)aWrites a renewal config file with the specified name and values.

    :param str o_filename: Absolute path to the previous version of config file
    :param str n_filename: Absolute path to the new destination of config file
    :param str archive_dir: Absolute path to the archive directory
    :param dict target: Maps ALL_FOUR to their symlink paths
    :param dict relevant_data: Renewal configuration options to save

    :returns: Configuration object for the new config file
    :rtype: configobj.ConfigObj

    r7r8�versionrQ�
renewalparams�z#Options used in the renewal process�renew_before_expiryzrenew_before_expiry = zWriting new config %s.�aN�wb)�outfile)r;r<�certbot�__version__�ALL_FOUR�comments�updaterr@�initial_comment�logger�debug�openrr'r2�stat�S_IMODE�lstat�st_moder�chmod�write)rOrPrQrRrSr#�kind�k�default_interval�current_permissions�fs           r,�write_renewal_configrp{s����
 �
 ��g�PW�
X�F��+�+�F�9��'�F�=���$���d�|��t��$��f�$�"$����,.�-B�,C�����(��?��"�"�=�1�
�O�
$�+���M�!���'��*�+��F�*�$�5�5�6K�L��":�=M�"M�!N����L�L�)�:�6�
�j�#�	�
��
�
�w�w�~�~�j�!�"�l�l�2�8�8�J�+?�+G�+G�H������%8�9�	
�j�$�	� �1����Q��� ��M�
�
�� ��M�s�E%�E1�%E.�1E;�	prev_name�new_name�
cli_configc��t||�}t||�}tjj|�rt	j
d��	t
j||�y#t$rt	j
d��wxYw)z�Renames cli_config.certname's config to cli_config.new_certname.

    :param .NamespaceConfig cli_config: parsed command line
        arguments
    z+The new certificate name is already in use.z=Please specify a valid filename for the new certificate name.N)	� renewal_filename_for_lineagenamerr'r2r�ConfigurationErrorr�replace�OSError)rqrrrs�
prev_filename�new_filenames     r,�rename_renewal_configr{�s���5�Z��K�M�3�J��I�L�	�w�w�~�~�l�#��'�'�)!�"�	"�-����=�,�7���-��'�'�),�-�	-�-�s�A%�%B�lineagenamec��t||�}|dz}tjj|�rtj|�t|�}t
|||||�tj||�tj|dd��S)a�Modifies lineagename's config to contain the specified values.

    :param str lineagename: Name of the lineage being modified
    :param str archive_dir: Absolute path to the archive directory
    :param dict target: Maps ALL_FOUR to their symlink paths
    :param .NamespaceConfig cli_config: parsed command line
        arguments

    :returns: Configuration object for the updated config file
    :rtype: configobj.ConfigObj

    z.newr7r8)rurr'r2�unlink�relevant_valuesrprrwr;r<)r|rQrRrs�config_filename�
temp_filename�valuess       r,�update_configurationr��sz��7�z�;�O�O�#�f�,�M�
�w�w�~�~�m�$�
�	�	�-� ��Z�
(�F���-��f�f�U����}�o�6������SZ�[�[r.�linkc��	tj|�}tjj|�s=tjjtjj|�|�}tjj|�S#t$r%tjdj|���wxYw)z�Get an absolute path to the target of link.

    :param str link: Path to a symbolic link

    :returns: Absolute path to the target of link
    :rtype: str

    :raises .CertStorageError: If link does not exists.

    zExpected {0} to be a symlink)r�readlinkrxrr3�formatrr'�isabsr(�dirname�abspath)r�rRs  r,�get_link_targetr��s���9��$�$�T�*��
�7�7�=�=�� ������b�g�g�o�o�d�3�V�<��
�7�7�?�?�6�"�"��
�9��%�%�*�1�1�$�7�9�	9�9�s�B�.C�readme_path�is_base_dirc��d}|rd}t|d�5}tjd|�|jdj	|���ddd�y#1swYyxYw)NrWz[cert name]/�wzWriting README to %s.a�This directory contains your keys and certificates.

`{prefix}privkey.pem`  : the private key for your certificate.
`{prefix}fullchain.pem`: the certificate file used in most server software.
`{prefix}chain.pem`    : used for OCSP stapling in Nginx >=1.3.7.
`{prefix}cert.pem`     : will break many server configurations, and should not be used
                 without reading further documentation (see link below).

WARNING: DO NOT MOVE OR RENAME THESE FILES!
         Certbot expects these files to remain in this location in order
         to function properly!

We recommend not moving these files. For more information, see the Certbot
User Guide at https://certbot.eff.org/docs/using.html#where-are-my-certificates.
)�prefix)rdrbrcrjr�)r�r�r�ros    r,�_write_live_readme_tor��sc��
�F����	
�k�3�	�M�1����,�k�:�	���6�7=�f�F�f�6K�	M�M�M�M�s�8A�A�
namespaces�optionc�X��ddlm}�|jvxst�fd�|D��S)z�
    Is this option one that could be restored for future renewal purposes?

    :param namespaces: plugin namespaces for configuration options
    :type namespaces: `list` of `str`
    :param str option: the name of the option

    :rtype: bool
    r)�renewalc3�@�K�|]}�j|����y�w�N)�
startswith)�.0�	namespacer�s  �r,�	<genexpr>z_relevant.<locals>.<genexpr>s�����I���!�!�)�,�I���)�certbot._internalr��CONFIG_ITEMS�any)r�r�r�s ` r,�	_relevantr�
s0���*��g�*�*�*�
J��I�j�I�I�Kr.c�\�|j�}tjj�}|D�cgc]}t	j
|���}}|j
�D��cic]%\}}t||�r|j|�r||��'}}}|d|d<|d|d<|Scc}wcc}}w)z�Return a new dict containing only items relevant for renewal.

    :param .NamespaceConfig config: parsed command line

    :returns: A new dictionary containing items that can be used in renewal.
    :rtype dict:

    �server�key_type)	�to_dict�
plugins_disco�PluginsRegistry�find_all�plugins_common�dest_namespace�itemsr��set_by_user)r#�
all_values�plugins�pluginr�r��value�rvs        r,rrs������!�J��+�+�4�4�6�G�FM�N�F�.�/�/��7�N�J�N�(�-�-�/�
��F�E��Z��(�V�-?�-?��-G�	��
�
�B�
��h�'�B�x�L� �
�+�B�z�N�
�I��!O��
s�B#�$*B(r�c��|jd�stjd��tjj|dt
d��S)�:Returns the lineagename for a configuration filename.
    r1z*renewal config file name must end in .confN)�endswithrr3rr'�basename�len)r�s r,�lineagename_for_filenamer�;sJ���#�#�G�,��%�%�8�:�	:�
�7�7���O�N�c�'�l�]�;�<�<r.c�\�tjj|j|�dzS)r�r1)rr'r(r))r#r|s  r,ruruDs$���7�7�<�<��2�2�K�@�7�J�Jr.�	from_filec�|�tjj|tjj|��S)zPath to a directory from a file)rr'�relpathr�)rQr�s  r,�_relpath_from_filer�Ks$��
�7�7�?�?�;������	�(B�C�Cr.�
config_objc�l�|r	d|vr|dStjj|j|�S)aMReturns the full archive path for a lineagename

    Uses cli_config to determine archive path if not available from config_obj.

    :param configobj.ConfigObj config_obj: Renewal conf file contents (can be None)
    :param configuration.NamespaceConfig cli_config: Main config file
    :param str lineagename: Certificate name
    rQ)rr'r(�default_archive_dir)r�rsr|s   r,�full_archive_pathr�Ps4���m�z�1��-�(�(�
�7�7�<�<�
�6�6��D�Dr.c�V�tjj|j|�S)z4Returns the full default live path for a lineagename)rr'r(�live_dir)rsr|s  r,�_full_live_pathr�_s��
�7�7�<�<�
�+�+�[�9�9r.c��t||�}td||�}t||�}	tj|dd��}	tj|�tjd|�t�}tD]o}|j!|�}	tj|�tj#d|�tj&j)|�}	|j+|	��qt-|�dk(r�|j/�}	tj&j1|	t2�}
	tj|
�tj#d|
�	tj4|	�tj#d|	�	t|||�}t7j8|�tj#d|�y#tj
$r=tjd|||�tjdj|���wxYw#tj|�tjd|�wxYw#t$$rtj#d|�Y���wxYw#t$$rtj#d|
�Y��1wxYw#t$$rtj#d	|	�Y��+wxYw#t$$rtj#d
�YywxYw)zmDelete all files related to the certificate.

    If some files are not found, ignore them and continue.
    Nr7r8zNCould not parse %s. You may wish to manually delete the contents of %s and %s.�error parsing {0}z
Removed %szUnable to delete %s�z&Unable to remove %s; may not be empty.zUnable to remove %s)r4r�r�r;r<�ConfigObjErrorrb�errorrr3r�r�remove�info�setr^�getrcrxr'r��addr��popr(r"�rmdir�shutil�rmtree)r#r/�renewal_filename�full_default_archive_dir�full_default_live_dir�renewal_config�directory_namesrkr��	directoryr��archive_paths            r,�delete_filesr�ds`��
1���B��0��v�x�H��+�F�H�=��4�"�,�,��w��J��	�	�	�"�#����L�"2�3�
�e�O��'���!�!�$�'��	6��I�I�d�O��L�L��t�,��G�G�O�O�D�)�	����I�&�'��?��q� �#�'�'�)�	��g�g�l�l�9�f�5��	=��I�I�k�"��L�L��{�3�	N��H�H�Y���L�L��y�1�
:�(����J���
�
�l�#����\�<�0��e�#�#�:����0�1A�!�#;�	=��%�%��&�&�'7�8�:�	:�:��	�	�	�"�#����L�"2�3���	6��L�L�.��5�	6���	=��L�L�.��<�	=���	N��L�L�A�9�M�	N���:����*�L�9�:�s`�G�+I�0+I*�+J�8J6�AH�H�-I�I'�&I'�*J
�J
�J3�2J3�6K�Kc
��eZdZdZ	d<dedejdeddfd�Ze	defd��Z
e	defd	��Ze	defd
��Ze	defd��Z
e	defd��Ze	dejfd
��Ze	defd��Zdedefd�Ze	deefd��Ze	defd��Ze	defd��Zd=d�Zd=d�Zdefd�Zd=d�Zdeeeeffd�Zd=d�Zdedeefd�Zdedee fd�Z!dede defd�Z"dedee fd�Z#dede fd �Z$de fd!�Z%de fd"�Z&defd#�Z'defd$�Z(dede ddfd%�Z)de ddfd&�Z*deefd'�Z+de defd(�Z,defd)�Z-defd*�Z.e/d+ed,e0d-e0d.e0dejddfd/��Z1de2e3e4ffd0�Z5e	defd1��Z6e	dee fd2��Z7e	deefd3��Z8d4e d5e0d6e0d7e0dejde fd8�Z9dejddfd9�Z:d>d:e ddfd;�Z;y)?�
RenewableCertaRenewable certificate.

    Represents a lineage of certificates that is under the management of
    Certbot, indicated by the existence of an associated renewal
    configuration file.

    Note that the notion of "current version" for a lineage is
    maintained on disk in the structure of symbolic links, and is not
    explicitly stored in any instance variable in this object. The
    RenewableCert object is able to determine information about the
    current (or other) version by accessing data on disk, but does not
    inherently know any of this information except by examining the
    symbolic links as needed. The instance variables mentioned below
    point to symlinks that reflect the notion of "current version" of
    each managed object, and it is these paths that should be used when
    configuring servers to use the certificate managed in a lineage.
    These paths are normally within the "live" directory, and their
    symlink targets -- the actual cert files -- are normally found
    within the "archive" directory.

    :ivar str cert: The path to the symlink representing the current
        version of the certificate managed by this lineage.
    :ivar str privkey: The path to the symlink representing the current
        version of the private key managed by this lineage.
    :ivar str chain: The path to the symlink representing the current version
        of the chain managed by this lineage.
    :ivar str fullchain: The path to the symlink representing the
        current version of the fullchain (combined chain and cert)
        managed by this lineage.
    :ivar configobj.ConfigObj configuration: The renewal configuration
        options associated with this lineage, obtained from parsing the
        renewal configuration file and/or systemwide defaults.

    r�rs�update_symlinksr$Nc���|�_t|��_	tj|dd���_t�j
��_t�fd�tD��s.tjdj�j
����jjd�}|�8t|�t kDr&t"j%d||t&j(��jd	�_�jd
�_�jd�_�jd�_t2j4j7�j*��_�j;�|r�j=��j?�y#tj$r%tjdj|���wxYw)
aInstantiate a RenewableCert object from an existing lineage.

        :param str config_filename: the path to the renewal config file
            that defines this lineage.
        :param .NamespaceConfig: parsed command line arguments

        :raises .CertStorageError: if the configuration file's name didn't end
            in ".conf", or the file is missing or broken.

        r7r8r�c3�:�K�|]}|�jv���y�wr�r�r��x�selfs  �r,r�z)RenewableCert.__init__.<locals>.<genexpr>�s�����=�q�1��*�*�*�=�s�z<renewal config file {0} is missing a required file referencerUNzzAttempting to parse the version %s renewal configuration file found at %s with version %s of Certbot. This might not work.rrr r!) rsr��_lineagenamer;r<�
configfiler�rr3r�rCr�allr^r�r�CURRENT_VERSIONrbr�r\r]rrr r!rr'r�r��
_fix_symlinks�_update_symlinks�_check_symlinks)r�r�rsr��conf_versions`    r,�__init__zRenewableCert.__init__�s����%���4�_�E���	=�'�1�1��'�G�M�D�O�2�$�/�/�B����=�H�=�=��)�)�!�!'�����!8�:�
:��)�)�-�-�i�8���$�#�L�1�O�C��K�K��%���8K�8K�
M�
�&�&�v�.��	��)�)�)�4����'�'��0��
��+�+�K�8���������	�	�2��
�������!�!�#������=�'�'�	=��)�)�#�*�*�?�;�=�
=�	=�s�F�8Gc��|jS)zDuck type for self.privkey)r�r�s r,�key_pathzRenewableCert.key_paths���|�|�r.c��|jS)zDuck type for self.cert)rr�s r,�	cert_pathzRenewableCert.cert_paths���y�y�r.c��|jS)zDuck type for self.chain)r r�s r,�
chain_pathzRenewableCert.chain_path
s���z�z�r.c��|jS)zDuck type for self.fullchain)r!r�s r,�fullchain_pathzRenewableCert.fullchain_paths���~�~�r.c��|jS)zEName given to the certificate lineage.

        :rtype: str

        )r�r�s r,r|zRenewableCert.lineagenames��� � � r.c�|�|jd�}|stjd��tj|�S)z�The current target certificate's expiration datetime

        :returns: Expiration datetime of the current target certificate
        :rtype: :class:`datetime.datetime`
        rz"Target certificate does not exist.)�current_targetr�Errorr�notAfter)r�r�s  r,�
target_expiryzRenewableCert.target_expirys8���'�'��/�	���,�,�C�D�D��#�#�I�.�.r.c�X�t|j|j|j�S)z2Returns the default or specified archive directory)r�rrsr|r�s r,rQzRenewableCert.archive_dir)s(��!��!3�!3��O�O�T�-�-�/�	/r.r�c�.�t|j|�S)zyReturns the default or specified archive directory as a relative path

        Used for creating symbolic links.
        )r�rQ)r�r�s  r,�relative_archive_dirz"RenewableCert.relative_archive_dir/s��
"�$�"2�"2�I�>�>r.c�@�|jdjdd�S)z8Returns the ACME server associated with this certificaterVr�N)rr�r�s r,r�zRenewableCert.server6s"���!�!�/�2�6�6�x��F�Fr.c�Z�|jrtj|j�Sy)z:Returns true if this is a test cert from a staging server.F)r�r�
is_stagingr�s r,�is_test_certzRenewableCert.is_test_cert;s!���;�;��?�?�4�;�;�/�/�r.c�d�d|jdvxr|jdjd�S)zGReturns whether this certificate is configured to reuse its private key�	reuse_keyrV�r�as_boolr�s r,rzRenewableCert.reuse_keyBs<���d�0�0��A�A�H��!�!�/�2�:�:�;�G�	Hr.c�V�tD]�}t||�}tjj	|�s$tjdj|���t|�}tjj|�r�}tjdj||���y)z.Raises an exception if a symlink doesn't existzexpected {0} to be a symlinkz(target {0} of symlink {1} does not existN)
r^�getattrrr'�islinkrr3r�r�r2)r�rkr�rRs    r,r�zRenewableCert._check_symlinksHs����	P�D��4��&�D��7�7�>�>�$�'��-�-�2�9�9�$�?�A�A�$�T�*�F��7�7�>�>�&�)��-�-�/:�:@�&���:N�P�P�	Pr.c�6�tD]�}t||�}t|�}tjj|j
|�tjj|��}tj|�tj||���y)z#Updates symlinks to use archive_dirN)
r^rr�rr'r(r�r�r~�symlink)r�rkr��
previous_link�new_links     r,r�zRenewableCert._update_symlinksTss���	'�D��4��&�D�+�D�1�M��w�w�|�|�D�$=�$=�d�$C���� � ��/�1�H�
�I�I�d�O��J�J�x��&�	'r.c�H�|j|j|j|jfD]9}tj
j
|�r�#tjd|�y|j|j|j|jfD]9}tj
j|�r�#tjd|�ytD�]D}t||�}t|�}tj
jtj
j|�|j�sAtjd|tj
j|�|j�ytj
j!|�stjd||�yt#j$dj'|��}|j)tj
j+|��r��/tjd|�yy)	z�Are the files associated with this lineage self-consistent?

        :returns: Whether the files stored in connection with this
            lineage appear to be correct and consistent with one
            another.
        :rtype: bool

        z3Element %s is not referenced with an absolute path.Fz"Element %s is not a symbolic link.a-Element's link does not point within the cert lineage's directory within the official archive directory. Link: %s, target directory: %s, archive directory: %s. If you've specified the archive directory in the renewal configuration file, you may need to update links by running certbot update_symlinks.z.Link %s points to file %s that does not exist.�^{0}([0-9]+)\.pem$z1%s does not follow the archive naming convention.T)rrr r!rr'r�rbrcrr^rr��samefiler�rQr2�re�compiler��matchr�)r�r�rkr�rR�patterns      r,�_consistentzRenewableCert._consistent_s����)�)�T�\�\�4�:�:�t�~�~�F�	�A��7�7�=�=��#����.�/0�2��		��)�)�T�\�\�4�:�:�t�~�~�F�	�A��7�7�>�>�!�$����A�1�E��	��	�D��4��&�D�$�T�*�F��7�7�#�#�B�G�G�O�O�F�$;�T�=M�=M�N����8�"�2�7�7�?�?�6�#:�D�<L�<L�N���7�7�>�>�&�)����M�!�6�+���j�j�!6�!=�!=�d�!C�D�G��=�=����!1�!1�&�!9�:����+�,2�4��=	�Zr.c��y)zpAttempt to fix defects or inconsistencies in this lineage.

        .. todo:: Currently unimplemented.

        N�r�s r,�_fixzRenewableCert._fix�s�r.c��g}tD]m}tjjt	||��}dj|�}|j
|tjj||�f��o|S)z�Returns the kind and path of all symlinks used in recovery.

        :returns: list of (kind, symlink) tuples
        :rtype: list

        zprevious_{0}.pem)r^rr'r�rr��appendr()r��previous_symlinksrk�link_dir�	link_bases     r,�_previous_symlinksz RenewableCert._previous_symlinks�sn�����	P�D��w�w���w�t�T�':�;�H�*�1�1�$�7�I��$�$�d�B�G�G�L�L��9�,M�%N�O�	P�
!� r.c��|j�}td�|D��rs|D]n\}}t||�}tjj|�rtj|�tjtj|�|��p|D]:\}}tjj|�s�&tj|��<y)z�Fixes symlinks in the event of an incomplete version update.

        If there is no problem with the current symlinks, this function
        has no effect.

        c3�`K�|]&}tjj|d����(y�w)r�N)rr'r2)r�r�s  r,r�z.RenewableCert._fix_symlinks.<locals>.<genexpr>�s!����E�4�r�w�w�~�~�d�1�g�&�E�s�,.N)rr�rrr'�lexistsr~rrr�r2)r�rrkr	�current_link�_r�s       r,r�zRenewableCert._fix_symlinks�s���!�3�3�5���E�3D�E�E�'8�
M�#��m�&�t�T�2���7�7�?�?�<�0��I�I�l�+��
�
�:�.�.�}�=�|�L�	
M�)�	 �G�A�t��w�w�~�~�d�#��	�	�$��	 r.rkc���|tvrtjd��t||�}tj
j
|�stjd||�yt|�S)a(Returns full path to which the specified item currently points.

        :param str kind: the lineage member item ("cert", "privkey",
            "chain", or "fullchain")

        :returns: The path to the current version of the specified
            member.
        :rtype: str or None

        �unknown kind of itemz*Expected symlink %s for %s does not exist.N)
r^rr3rrr'r2rbrcr�)r�rkr�s   r,r�zRenewableCert.current_target�s\���x���)�)�*@�A�A��t�T�"���w�w�~�~�d�#��L�L�E��t�
%���t�$�$r.c���|tvrtjd��tjdj|��}|j
|�}|�tjj|�stjd||�d}|jtjj|��}|rt|j�d�Stjd|�y)a�Returns numerical version of the specified item.

        For example, if kind is "chain" and the current chain link
        points to a file named "chain7.pem", returns the integer 7.

        :param str kind: the lineage member item ("cert", "privkey",
            "chain", or "fullchain")

        :returns: the current version of the specified member.
        :rtype: int

        r"rNz3Current-version target for %s does not exist at %s.rWrzNo matches for target %s.)r^rr3rrr�r�rr'r2rbrcrr��int�groups)r�rkrrR�matchess     r,�current_versionzRenewableCert.current_version�s����x���)�)�*@�A�A��*�*�2�9�9�$�?�@���$�$�T�*���>�������!7��L�L�1�26��
@��F��-�-���� 0� 0�� 8�9����w�~�~�'��*�+�+����0�$�7�r.rUc�2�|tvrtjd��|j|�}|stjd|�d���t
jj|�}t
jj|dj||��S)a�The filename that corresponds to the specified version and kind.

        .. warning:: The specified version may not exist in this
           lineage. There is no guarantee that the file path returned
           by this method actually exists.

        :param str kind: the lineage member item ("cert", "privkey",
            "chain", or "fullchain")
        :param int version: the desired version

        :returns: The path to the specified version of the specified member.
        :rtype: str

        r"�Target � does not exist!�
{0}{1}.pem)
r^rr3r�r�rr'r�r(r�)r�rkrUr��wheres     r,rUzRenewableCert.versions~���x���)�)�*@�A�A��"�"�4�(����,�,����.>�?�@�@�������%���w�w�|�|�E�<�#6�#6�t�W�#E�F�Fr.c	��|tvrtjd��|j|�}|stjd|�d���t
jj|�}tj|�}tjdj|��}|D�cgc]}|j|���}}t|D�cgc]!}|s�t|j�d���#c}�Scc}wcc}w)a�Which alternative versions of the specified kind of item exist?

        The archive directory where the current version is stored is
        consulted to obtain the list of alternatives.

        :param str kind: the lineage member item (
            ``cert``, ``privkey``, ``chain``, or ``fullchain``)

        :returns: all of the version numbers that currently exist
        :rtype: `list` of `int`

        r"r)r*rr)r^rr3r�r�rr'r��listdirrrr�r�sortedr$r%)	r�rkr�r,�filesrror&�ms	         r,�available_versionsz RenewableCert.available_versionss����x���)�)�*@�A�A��"�"�4�(����,�,����.>�?�@�@�������%���
�
�5�!���*�*�2�9�9�$�?�@��-2�3��7�=�=��#�3��3��7�@�a�a�s�1�8�8�:�a�=�)�@�A�A��4��@s�&C6�	C;�C;c�6�t|j|��S)aNewest available version of the specified kind of item?

        :param str kind: the lineage member item (``cert``,
            ``privkey``, ``chain``, or ``fullchain``)

        :returns: the newest available version of this member
        :rtype: int

        )�maxr2)r�rks  r,�newest_available_versionz&RenewableCert.newest_available_version5s���4�*�*�4�0�1�1r.c���tD�cgc]}|j|���c}�t�fd��dD��Scc}w)z�Newest version for which all items are available?

        :returns: the newest available version for which all members
            (``cert, ``privkey``, ``chain``, and ``fullchain``) exist
        :rtype: int

        c3�T��K�|]�t�fd��ddD��s����� y�w)c3�&�K�|]}�|v���
y�wr�r)r��v�ns  �r,r�z@RenewableCert.latest_common_version.<locals>.<genexpr>.<genexpr>Ns�����0N�A��a��0N�s�r�N)r�)r�r:�versionss @�r,r�z6RenewableCert.latest_common_version.<locals>.<genexpr>Ns$�����O��S�0N��!�"��0N�-N�1�O�s�(�(r)r^r2r4)r�r�r;s  @r,�latest_common_versionz#RenewableCert.latest_common_versionAs<���9A�A�1�D�+�+�A�.�A���O�h�q�k�O�O�O��Bs�<c�:��t�fd�tD��dzS)z�Smallest version newer than all full or partial versions?

        :returns: the smallest version number that is larger than any
            version of any item currently stored in this lineage
        :rtype: int

        c3�@�K�|]}�j|����y�wr�)r5r�s  �r,r�z2RenewableCert.next_free_version.<locals>.<genexpr>\s�����F��4�0�0��3�F�r�r�)r4r^r�s`r,�next_free_versionzRenewableCert.next_free_versionPs����F�X�F�F��J�Jr.c��|j�r5tjd�|j|j	��yy)z�Make sure we've deployed the latest version.

        :returns: False if a change was needed, True otherwise
        :rtype: bool

        May need to recover from rare interrupted / crashed states.zMFound a new certificate /archive/ that was not linked to in /live/; fixing...FT)�has_pending_deploymentrb�warning�update_all_links_tor<r�s r,�ensure_deployedzRenewableCert.ensure_deployed^s>���&�&�(��N�N�<�
=��$�$�T�%?�%?�%A�B��r.c���g}tD]>}|j|�}|�tj|�d���|j	|��@t|�}||j
�kS)aIs there a later version of all of the managed items?

        :returns: ``True`` if there is a complete version of this
            lineage with a larger version number than the current
            version, and ``False`` otherwise
        :rtype: bool

        z. is required but missing for this certificate.)r^r'rr�r�minr<)r��all_versions�itemrU�smallest_currents     r,rAz$RenewableCert.has_pending_deploymentmss��#%���	)�D��*�*�4�0�G����l�l�d�V�+Y�#Z�[�[�����(�		)��|�,���$�"<�"<�">�>�>r.c�p�|tvrtjd��t||�}dj	||�}t
jjtj|��}tj|�tjt
jj||�|�y)a7Make the specified item point at the specified version.

        (Note that this method doesn't verify that the specified version
        exists.)

        :param str kind: the lineage member item ("cert", "privkey",
            "chain", or "fullchain")
        :param int version: the desired version

        r"r+N)
r^rr3rr�rr'r�rr�r~rr()r�rkrUr��filename�target_directorys      r,�_update_link_tozRenewableCert._update_link_to�s����x���)�)�*@�A�A��t�T�"���&�&�t�W�5���7�7�?�?�:�+>�+>�t�+D�E��	�	�	�$��
�
�
�2�7�7�<�<� 0�(�;�T�Br.c��tj|j�5|j�}|D]G\}}|j	|�}|stjd|�d���tj||��ItD]}|j||��|D]\}}tj|��	ddd�y#1swYyxYw)zwChange all member objects to point to the specified version.

        :param int version: the desired version

        r)r*N)r�ErrorHandlerr�rr�rr�rrr^rMr~)r�rU�previous_linksrkr�rRr s       r,rCz!RenewableCert.update_all_links_to�s����
'�
'��(:�(:�
;�	 �!�4�4�6�N�,�
)�
��d��,�,�T�2��� �,�,����6F�'G�H�H��
�
�6�4�(�	
)�!�
4���$�$�T�7�3�
4�*�
 ���4��	�	�$��
 �	 �	 �	 �s�BC�Cc���|jd�}|�tjd��t|d�5}t	j
|j
��cddd�S#1swYyxYw)z�What are the subject names of this certificate?

        :returns: the subject names
        :rtype: `list` of `str`
        :raises .CertStorageError: if could not find cert file.

        rNz#could not find the certificate file�rb)r�rr3rdr�get_names_from_cert�read)r�rRros   r,�nameszRenewableCert.names�s`���$�$�V�,���>��)�)�*O�P�P�
�&�$�
�	=�1��2�2�1�6�6�8�<�	=�	=�	=�s�#A"�"A+c�(�|jd|�}|jd|�}	tj�j||�S#t$r>}t
j
d|�t
jt|��Yd}~yd}~wwxYw)a{Is the specified cert version revoked according to OCSP?

        Also returns True if the cert version is declared as revoked
        according to OCSP. If OCSP status could not be determined, False
        is returned.

        :param int version: the desired version number

        :returns: True if the certificate is revoked, otherwise, False
        :rtype: bool

        rr z4An error occurred determining the OCSP status of %s.NF)	rUr�RevocationChecker�ocsp_revoked_by_paths�	ExceptionrbrBrc�str)r�rUr�r��es     r,�ocsp_revokedzRenewableCert.ocsp_revoked�s����L�L���1�	��\�\�'�7�3�
�	��)�)�+�A�A�)�BL�N�
N���	��N�N�F��
�
�L�L��Q�� ���	�s�#A
�
	B�4B�Bc�d�d|jdvxs|jdjd�S)z�Is automatic renewal enabled for this cert?

        If autorenew is not specified, defaults to True.

        :returns: True if automatic renewal is enabled
        :rtype: bool

        �	autorenewrVrr�s r,�autorenewal_is_enabledz$RenewableCert.autorenewal_is_enabled�s<���4�#5�#5�o�#F�F�I��"�"�?�3�;�;�K�H�	Jr.c��|j�r�|j|j��rtj	d�yt
jd}|jjd|�}tj|jd|j���}tjjtj�}|t!||�kr'tj	d||j#d��yy)aTShould we now try to autorenew the most recent cert version?

        This is a policy question and does not only depend on whether
        the cert is expired. (This considers whether autorenewal is
        enabled, whether the cert is revoked, and whether the time
        interval for autorenewal has been reached.)

        Note that this examines the numerically most recent cert version,
        not the currently deployed version.

        :returns: whether an attempt should now be made to autorenew the
            most current cert version in this lineage
        :rtype: bool

        z%Should renew, certificate is revoked.TrXrz8Should renew, less than %s before certificate expiry %s.z%Y-%m-%d %H:%M:%S %ZF)r_r\r<rbrcrr@rr�rr�rU�datetime�nowrKrLrN�strftime)r�rmrE�expiryrbs     r,�should_autorenewzRenewableCert.should_autorenew�s��� �&�&�(�� � ��!;�!;�!=�>����D�E�� )�9�9�:O�P���)�)�-�-�.C�EU�V�H� �)�)�$�,�,���2�2�4�+6�7�F��#�#�'�'����1�C��)�#�x�8�8����*�+3�#�_�_�-C�D�F��r.r|rrr c	�	�|j|j|jfD]N}tjj|�r�#t
j|d�tjd|��Ptj|j|�\}}tjj|jt�}	tjj|	�s
t|	d��t|�}t!d||�}
t#||�}tjj|
�r\tjj%|
�rtj&|
�r(|j)�t+j,d|z��tjj|�r\tjj%|�rtj&|�r(|j)�t+j,d|z��|
|fD]M}tjj|�r�#t
j|�tjd|��Ot.D�cic]&}|tjj||dz���(}
}t.D�cic]&}|tjj|
|d	z���(}}t.D]+}tj0t3|||
|�|
|��-t5|
d
d�5}tjd|
d
�|j7|�ddd�tj8|d
dt:��5}tjd|
d
�|j7|�ddd�t5|
dd�5}tjd|
d�|j7|�ddd�t5|
dd�5}tjd|
d�|j7||z�ddd�tjj|t�}t|�|j)�t=|�}t?|||
|
|�}||j@|�Scc}wcc}w#1swY��YxYw#1swY��xYw#1swY��xYw#1swY��xYw)a�Create a new certificate lineage.

        Attempts to create a certificate lineage -- enrolled for
        potential future renewal -- with the (suggested) lineage name
        lineagename, and the associated cert, privkey, and chain (the
        associated fullchain will be created automatically). Optional
        configurator and renewalparams record the configuration that was
        originally used to obtain this cert, so that it can be reused
        later during automated renewal.

        Returns a new RenewableCert object referring to the created
        lineage. (The actual lineage name, as well as all the relevant
        file paths, will be available within this object.)

        :param str lineagename: the suggested name for this lineage
            (normally the current cert's first subject DNS name)
        :param str cert: the initial certificate version in PEM format
        :param str privkey: the private key in PEM format
        :param str chain: the certificate chain in PEM format
        :param .NamespaceConfig cli_config: parsed command line
            arguments

        :returns: the newly-created RenewalCert object
        :rtype: :class:`storage.renewableCert`

        i�zCreating directory %s.T)r�Nzarchive directory exists for zlive directory exists for �.pemz1.pemrrZ�Writing certificate to %s.r�rizWriting private key to %s.r �Writing chain to %s.r!�Writing full chain to %s.)!r)r�r�rr'r2r�makedirsrbrcr�unique_lineage_namer(r"r�r�r�r��isdirr.�closerr3r^rr�rdrj�	safe_open�BASE_PRIVKEY_MODErrprK)�clsr|rrr rs�i�config_filer��base_readme_path�archiver�rkrR�archive_target�f_b�f_ar�r��
new_configs                    r,�new_lineagezRenewableCert.new_lineage
s���>�0�0�*�2P�2P��%�%�'�	:�A��7�7�>�>�!�$��#�#�A�u�-����5�q�9�		:�
(,�'?�'?��*�*�K�(9�$��_��7�7�<�<�
�(;�(;�V�D���w�w�~�~�.�/�!�"2��E�
/��?��#�D�*�k�B��"�:�{�;��
�7�7�>�>�'�"�B�G�G�M�M�'�,B�b�j�j�QX�FY������)�)�/�+�=�?�
?�
�7�7�>�>�(�#�R�W�W�]�]�8�-D��
�
�S[�H\������)�)�,�{�:�<�
<��8�$�	:�A��7�7�>�>�!�$��#�#�A�&����5�q�9�	:�KS�S�$�$������X�t�f�}�=�=�S��S�RZ�[�$�$������W�d�W�n� E�E�[��[��	]�D��J�J�)�.��*>��t��M�v�VZ�|�\�	]�
�&��.�$�
'�	�3��L�L�5�v�f�~�F��I�I�d�O�	��^�^�N�9�5�t�CT�
U�	�Y\��L�L�5�v�i�7H�I��I�I�g��	��&��/�4�
(�	�C��L�L�/����A��I�I�e��	��&��%�t�
,�	$��
�L�L�4�f�[�6I�J��I�I�d�U�l�#�		$��g�g�l�l�8�V�4���k�*�	����!��,��)�/�?�G��F��
��:�&�&�
�3�3��AT��[�	�	��	�	��	�	��	$�	$�s<�(+R�+R
�
+R�+R�!+R)�#.R5�R�R&�)R2�5R>c���t|jdd�5}t|j�dt	���}ttttf|�cddd�S#1swYyxYw)NrrR)�data�password�backend)	rdrrrTrrrrr
)r��
priv_key_file�keys   r,�_private_keyzRenewableCert._private_keyjsh��
�$�$�$�Y�/��
6�	L�-�&�"�'�'�)��'�)��C�
��m�-D�D�E�s�K�
	L�	L�	L�s�AA%�%A.c�F�|j�}t|t�ryy)zc
        :returns: The type of algorithm for the private, RSA or ECDSA
        :rtype: str
        �RSA�ECDSA)r��
isinstancer�r�r�s  r,�private_key_typezRenewableCert.private_key_typess"�����!���c�=�)��r.c�\�|j�}t|t�r|jSy)z[
        :returns: If the private key is an RSA key, its size.
        :rtype: int
        N)r�r�r�key_sizer�s  r,�rsa_key_sizezRenewableCert.rsa_key_size~s)�����!���c�=�)��<�<��r.c�p�|j�}t|t�r|jjSy)zm
        :returns: If the private key is an elliptic key, the name of its curve.
        :rtype: str
        N)r�r�r
�curve�namer�s  r,�elliptic_curvezRenewableCert.elliptic_curve�s.�����!���c�2�3��9�9�>�>�!�r.�
prior_version�new_cert�new_privkey�	new_chainc��||_|j�}tD�cic]=}|tjj|jdj||����?}}tjj|jdj|��}	|�ktjj|	�rtj|	�}	nd|�d�}	tjd|	�tj|	|d�n�tj|ddt ��5}
tjd	|d�|
j#|�ddd�tj$|	t �}tj&|	|d|d
d��t)|d
d�5}
tjd|d
�|
j#|�ddd�t)|dd�5}
tjd|d�|
j#|�ddd�t)|dd�5}
tjd|d�|
j#||z�ddd�tD�cic]}||j*|��}}t-|j.|j||�|_t3|j0�|_|Scc}w#1swY��sxYw#1swY��xYw#1swY��xYw#1swY��xYwcc}w)a�Save new cert and chain as a successor of a prior version.

        Returns the new version number that was created.

        .. note:: this function does NOT update links to deploy this
                  version

        :param int prior_version: the old version to which this version
            is regarded as a successor (used to choose a privkey, if the
            key has not changed, but otherwise this information is not
            permanently recorded anywhere)
        :param bytes new_cert: the new certificate, in PEM format
        :param bytes new_privkey: the new private key, in PEM format,
            or ``None``, if the private key has not changed
        :param bytes new_chain: the new chain, in PEM format
        :param .NamespaceConfig cli_config: parsed command line
            arguments

        :returns: the new version number that was created
        :rtype: int

        r+zprivkey{0}.pemNrrgz'Writing symlink to old private key, %s.rZrizWriting new private key to %s.FT)�	copy_user�
copy_grouprrhr rjr!rk)rsr?r^rr'r(rQr�rrr�rbrcrrrprqrj�compute_private_key_mode�copy_ownership_and_apply_moderdrr�r|r�rC)
r�r�r�r�r�rs�target_versionrkrR�old_privkeyro�mode�symlinkss
             r,�save_successorzRenewableCert.save_successor�s���<%����/�/�1��&�(��������T�%5�%5�|�7J�7J�4�Q_�7`�a�a�(��(��g�g�l�l����.�5�5�m�D�F�����w�w�~�~�k�*�(�1�1�+�>�� '�
��d�;���L�L�B�K�P��J�J�{�F�9�$5�6�����y� 1�4�?P�Q�
%�UV����=�v�i�?P�Q�����$�
%�
�6�6�{�DU�V�D��4�4��V�I�.���RV�
X��&��.�$�
'�	�1��L�L�5�v�f�~�F�
�G�G�H��	��&��/�4�
(�	�A��L�L�/����A�
�G�G�I��	��&��%�t�
,�	*���L�L�4�f�[�6I�J�
�G�G�H�y�(�)�	*�@H�H�t�D�$�,�,�T�2�2�H��H�.����d�.�.��*�F���1�$�/�/�B������[(�&
%�
%��	�	��	�	��	*�	*��Is<�AK�)+K�"+K�$+K�&.K+�$K7�K�K�K(�+K4c���||_tD�cic]}||j|��}}t|j|j
||�|_t|j�|_ycc}w)z�Save only the config information without writing the new cert.

        :param .NamespaceConfig cli_config: parsed command line
            arguments
        N)rsr^rr�r|rQr�rC)r�rsrkr�s    r,�save_new_config_valuesz$RenewableCert.save_new_config_values�sg��%���?G�H�t�D�$�,�,�T�2�2�H��H�.����d�.�.��*�F���1�$�/�/�B����	Is�A+�num_prior_certs_to_keepc��|j�}t|jd��}|tt||dz
|z
d��z}|j}|D]~}t
j
d||�tD]\}tjj||�|�d��}	tjj|�rtj|��^��y	#t$rt
j
d|d��Y��wxYw)
aQDelete unused historical certificate, chain and key items from the lineage.

        A certificate version will be deleted if it is:
          1. not the current target, and
          2. not a previous version within num_prior_certs_to_keep.

        :param num_prior_certs_to_keep: How many prior certificate versions to keep.

        rr����z8Deleting %s/cert%d.pem and related items during clean uprgzFailed to clean up %sT)�exc_infoN)r<r�r2�rangerQrbrcr^rr'r(r2r~rx)r�r�r'�versions_to_deleterv�verrk�	item_paths        r,�truncatezRenewableCert.truncate�s���4�4�6�� ��!8�!8��!@�A���c�%��(7�!�(;�>U�(U�WY�#[�\�	\���"�"��&�		T�C��L�L�S� �#�
'� �
T���G�G�L�L��T�F�3�%�t�2D�E�	�T��w�w�~�~�i�0��	�	�)�,��	
T�		T���T��L�L�!8�)�d�L�S�T�s�!4C�!C>�=C>�F)r$N)�)<�__name__�
__module__�__qualname__�__doc__rZr�NamespaceConfig�boolr��propertyr�r�r�r�r|rar�rQr�r	r�r�rr�r�rrrr
rr�r�r$r'rUr2r5r<r?rDrArMrCrUr\r_re�classmethod�bytesr{rrr
r�r�r�r�r�r�r�rr.r,r�r��s���!�F*/�4��4��9V�9V�4�"&�4�37�4�l��#������3������C�����������!�S�!��!��	/�x�0�0�	/��	/��/�S�/��/�
?�c�?�c�?��G���
�G��G���d�����H�4�H��H�

P�	'�B�T�B�H�$
!�D��s�C�x��$9�
!� �&%�3�%�8�C�=�%�(�C��H�S�M��6G�C�G�#�G�#�G�.B�s�B�t�C�y�B�0
2�S�
2�S�
2�
P�s�
P�K�3�K�
��
�?��?�(C�C�C�#�C�$�C�4 �3� �4� �(=�t�C�y�=��C��D��8
J��
J�#�$�#�J�]4�c�]4��]4��]4�u�]4� -� =� =�]4�BQ�]4��]4�~L�e�M�3J�$J�K�L���#������h�s�m��������
����M�C�M�5�M�u�M�"'�M�5B�5R�5R�M�WZ�M�^C��1N�1N�C�SW�C�T��T�D�Tr.r�r�r�)Qr�rar&�loggingrr�re�typingrrrrrrr	r
rr;�cryptography.hazmat.backendsr�,cryptography.hazmat.primitives.asymmetric.ecr
�-cryptography.hazmat.primitives.asymmetric.rsar�,cryptography.hazmat.primitives.serializationr�
parsedatetimerKr\rrrrrrr�rr�certbot._internal.pluginsrr��certbot.compatrr�certbot.pluginsrr��certbot.utilr�	getLoggerr�rbr^r"r]r�rqr�rZr-r4r>r<rC�CalendarrNrpr{r�r�r�r�r�rr�rur�r�r�r�r�rr.r,�<module>r�s���%����	�
������������8�P�G�M����!������'�+�<�%��4�,�	��	�	�8�	$��4��	��%�g�&9�&9�:����
�}�<�<���c����m�&C�&C��s��WZ��	Y�M�$A�$A�	Y�c�	Y�VY�	Y���-�*G�*G�!H��'�1�1��<R�=�;Q�;Q�;S�E��!2�!2�E�c�E�"/�"8�"8�E�#�,�,�E�44�S�4�c�4��4�!(��c��!2�4�(/��S��(9�4�>G�>Q�>Q�4�n-�S�-�C�-�&3�&C�&C�-�HL�-�&\�c�\��\�W�S�RU�X�EV�\�%2�%B�%B�\�GP�GZ�GZ�\�:#�#�#�#�#�,M�s�M��M�$�M�*
K�(�3�-�
K��
K��
K� �M�9�9��d�3��8�n��<=�c�=�c�=�K�]�-J�-J�K�25�K�:=�K�D�C�D�C�D�C�D�
E�)�"5�"5�E�=�C`�C`�E�#&�E�+.�E�:�
� =� =�:�C�:�TW�:�
@:��6�6�@:�#�@:�$�@:�Fd
T�J�,�,�d
Tr.
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!