OPSI.Util.Task.Certificate module¶
opsi python library - Util - Task - Certificate
Functionality to work with certificates. Certificates play an important role in the encrypted communication between servers and clients.
New in version 4.0.4.
author: | Niko Wenselowski <n.wenselowski@uib.de> |
---|---|
license: | GNU Affero General Public License version 3 |
-
exception
OPSI.Util.Task.Certificate.
CertificateCreationError
¶ Bases:
exceptions.Exception
-
exception
OPSI.Util.Task.Certificate.
NoCertificateError
¶ Bases:
exceptions.Exception
-
exception
OPSI.Util.Task.Certificate.
UnreadableCertificateError
¶ Bases:
exceptions.Exception
-
OPSI.Util.Task.Certificate.
createCertificate
(path=None, config=None)¶ Creates a certificate.
Will overwrite any certificate that may exists in
path
.Changed in version 4.0.6.2: Incrementing previously set serial number on re-creation. For new certificates a random number will be generated.
Parameters: - path (str) – The path of the certificate. If this is None the default will be used.
- config (dict) – The configuration of the certificate. If not given will use a default.
Raises: CertificateCreationError – If errors exist in configuration.
-
OPSI.Util.Task.Certificate.
loadConfigurationFromCertificate
(path=None)¶ Loads certificate configuration from a file.
Parameters: path (str) – The path to the certificate. Uses OPSICONFD_CERTFILE if no path is given.
Raises: - NoCertificateError – If no certificate found.
- UnreadableCertificateError – If certificate can not be read.
Returns: The configuration as read from the certificate.
Return type: dict
-
OPSI.Util.Task.Certificate.
renewCertificate
(path=None, yearsUntilExpiration=2, config=None)¶ Renews an existing certificate and creates a backup of the old file
If an error occurs during the creation of the new certificate the backup will be restored.
Parameters: - path (str) – The path of the certificate.
- yearsUntilExpiration (int) – How many years will the certificate be valid? Will always overwrite an existing value in
config
. - config (dict) – Settings for the new certificate. If this is None the values for the configuration will be read from the existing certificate.
Raises: NoCertificateError – If no certificate found.