mirror of
https://github.com/certbot/certbot.git
synced 2026-06-06 15:22:38 -04:00
Remove partially implemented revoker compatibility code
This commit is contained in:
parent
7577894d2a
commit
343f25cc89
3 changed files with 25 additions and 32 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -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?",
|
||||
|
|
|
|||
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in a new issue