HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //snap/certbot/5214/lib/python3.12/site-packages/certbot/__pycache__/configuration.cpython-312.pyc
�

Ȗ0i�J���dZddlZddlZddlZddlZddlmZddlmZddlm	Z	ddl
mZddlm
Z
ddlmZdd	lmZej"e�ZGd
�dej(�ZGd�d
�Zdeddfd�Zdedefd�Zy)z$Certbot user-supplied configuration.�N)�Any)�Optional)�parse)�errors)�	constants)�misc)�osc���eZdZdZej
�Z	ej
�Z	ej
�Z	ej
�Z		ej
�Z
y)�ArgumentSourcez;Enum for describing where a configuration argument was set.N)�__name__�
__module__�__qualname__�__doc__�enum�auto�COMMAND_LINE�CONFIG_FILE�DEFAULT�ENV_VAR�RUNTIME����/build/snapcraft-certbot-3159324ea1206d36e7f0992193f2ac71/parts/certbot/install/lib/python3.12/site-packages/certbot/configuration.pyrrsU��E��4�9�9�;�L�4��$�)�)�+�K�6��d�i�i�k�G�N��d�i�i�k�G�;��d�i�i�k�G�0rrc���eZdZdZdej
ddfd�Zdeee	fddfd�Z
dedefd	�Zdeee
ffd
�Zdeddfd�Zedeeee	ffd
��Zdede
fd�Zdede
ddfd�Zedefd��Zej,deddfd��Zedeefd��Zej,deddfd��Zedefd��Zej,deddfd��Zedefd��Zej,deddfd��Zedefd��Zej,deddfd��Zedefd ��Zedefd!��Zedefd"��Zedefd#��Zedefd$��Z edefd%��Z!edefd&��Z"edefd'��Z#edefd(��Z$edefd)��Z%edefd*��Z&ede'efd+��Z(edefd,��Z)edefd-��Z*edefd.��Z+edeefd/��Z,edeefd0��Z-edeefd1��Z.edefd2��Z/d3edefd4�Z0edefd5��Z1edefd6��Z2edefd7��Z3edefd8��Z4edefd9��Z5edefd:��Z6edefd;��Z7edefd<��Z8edefd=��Z9d>e
ddfd?�Z:y)@�NamespaceConfigaConfiguration wrapper around :class:`argparse.Namespace`.

    Please note that the following attributes are dynamically resolved using
    :attr:`~certbot.configuration.NamespaceConfig.work_dir` and relative
    paths defined in :py:mod:`certbot._internal.constants`:

      - `accounts_dir`
      - `in_progress_dir`
      - `temp_checkpoint_dir`

    And the following paths are dynamically resolved using
    :attr:`~certbot.configuration.NamespaceConfig.config_dir` and relative
    paths defined in :py:mod:`certbot._internal.constants`:

      - `default_archive_dir`
      - `live_dir`
      - `renewal_configs_dir`

    :ivar namespace: Namespace typically produced by
        :meth:`argparse.ArgumentParser.parse_args`.
    :type namespace: :class:`argparse.Namespace`

    �	namespace�returnNc�4�|tj|d|�tj|dd�tj|di�tjj	|j
j�|j
_tjj	|j
j�|j
_tjj	|j
j�|j
_t|�y)Nr�_argument_sources�_previously_accessed_mutables)
�object�__setattr__r	�path�abspathr�
config_dir�work_dir�logs_dir�_check_config_sanity)�selfrs  r�__init__zNamespaceConfig.__init__;s�������4��i�8����4�!4�d�;����4�!@�"�E�$&�G�G�O�O�D�N�N�4M�4M�$N����!�"$�'�'�/�/�$�.�.�2I�2I�"J�����"$�'�'�/�/�$�.�.�2I�2I�"J�����	�T�"r�argument_sourcesc�2�tj|d|�y)al
        Associate the NamespaceConfig with a dictionary describing where each of
        its arguments came from, e.g. `{ 'email': ArgumentSource.CONFIG_FILE }`.
        This is necessary for making runtime evaluations on whether an argument
        was specified by the user or not (see `set_by_user`).

        For an example of how to build such a dictionary, see
        `certbot._internal.cli.helpful.HelpfulArgumentParser._build_sources_dict`

        :ivar argument_sources: dictionary of argument names to their :class:`ArgumentSource`
        :type argument_sources: :class:`Dict[str, ArgumentSource]`
        rN)r!r")r)r+s  r�set_argument_sourcesz$NamespaceConfig.set_argument_sourcesIs��	���4�!4�6F�Gr�varc	��ddlm}ddlm}ddlm}|j
�t
d��||vry|dvr&|j|�\}}|d	k(r|duS|d
k(r|duS||j
vrB|j
|tjk7r"tjd|t||��y|j|g�D]<}|j|�s�tjd||j|g��yy)
ad
        Return True if a particular config variable has been set by the user
        (via CLI or config file) including if the user explicitly set it to the
        default, or if it was dynamically set at runtime.  Returns False if the
        variable was assigned a default value.

        Raises an exception if `argument_sources` is not set.
        r)�DEPRECATED_OPTIONS)�
VAR_MODIFIERS)�	selectionNzoNamespaceConfig.set_by_user called without an ArgumentSources dict. See NamespaceConfig.set_argument_sources().F)�
authenticator�	installerr3r4zVar %s=%s (set by user).T)�#certbot._internal.cli.cli_constantsr0r1�certbot._internal.pluginsr2r+�RuntimeError�cli_plugin_requestsrr�logger�debug�getattr�get�set_by_user)r)r.r0r1r2�auth�inst�modifiers        rr=zNamespaceConfig.set_by_user[s��	K�E�7�� � �(��>�?�
?��$�$���0�0�"�6�6�t�<�J�D�$��o�%��4�'�'��k�!��4�'�'��$�'�'�'�D�,A�,A�#�,F�.�J`�J`�,`��L�L�3�S�'�$��:L�M��%�)�)�#�r�2�	�H�����)����7���*�*�3��3�5��		�rc�,�t|j�S)zQ
        Returns a dictionary mapping all argument names to their values
        )�varsr�r)s r�to_dictzNamespaceConfig.to_dict�s���D�N�N�#�#r�namec��|j�:tj|j|<||jvr|j|=yyy)a)
        If an argument_sources dict was set, overwrites an argument's source to
        be ArgumentSource.RUNTIME. Used when certbot sets an argument's values
        at runtime. This also clears the modified value from
        _previously_accessed_mutables since it is no longer needed.
        N)rrrr )r)rEs  r�_mark_runtime_overridez&NamespaceConfig._mark_runtime_override�sL���!�!�-�+9�+A�+A�D�"�"�4�(��t�9�9�9��6�6�t�<�:�.rc���|jj�j�D]2\}}t|j|�}||k7s�"|j|��4|jS)zPReturns _argument_sources after handling any changes to accessed mutable values.)r �copy�itemsr;rrGr)r)rE�
prev_value�
current_values    rr+z NamespaceConfig.argument_sources�sd��!%� B� B� G� G� I� O� O� Q�	2��D�*�#�D�N�N�D�9�M��
�*��+�+�D�1�	2��%�%�%rc��|j}t|j|�}|�U||vs||tjk7r;||j
vr-t
|�s"tj|�|j
|<|S�N)	r+r;rrrr �
_is_immutablerI�deepcopy)r)rE�arg_sources�values    r�__getattr__zNamespaceConfig.__getattr__�su���+�+�������-���"��;�&�+�d�*;�~�?U�?U�*U�
�t�A�A�A�-�X]�J^�?C�}�}�U�?S�D�6�6�t�<��rrRc�T�|j|�t|j||�yrN)rG�setattrr)r)rErRs   rr"zNamespaceConfig.__setattr__�s ���#�#�D�)������e�,rc�.�|jjS)zACME Directory Resource URI.)r�serverrCs rrWzNamespaceConfig.server�s���~�~�$�$�$r�server_c�H�|jd�||j_y)NrW)rGrrW)r)rXs  rrWzNamespaceConfig.server�s���#�#�H�-� '����rc�.�|jjS)z�Email used for registration and recovery contact.

        Use comma to register multiple emails,
        ex: u1@example.com,u2@example.com. (default: Ask).
        )r�emailrCs rr[zNamespaceConfig.email�s���~�~�#�#�#r�mailc�H�|jd�||j_y)Nr[)rGrr[)r)r\s  rr[zNamespaceConfig.email�s���#�#�G�,�#����rc�.�|jjS)zSize of the RSA key.)r�rsa_key_sizerCs rr_zNamespaceConfig.rsa_key_size�s���~�~�*�*�*r�ksizec�H�|jd�||j_y)zSet the rsa_key_size propertyr_N)rGrr_)r)r`s  rr_zNamespaceConfig.rsa_key_size�s��	
�#�#�N�3�&+����#rc�.�|jjS)z`The SECG elliptic curve name to use.

        Please see RFC 8446 for supported values.
        )r�elliptic_curverCs rrczNamespaceConfig.elliptic_curve�s���~�~�,�,�,r�ecurvec�H�|jd�||j_y)zSet the elliptic_curve propertyrcN)rGrrc)r)rds  rrczNamespaceConfig.elliptic_curve�s��	
