mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
OpenSSL modules uses file_common_args (#27032)
* openssl_publickey: Allow one to specify file permission Allow a user to specify file permissions on the generated publickey via the file module common arguments. * openssl: Add documentation regarding file_common_args Add documentation for those modules to let the user know that he can rely on file_common_args to specify file permissions.
This commit is contained in:
parent
0a4c570153
commit
1dc608f2cf
3 changed files with 9 additions and 3 deletions
|
@ -31,7 +31,7 @@ description:
|
|||
- "This module allows one to (re)generates OpenSSL certificate signing requests.
|
||||
It uses the pyOpenSSL python library to interact with openssl. This module support
|
||||
the subjectAltName extension. Note: At least one of commonName or subjectAltName must
|
||||
be specified."
|
||||
be specified. This module uses file common arguments to specify generated file permissions."
|
||||
requirements:
|
||||
- "python-pyOpenSSL"
|
||||
options:
|
||||
|
|
|
@ -30,7 +30,8 @@ short_description: Generate OpenSSL private keys.
|
|||
description:
|
||||
- "This module allows one to (re)generate OpenSSL private keys. It uses
|
||||
the pyOpenSSL python library to interact with openssl. One can generate
|
||||
either RSA or DSA private keys. Keys are generated in PEM format."
|
||||
either RSA or DSA private keys. Keys are generated in PEM format.
|
||||
This module uses file common arguments to specify generated file permissions."
|
||||
requirements:
|
||||
- "python-pyOpenSSL"
|
||||
options:
|
||||
|
|
|
@ -30,7 +30,8 @@ short_description: Generate an OpenSSL public key from its private key.
|
|||
description:
|
||||
- "This module allows one to (re)generate OpenSSL public keys from their private keys.
|
||||
It uses the pyOpenSSL python library to interact with openssl. Keys are generated
|
||||
in PEM format. This module works only if the version of PyOpenSSL is recent enough (> 16.0.0)"
|
||||
in PEM format. This module works only if the version of PyOpenSSL is recent enough (> 16.0.0).
|
||||
This module uses file common arguments to specify generated file permissions."
|
||||
requirements:
|
||||
- "python-pyOpenSSL"
|
||||
options:
|
||||
|
@ -145,6 +146,10 @@ class PublicKey(object):
|
|||
publickey_file = open(self.path, 'w')
|
||||
publickey_file.write(publickey_content)
|
||||
publickey_file.close()
|
||||
|
||||
file_args = module.load_file_common_arguments(module.params)
|
||||
if module.set_fs_attributes_if_different(file_args, False):
|
||||
self.changed = True
|
||||
except (IOError, OSError) as exc:
|
||||
raise PublicKeyError(exc)
|
||||
except AttributeError as exc:
|
||||
|
|
Loading…
Reference in a new issue