Skip to content

Commit dbf2eb7

Browse files
chore: Explain the calculation of safe_max_cert_lifetime
1 parent 3757715 commit dbf2eb7

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

  • rust/operator-binary/src/backend/tls

rust/operator-binary/src/backend/tls/mod.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ impl TlsGenerate {
213213

214214
// Safe maximum certificate lifetime that ensures that the lifetimes of two certificates do
215215
// not overlap if their issuer certificates are not known to each other.
216+
//
217+
// For instance, if the `active_ca_certificate_lifetime` is 20 days, then it is rotated
218+
// after 10 days (= active_ca_certificate_lifetime / CA_ROTATION_FRACTION). Let us assume
219+
// that `max_cert_lifetime` is 6 days (> 10 days / 2). If pod 1 is generated on day 9, it
220+
// can be alive until day 15 and only knows CA 1. If pod 2 is generated on day 15, its
221+
// certificate is signed by CA 2 because CA 1 expires while pod 2 is alive. On day 15, pod
222+
// 1 would not be able to communicate with pod 2 because it has no knowledge of CA 2. To
223+
// ensure, that the lifetimes of these two pods cannot overlap, the
224+
// `safe_max_cert_lifetime` is the half of the 10 days (= active_ca_certificate_lifetime /
225+
// CA_ROTATION_FRACTION / 2).
216226
let safe_max_cert_lifetime = active_ca_certificate_lifetime / CA_ROTATION_FRACTION / 2;
217227

218228
if max_cert_lifetime > safe_max_cert_lifetime {

0 commit comments

Comments
 (0)