Spamworldpro Mini Shell
Spamworldpro


Server : Apache/2.4.62 (Unix) OpenSSL/1.0.2k-fips
System : Linux server1.richineiserver.com 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User : fdshops ( 1003)
PHP Version : 8.2.21
Disable Function : NONE
Directory :  /lib/python2.7/site-packages/certbot/_internal/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : //lib/python2.7/site-packages/certbot/_internal/storage.pyc
�
���_c@s{dZddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlmZddl
mZddlmZddlZddlmZddlmZddlmZdd	lmZdd
lmZddlmZddlmZdd
lmZddlmZddlmZddlm Z ddl!m"Z#ej$e%�Z&d,Z'dZ(ej)ej*�Z+dZ,d�Z-d�Z.d�Z/dd�Z1ej2�d�Z3d�Z4d�Z5d�Z6d �Z7e8d!�Z9d"�Z:d#�Z;d$�Z<d%�Z=d&�Z>d'�Z?d(�Z@d)�ZAd*ejBfd+��YZBdS(-sRenewable certificates storage.i����N(tdefault_backend(t
RSAPrivateKey(tload_pem_private_key(tcrypto_util(terrors(t
interfaces(tocsp(tutil(tcli(t	constants(t
error_handler(tdisco(t
filesystem(tos(tcommontcerttprivkeytchaint	fullchaintREADMEi�cCs/tjtjj|jd��}|j�|S(s�Build a list of all renewal configuration files.

    :param certbot.interfaces.IConfig config: Configuration object

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

    s*.conf(tglobR
tpathtjointrenewal_configs_dirtsort(tconfigtresult((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytrenewal_conf_files's	!
cCsUtjj|jdj|��}tjj|�sQtjdj||���n|S(s;Return /path/to/certname.conf in the renewal conf directorys{0}.confs2No certificate found with name {0} (expected {1}).(R
RRRtformattexistsRtCertStorageError(RtcertnameR((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytrenewal_file_for_certname5s
!cCsMt||�}tj|�d}t|��}||j�f}WdQX|S(s� 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.

    RN(R t	configobjt	ConfigObjtopentread(Rt	cert_nametcert_name_implied_conftfullchain_pathtft	cert_path((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytcert_path_for_cert_name>s
cCs;tjtj�}|j|dk	r*|n	tj��|S(s?Merge supplied config, if provided, on top of builtin defaults.N(R!R"R	tRENEWER_DEFAULTStmergetNone(Rt
defaults_copy((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytconfig_with_defaultsLs%cCsK|j�j�r|d7}n|jp.tj}|j||d|�dS(s�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`s daysttzinfoi(tstriptisdigitR0tpytztUTCtparseDT(t	base_timetintervalt
textparserR0((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytadd_time_intervalSs
cCsltj|�}tj|d<||d<xtD]}||||<q-Wd|krqi|d<ddg|jd<n|dj|�x,|dD] }||kr�|d|=q�q�Wd|kr�tjd}d|g|_	nt
jd|�t|d	�j
�tjj|�r@tjtj|�j�}	tj||	�nt|d
��}
|jd|
�WdQX|S(
sWrites 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

    tversiontarchive_dirt
renewalparamsts#Options used in the renewal processtrenew_before_expirysrenew_before_expiry = sWriting new config %s.tatwbtoutfileN(R!R"tcertbott__version__tALL_FOURtcommentstupdateR	R+tinitial_commenttloggertdebugR#tcloseR
RRtstattS_IMODEtlstattst_modeRtchmodtwrite(t
o_filenamet
n_filenameR;ttargett
relevant_dataRtkindtktdefault_intervaltcurrent_permissionsR(((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytwrite_renewal_configks0





cCs}t||�}t||�}tjj|�rBtjd��nytj||�Wn tk
rxtjd��nXdS(s�Renames cli_config.certname's config to cli_config.new_certname.

    :param .NamespaceConfig cli_config: parsed command line
        arguments
    s+The new certificate name is already in use.s=Please specify a valid filename for the new certificate name.N(	t renewal_filename_for_lineagenameR
RRRtConfigurationErrorRtreplacetOSError(t	prev_nametnew_namet
cli_configt
prev_filenametnew_filename((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytrename_renewal_config�s
cCs�t||�}|d}tjj|�r;tj|�ntt|j��}t|||||�t	j
||�tj|�S(s�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

    s.new(
RZR
RRtunlinktrelevant_valuestvarst	namespaceRYRR\R!R"(tlineagenameR;RSR`tconfig_filenamet
temp_filenametvalues((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytupdate_configuration�s

cCs�ytj|�}Wn)tk
r>tjdj|���nXtjj|�sutjjtjj	|�|�}ntjj
|�S(s�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.

    sExpected {0} to be a symlink(R
treadlinkR]RRRRtisabsRtdirnametabspath(tlinkRS((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytget_link_target�s
$cCsZd}|rd}nt|d��0}tjd|�|jdjd|��WdQXdS(NR=s[cert name]/twsWriting README to %s.s�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.
tprefix(R#RHRIRPR(treadme_pathtis_base_dirRtR(((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt_write_live_readme_to�s	cs9ddlm}�|jkp8t�fd�|D��S(s�
    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
    i����(trenewalc3s|]}�j|�VqdS(N(t
startswith(t.0Rg(toption(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>s(tcertbot._internalRxtCONFIG_ITEMStany(t
namespacesR{Rx((R{s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt	_relevant�s
cshtjj�}g|D]}tj|�^q�t�fd�tj|�D��}|d|d<|S(s�Return a new dict containing only items relevant for renewal.

    :param dict all_values: The original values.

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

    c3sB|]8\}}t�|�rtj||�r||fVqdS(N(R�Rtoption_was_set(RzR{tvalue(R(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>s	tserver(t
plugins_discotPluginsRegistrytfind_alltplugins_commontdest_namespacetdicttsixt	iteritems(t
all_valuestpluginstplugintrv((Rs=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyRes	"cCs<|jd�s!tjd��ntjj|td� �S(s:Returns the lineagename for a configuration filename.
    s.confs*renewal config file name must end in .conf(tendswithRRR
Rtbasenametlen(Ri((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytlineagename_for_filenamescCstjj|j|�dS(s:Returns the lineagename for a configuration filename.
    s.conf(R
RRR(RRh((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyRZ%scCstjj|tjj|��S(sPath to a directory from a file(R
RtrelpathRo(R;t	from_file((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt_relpath_from_file*scCs0|rd|kr|dStjj|j|�S(sMReturns 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
    R;(R
RRtdefault_archive_dir(t
config_objR`Rh((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytfull_archive_path.s	cCstjj|j|�S(s4Returns the full default live path for a lineagename(R
RRtlive_dir(R`Rh((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt_full_live_path;scCsUt||�}td||�}t||�}z\ytj|�}WnBtjk
r�tjd|||�t	j
dj|���nXWdtj
|�tjd|�Xt�}x�tD]y}|j|�}y!tj
|�tjd|�Wn!tk
rtjd|�nXtjj|�}	|j|	�q�Wt|�dkr�|j�}	tjj|	t�}
y!tj
|
�tjd|
�Wn!tk
r�tjd|
�nXy!tj|	�tjd|	�Wq�tk
r�tjd|	�q�Xny3t|||�}tj|�tjd|�Wn!tk
rPtjd|�nXdS(	smDelete all files related to the certificate.

    If some files are not found, ignore them and continue.
    sNCould not parse %s. You may wish to manually delete the contents of %s and %s.serror parsing {0}Ns
Removed %ssUnable to delete %sis&Unable to remove %s; may not be empty.sUnable to remove %s(R R�R-R�R!R"tConfigObjErrorRHtwarningRRRR
tremoveRItsetRDtgetR]RRotaddR�tpopRRtrmdirtshutiltrmtree(RRtrenewal_filenametfull_default_archive_dirtfull_default_live_dirtrenewal_configtdirectory_namesRURqt	directoryRutarchive_path((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytdelete_files?sV	

	








t
RenewableCertcBseZdZed�Zed��Zed��Zed��Zed��Z	ed��Z
ed��Zed��Zd	�Z
ed
��Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z d�Z!d�Z"d�Z#e$d ��Z%ed!��Z&d"�Z'RS(#sRenewable 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.

    cs{|�_t|��_ytj|��_Wn,tjk
r\tjdj	|���nXt
�j��_t�fd�t
D��s�tjdj	�j���n�jjd�}|d
k	r�tj|�tkr�tjd||tj�n�jd�_�jd�_�jd�_�jd	�_tjj�j��_�j�|rm�j �n�j!�d
S(sInstantiate 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.

        serror parsing {0}c3s|]}|�jkVqdS(N(t
configuration(Rztx(tself(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>�ss<renewal config file {0} is missing a required file referenceR:szAttempting to parse the version %s renewal configuration file found at %s with version %s of Certbot. This might not work.RRRRN("R`R�t_lineagenameR!R"t
configfileR�RRRR/R�tallRDR�R-Rtget_strict_versiontCURRENT_VERSIONRHtinfoRBRCRRRRR
RRoR�t
_fix_symlinkst_update_symlinkst_check_symlinks(R�RiR`tupdate_symlinkstconf_version((R�s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt__init__�s6	

cCs|jS(sDuck type for self.privkey(R(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytkey_path�scCs|jS(sDuck type for self.cert(R(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR)�scCs|jS(sDuck type for self.chain(R(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt
chain_path�scCs|jS(sDuck type for self.fullchain(R(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR'�scCs|jS(sEName given to the certificate lineage.

        :rtype: str

        (R�(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyRh�scCstj|jd��S(s�The current target certificate's expiration datetime

        :returns: Expiration datetime of the current target certificate
        :rtype: :class:`datetime.datetime`
        R(RtnotAftertcurrent_target(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt
target_expiry�scCst|j|j|j�S(s2Returns the default or specified archive directory(R�R�R`Rh(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR;�s	cCst|j|�S(syReturns the default or specified archive directory as a relative path

        Used for creating symbolic links.
        (R�R;(R�R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytrelative_archive_dirscCs0|jdjdd�}|r,tj|�StS(s:Returns true if this is a test cert from a staging server.R<R�N(R�R�R-Rt
is_stagingtFalse(R�R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytis_test_certs
cCs�x�tD]~}t||�}tjj|�sItjdj|���nt|�}tjj	|�stjdj||���qqWdS(s.Raises an exception if a symlink doesn't existsexpected {0} to be a symlinks(target {0} of symlink {1} does not existN(
RDtgetattrR
RtislinkRRRRrR(R�RURqRS((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR�s
cCswxptD]h}t||�}t|�}tjj|j|�tjj|��}tj|�tj	||�qWdS(s#Updates symlinks to use archive_dirN(
RDR�RrR
RRR�R�Rdtsymlink(R�RURqt
previous_linktnew_link((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR�s

cCs�xL|j|j|j|jfD],}tjj|�stjd|�t	SqWxL|j|j|j|jfD],}tjj
|�sntjd|�t	SqnWx�tD]�}t||�}t
|�}tjjtjj|�|j�stjd|tjj|�|j�t	Stjj|�s<tjd||�t	Stjdj|��}|jtjj|��s�tjd|�t	Sq�WtS(s�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

        s3Element %s is not referenced with an absolute path.s"Element %s is not a symbolic link.s-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.s.Link %s points to file %s that does not exist.s^{0}([0-9]+)\.pem$s1%s does not follow the archive naming convention.(RRRRR
RRnRHRIR�R�RDR�RrtsamefileRoR;RtretcompileRtmatchR�tTrue(R�R�RURqRStpattern((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt_consistent*s4
%	%
$		
	cCsdS(spAttempt to fix defects or inconsistencies in this lineage.

        .. todo:: Currently unimplemented.

        N((R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt_fixnscCsgg}xZtD]R}tjjt||��}dj|�}|j|tjj||�f�q
W|S(s�Returns the kind and path of all symlinks used in recovery.

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

        sprevious_{0}.pem(RDR
RRoR�RtappendR(R�tprevious_symlinksRUtlink_dirt	link_base((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt_previous_symlinks�s
&cCs�|j�}td�|D��r�xa|D]V\}}t||�}tjj|�rftj|�ntjtj|�|�q)Wnx6|D].\}}tjj	|�r�tj|�q�q�WdS(s�Fixes symlinks in the event of an incomplete version update.

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

        css%|]}tjj|d�VqdS(iN(R
RR(RzRq((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>�sN(
R�R�R�R
RtlexistsRdR�RmR(R�R�RUR�tcurrent_linkt_Rq((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR��s cCs`|tkrtjd��nt||�}tjj|�sVtjd||�dSt
|�S(s(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

        sunknown kind of items*Expected symlink %s for %s does not exist.N(RDRRR�R
RRRHRIR-Rr(R�RURq((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR��s	
cCs�|tkrtjd��ntjdj|��}|j|�}|dksdtj	j
|�r�tjd||�d}n|j
tj	j|��}|r�t|j�d�Stjd|�dS(s�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

        sunknown kind of items^{0}([0-9]+)\.pem$s3Current-version target for %s does not exist at %s.R=isNo matches for target %s.N(RDRRR�R�RR�R-R
RRRHRIR�R�tinttgroups(R�RUR�RStmatches((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytcurrent_version�s
	
	cCsX|tkrtjd��ntjj|j|��}tjj|dj||��S(s�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

        sunknown kind of items
{0}{1}.pem(	RDRRR
RRoR�RR(R�RUR:twhere((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR:�scCs�|tkrtjd��ntjj|j|��}tj|�}tj	dj
|��}g|D]}|j|�^qg}tg|D]"}|r�t
|j�d�^q��S(s�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`

        sunknown kind of items^{0}([0-9]+)\.pem$i(RDRRR
RRoR�tlistdirR�R�RR�tsortedR�R�(R�RUR�tfilesR�R(R�tm((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytavailable_versions�s
"cCst|j|��S(sNewest 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

        (tmaxR�(R�RU((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytnewest_available_version�s
cs@gtD]}|j|�^q�t�fd��dD��S(s�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

        c3s5|]+�t�fd��dD��r�VqdS(c3s|]}�|kVqdS(N((Rztv(tn(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>siN(R�(Rz(tversions(R�s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>si(RDR�R�(R�R�((R�s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytlatest_common_versions"cst�fd�tD��dS(s�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

        c3s|]}�j|�VqdS(N(R�(RzR�(R�(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>!si(R�RD(R�((R�s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytnext_free_versionscCs4|j�r0tjd�|j|j��tStS(s�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.sMFound a new certificate /archive/ that was not linked to in /live/; fixing...(thas_pending_deploymentRHR�tupdate_all_links_toR�R�R�(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytensure_deployed#s

cs,t�fd�tD��}|�j�kS(sIs 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

        c3s|]}�j|�VqdS(N(R�(RzR�(R�(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys	<genexpr>>s(tminRDR�(R�tsmallest_current((R�s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR�3scCs�|tkrtjd��nt||�}dj||�}tjjtj|��}tj	|�tj
tjj||�|�dS(s7Make 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

        sunknown kind of items
{0}{1}.pemN(RDRRR�RR
RRoRmRdR�R(R�RUR:Rqtfilenamettarget_directory((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt_update_link_toAs
cCs�tj|j���|j�}x-|D]%\}}tj|j|�|�q&WxtD]}|j||�qVWx!|D]\}}tj	|�qwWWdQXdS(swChange all member objects to point to the specified version.

        :param int version: the desired version

        N(
R
tErrorHandlerR�R�R
R�R�RDR�Rd(R�R:tprevious_linksRURqR�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR�[s
cCsY|jd�}|dkr-tjd��nt|��}tj|j��SWdQXdS(s�What are the subject names of this certificate?

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

        Rs#could not find the certificate fileN(R�R-RRR#Rtget_names_from_certR$(R�RSR(((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytnamesls
cCs||jd|�}|jd|�}ytj�j||�SWn7tk
rw}tjd|�tjt|��t	SXdS(s{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

        RRs4An error occurred determining the OCSP status of %s.N(
R:RtRevocationCheckertocsp_revoked_by_pathst	ExceptionRHR�RItstrR�(R�R:R)R�te((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytocsp_revokedzs
cCs'd|jdkp&|jdjd�S(s�Is automatic renewal enabled for this cert?

        If autorenew is not specified, defaults to True.

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

        t	autorenewR<(R�tas_bool(R�((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytautorenewal_is_enabled�s	cCs�|j�r�|j|j��r2tjd�tStjd}|jj	d|�}t
j|jd|j���}t
jjtjj��}|t||�kr�tjd||jd��tSntS(sTShould 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

        s%Should renew, certificate is revoked.R>Rs8Should renew, less than %s before certificate expiry %s.s%Y-%m-%d %H:%M:%S %Z(RR�R�RHRIR�R	R+R�R�RR�R:R3R4tfromutctdatetimetutcnowR9tstrftimeR�(R�RWR7texpirytnow((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytshould_autorenew�s

	cs�xU|j|j|jfD];}tjj|�stj|d�tj	d|�qqWt
j|j|�\}}tjj|jt
�}	tjj|	�s�t|	dt�nt|�}td||��t||��tjj��r1tjj��stj��r1|j�tjd|��ntjj��r�tjj��setj��r�|j�tjd|��nxF��fD]8}tjj|�s�tj|�tj	d|�q�q�W�fd�tD�}
�fd�tD�}x3tD]+}tjt|||
|�|
|�qWt|
dd	��(}
tj	d
|
d�|
j|�WdQXt
j|dd	d
t��(}
tj	d|
d�|
j|�WdQXt|
dd	��(}
tj	d|
d�|
j|�WdQXt|
dd	��,}
tj	d|
d�|
j||�WdQXtjj�t
�}t|�|j�t t!|j"��}t#||�|
|�}||j$|�S(s�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�sCreating directory %s.Rvsarchive directory exists for slive directory exists for cs,i|]"}tjj�|d�|�qS(s.pem(R
RR(RzRU(R�(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys
<dictcomp>s	cs,i|]"}tjj�|d�|�qS(s1.pem(R
RR(RzRU(tarchive(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys
<dictcomp>s	RR@sWriting certificate to %s.NRROsWriting private key to %s.RsWriting chain to %s.RsWriting full chain to %s.(%RR�R�R
RRRtmakedirsRHRIRtunique_lineage_nameRRRwR�R�R�R-R�tisdirR�RJRRRDR�R�R#RPt	safe_opentBASE_PRIVKEY_MODEReRfRgRYR�(tclsRhRRRR`titconfig_fileRitbase_readme_pathRStarchive_targetRUR(RuRkt
new_config((R	R�s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytnew_lineage�s`4
4


)

cCs^t|jdd��+}td|j�dddt��}WdQXt|t�rVdSdSdS(	sc
        :returns: The type of algorithm for the private, RSA or ECDSA
        :rtype: str
        RtrbtdatatpasswordtbackendNtRSAtECDSA(R#R�RR$R-Rt
isinstanceR(R�t
priv_key_filetkey((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytprivate_key_type&scs5|�_�j����fd�tD�}tjj�jdj|��}|dkr�tjj	|�rtj
|�}ndj|�}tjd|�tj
||d�n{tj|dddt��(}tjd|d�|j|�WdQXtj|t�}	tj||d|	d	td
t�t|dd��(}tjd|d�|j|�WdQXt|d
d��(}tjd|d
�|j|�WdQXt|dd��,}tjd|d�|j||�WdQX�fd�tD�}
t�j�j|
|��_t�j��_�S(s�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

        cs7i|]-}tjj�jdj|���|�qS(s
{0}{1}.pem(R
RRR;R(RzRU(R�ttarget_version(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys
<dictcomp>Ws	sprivkey{0}.pems'Writing symlink to old private key, %s.RR@ROsWriting new private key to %s.Nt	copy_usert
copy_groupRsWriting certificate to %s.RsWriting chain to %s.RsWriting full chain to %s.cs i|]}�j||�qS((R�(RzRU(R�(s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pys
<dictcomp>~s	(R`R�RDR
RRR;RR-R�RmRHRIR�RR
RRPRtcompute_private_key_modetcopy_ownership_and_apply_modeR�R�R#RlRhR�R/R�(R�t
prior_versiontnew_certtnew_privkeyt	new_chainR`RStold_privkeyR(tmodetsymlinks((R�R s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pytsave_successor7s@	
	((t__name__t
__module__t__doc__R�R�tpropertyR�R)R�R'RhR�R;R�R�R�R�R�R�R�R�R�R�R:R�R�R�R�R�R�R�R�R�R�RRtclassmethodRRR,(((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyR��sF"4						D																		%_(scertsprivkeyschains	fullchain(CR/RRtloggingR�R�RKR!t
parsedatetimeR3R�tcryptography.hazmat.backendsRt-cryptography.hazmat.primitives.asymmetric.rsaRt,cryptography.hazmat.primitives.serializationRRBRRRRRR|RR	R
tcertbot._internal.pluginsRR�tcertbot.compatRR
tcertbot.pluginsRR�t	getLoggerR-RHRDRR�RCR�RRR R*R-R/tCalendarR9RYRcRlRrR�RwR�ReR�RZR�R�R�R�R�(((s=/usr/lib/python2.7/site-packages/certbot/_internal/storage.pyt<module>sd					4									
		B

Spamworldpro Mini