Commit 8d759f9e authored by Vincent Pelletier's avatar Vincent Pelletier

ca: Allow disabling CA key renewal.

For easier use when renewing a single certificate after restoring
backups, for example.
parent f6661875
...@@ -96,8 +96,9 @@ class CertificateAuthority(object): ...@@ -96,8 +96,9 @@ class CertificateAuthority(object):
Items to use as Certificate Authority certificate subject. Items to use as Certificate Authority certificate subject.
Supported keys are: C, O, OU, ST, CN, L, SN, GN. Supported keys are: C, O, OU, ST, CN, L, SN, GN.
ca_key_size (int) ca_key_size (int, None)
Number of bits to use as Certificate Authority key. Number of bits to use as Certificate Authority key.
None to disable CA renewal.
crt_life_time (float) crt_life_time (float)
Validity duration for every issued certificate, in days. Validity duration for every issued certificate, in days.
...@@ -436,7 +437,7 @@ class CertificateAuthority(object): ...@@ -436,7 +437,7 @@ class CertificateAuthority(object):
Updates self._ca_key_pairs_list . Updates self._ca_key_pairs_list .
""" """
if ( if (
not self._ca_key_pairs_list or ( self._ca_key_size is not None and not self._ca_key_pairs_list or (
self._ca_key_pairs_list[-1]['crt'].not_valid_after - datetime.datetime.utcnow() self._ca_key_pairs_list[-1]['crt'].not_valid_after - datetime.datetime.utcnow()
).total_seconds() / self._crt_life_time.total_seconds() <= 2 ).total_seconds() / self._crt_life_time.total_seconds() <= 2
) and self._ca_renewal_lock.acquire(False): ) and self._ca_renewal_lock.acquire(False):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment