diff options
| author | J08nY | 2017-07-07 17:36:12 +0200 |
|---|---|---|
| committer | J08nY | 2017-07-07 17:36:12 +0200 |
| commit | 45174af3b9b410102022cb5c335e42c7e0052b19 (patch) | |
| tree | 346fd6ccad4c5abe548eb71a819f390d31974403 /src/mailman_pgp/pgp | |
| parent | 6b627e130ad1a2fa453045b76b8f9a08e9520c34 (diff) | |
| download | mailman-pgp-45174af3b9b410102022cb5c335e42c7e0052b19.tar.gz mailman-pgp-45174af3b9b410102022cb5c335e42c7e0052b19.tar.zst mailman-pgp-45174af3b9b410102022cb5c335e42c7e0052b19.zip | |
Simplify key generation.
Diffstat (limited to 'src/mailman_pgp/pgp')
| -rw-r--r-- | src/mailman_pgp/pgp/__init__.py | 2 | ||||
| -rw-r--r-- | src/mailman_pgp/pgp/keygen.py | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/src/mailman_pgp/pgp/__init__.py b/src/mailman_pgp/pgp/__init__.py index d273f5e..31b61b3 100644 --- a/src/mailman_pgp/pgp/__init__.py +++ b/src/mailman_pgp/pgp/__init__.py @@ -30,7 +30,7 @@ from public import public from mailman_pgp.config import config KEYDIR_CONFIG_PATHS = ['list_keydir', 'user_keydir', 'archive_keydir'] -KEYPAIR_CONFIG_VARIABLES = ['key_type', 'key_length', +KEYPAIR_CONFIG_VARIABLES = ['autogenerate', 'key_type', 'key_length', 'subkey_type', 'subkey_length'] # The main key needs to support signing. diff --git a/src/mailman_pgp/pgp/keygen.py b/src/mailman_pgp/pgp/keygen.py index 36c90ca..b750e28 100644 --- a/src/mailman_pgp/pgp/keygen.py +++ b/src/mailman_pgp/pgp/keygen.py @@ -19,7 +19,6 @@ potentially long key generation operation.""" import multiprocessing as mp -from os.path import exists, isfile from flufl.lock import Lock from pgpy import PGPKey, PGPUID @@ -36,12 +35,12 @@ class ListKeyGenerator(mp.Process): target=self.generate, args=(keypair_config, display_name, posting_address, request_address, key_path), - daemon=False) + daemon=True) def generate(self, keypair_config, display_name, posting_address, request_address, key_path): """ - Generate the list keypair and save it, if it does not exist. + Generate the list keypair and save it. :param keypair_config: :param display_name: @@ -49,11 +48,9 @@ class ListKeyGenerator(mp.Process): :param request_address: :param key_path: """ + key = self._create(keypair_config, display_name, posting_address, + request_address) with Lock(key_path + '.lock'): - if exists(key_path) and isfile(key_path): - return - key = self._create(keypair_config, display_name, posting_address, - request_address) self._save(key, key_path) def _create(self, config, display_name, posting_address, request_address): |
