mirror of
https://github.com/certbot/certbot.git
synced 2026-08-03 03:52:02 +02:00
Remove partially implemented revoker compatibility code
This commit is contained in:
@@ -535,10 +535,18 @@ def revoke(server):
|
|||||||
except errors.LetsEncryptMisconfigurationError:
|
except errors.LetsEncryptMisconfigurationError:
|
||||||
zope.component.getUtility(interfaces.IDisplay).generic_notification(
|
zope.component.getUtility(interfaces.IDisplay).generic_notification(
|
||||||
"The web server is currently misconfigured. Some "
|
"The web server is currently misconfigured. Some "
|
||||||
"abilities like seeing which certificates are currently"
|
"abilities like seeing which certificates are currently "
|
||||||
" installed may not be available at this time.")
|
"installed may not be available.")
|
||||||
installer = None
|
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 = revoker.Revoker(server, installer)
|
||||||
revoc.list_certs_keys()
|
revoc.list_certs_keys()
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ import textwrap
|
|||||||
import dialog
|
import dialog
|
||||||
import zope.interface
|
import zope.interface
|
||||||
|
|
||||||
from letsencrypt.client import CONFIG
|
|
||||||
from letsencrypt.client import interfaces
|
from letsencrypt.client import interfaces
|
||||||
|
|
||||||
|
|
||||||
@@ -83,20 +82,12 @@ class NcursesDisplay(CommonDisplayMixin):
|
|||||||
+ gen_https_names(domains) + "!", width=self.width)
|
+ gen_https_names(domains) + "!", width=self.width)
|
||||||
|
|
||||||
def display_certs(self, certs): # pylint: disable=missing-docstring
|
def display_certs(self, certs): # pylint: disable=missing-docstring
|
||||||
list_choices = []
|
list_choices = [
|
||||||
for i, cert in enumerate(certs):
|
(str(i+1), "%s | %s | %s" %
|
||||||
if cert["installed"]:
|
(str(c["cn"].ljust(self.width - 39)),
|
||||||
if cert["installed"] == CONFIG.CERT_DELETE_MSG:
|
c["not_before"].strftime("%m-%d-%y"),
|
||||||
status = "Deleted/Moved"
|
"Installed" if c["installed"] else ""))
|
||||||
else:
|
for i, c in enumerate(certs)]
|
||||||
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)))
|
|
||||||
|
|
||||||
code, tag = self.dialog.menu(
|
code, tag = self.dialog.menu(
|
||||||
"Which certificates would you like to revoke?",
|
"Which certificates would you like to revoke?",
|
||||||
|
|||||||
@@ -57,36 +57,30 @@ class Revoker(object):
|
|||||||
return
|
return
|
||||||
|
|
||||||
c_sha1_vh = {}
|
c_sha1_vh = {}
|
||||||
|
for (cert, _, path) in self.installer.get_all_certs_keys():
|
||||||
if self.installer is not None:
|
try:
|
||||||
for (cert, _, path) in self.installer.get_all_certs_keys():
|
c_sha1_vh[M2Crypto.X509.load_cert(
|
||||||
try:
|
cert).get_fingerprint(md='sha1')] = path
|
||||||
c_sha1_vh[M2Crypto.X509.load_cert(
|
except M2Crypto.X509.X509Error:
|
||||||
cert).get_fingerprint(md='sha1')] = path
|
continue
|
||||||
except M2Crypto.X509.X509Error:
|
|
||||||
continue
|
|
||||||
|
|
||||||
with open(list_file, 'rb') as csvfile:
|
with open(list_file, 'rb') as csvfile:
|
||||||
csvreader = csv.reader(csvfile)
|
csvreader = csv.reader(csvfile)
|
||||||
for row in csvreader:
|
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,
|
b_k = os.path.join(CONFIG.CERT_KEY_BACKUP,
|
||||||
os.path.basename(row[2]) + "_" + row[0])
|
os.path.basename(row[2]) + "_" + row[0])
|
||||||
b_c = os.path.join(CONFIG.CERT_KEY_BACKUP,
|
b_c = os.path.join(CONFIG.CERT_KEY_BACKUP,
|
||||||
os.path.basename(row[1]) + "_" + row[0])
|
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({
|
cert.update({
|
||||||
"orig_key_file": row[2],
|
"orig_key_file": row[2],
|
||||||
"orig_cert_file": row[1],
|
"orig_cert_file": row[1],
|
||||||
"idx": int(row[0]),
|
"idx": int(row[0]),
|
||||||
"backup_key_file": b_k,
|
"backup_key_file": b_k,
|
||||||
"backup_cert_file": b_c,
|
"backup_cert_file": b_c,
|
||||||
"installed": c_sha1_vh.get(
|
"installed": c_sha1_vh.get(cert["fingerprint"], ""),
|
||||||
cert["fingerprint"], cert.get("installed", "")),
|
|
||||||
})
|
})
|
||||||
certs.append(cert)
|
certs.append(cert)
|
||||||
if certs:
|
if certs:
|
||||||
|
|||||||
Reference in New Issue
Block a user