�#�#�$4�5�(.����%rc�.�|jjS)zhType of generated private key.

        Only *ONE* per invocation can be provided at this time.
        )r�key_typerCs rrgzNamespaceConfig.key_type�s���~�~�&�&�&r�ktypec�H�|jd�||j_y)zSet the key_type propertyrgN)rGrrg)r)rhs  rrgzNamespaceConfig.key_type�s��	
�#�#�J�/�"'����rc�.�|jjS)z�Adds the OCSP Must-Staple extension to the certificate.

        Autoconfigures OCSP Stapling for supported setups
        (Apache version >= 2.3.3 ).
        )r�must_staplerCs rrkzNamespaceConfig.must_staple�����~�~�)�)�)rc�.�|jjS)zConfiguration directory.)rr%rCs rr%zNamespaceConfig.config_dirs���~�~�(�(�(rc�.�|jjS)zWorking directory.)rr&rCs rr&zNamespaceConfig.work_dirs���~�~�&�&�&rc�8�|j|j�S)z2Directory where all account information is stored.)�accounts_dir_for_server_path�server_pathrCs r�accounts_dirzNamespaceConfig.accounts_dirs���0�0��1A�1A�B�Brc��tjj|jjt
j�S)z Configuration backups directory.)r	r#�joinrr&r�
BACKUP_DIRrCs r�
backup_dirzNamespaceConfig.backup_dirs)���w�w�|�|�D�N�N�3�3�Y�5I�5I�J�Jrc��tjj|jjt
j�S)z:Directory used before a permanent checkpoint is finalized.)r	r#rtrr&r�IN_PROGRESS_DIRrCs r�in_progress_dirzNamespaceConfig.in_progress_dirs)���w�w�|�|�D�N�N�3�3�Y�5N�5N�O�Orc��tjj|jjt
j�S)zTemporary checkpoint directory.)r	r#rtrr&r�TEMP_CHECKPOINT_DIRrCs r�temp_checkpoint_dirz#NamespaceConfig.temp_checkpoint_dirs0���w�w�|�|��N�N�#�#�Y�%B�%B�D�	Drc�.�|jjS)z�Disable verification of the ACME server's certificate.

        The root certificates trusted by Certbot can be overridden by setting the
        REQUESTS_CA_BUNDLE environment variable.
        )r�
no_verify_sslrCs rr~zNamespaceConfig.no_verify_ssl%s���~�~�+�+�+rc�.�|jjS)z�Port used in the http-01 challenge.

        This only affects the port Certbot listens on.
        A conforming ACME server will still attempt to connect on port 80.
        )r�http01_portrCs rr�zNamespaceConfig.http01_port.rlrc�.�|jjS)z;The address the server listens to during http-01 challenge.)r�http01_addressrCs rr�zNamespaceConfig.http01_address7s���~�~�,�,�,rc�.�|jjS)z�Port used to serve HTTPS.

        This affects which port Nginx will listen on after a LE certificate
        is installed.
        )r�
