a }|g@shdZddlZddlZddlZddlZddlZddlZddlmZddlm Z ddlm Z ddlm Z ddlm Z ddlm Z dd lmZdd lmZdd lmZddlZdd lmZdd lmZddlmZddlmZddlZddlZddlZddlmZddlmZddlmZddlm Z ddlm!Z!ddlm"Z"ddl#m$Z$ddl#m%Z%ddl&m'Z(ddl)m*Z*ddl)m+Z+ddl,m-Z.ddl/m0Z0e1e2Z3dZ4dZ5e0ej6Z7dZ8ej9e e:d d!d"Z;ej9e:e:d#d$d%Zd d)d*Z?e@feje:ej@ejd+d,d-ZAe:e:e:e e:e:fe e:efej>d.d/d0ZBe:e:ej9dd1d2d3ZCe:e:e e:e:fej9ej>d4d5d6ZDe:e:d7d8d9ZEdWe:eFdd;dd?d@ZHej9e e:efd dAdBZIe:e:dCdDdEZJej9e:e:dFdGdHZKe:e:e:dIdJdKZLej>ej9e:e:dLdMdNZMej9e:e:dOdPdQZNej9e:dd#dRdSZOGdTdUdUe jPZPdS)XzRenewable certificates storage.N)Any)cast)Dict)Iterable)List)Mapping)Optional)Tuple)Union)default_backend)EllipticCurvePrivateKey) RSAPrivateKey)load_pem_private_key configuration) crypto_util)errors) interfaces)ocsp)util) constants) error_handler)disco) filesystem)os)common)parse_loose_version)certprivkeychain fullchainREADMEi)configreturncCs"ttj|jd}||S)zBuild a list of all renewal configuration files. :param configuration.NamespaceConfig config: Configuration object :returns: list of renewal configuration files :rtype: `list` of `str` z*.conf)globrpathjoinrenewal_configs_dirsort)r"resultr*=/usr/lib/python3.9/site-packages/certbot/_internal/storage.pyrenewal_conf_files4s r,)r"certnamer#cCs>tj|j|d}tj|s:td|d|d|S)z;Return /path/to/certname.conf in the renewal conf directory.confzNo certificate found with name z (expected z).)rr%r&r'existsrCertStorageError)r"r-r%r*r*r+renewal_file_for_certnameBs  r1)r" cert_namer#cCst||}tj|ddddS)z 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. utf-8encodingZdefault_encodingr )r1 configobj ConfigObj)r"r2Zcert_name_implied_confr*r*r+cert_path_for_cert_nameKs  r8cCs6tjtjddd}||dur"|n tjddd|S)z?Merge supplied config, if provided, on top of builtin defaults.r3r4N)r6r7rRENEWER_DEFAULTSmerge)r"Z defaults_copyr*r*r+config_with_defaultsWsr;) base_timeinterval textparserr#cCs4|r|d7}|jptj}|j|||ddS)aParse 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`z days)tzinfor)stripisdigitr?pytzUTCZparseDT)r<r=r>r?r*r*r+add_time_intervalas  rD) o_filename n_filename archive_dirtarget relevant_datar#c Cs@tj|ddd}tj|d<||d<tD]}||||<q&d|vrVi|d<ddg|jd<|d||dD]}||vrl|d|=qld|vrtjd}d |g|_ t d |t |d Wd n1s0Yt j|rtt |j} t|| t |d } |j| dWd n1s20Y|S)aWrites 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 r3r4versionrG renewalparamsz#Options used in the renewal processrenew_before_expiryzrenew_before_expiry = zWriting new config %s.aNwb)Zoutfile)r6r7certbot __version__ALL_FOURZcommentsupdaterr9Zinitial_commentloggerdebugopenrr%r/statS_IMODElstatst_moderchmodwrite) rErFrGrHrIr"kindkdefault_intervalZcurrent_permissionsfr*r*r+write_renewal_config{s4          ,ra) prev_namenew_name cli_configr#cCs\t||}t||}tj|r*tdzt||WntyVtdYn0dS)zRenames cli_config.certname's config to cli_config.new_certname. :param .NamespaceConfig cli_config: parsed command line arguments z+The new certificate name is already in use.z=Please specify a valid filename for the new certificate name.N) renewal_filename_for_lineagenamerr%r/rZConfigurationErrorrreplaceOSError)rbrcrdZ prev_filenameZ new_filenamer*r*r+rename_renewal_configs     rh) lineagenamerGrHrdr#cCs\t||}|d}tj|r(t|t|}t|||||t||t j |dddS)aModifies 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 z.newr3r4) rerr%r/unlinkrelevant_valuesrarrfr6r7)rirGrHrdconfig_filenameZ temp_filenamevaluesr*r*r+update_configurations    rn)linkr#cCs`zt|}Wn"ty0td|Yn0tj|sTtj tj ||}tj |S)zGet 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. zExpected {0} to be a symlink) rreadlinkrgrr0formatrr%isabsr&dirnameabspath)rorHr*r*r+get_link_targets    ruF) readme_path is_base_dirr#cCsXd}|r d}t|d.}td||dj|dWdn1sJ0YdS)NrLz [cert name]/wzWriting README to %s.aThis 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. )prefix)rVrTrUr\rq)rvrwryr`r*r*r+_write_live_readme_tos   rz) namespacesoptionr#cs,ddlm}|jvp*tfdd|DS)z 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 r)renewalc3s|]}|VqdSN) startswith).0 namespacer|r*r+ z_relevant..)certbot._internalr}Z CONFIG_ITEMSany)r{r|r}r*rr+ _relevant s  rcsT}tj}dd|Dfdd|D}|d|d<|d|d<|S)zReturn a new dict containing only items relevant for renewal. :param .NamespaceConfig config: parsed command line :returns: A new dictionary containing items that can be used in renewal. :rtype dict: cSsg|]}t|qSr*)plugins_commonZdest_namespace)rZpluginr*r*r+ (rz#relevant_values..cs*i|]"\}}t|r|r||qSr*)rZ set_by_user)rr|valuer"r{r*r+ *sz#relevant_values..serverZkey_type)Zto_dict plugins_discoZPluginsRegistryZfind_allitems)r"Z all_valuesZpluginsrvr*rr+rks     rk)rlr#cCs.|dstdtj|dtd S):Returns the lineagename for a configuration filename. r.z*renewal config file name must end in .confN)endswithrr0rr%basenamelen)rlr*r*r+lineagename_for_filename;s  r)r"rir#cCstj|j|dS)rr.)rr%r&r')r"rir*r*r+reDsre)rG from_filer#cCstj|tj|S)zPath to a directory from a file)rr%relpathrs)rGrr*r*r+_relpath_from_fileKsr) config_objrdrir#cCs$|rd|vr|dStj|j|S)aMReturns 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 rG)rr%r&default_archive_dir)rrdrir*r*r+full_archive_pathPs r)rdrir#cCstj|j|S)z4Returns the full default live path for a lineagename)rr%r&live_dir)rdrir*r*r+_full_live_path_src Cst||}td||}t||}zdztj|ddd}Wn4tjyjtd|||t d |Yn0Wt |t d|nt |t d|0t}tD]^}||}zt |td|Wntytd|Yn0t j|} || qt|dkr|} t j| t} zt | td| Wn tyftd| Yn0zt | td| Wn tytd | Yn0z&t|||} t| td| Wn tytd | Yn0dS) zmDelete all files related to the certificate. If some files are not found, ignore them and continue. Nr3r4zNCould not parse %s. You may wish to manually delete the contents of %s and %s.error parsing {0}z Removed %szUnable to delete %sz&Unable to remove %s; may not be empty.zUnable to remove %s)r1rrr6r7ConfigObjErrorrTerrorrr0rqrremoveinfosetrRgetrUrgr%rsaddrpopr&r!rmdirshutilrmtree) r"r-Zrenewal_filenameZfull_default_archive_dirZfull_default_live_dirZrenewal_configZdirectory_namesr]roZ directoryrvZ archive_pathr*r*r+ delete_filesds`                rc@seZdZdZeejddddZeedddZ eedd d Z eedd d Z eedd dZ eedddZ eejdddZeedddZeedddZeeedddZeedddZeedddZddddZedd d!Zddd"d#Zeeeefdd$d%Zddd&d'Zeeed(d)d*Zeeed(d+d,Z eeed-d.d/Z!eeed(d0d1Z"eed(d2d3Z#edd4d5Z$edd6d7Z%edd8d9Z&edd:d;Z'eedd-dd?d@Z)eeddAdBZ*eed>dCdDZ+eddEdFZ,eddGdHZ-e.ee/e/e/ejddIdJdKZ0e1e2e3fddLdMZ4eeddNdOZ5eeeddPdQZ6eeeddRdSZ7ee/e/e/ejedTdUdVZ8ejddWdXdYZ9d^edd[d\d]Z:dS)_ RenewableCertaRenewable 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. N)rlrdr#cs|_t|_ztj|ddd_Wn$tjyJtd |Yn0t j_ t fddt Dstd jj d}|durt|tkrtd ||tjj d _j d _j d _j d _tjj_dS)aInstantiate 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. r3r4rc3s|]}|jvVqdSr~rrxselfr*r+rrz)RenewableCert.__init__..z.N) rrrrr%lexistsrjsymlinkrrpr/)rrr]Z previous_linkZ current_link_ror*r*r+rs      zRenewableCert._fix_symlinks)r]r#cCsB|tvrtdt||}tj|s:td||dSt |S)a(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 unknown kind of itemz*Expected symlink %s for %s does not exist.N) rRrr0rrr%r/rTrUru)rr]ror*r*r+rs    zRenewableCert.current_targetcCs|tvrtdtd|}||}|dus@tj |sRt d||d}| tj |}|rxt|dSt d|dS)aReturns 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 rrNz3Current-version target for %s does not exist at %s.rLrzNo matches for target %s.)rRrr0rrrqrrr%r/rTrUrrintgroups)rr]rrHmatchesr*r*r+current_versions    zRenewableCert.current_version)r]rJr#cCsT|tvrtd||}|s2td|dtj|}tj|d ||S)aThe 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 rTarget  does not exist! {0}{1}.pem) rRrr0rrrr%rsr&rq)rr]rJrowherer*r*r+rJs   zRenewableCert.versioncs||tvrtd||}|s2td|dtj|}t|}t d |fdd|D}t dd|DS)aWhich 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` rrrrcsg|]}|qSr*)r)rr`rr*r+r!rz4RenewableCert.available_versions..cSs g|]}|rt|dqS)r)rr)rmr*r*r+r"r) rRrr0rrrr%rslistdirrrrqsorted)rr]rorfilesrr*rr+available_versions s     z RenewableCert.available_versionscCst||S)aNewest 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 )maxr)rr]r*r*r+newest_available_version$s z&RenewableCert.newest_available_versioncs,fddtDtfdddDS)zNewest version for which all items are available? :returns: the newest available version for which all members (``cert, ``privkey``, ``chain``, and ``fullchain``) exist :rtype: int csg|]}|qSr*)rrrr*r+r<rz7RenewableCert.latest_common_version..c3s0|](tfddddDrVqdS)c3s|]}|vVqdSr~r*)rvnr*r+r=rz@RenewableCert.latest_common_version...rN)r)r)versionsrr+r=rz6RenewableCert.latest_common_version..r)rRrrr*)rrr+latest_common_version0s z#RenewableCert.latest_common_versioncstfddtDdS)zSmallest 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|]}|VqdSr~)rrrr*r+rKrz2RenewableCert.next_free_version..r)rrRrr*rr+next_free_version?s zRenewableCert.next_free_versioncCs(|r$td||dSdS)zMake 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.zMFound a new certificate /archive/ that was not linked to in /live/; fixing...FT)has_pending_deploymentrTwarningupdate_all_links_torrr*r*r+ensure_deployedMs  zRenewableCert.ensure_deployedcCsNg}tD]0}||}|dur.t|d||qt|}||kS)aIs 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 Nz. is required but missing for this certificate.)rRrrrrminr)rZ all_versionsitemrJZsmallest_currentr*r*r+r\s   z$RenewableCert.has_pending_deploymentcCs^|tvrtdt||}d||}tjt |}t |t tj |||dS)a7Make 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 rrN) rRrr0rrqrr%rsrrprjrr&)rr]rJrofilenameZtarget_directoryr*r*r+_update_link_tops     zRenewableCert._update_link_to)rJr#cCst|j|}|D]4\}}||}|sBtd|dt||qt D]}| ||qT|D]\}}t |qjWdn1s0YdS)zwChange all member objects to point to the specified version. :param int version: the desired version rrN) rZ ErrorHandlerrrrrrrrrRrrj)rrJZprevious_linksr]rorHrr*r*r+rs   z!RenewableCert.update_all_links_tocCsX|d}|durtdt|d}t|WdS1sJ0YdS)zWhat are the subject names of this certificate? :returns: the subject names :rtype: `list` of `str` :raises .CertStorageError: if could not find cert file. rNz#could not find the certificate filerb)rrr0rVrZget_names_from_certread)rrHr`r*r*r+namess    zRenewableCert.namesc Csp|d|}|d|}zt||WStyj}z(td|tt|WYd}~dSd}~00dS)a{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 rrz4An error occurred determining the OCSP status of %s.NF) rJrZRevocationCheckerZocsp_revoked_by_paths ExceptionrTrrUstr)rrJrrer*r*r+ ocsp_revokeds   zRenewableCert.ocsp_revokedcCsd|jdvp|jddS)zIs automatic renewal enabled for this cert? If autorenew is not specified, defaults to True. :returns: True if automatic renewal is enabled :rtype: bool Z autorenewrKrrr*r*r+autorenewal_is_enableds z$RenewableCert.autorenewal_is_enabledcCs|r||r$tddStjd}|jd|}t | d|}t j tj}|t||krtd||ddSdS)aTShould 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 z%Should renew, certificate is revoked.TrMrz8Should renew, less than %s before certificate expiry %s.z%Y-%m-%d %H:%M:%S %ZF)rrrrTrUrr9rrrrrJdatetimenowrBrCrDstrftime)rr_r=Zexpiryrr*r*r+should_autorenews"  zRenewableCert.should_autorenew)rirrrrdr#cs|j|j|jfD](}tj|st|dt d|qt |j|\}}tj |jt } tj| stt| ddt|}td||t||tjrtjrtr|td|tjrtjrtr|td|fD]*}tj|st|t d|qfdd tD} fd d tD} tD]$} tt| | | | | | qbt| d d *} t d | d | |Wdn1s0Yt j| dd td*}t d| d||Wdn1s0Yt| dd *} t d| d| |Wdn1sb0Yt| dd .} t d| d| ||Wdn1s0Ytj t }t||t|}t||| |}||j |S)aCreate 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` izCreating directory %s.T)rwNzarchive directory exists for zlive directory exists for cs i|]}|tj|dqS).pemrr%r&rr])rr*r+r7rz-RenewableCert.new_lineage..cs i|]}|tj|dqS)z1.pemrr)archiver*r+r8rrrOWriting certificate to %s.rr[zWriting private key to %s.rWriting chain to %s.r Writing full chain to %s.)!r'rrrr%r/rmakedirsrTrUrZunique_lineage_namer&r!rzrrrisdirrcloserr0rRrrrVr\ safe_openBASE_PRIVKEY_MODErkrar)clsrirrrrdiZ config_filerlZbase_readme_pathrHZarchive_targetr]Zf_bZf_arvrmZ new_configr*)rrr+ new_lineagesj      "&  "***.zRenewableCert.new_lineagecCsZt|jdd6}t|dtd}ttttf|WdS1sL0YdS)Nrr)datapasswordZbackend) rVrrrr rr r r )rZ priv_key_filekeyr*r*r+ _private_keyYszRenewableCert._private_keycCs|}t|trdSdS)zc :returns: The type of algorithm for the private, RSA or ECDSA :rtype: str ZRSAZECDSA)r isinstancer rrr*r*r+private_key_typebs zRenewableCert.private_key_typecCs|}t|tr|jSdS)z[ :returns: If the private key is an RSA key, its size. :rtype: int N)rrr Zkey_sizerr*r*r+ rsa_key_sizems zRenewableCert.rsa_key_sizecCs|}t|tr|jjSdS)zm :returns: If the private key is an elliptic key, the name of its curve. :rtype: str N)rrr Zcurvenamerr*r*r+elliptic_curvexs zRenewableCert.elliptic_curve) prior_versionnew_cert new_privkey new_chainrdr#c s |_fddtD}tjjd|}|durtj|rXt |}n d|d}t d|t ||dnrtj|ddtd *}t d |d||Wdn1s0Yt |t} t j||d| d d d t|dd*}t d|d||Wdn1s40Yt|dd*}t d|d||Wdn1s~0Yt|dd.}t d|d|||Wdn1s0YfddtD} tjj| |_tj_S)aSave 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 c s&i|]}|tjjd|qS)r)rr%r&rGrqrrZtarget_versionr*r+rsz0RenewableCert.save_successor..zprivkey{0}.pemNrrz'Writing symlink to old private key, %s.rOrzWriting new private key to %s.FT)Z copy_userZ copy_grouprrrrr rcsi|]}|j|qSr*rrrr*r+rr)rdrrRrr%r&rGrqrrrprTrUrrr r r\Zcompute_private_key_modeZcopy_ownership_and_apply_moderVrnrirr;r) rrrrrrdrHZ old_privkeyr`modesymlinksr*rr+save_successorsH      ( **.  zRenewableCert.save_successor)rdr#cs<|_fddtD}tjj||_tj_dS)zSave only the config information without writing the new cert. :param .NamespaceConfig cli_config: parsed command line arguments csi|]}|j|qSr*rrrr*r+rrz8RenewableCert.save_new_config_values..N)rdrRrnrirGrr;r)rrdrr*rr+save_new_config_valuess  z$RenewableCert.save_new_config_values)num_prior_certs_to_keepr#c Cs|}t|d}|tt||d|d8}|j}|D]r}td||tD]Z}tj |||d}ztj |rt |WqRt ytjd|ddYqR0qRqs                                  7     C