From 343f25cc898bfe5ff76dd64817cafa6633021c6b Mon Sep 17 00:00:00 2001 From: James Kasten Date: Sun, 25 Jan 2015 23:01:48 -0800 Subject: [PATCH] Remove partially implemented revoker compatibility code --- letsencrypt/client/client.py | 12 ++++++++++-- letsencrypt/client/display.py | 21 ++++++--------------- letsencrypt/client/revoker.py | 24 +++++++++--------------- 3 files changed, 25 insertions(+), 32 deletions(-) diff --git a/letsencrypt/client/client.py b/letsencrypt/client/client.py index 4455e76c3..0f5166399 100644 --- a/letsencrypt/client/client.py +++ b/letsencrypt/client/client.py @@ -535,10 +535,18 @@ def revoke(server): except errors.LetsEncryptMisconfigurationError: zope.component.getUtility(interfaces.IDisplay).generic_notification( "The web server is currently misconfigured. Some " - "abilities like seeing which certificates are currently" - " installed may not be available at this time.") + "abilities like seeing which certificates are currently " + "installed may not be available.") installer = None + # This is a temporary fix to avoid errors. The Revoker is not fully + # developed. + if installer is None: + zope.component.getUtility(interfaces.IDisplay).generic_notification( + "The Let's Encrypt Revoker module does not currently support " + "revocation without a valid installer. This feature should come " + "soon.") + return revoc = revoker.Revoker(server, installer) revoc.list_certs_keys() diff --git a/letsencrypt/client/display.py b/letsencrypt/client/display.py index 213de34d1..867675495 100644 --- a/letsencrypt/client/display.py +++ b/letsencrypt/client/display.py @@ -4,7 +4,6 @@ import textwrap import dialog import zope.interface -from letsencrypt.client import CONFIG from letsencrypt.client import interfaces @@ -83,20 +82,12 @@ class NcursesDisplay(CommonDisplayMixin): + gen_https_names(domains) + "!", width=self.width) def display_certs(self, certs): # pylint: disable=missing-docstring - list_choices = [] - for i, cert in enumerate(certs): - if cert["installed"]: - if cert["installed"] == CONFIG.CERT_DELETE_MSG: - status = "Deleted/Moved" - else: - status = "Installed" - else: - status = "" - - list_choices.append((str(i+1), "{0} | {1} | {2}".format( - str(cert["cn"].ljust(self.width-39)), - cert["not_before"].strftime("%m-%d-%y"), - status))) + list_choices = [ + (str(i+1), "%s | %s | %s" % + (str(c["cn"].ljust(self.width - 39)), + c["not_before"].strftime("%m-%d-%y"), + "Installed" if c["installed"] else "")) + for i, c in enumerate(certs)] code, tag = self.dialog.menu( "Which certificates would you like to revoke?", diff --git a/letsencrypt/client/revoker.py b/letsencrypt/client/revoker.py index 28cdf1bf1..f8b75b39c 100644 --- a/letsencrypt/client/revoker.py +++ b/letsencrypt/client/revoker.py @@ -57,36 +57,30 @@ class Revoker(object): return c_sha1_vh = {} - - if self.installer is not None: - for (cert, _, path) in self.installer.get_all_certs_keys(): - try: - c_sha1_vh[M2Crypto.X509.load_cert( - cert).get_fingerprint(md='sha1')] = path - except M2Crypto.X509.X509Error: - continue + for (cert, _, path) in self.installer.get_all_certs_keys(): + try: + c_sha1_vh[M2Crypto.X509.load_cert( + cert).get_fingerprint(md='sha1')] = path + except M2Crypto.X509.X509Error: + continue with open(list_file, 'rb') as csvfile: csvreader = csv.reader(csvfile) for row in csvreader: - # Generate backup key/cert names + cert = crypto_util.get_cert_info(row[1]) + b_k = os.path.join(CONFIG.CERT_KEY_BACKUP, os.path.basename(row[2]) + "_" + row[0]) b_c = os.path.join(CONFIG.CERT_KEY_BACKUP, os.path.basename(row[1]) + "_" + row[0]) - cert = crypto_util.get_cert_info(b_c) - if not os.path.isfile(row[1]): - cert["installed"] = CONFIG.CERT_DELETE_MSG - cert.update({ "orig_key_file": row[2], "orig_cert_file": row[1], "idx": int(row[0]), "backup_key_file": b_k, "backup_cert_file": b_c, - "installed": c_sha1_vh.get( - cert["fingerprint"], cert.get("installed", "")), + "installed": c_sha1_vh.get(cert["fingerprint"], ""), }) certs.append(cert) if certs: