证书责任
Server Certificate 责任取决于创建实例时选择的 DNS Zone 模式。在两种模式下,用户都需要提供客户端 CA,并为每个客户端身份签发独立的 Client Certificate。创建实例时需要选择 DNS Zone 模式并启用 mTLS。现有实例不能从未加密 Listener 变更为 mTLS。
配置流程
请按以下顺序完成配置:- 创建或选择 Client CA,并签发 Client Certificate。两种 DNS Zone 模式都必须完成此步骤。
- 准备服务端身份。Public DNS Zone 由 AutoMQ 管理;Private DNS Zone 由用户提供。
- 配置 AutoMQ 实例。
- 配置 Kafka 客户端。
步骤 1:创建 Client CA 和 Client Certificate
两种 DNS Zone 模式都需要 Client CA 和 Client Certificate。优先使用组织的证书管理系统。如果需要自行创建和维护私有 Client CA,可参考以下步骤。创建 Client CA
创建client-ca.cnf,执行命令前替换证书主题信息。
签发 Client Certificate
签发 Client Certificate 前,先创建对应的 Kafka ACL 用户。除非配置了其他 Principal Mapping Rule,否则将证书 Common Name(CN)设置为 ACL 用户名。 默认 Principal Mapping Rule 从 Client Certificate 中提取 CN:CN=user01 的证书映射到 ACL 用户 user01。
创建 client.cnf:
步骤 2:准备服务端身份
AutoMQ Managed Public DNS Zone
用户无需执行服务端证书操作。AutoMQ 提供、安装并续期 Server 权威证书。不要创建或上传 Server Certificate 和 Server Private Key。用户管理的 Private DNS Zone
用户必须提供 Subject Alternative Name(SAN)覆盖 AutoMQ Private DNS Zone 私有接入域名的 Server Certificate。优先使用组织证书颁发机构签发的证书。 以下参考步骤使用步骤 1 创建的 Client CA 签发 Server Certificate。如果组织要求分别使用 Server CA 和 Client CA,请使用 Server CA 签发 Server Certificate,并保留两个 CA 的公共证书,用于步骤 3 的 CA Bundle。 创建server.cnf。请根据实例接入地址使用准确域名或所需的通配符域名,不要依赖 Common Name 完成主机名验证。
步骤 3:配置 AutoMQ
AutoMQ Managed Public DNS Zone
- 创建实例时选择
Public DNS Zone和 AutoMQ Managed 模式。 - 启用 mTLS Listener。
- 将
client-ca.crt作为 Client CA Certificate 上传。 - 不要上传 Server Certificate 或 Server Private Key。
- 创建与 Client Certificate 身份匹配的 ACL 用户,并仅授予所需的 Topic 和 Consumer Group 权限。
用户管理的 Private DNS Zone
- 创建实例时选择用户管理的
Private DNS Zone,并启用 mTLS Listener。 - 上传同时包含 Client CA 和 Server CA 公共证书的 PEM CA Bundle。如果像本示例一样使用同一个 CA 签发两类证书,只需上传一次
client-ca.crt。 - 将
server.crt作为 Server Certificate、server.key作为 Server Private Key 上传。 - 创建与 Client Certificate 身份匹配的 ACL 用户,并仅授予所需的 Topic 和 Consumer Group 权限。
步骤 4:配置 Kafka 客户端
将 Client Certificate 和 Client Private Key 转换为 PKCS#12 Keystore:client-ca.crt 作为 Server CA Certificate。
证书过期责任
- AutoMQ Managed Public DNS Zone: AutoMQ 监控并续期 Server Certificate;用户监控并轮转 Client CA 和所有 Client Certificate。
- 用户管理的 Private DNS Zone: 用户监控并轮转 Server CA、Server Certificate、Client CA 和 Client Certificate。
kafka_stream_cert_expiry_timestamp_milliseconds 和 kafka_stream_cert_days_remaining 暴露已安装 Server Certificate 的有效期。采集方法请参见 Prometheus 监控与告警。Client Certificate 有效期需要纳入用户自己的证书管理流程。