ok

Mini Shell

Direktori : /lib/python3.6/site-packages/certbot/plugins/__pycache__/
Upload File :
Current File : //lib/python3.6/site-packages/certbot/plugins/__pycache__/enhancements.cpython-36.pyc

3

گa��@snUdZddlZddlmZddlmZddlmZddlmZddlmZddlmZdd	lm	Z	dd
l
mZddl
mZddl
mZd
ddgZejeeeefddfd�dd�Zejed�dd�Zeje	ejed�dd�Ze	ejeee	ejejdd�dd�Zed.dd�dd�ZGdd �d eejd!�Zd"d/d%ejd&d'd(gd&d)ed*d+d,d-�gZeeeefdS)0z(New interface style Certbot enhancements�N)�Any)�Callable)�Dict)�	Generator)�Iterable)�List)�Optional)�
configuration)�
interfaces)�	constantsZredirectzensure-http-headerz
ocsp-stapling)�config�returnccs&x tD]}t||d�r|VqWdS)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.6/enhancements.py�enabled_enhancementss
rcCstt|��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)rrrr�
are_requested(sr)r�	installerr
cCs(x"t|�D]}t||d�s
dSq
WdS)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)rrrrrr�
are_supported3sr)�lineage�domainsrrr
cCs.|r*x$t|�D]}t||d�||�qWdS)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)rrrrrrrr�enableHsr.)�addr
c	Cs>x8tD]0}||d|d|d|d|d|dd�qWdS)	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
ejeejee
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
        Nr)r-rr+r,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.r/rr�strr0rrrrr*ls
	r*)�	metaclassZAutoHSTSz=Gradually increasing max-age value for HTTP Strict Transport zSecurity security headerz--auto-hstsZ	auto_hstsZsecurityZenhance�
store_truer.r/r0)�namer$r!r#r rr"rZupdater_functionZdeployer_functionr).NzUGradually increasing max-age value for HTTP Strict Transport Security security header)r4r5ZtypingrrrrrrrZcertbotr	r
Zcertbot._internalrZENHANCEMENTSZNamespaceConfigr8r�boolrZ	Installerrr7rr)�object�ABCMetar*ZCLI_DEFAULTSrrrrr�<module>sB

$
G

Zerion Mini Shell 1.0