JFIF$        dd7 

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

a

}|�g��@spUdZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l
mZddl
mZddl
mZgd
�Zejeeeefddfd�dd�Zejed�dd�Zeje	ejed�dd�Ze	ejeee	ejejdd�dd�Zeddd�dd�ZGdd�deejd�Zd d!d"ejd#d$d%gd#d&ed'd(d)d*�gZeeeefed+<dS),z(New interface style Certbot enhancements�N)�Any)�Callable)�Dict)�	Generator)�Iterable)�List)�Optional)�
configuration)�
interfaces)�	constants)Zredirectzensure-http-headerz
ocsp-stapling)�config�returnccs"tD]}t||d�r|VqdS)z�
    Generator to yield the enabled new style enhancements.

    :param config: Configuration.
    :type config: certbot.configuration.NamespaceConfig
    �cli_destN)�_INDEX�getattr)r�enh�r�@/usr/lib/python3.9/site-packages/certbot/plugins/enhancements.py�enabled_enhancementssrcCstt|��S)z�
    Checks if one or more of the requested enhancements are those of the new
    enhancement interfaces.

    :param config: Configuration.
    :type config: certbot.configuration.NamespaceConfig
    )�anyr)rrrr�
are_requested(sr)r�	installerr
cCs&t|�D]}t||d�sdSqdS)ai
    Checks that all of the requested enhancements are supported by the
    installer.

    :param config: Configuration.
    :type config: certbot.configuration.NamespaceConfig

    :param installer: Installer object
    :type installer: interfaces.Installer

    :returns: If all the requested enhancements are supported by the installer
    :rtype: bool
    �classFT)r�
isinstance)rrrrrr�
are_supported3sr)�lineage�domainsrrr
cCs*|r&t|�D]}t||d�||�qdS)a�
    Run enable method for each requested enhancement that is supported.

    :param lineage: Certificate lineage object
    :type lineage: certbot.interfaces.RenewableCert

    :param domains: List of domains in certificate to enhance
    :type domains: str

    :param installer: Installer object
    :type installer: interfaces.Installer

    :param config: Configuration.
    :type config: certbot.configuration.NamespaceConfig
    �enable_functionN)rr)rrrrrrrr�enableHsr).N)�addr
c	Cs:tD]0}||d|d|d|d|d|dd�qdS)	z�
    Populates the command line flags for certbot._internal.cli.HelpfulParser

    :param add: Add function of certbot._internal.cli.HelpfulParser
    :type add: func
    �
cli_groups�cli_flag�
cli_actionr�cli_flag_default�cli_help)�action�dest�default�helpN)r)rrrrr�populate_cli_s
�r)c@sneZdZdZejejeedd�dd��Z	ejejeedd�dd��Z
ejeejee
eedd�d	d
��ZdS)�AutoHSTSEnhancementa;
    Enhancement interface that installer plugins can implement in order to
    provide functionality that configures the software to have a
    'Strict-Transport-Security' with initially low max-age value that will
    increase over time.

    The plugins implementing new style enhancements are responsible of handling
    the saving of configuration checkpoints as well as calling possible restarts
    of managed software themselves. For update_autohsts method, the installer may
    have to call prepare() to finalize the plugin initialization.

    Methods:
        enable_autohsts is called when the header is initially installed using a
        low max-age value.

        update_autohsts is called every time when Certbot is run using 'renew'
        verb. The max-age value should be increased over time using this method.

        deploy_autohsts is called for every lineage that has had its certificate
        renewed. A long HSTS max-age value should be set here, as we should be
        confident that the user is able to automatically renew their certificates.


    N)r�args�kwargsr
cOsdS)a�
        Gets called for each lineage every time Certbot is run with 'renew' verb.
        Implementation of this method should increase the max-age value.

        :param lineage: Certificate lineage object
        :type lineage: certbot.interfaces.RenewableCert

        .. note:: prepare() method inherited from `interfaces.Plugin` might need
            to be called manually within implementation of this interface method
            to finalize the plugin initialization.
        Nr��selfrr+r,rrr�update_autohsts�sz#AutoHSTSEnhancement.update_autohstscOsdS)a
        Gets called for a lineage when its certificate is successfully renewed.
        Long max-age value should be set in implementation of this method.

        :param lineage: Certificate lineage object
        :type lineage: certbot.interfaces.RenewableCert
        Nrr-rrr�deploy_autohsts�sz#AutoHSTSEnhancement.deploy_autohsts)rrr+r,r
cOsdS)a�
        Enables the AutoHSTS enhancement, installing
        Strict-Transport-Security header with a low initial value to be increased
        over the subsequent runs of Certbot renew.

        :param lineage: Certificate lineage object
        :type lineage: certbot.interfaces.RenewableCert

        :param domains: List of domains in certificate to enhance
        :type domains: `list` of `str`
        Nr)r.rrr+r,rrr�enable_autohsts�sz#AutoHSTSEnhancement.enable_autohsts)�__name__�
__module__�__qualname__�__doc__�abc�abstractmethodr
�
RenewableCertrr/r0rr�strr1rrrrr*ls
	�r*)�	metaclassZAutoHSTSzUGradually increasing max-age value for HTTP Strict Transport Security security headerz--auto-hstsZ	auto_hstsZsecurityZenhance�
store_truer/r0r1)�namer$r!r#r rr"rZupdater_functionZdeployer_functionrr) r5r6�typingrrrrrrrZcertbotr	r
Zcertbot._internalrZENHANCEMENTSZNamespaceConfigr9r�boolrZ	Installerrr8rr)�object�ABCMetar*ZCLI_DEFAULTSr�__annotations__rrrr�<module>sJ
�

��
G��
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Ǧ Gjh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