JFIF$        dd7 

Viewing File: /usr/lib/python3.9/site-packages/certbot/__pycache__/configuration.cpython-39.pyc

a

}|�g�G�@s�dZddlZddlZddlZddlZddlmZddlmZddlmZddlm	Z	ddl
mZddlm
Z
dd	lmZdd
lmZddlmZddlmZe�e�ZGd
d�dej�ZGdd�d�Zedd�dd�Zeed�dd�ZdS)z$Certbot user-supplied configuration.�N)�Any)�Dict)�List)�Optional)�parse)�errors)�util)�	constants)�misc)�osc@s8eZdZdZe��Ze��Ze��Ze��Z	e��Z
dS)�ArgumentSourcez;Enum for describing where a configuration argument was set.N)�__name__�
__module__�__qualname__�__doc__�enum�autoZCOMMAND_LINEZCONFIG_FILE�DEFAULTZENV_VAR�RUNTIME�rr�9/usr/lib/python3.9/site-packages/certbot/configuration.pyrsrc@sxeZdZdZejdd�dd�Zeee	fdd�dd�Z
eed	�d
d�Zeee
fd�d
d�Zedd�dd�Zeeeee	fd�dd��Zee
d�dd�Zee
dd�dd�Zeed�dd��Zejedd�dd��Zeeed�dd��Zejedd�d d��Zeed�d!d"��Zejedd#�d$d"��Zeed�d%d&��Zejedd'�d(d&��Zeed�d)d*��Zejedd+�d,d*��Zeed�d-d.��Zeed�d/d0��Zeed�d1d2��Zeed�d3d4��Zeed�d5d6��Z eed�d7d8��Z!eed�d9d:��Z"eed�d;d<��Z#eed�d=d>��Z$eed�d?d@��Z%eed�dAdB��Z&ee'ed�dCdD��Z(eed�dEdF��Z)eed�dGdH��Z*eed�dIdJ��Z+eeed�dKdL��Z,eed�dMdN��Z-eedO�dPdQ�Z.eed�dRdS��Z/eed�dTdU��Z0eed�dVdW��Z1eed�dXdY��Z2eed�dZd[��Z3eed�d\d]��Z4eed�d^d_��Z5eed�d`da��Z6eed�dbdc��Z7e
ddd�dedf�Z8dS)g�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`

    N)�	namespace�returncCsv|t�|d|�t�|dd�t�|di�tj�|jj�|j_tj�|jj�|j_tj�|jj�|j_t	|�dS)Nr�_argument_sources�_previously_accessed_mutables)
�object�__setattr__r�path�abspathr�
config_dir�work_dirZlogs_dir�_check_config_sanity)�selfrrrr�__init__>szNamespaceConfig.__init__)�argument_sourcesrcCst�|d|�dS)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)rr)r#r%rrr�set_argument_sourcesLsz$NamespaceConfig.set_argument_sources)�varrc	Cs�ddlm}ddlm}ddlm}|jdur6td��||vrBdS|dvrx|�|�\}}|d	krh|duS|d
krx|duS||jvr�|j|tj	kr�t
�d|t||��dS|�
|g�D]*}|�|�r�t
�d||�
|g��dSq�dS)
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�	installerr+r,zVar %s=%s (set by user).T)Z#certbot._internal.cli.cli_constantsr(r)Zcertbot._internal.pluginsr*r%�RuntimeErrorZcli_plugin_requestsrr�logger�debug�getattr�get�set_by_user)r#r'r(r)r*Zauth�inst�modifierrrrr2^s2	
�
�zNamespaceConfig.set_by_user)rcCs
t|j�S)zQ
        Returns a dictionary mapping all argument names to their values
        )�varsr�r#rrr�to_dict�szNamespaceConfig.to_dict)�namercCs,|jdur(tj|j|<||jvr(|j|=dS)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)rrrr)r#r8rrr�_mark_runtime_override�s

z&NamespaceConfig._mark_runtime_overridecCs<|j����D]&\}}t|j|�}||kr|�|�q|jS)zPReturns _argument_sources after handling any changes to accessed mutable values.)r�copy�itemsr0rr9r)r#r8Z
prev_valueZ
current_valuerrrr%�s
	z NamespaceConfig.argument_sourcescCsV|j}t|j|�}|durR||vs0||tjkrR||jvrRt|�sRt�|�|j|<|S�N)	r%r0rrrr�
_is_immutabler:�deepcopy)r#r8Zarg_sources�valuerrr�__getattr__�szNamespaceConfig.__getattr__)r8r?rcCs|�|�t|j||�dSr<)r9�setattrr)r#r8r?rrrr�s
zNamespaceConfig.__setattr__cCs|jjS)zACME Directory Resource URI.)r�serverr6rrrrB�szNamespaceConfig.server)�server_rcCs|�d�||j_dS)NrB)r9rrB)r#rCrrrrB�s
cCs|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�emailr6rrrrD�szNamespaceConfig.email)�mailrcCs|�d�||j_dS)NrD)r9rrD)r#rErrrrD�s
cCs|jjS)zSize of the RSA key.)r�rsa_key_sizer6rrrrF�szNamespaceConfig.rsa_key_size)�ksizercCs|�d�||j_dS)zSet the rsa_key_size propertyrFN)r9rrF)r#rGrrrrF�s
cCs|jjS)z`The SECG elliptic curve name to use.

        Please see RFC 8446 for supported values.
        )r�elliptic_curver6rrrrH�szNamespaceConfig.elliptic_curve)�ecurvercCs|�d�||j_dS)zSet the elliptic_curve propertyrHN)r9rrH)r#rIrrrrH�s
cCs|jjS)zhType of generated private key.

        Only *ONE* per invocation can be provided at this time.
        )r�key_typer6rrrrJ�szNamespaceConfig.key_type)�ktypercCs|�d�||j_dS)zSet the key_type propertyrJN)r9rrJ)r#rKrrrrJ�s
cCs|jjS)z�Adds the OCSP Must-Staple extension to the certificate.

        Autoconfigures OCSP Stapling for supported setups
        (Apache version >= 2.3.3 ).
        )r�must_stapler6rrrrLszNamespaceConfig.must_staplecCs|jjS)zConfiguration directory.)rr r6rrrr 	szNamespaceConfig.config_dircCs|jjS)zWorking directory.)rr!r6rrrr!szNamespaceConfig.work_dircCs|�|j�S)z2Directory where all account information is stored.)�accounts_dir_for_server_path�server_pathr6rrr�accounts_dirszNamespaceConfig.accounts_dircCstj�|jjtj�S)z Configuration backups directory.)rr�joinrr!r	Z
BACKUP_DIRr6rrr�
backup_dirszNamespaceConfig.backup_dircCstj�|jjtj�S)z:Directory used before a permanent checkpoint is finalized.)rrrPrr!r	ZIN_PROGRESS_DIRr6rrr�in_progress_dirszNamespaceConfig.in_progress_dircCstj�|jjtj�S)zTemporary checkpoint directory.)rrrPrr!r	ZTEMP_CHECKPOINT_DIRr6rrr�temp_checkpoint_dir"s
�z#NamespaceConfig.temp_checkpoint_dircCs|jjS)z�Disable verification of the ACME server's certificate.

        The root certificates trusted by Certbot can be overriden by setting the
        REQUESTS_CA_BUNDLE environment variable.
        )r�
no_verify_sslr6rrrrT(szNamespaceConfig.no_verify_sslcCs|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_portr6rrrrU1szNamespaceConfig.http01_portcCs|jjS)z;The address the server listens to during http-01 challenge.)r�http01_addressr6rrrrV:szNamespaceConfig.http01_addresscCs|jjS)z�Port used to serve HTTPS.

        This affects which port Nginx will listen on after a LE certificate
        is installed.
        )r�
https_portr6rrrrW?szNamespaceConfig.https_portcCs|jjS)zuList of user specified preferred challenges.

        Sorted with the most preferred challenge listed first.
        )r�pref_challsr6rrrrXHszNamespaceConfig.pref_challscCs|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_namesr6rrrrYPs
z%NamespaceConfig.allow_subset_of_namescCs|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_permissionsr6rrrrZ\sz"NamespaceConfig.strict_permissionscCs|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_updatesr6rrrr[esz%NamespaceConfig.disable_renew_updatescCs|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_chainr6rrrr\nszNamespaceConfig.preferred_chaincCs&t�|jj�}|j|j�dtjj�S)zFile path based on ``server``.�/)	r�urlparserrB�netlocr�replacer�sep)r#�parsedrrrrNxszNamespaceConfig.server_path)rNrcCs t�|�}tj�|jjtj|�S)z/Path to accounts directory based on server_path)	r
Z.underscores_for_unsupported_characters_in_pathrrrPrr r	ZACCOUNTS_DIR)r#rNrrrrM~s
�z,NamespaceConfig.accounts_dir_for_server_pathcCstj�|jjtj�Sr<)rrrPrr r	ZARCHIVE_DIRr6rrr�default_archive_dir�sz#NamespaceConfig.default_archive_dircCstj�|jjtj�Sr<)rrrPrr r	ZLIVE_DIRr6rrr�live_dir�szNamespaceConfig.live_dircCstj�|jjtj�Sr<)rrrPrr r	ZRENEWAL_CONFIGS_DIRr6rrr�renewal_configs_dir�s
�z#NamespaceConfig.renewal_configs_dircCstj�|jjtj�S)z>Path to directory with hooks to run with the renew subcommand.)rrrPrr r	ZRENEWAL_HOOKS_DIRr6rrr�renewal_hooks_dir�s�z!NamespaceConfig.renewal_hooks_dircCstj�|jtj�S)z8Path to the pre-hook directory for the renew subcommand.)rrrPrfr	ZRENEWAL_PRE_HOOKS_DIRr6rrr�renewal_pre_hooks_dir�s
�z%NamespaceConfig.renewal_pre_hooks_dircCstj�|jtj�S)z;Path to the deploy-hook directory for the renew subcommand.)rrrPrfr	ZRENEWAL_DEPLOY_HOOKS_DIRr6rrr�renewal_deploy_hooks_dir�s
�z(NamespaceConfig.renewal_deploy_hooks_dircCstj�|jtj�S)z9Path to the post-hook directory for the renew subcommand.)rrrPrfr	ZRENEWAL_POST_HOOKS_DIRr6rrr�renewal_post_hooks_dir�s
�z&NamespaceConfig.renewal_post_hooks_dircCs|jjS)zuThis option specifies how long (in seconds) Certbot will wait
        for the server to issue a certificate.
        )r�issuance_timeoutr6rrrrj�sz NamespaceConfig.issuance_timeoutcCs|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_keyr6rrrrk�szNamespaceConfig.new_key)�_memorcCsHt�|j�}t|�|�}t�|dt�|j��t�|dt�|j��|S)Nrr)r:r>r�typerrr%r)r#rlZnew_nsZ
new_configrrr�__deepcopy__�s
�zNamespaceConfig.__deepcopy__)9r
rrr�argparse�	Namespacer$r�strrr&�boolr2rr7r9�propertyrr%r@rrB�setterrD�intrFrHrJrLr r!rOrQrRrSrTrUrVrWrrXrYrZr[r\rNrMrcrdrerfrgrhrirjrkrnrrrrr%s�*	r)�configrcCsF|j|jkrt�d�|j���|jjdurB|jjD]}t�|�q2dS)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)	rUrWrZConfigurationError�formatrZdomainsrZenforce_domain_sanity)rv�domainrrrr"�s	��r")r?rcCsLt|t�rtdd�|D��Sttttttt	fD]}t||�r.dSq.|duS)zIs value of an immutable type?css|]}t|�VqdSr<)r=)�.0Zsubvaluerrr�	<genexpr>��z _is_immutable.<locals>.<genexpr>TN)
�
isinstance�tuple�allru�float�complexrq�bytesrr�	frozenset)r?Zimmutable_typerrrr=�s

r=)rror:rZlogging�typingrrrrZurllibrZcertbotrrZcertbot._internalr	Zcertbot.compatr
rZ	getLoggerr
r.�Enumrrr"rrr=rrrr�<module>s,
"
Back to Directory  nL+D550H?Mx ,D"v]qv;6*Zqn)ZP0!1 A "#a$2Qr D8 a Ri[f\mIykIw0cuFcRı?lO7к_f˓[C$殷WF<_W ԣsKcëIzyQy/_LKℂ;C",pFA:/]=H  ~,ls/9ć:[=/#f;)x{ٛEQ )~ =𘙲r*2~ a _V=' kumFD}KYYC)({ *g&f`툪ry`=^cJ.I](*`wq1dđ#̩͑0;H]u搂@:~וKL Nsh}OIR*8:2 !lDJVo(3=M(zȰ+i*NAr6KnSl)!JJӁ* %݉?|D}d5:eP0R;{$X'xF@.ÊB {,WJuQɲRI;9QE琯62fT.DUJ;*cP A\ILNj!J۱+O\͔]ޒS߼Jȧc%ANolՎprULZԛerE2=XDXgVQeӓk yP7U*omQIs,K`)6\G3t?pgjrmۛجwluGtfh9uyP0D;Uڽ"OXlif$)&|ML0Zrm1[HXPlPR0'G=i2N+0e2]]9VTPO׮7h(F*癈'=QVZDF,d߬~TX G[`le69CR(!S2!P <0x<!1AQ "Raq02Br#SCTb ?Ζ"]mH5WR7k.ۛ!}Q~+yԏz|@T20S~Kek *zFf^2X*(@8r?CIuI|֓>^ExLgNUY+{.RѪ τV׸YTD I62'8Y27'\TP.6d&˦@Vqi|8-OΕ]ʔ U=TL8=;6c| !qfF3aů&~$l}'NWUs$Uk^SV:U# 6w++s&r+nڐ{@29 gL u"TÙM=6(^"7r}=6YݾlCuhquympǦ GjhsǜNlɻ}o7#S6aw4!OSrD57%|?x>L |/nD6?/8w#[)L7+6〼T ATg!%5MmZ/c-{1_Je"|^$'O&ޱմTrb$w)R$& N1EtdU3Uȉ1pM"N*(DNyd96.(jQ)X 5cQɎMyW?Q*!R>6=7)Xj5`J]e8%t!+'!1Q5 !1 AQaqё#2"0BRb?Gt^## .llQT $v,,m㵜5ubV =sY+@d{N! dnO<.-B;_wJt6;QJd.Qc%p{ 1,sNDdFHI0ГoXшe黅XۢF:)[FGXƹ/w_cMeD,ʡcc.WDtA$j@:) -# u c1<@ۗ9F)KJ-hpP]_x[qBlbpʖw q"LFGdƶ*s+ډ_Zc"?%t[IP 6J]#=ɺVvvCGsGh1 >)6|ey?Lӣm,4GWUi`]uJVoVDG< SB6ϏQ@ TiUlyOU0kfV~~}SZ@*WUUi##; s/[=!7}"WN]'(L! ~y5g9T̅JkbM' +s:S +B)v@Mj e Cf jE 0Y\QnzG1д~Wo{T9?`Rmyhsy3!HAD]mc1~2LSu7xT;j$`}4->L#vzŏILS ֭T{rjGKC;bpU=-`BsK.SFw4Mq]ZdHS0)tLg