also dump dkim_publickey. allow key generation.

master
Alexander Graf 4 years ago
parent acc728109b
commit c46f9328f7

@ -363,7 +363,7 @@ class Domain(Base):
__tablename__ = "domain" __tablename__ = "domain"
_dict_hide = {'users', 'managers', 'aliases'} _dict_hide = {'users', 'managers', 'aliases'}
_dict_show = {'dkim_key'} _dict_show = {'dkim_key', 'dkim_publickey'}
_dict_secret = {'dkim_key'} _dict_secret = {'dkim_key'}
_dict_types = {'dkim_key': (bytes, type(None))} _dict_types = {'dkim_key': (bytes, type(None))}
_dict_output = {'dkim_key': lambda v: v.decode('utf-8').strip().split('\n')[1:-1]} _dict_output = {'dkim_key': lambda v: v.decode('utf-8').strip().split('\n')[1:-1]}
@ -376,7 +376,9 @@ class Domain(Base):
key = ''.join(key) key = ''.join(key)
if type(key) is str: if type(key) is str:
key = ''.join(key.strip().split()) # removes all whitespace key = ''.join(key.strip().split()) # removes all whitespace
if key: if key == 'generate':
data['dkim_key'] = dkim.gen_key()
elif key:
m = re.match('^-----BEGIN (RSA )?PRIVATE KEY-----', key) m = re.match('^-----BEGIN (RSA )?PRIVATE KEY-----', key)
if m is not None: if m is not None:
key = key[m.end():] key = key[m.end():]

Loading…
Cancel
Save