autoTls: bound certificate lifetime by the CA that will actually sign it, not the configured caCertificateLifetime
还没有人认领这个 Issue。
评估
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- kubernetes, rust
调研方向
从 TlsGenerate::get_or_create_k8s_certificate 开始;NodePublishVolume 构建后端时会调用它,然后检查 ca::Manager::load_or_create,以加载 Secret 的 CA 证书。使用 CA 中最晚的过期时间实现有效期上限,同时保留现有的硬失败行为:当没有 CA 能覆盖当前时间加上重启缓冲时间时失败。检查现有的警告或条件行为,并通过相关测试验证证书有效期和失败边界情况。
由索引模型根据 Issue 内容生成。
描述
get_or_create_k8s_certificate clamps maxCertificateLifetime to (caCertificateLifetime - caCertificateRetirementDuration) / 4.
That is good in general, bad when someone brings their own CA as secret operator never looks at the actual CA that is provided. It just looks at what is in the CR:
ca:
secret:
name: secret-provisioner-tls-ca
namespace: default
autoGenerate: false
caCertificateLifetime: 700d
caCertificateRetirementDuration: 1d
maxCertificateLifetime = (700 - 1) / 4 = 174 (or 175, not sure, doesn't matter here)
That clamps to 174d . But we have no idea what's really in the CA.
If it has 200 days left:
- above 174 days remaining: works
- 174 down to 139: flip-flops, because jitter puts each cert somewhere in 139-174d and only some of them still fit
- below 139: every mount fails
That is not great.
It only happens when autoGenerate is false, but still....
Scope
- Calculate the clamp by looking at the CA in the Secret that expires last
- Keep it a hard failure where no CA covers
now + restartBuffer - Warning Event and/or condition on the Pod when the cert had to be shortened because of the CA's remaining lifetime?
- Open question....do we do this elsewhere? Easy to do? I think it'd be good.
[!NOTE]
This next bit is complicated and I'm not 100% sure it is all correct. I think it makes sense but I have a nagging feeling that something is still off. It is 100% written by hand but I'm not sure if the new steps 3 & 4 are correct to be honest. So many edge cases.
When a pod mounts a TLS volume, NodePublishVolume builds the backend for that SecretClass.
For autoTls that is TlsGenerate::get_or_create_k8s_certificate, which does, in this order:
- safe_max_cert_lifetime = (caCertificateLifetime - caCertificateRetirementDuration) / 4, from the CR fields
- max_cert_lifetime = min(maxCertificateLifetime, safe_max_cert_lifetime). This is the clamp.
- ca::Manager::load_or_create, which reads the CA certificates from the Secret
We need to load the CAs (step 3) before computing the clamp (step 2), and additionally bound it (the max cert lifetime) by the remaining lifetime (not_after - now, minus caCertificateRetirementDuration) of the CA that expires last. This way we never create certificates that can outlive the last expiring CA.
- ca::Manager::load_or_create, reads the CA certificates from the Secret
- safe_max_cert_lifetime = (caCertificateLifetime - caCertificateRetirementDuration) / 4, from the CR, unchanged
- ca_bound = not_after(CA that expires last) - now - caCertificateRetirementDuration, from the loaded certificates. This is new.
- max_cert_lifetime = min(maxCertificateLifetime, safe_max_cert_lifetime, ca_bound)
[!NOTE]
Do we even still needsafe_max_cert_lifetime? I believe it makes sure that all Pods can still talk to each other even if some already have a new CA and others don't but 🤯
Open questions
- Check the existing warnings whether they are correctly calculated and/or whether we want something new
- Event or Pod condition or both? An Event per mount is noisy on a large StatefulSet, otoh we might want noisy in this case?
- I believe it'd be easy to fold #94 into this. If you agree and it adds less than a day you're welcome to do so. Otherwise skip.
- I understand that this is underspecified but at least a log line and maybe another condition woudl be good here?
Out of scope
- Validating the SecretClass on admission
Expected effort
1-2 days. If it takes longer, stop and flag it.
- 主要语言
- Rust
- 星标
- 13
- 派生
- 8
- 平均合并
- 1 天 6 小时
- 30 天内合并 PR
- 8
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
stackabletech/secret-operator 的其他 Issue
-
type/bug
难度 4/5 3-5 天 新手友好度 45/100
stackabletech/secret-operator#754 ·
-
难度 3/5 1-2 天 新手友好度 72/100
stackabletech/secret-operator#720 · 1 条评论 ·
-
customer-request type/bug
难度 3/5 1-2 天 新手友好度 38/100
stackabletech/secret-operator#666 · 2 条评论 ·
-
Allow certificates to contain subjects with allowed external names可能重新可做 @NickLarsenNZ 于 402 天前认领,目前没有进行中的 PR。 未关闭customer-request type/feature-improvement
stackabletech/secret-operator#630 · 7 条评论 · 已指派 1 人 ·
-
Add missing Pod IPs to created certificates可能重新可做 @Techassi 于 213 天前认领,目前没有进行中的 PR。 未关闭
stackabletech/secret-operator#620 · 2 条评论 · 已指派 1 人 ·
查看 stackabletech/secret-operator 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 78/100
solana-foundation/pay-kit#341 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 88/100
anthropics/buffa#487 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 74/100
arkworks-rs/algebra#1161 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 85/100
lbjlaq/Antigravity-Manager#3525 · 2 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
bug
难度 2/5 1-3 小时 新手友好度 78/100
rustdesk/rustdesk-server#708 ·