Browse Source

add command to set certificate as revoked

master
Edoardo Putti 7 years ago
parent
commit
73a5ff2b3d
2 changed files with 22 additions and 0 deletions
  1. +6
    -0
      ca_manager/models/certificate.py
  2. +16
    -0
      ca_manager/shell.py

+ 6
- 0
ca_manager/models/certificate.py View File

@ -45,6 +45,12 @@ class Certificate(CustomModel):
help_text = 'certificate\'s path on filesystem',
)
revoked = BooleanField(
index = True,
default = False,
help_text = 'certificate lifecycle state',
)
def __repr__(self):
msg = """<%s:%s> for %s
signed %s by %s"""


+ 16
- 0
ca_manager/shell.py View File

@ -91,6 +91,7 @@ class CAManagerShell(cmd.Cmd):
Receiver: %s
Certificate Serial: %s
Validity Interval: %s
Revoked: %s
"""
request_info = (
@ -100,6 +101,7 @@ class CAManagerShell(cmd.Cmd):
cert.receiver,
cert.serial_number,
cert.validity_interval,
cert.revoked,
)
print(cert_description % cert_info)
@ -220,6 +222,20 @@ class CAManagerShell(cmd.Cmd):
sign_request(self.ca_manager, request_id, authority_id)
def do_revoke_certificates(self, l):
'Revoke the issued certificates: REVOKE_CERTIFICATE certificate_id ...'
argv = l.split()
argc = len(argv)
# argument number is too low
if argc < 1:
print("Usage: REVOKE_CERTIFICATE certificate_id ...")
for item in argv:
cert = self.ca_manager.certificate[item]
cert.revoked = True
cert.save()
def common_complete_request(self, text, line, begidx, endidx, check_argc=2):
argv = ("%send"%line).split()
argc = len(argv)


Loading…
Cancel
Save