Browse Source

remove duplicate compatible_requests field

master
Andrea Cimbalo 7 years ago
parent
commit
5cc4e5a2f1
6 changed files with 7 additions and 9 deletions
  1. +1
    -1
      manager.py
  2. +1
    -2
      models/authority.py
  3. +1
    -0
      models/customModel.py
  4. +0
    -2
      models/ssh.py
  5. +3
    -3
      models/ssl.py
  6. +1
    -1
      shell.py

+ 1
- 1
manager.py View File

@ -90,7 +90,7 @@ def sign_request(ca_manager, request_id, authority_id):
h.update(request.key_data.encode('utf-8'))
print("Request hash: %s" % h.hexdigest())
print("You are about to sign this request with the following CA:")
print("You are about to sign this request with the following CA: %s"%authority)
confirm = input('Proceed? (type yes)> ')
if confirm != 'yes':
print ("user abort")


+ 1
- 2
models/authority.py View File

@ -15,6 +15,7 @@ Module of base classes to handle authorities
"""
class Authority(customModel.CustomModel):
request_allowed = []
# data stored in the database
@ -38,8 +39,6 @@ class Authority(customModel.CustomModel):
help_text = 'last certificate serial number',
)
compatible_requests = []
def __bool__(self):
return os.path.exists(self.path)


+ 1
- 0
models/customModel.py View File

@ -7,3 +7,4 @@ custom_db = SqliteDatabase(os.path.join(MANAGER_PATH, 'ca_manager.db'))
class CustomModel(Model):
class Meta:
database = custom_db

+ 0
- 2
models/ssh.py View File

@ -68,8 +68,6 @@ class SSHAuthority(Authority):
user_validity = '+52w'
host_validity = '+52w'
compatible_requests = [HostSSHRequest, UserSSHRequest]
def __bool__(self):
"""
Check if key pair already exists


+ 3
- 3
models/ssl.py View File

@ -40,8 +40,6 @@ class SSLAuthority(Authority):
ca_validity = '365'
cert_validity = '365'
compatible_requests = [HostSSLRequest]
def generate(self):
if os.path.exists(self.path):
raise ValueError("A CA with the same id and type already exists")
@ -68,7 +66,9 @@ class SSLAuthority(Authority):
def sign(self, request):
OUTPUT_PATH
"""
Sign a *SSLRequest with this certification authority
"""
assert type(request) in self.request_allowed


+ 1
- 1
shell.py View File

@ -260,7 +260,7 @@ class CAManagerShell(cmd.Cmd):
print ("Error: %s"%e)
return
results = [request.req_id for i, request in enumerate(self.ca_manager.request) if request.req_id.startswith(text) and request.__class__ in ca.compatible_requests]
results = [request.req_id for i, request in enumerate(self.ca_manager.request) if request.req_id.startswith(text) and request.__class__ in ca.request_allowed]
return results
def complete(self, text, state):


Loading…
Cancel
Save