Work in progress toward renewer enrollment

This commit is contained in:
Seth Schoen
2015-05-08 15:00:35 -07:00
parent 953b57453e
commit 2ee1ab05b3
2 changed files with 15 additions and 7 deletions
+3 -2
View File
@@ -147,7 +147,7 @@ class Client(object):
cert_pem = certr.body.as_pem() cert_pem = certr.body.as_pem()
chain_pem = None chain_pem = None
if certr.cert_chain_uri: if certr.cert_chain_uri:
chain_pem = self.network.fetch_chain(certr.cert_chain_uri) chain_pem = self.network.fetch_chain(certr)
if chain_pem is None: if chain_pem is None:
# XXX: just to stop RenewableCert from complaining; this is # XXX: just to stop RenewableCert from complaining; this is
@@ -158,7 +158,8 @@ class Client(object):
def obtain_and_enroll_certificate(self, domains, csr=None): def obtain_and_enroll_certificate(self, domains, csr=None):
cert_pem, privkey, chain_pem = self._obtain_certificate(domains, csr) cert_pem, privkey, chain_pem = self._obtain_certificate(domains, csr)
return renewer.RenewableCert.new_lineage(domains[0], cert_pem, return renewer.RenewableCert.new_lineage(domains[0], cert_pem,
privkey, chain_pem) privkey, chain_pem, None,
vars(self.config.namespace))
# XXX: self.account.key.file is totally wrong here, that's # XXX: self.account.key.file is totally wrong here, that's
# the account key and not the cert key! # the account key and not the cert key!
+12 -5
View File
@@ -323,14 +323,19 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
return False return False
@classmethod @classmethod
def new_lineage(cls, lineagename, cert, privkey, chain, config=DEFAULTS): def new_lineage(cls, lineagename, cert, privkey, chain, configurator=None,
renewalparams=None, config=DEFAULTS):
# pylint: disable=too-many-locals # pylint: disable=too-many-locals
"""Create a new certificate lineage with the (suggested) lineage name """Create a new certificate lineage with the (suggested) lineage name
lineagename, and the associated cert, privkey, and chain (the lineagename, and the associated cert, privkey, and chain (the
associated fullchain will be created automatically). Returns a new associated fullchain will be created automatically). Optional
RenewableCert object referring to the created lineage. (The actual configurator and renewalparams record the configuration that was
lineage name, as well as all the relevant file paths, will be originally used to obtain this cert, so that it can be reused later
available within this object.)""" 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.)"""
configs_dir = config["renewal_configs_dir"] configs_dir = config["renewal_configs_dir"]
archive_dir = config["official_archive_dir"] archive_dir = config["official_archive_dir"]
live_dir = config["live_dir"] live_dir = config["live_dir"]
@@ -380,6 +385,8 @@ class RenewableCert(object): # pylint: disable=too-many-instance-attributes
new_config["privkey"] = privkey_target new_config["privkey"] = privkey_target
new_config["chain"] = chain_target new_config["chain"] = chain_target
new_config["fullchain"] = fullchain_target new_config["fullchain"] = fullchain_target
if configurator: new_config["configurator"] = configurator
if renewalparams: new_config["renewalparams"] = renewalparams
# TODO: add human-readable comments explaining other available # TODO: add human-readable comments explaining other available
# parameters # parameters
new_config.write() new_config.write()