https_portrCs rr�zNamespaceConfig.https_port<s���~�~�(�(�(rc�.�|jjS)zuList of user specified preferred challenges.

        Sorted with the most preferred challenge listed first.
        )r�pref_challsrCs rr�zNamespaceConfig.pref_challsEs���~�~�)�)�)rc�.�|jjS)a�Allow only a subset of names to be authorized to perform validations.

        When performing domain validation, do not consider it a failure
        if authorizations can not be obtained for a strict subset of
        the requested domains. This may be useful for allowing renewals for
        multiple domains to succeed even if some domains no longer point
        at this system.
        )r�allow_subset_of_namesrCs rr�z%NamespaceConfig.allow_subset_of_namesMs���~�~�3�3�3rc�.�|jjS)z�Enable strict permissions checks.

        Require that all configuration files are owned by the current
        user; only needed if your config is somewhere unsafe like /tmp/.
        )r�strict_permissionsrCs rr�z"NamespaceConfig.strict_permissionsYs���~�~�0�0�0rc�.�|jjS)z�Disable renewal updates.

        If updates provided by installer enhancements when Certbot is being run
        with "renew" verb should be disabled.
        )r�disable_renew_updatesrCs rr�z%NamespaceConfig.disable_renew_updatesbs���~�~�3�3�3rc�.�|jjS)a]Request the given profile name from the ACME server.

        If the ACME server returns an error, issuance (or renewal) will fail.
        For long-term reliability, setting preferred_profile instead may be
        preferable because it allows fallback to a default. Use this setting
        when renewal failure is preferable to fallback.
        )r�required_profilerCs rr�z NamespaceConfig.required_profileks���~�~�.�.�.rc�.�|jjS)a�Request the given profile name from the ACME server, or fallback to default.

        If the given profile name exists in the ACME directory, use it to request a
        a certificate. Otherwise, fall back to requesting a certificate without a profile
        (which means the CA will use its default profile). This allows renewals to
        succeed even if the CA deprecates and removes a given profile.
        )r�preferred_profilerCs rr�z!NamespaceConfig.preferred_profilevs���~�~�/�/�/rc�.�|jjS)z�Set the preferred certificate chain.

        If the CA offers multiple certificate chains, prefer the chain whose
        topmost certificate was issued from this Subject Common Name.
        If no match, the default offered chain will be used.
        )r�preferred_chainrCs rr�zNamespaceConfig.preferred_chain�s���~�~�-�-�-rc���tj|jj�}|j|j
zj
dtj
j�S)zFile path based on ``server``.�/)	r�urlparserrW�netlocr#�replacer	�sep)r)�parseds  rrqzNamespaceConfig.server_path�sD�������� 5� 5�6���
�
����+�4�4�S�"�'�'�+�+�F�Frrqc��tj|�}tjj	|j
jtj|�S)z/Path to accounts directory based on server_path)	r�.underscores_for_unsupported_characters_in_pathr	r#rtrr%r�ACCOUNTS_DIR)r)rqs  rrpz,NamespaceConfig.accounts_dir_for_server_path�s@���I�I�+�V���w�w�|�|��N�N�%�%�y�'=�'=�{�L�	Lrc��tjj|jjt
j�SrN)r	r#rtrr%r�ARCHIVE_DIRrCs r�default_archive_dirz#NamespaceConfig.default_archive_dir�s'���w�w�|�|�D�N�N�5�5�y�7L�7L�M�Mrc��tjj|jjt
j�SrN)r	r#rtrr%r�LIVE_DIRrCs r�live_dirzNamespaceConfig.live_dir�s'���w�w�|�|�D�N�N�5�5�y�7I�7I�J�Jrc��tjj|jjt
j�SrN)r	r#rtrr%r�RENEWAL_CONFIGS_DIRrCs r�renewal_configs_dirz#NamespaceConfig.renewal_configs_dir�s.���w�w�|�|��N�N�%�%�y�'D�'D�F�	Frc��tjj|jjt
j�S)z>Path to directory with hooks to run with the renew subcommand.)r	r#rtrr%r�RENEWAL_HOOKS_DIRrCs r�renewal_hooks_dirz!NamespaceConfig.renewal_hooks_dir�s.���w�w�|�|�D�N�N�5�5�%�7�7�9�	9rc�r�tjj|jtj
�S)z8Path to the pre-hook directory for the renew subcommand.)r	r#rtr�r�RENEWAL_PRE_HOOKS_DIRrCs r�renewal_pre_hooks_dirz%NamespaceConfig.renewal_pre_hooks_dir�s*���w�w�|�|�D�2�2�%�;�;�=�	=rc�r�tjj|jtj
�S)z;Path to the deploy-hook directory for the renew subcommand.)r	r#rtr�r�RENEWAL_DEPLOY_HOOKS_DIRrCs r�renewal_deploy_hooks_dirz(NamespaceConfig.renewal_deploy_hooks_dir�s,���w�w�|�|�D�2�2�%�>�>�@�	@rc�r�tjj|jtj
�S)z9Path to the post-hook directory for the renew subcommand.)r	r#rtr�r�RENEWAL_POST_HOOKS_DIRrCs r�renewal_post_hooks_dirz&NamespaceConfig.renewal_post_hooks_dir�s*���w�w�|�|�D�2�2�%�<�<�>�	>rc�.�|jjS)zuThis option specifies how long (in seconds) Certbot will wait
        for the server to issue a certificate.
        )r�issuance_timeoutrCs rr�z NamespaceConfig.issuance_timeout�s��
