Allow certificates to contain subjects with allowed external names
@NickLarsenNZ 已经在做这个了。
开始于 2025年8月20日。
评估
这个 Issue 还没有评估数据。
描述
Overview
Currently, secret-operator can only sign/request certificates with IP/DNS names based on these scopes:
listener-volume(The external-name that is reported back by the Load Balancer controller[^1]).node(eg:10.0.0.1ornode-1.local.domain. If I understand correctly, this becomes obsolete sincelistener-volumescope)pod(STS) (eg:pod-0.app-service.app-namespace.svc.cluster.local)service(FQDN of the named service, eg:app-service.app-namespace.svc.cluster.local
Customers often want to use an external[^2] DNS name, and in many cases use external-dns to automatically create DNS records for Services/Ingress/Gateway resources.
Common environment setups
In many environments (both Cloud and On-Prem):
- The kubelet clusterDomain is not usable outside of the cluster (especially
when it is the default ofcluster.local), and - Customers often use names under a suffix separate from the kubelet
clusterDomain. Often this is a shorter name (eg:app.team.example.com
instead ofapp.app-service.app-namespace.cluster.domain). - DNS is often auto-configured using External DNS, which is configured in these
ways:- For Services, an annotation is place to map the DNS name to the Service
(NodePort, or LoadBalancer) IP. - For Ingress/Gateway, there are dedicated fields for specifying the DNS name.
- For Services, an annotation is place to map the DNS name to the Service
- Load balancers do TLS termination
- In the case of internet-facing load balancers, this can be used to hide the
subject names on the internal certificate which leak information such as the
Kubernetes namespace and clusterDomain.
- In the case of internet-facing load balancers, this can be used to hide the
In some cases, they can work around this by using a Load Balancer that does L5 (TLS termination) or L7 (HTTP proxying), however with SNI checks becoming more prevalent these methods are becoming less effective when the external name used is not in the certificate used by the application.
This issue is about allowing external names to be added to certificates and a suggested approach follows...
[^1]: Often, this is a dynamic (and not user-friendly) name and is not intended to be used directly, but rather be the value of the DNS CNAME record of the intended external name.
[^2]: Whether that is on the internet, or just within their organization - it is external to the Kubernetes cluster.
Suggested approach
- Extend the
SecretClassto allow a list of suffixes (and minDepth/maxDepth number of dots) for additional names that can be added to the certificate. - Extend
Listenerwith anexternalName(or externalNames?) field.- If the listener-volume scope is used, and the suffix is permitted (within the minDepth/maxDepth bounds), then secret-operator will add that as a subject to the certificate request.
- Extend
Listenerwith aserviceAnnotationsfield.- We could use this opportunity to consistently name the fields in
ListenerandListenerClass(either all fields to be passed to Service are prefixed withservice, or we put everything underServiceOverrides.
- We could use this opportunity to consistently name the fields in
[!IMPORTANT]
Question: If the externalName set on the listener is not permitted in the certificate (or minDepth/maxDepth are out of bounds), where should an error event go? It could go on the Listener, but the listener doesn't concern itself too much with TLS details.
Example config:
Have a SecretClass which allows signing names under certain additional suffixes.
apiVersion: secrets.stackable.tech/v1alpha1
kind: SecretClass
metadata:
name: org-pki
spec:
backend:
# Using autoTls as an example, but same applies for any supported backend
autoTls:
ca:
secret:
name: secret-provisioner-tls-ca
namespace: default
autoGenerate: true
maxCertificateLifetime: 15d
# 👇 New
allowedSuffixes: # maybe should be additionalSuffixes, since it is on top of existing names
- suffix: internal.example.com
maxDepth: 0 # allow anything under internal.example.com, eg: a.b.c.d.internal.example.com
# or
- suffix: internal.example.com
maxDepth: 1 # default, only allow one dot between the name and the suffix, eg: a.internal.example.com
# or
- suffix: internal.example.com
# Example: the organisation allows signing certs for $app.$team.internal.example.com
# by requiring two dots between the name and the suffix
# allow a.b.internal.example.com
# disallow a.internal.example.com
# disallow a.b.c.internal.example.com
minDepth: 2
maxDepth: 2
# alternatively we could define depth and make it mutually exclusive to minDepth/maxDepth
- suffix: internal.example.net
Have a ListenerClass ready for making public facing AWS NLBs with TLS termination
apiVersion: listeners.stackable.tech/v1alpha1
kind: ListenerClass
metadata:
name: aws-ec2-nlb-public
spec:
# I think it would make more sense to make a serviceOverrides key instead of prefixing some with "service" and missing it in others (eg: loadBalancerClass)
serviceType: LoadBalancer
# https://docs.aws.amazon.com/eks/latest/userguide/auto-configure-nlb.html#_sample_service
loadBalancerClass: eks.amazonaws.com/nlb
loadBalancerAllocateNodePorts: false
preferredAddressType: HostnameConservative
serviceExternalTrafficPolicy: Local
serviceAnotations:
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip # Forward directly through node to Pod IP instead of an L3 hop/NAT through the node.
service.beta.kubernetes.io/aws-load-balancer-attributes: >-
proxy_protocol_v2.enabled=true
Have a NifiCluster, specifying an externalName (to be used in the resultant Listener) and service annotations to enable TLS temination on the Load Balancer, and a hostname to be configured by External DNS.
apiVersion: nifi.stackable.tech/v1alpha1
kind: NifiCluster
metadata:
name: simple-nifi
spec:
clusterConfig:
tls:
serverSecretClass: org-pki
nodes:
roleConfig:
# I think this should be moved under listenerOverrides as className...
listenerClass: aws-nlb-tls
# 👇 New
listenerOverrides:
className: aws-nlb-tls # moved from roleConfig.listenerClass
externalName: app.internal.example.com
serviceAnnotations:
external-dns.alpha.kubernetes.io/hostname: app.internal.example.com
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:eu-central-1:123456789012:certificate/4e12c4fe-eed9-48db-98d8-820b6b50ace4
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "8443"
Based on the configurations above, the objects below should be created by the NiFi Operator:
# This is the Listener produced by NifiCluster
kind: Listener
metadata:
name: the-nifi-listener
spec:
className: aws-nlb-tls-public
# 👇 New
externalName: app.internal.example.com # this came from the NifiCluster overrides
# 👇 Not yet available, see (see: https://github.com/stackabletech/listener-operator/issues/331)
serviceAnnotations:
external-dns.alpha.kubernetes.io/hostname: app.internal.example.com
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:eu-central-1:123456789012:certificate/4e12c4fe-eed9-48db-98d8-820b6b50ace4
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "8443"
# This is the Pod produced by the Deployment produced by the NifiCluster
apiVersion: v1
kind: Pod
metadata:
name: nifi-0
spec:
volumes:
- name: tls
ephemeral:
volumeClaimTemplate:
metadata:
annotations:
secrets.stackable.tech/class: org-pki
secrets.stackable.tech/scope: pod,service=nifi,listener-volume=the-nifi-listener
Based on the configurations above, the object below should be created by the Listener Operator:
apiVersion: v1
kind: Service
metadata:
name: nifi-listener
annotations:
external-dns.alpha.kubernetes.io/hostname: app.internal.example.com
service.beta.kubernetes.io/aws-load-balancer-attributes: proxy_protocol_v2.enabled=true
service.beta.kubernetes.io/aws-load-balancer-nlb-target-type: ip
service.beta.kubernetes.io/aws-load-balancer-scheme: internet-facing
service.beta.kubernetes.io/aws-load-balancer-ssl-cert: arn:aws:acm:eu-central-1:123456789012:certificate/4e12c4fe-eed9-48db-98d8-820b6b50ace4
service.beta.kubernetes.io/aws-load-balancer-ssl-ports: "8443"
spec:
type: LoadBalancer
loadBalancerClass: eks.amazonaws.com/nlb
loadBalancerAllocateNodePorts: false
externalTrafficPolicy: Local
ports: ...
- 主要语言
- Rust
- 星标
- 13
- 派生
- 8
- 平均合并
- 1 天 12 小时
- 30 天内合并 PR
- 6
环境准备
- 没有 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 天 新手友好度 48/100
stackabletech/secret-operator#753 · 1 条评论 ·
-
skip the PodListeners lookup when the served Pod is being deleted可能已有人在做 @soenkeliebau 于 31 天前认领。 未关闭
难度 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 条评论 ·
-
Add missing Pod IPs to created certificates可能重新可做 @Techassi 于 229 天前认领,目前没有进行中的 PR。 未关闭
stackabletech/secret-operator#620 · 2 条评论 · 已指派 1 人 ·
查看 stackabletech/secret-operator 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 69/100
router-for-me/EasyCLIProxyAPI#406 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 67/100
-
难度 2/5 1-3 小时 新手友好度 83/100
维护者通常 1 天内回复
-
ai-priority/P2 bug db/oracle user-priority/P1
难度 2/5 1-3 小时 新手友好度 67/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 63/100