�~�~�.�.�.rc�.�|jjS)z�This option specifies whether Certbot should generate a new private
        key when replacing a certificate, even if reuse_key is set.
        )r�new_keyrCs rr�zNamespaceConfig.new_key�s��
�~�~�%�%�%r�_memoc�6�tj|j�}t|�|�}tj|dtj|j��tj|dtj|j��|S)Nrr )rIrPr�typer!r"r+r )r)r��new_ns�
new_configs    r�__deepcopy__zNamespaceConfig.__deepcopy__�sr�����t�~�~�.���T�$�Z��'�
����:�':�D�M�M�$�J_�J_�<`�a����:�'F��=�=��)K�)K�L�	N��r);rr
rr�argparse�	Namespacer*�dict�strrr-�boolr=rrDrG�propertyrr+rSr"rW�setterr[�intr_rcrgrkr%r&rrrvryr|r~r�r�r��listr�r�r�r�r�r�r�rqrpr�r�r�r�r�r�r�r�r�r�rrrrr"si���0#�(�"4�"4�#��#�H�T�#�~�:M�5N�H�SW�H�$(�s�(�t�(�T$��c�3�h��$�
=�3�
=�4�
=��&�(�4��^�0C�+D�"E�&��&�&
��
��
�-��-�C�-�D�-��%��%��%��]�]�(�c�(�d�(��(��$�x��}�$��$��\�\�$�#�$�$�$��$��+�c�+��+����,�#�,�$�,��,�
�-��-��-����/�S�/�T�/��/�
�'�#�'��'��_�_�(�c�(�d�(��(�
�*�T�*��*��)�C�)��)��'�#�'��'��C�c�C��C��K�C�K��K��P��P��P��D�S�D��D�
�,�t�,��,��*�S�*��*��-��-��-��)�C�)��)��*�T�#�Y�*��*��	4�t�	4��	4��1�D�1��1��4�t�4��4��/�(�3�-�/��/��0�8�C�=�0��0��.��#��.��.��G�S�G��G�
L��L��L��N�S�N��N��K�#�K��K��F�S�F��F��9�3�9��9�
�=�s�=��=�
�@�#�@��@�
�>��>��>�
�/�#�/��/��&��&��&��#��*;�rr�configrc��|j|jk(r.tjdj	|j���y)z�Validate command line options and display error message if
    requirements are not met.

    :param config: NamespaceConfig instance holding user configuration
    :type args: :class:`certbot.configuration.NamespaceConfig`

    z;Trying to run http-01 and https-port on the same port ({0})N)r�r�r�ConfigurationError�format)r�s rr(r(�sG�����V�.�.�.��'�'�
%�%+�V�F�,=�,=�%>�@�	@�/rrRc��t|t�rtd�|D��Sttt
ttttfD]}t||�s�y|duS)zIs value of an immutable type?c3�2K�|]}t|����y�wrN)rO)�.0�subvalues  r�	<genexpr>z _is_immutable.<locals>.<genexpr>�s����A�x�=��*�A�s�TN)
�
isinstance�tuple�allr��float�complexr��bytesr��	frozenset)rR�immutable_types  rrOrO�sT���%����A�5�A�A�A���w��U�D�)�M����e�^�,����D�=�r)rr�rIr�logging�typingrr�urllibr�certbotr�certbot._internalr�certbot.compatrr	�	getLoggerrr9�Enumrrr(r�rOrrr�<module>r�s���*���������'���
��	�	�8�	$��1�T�Y�Y�1�r�r�j
@��@�T�@�	��	��	r