istio中如何对服务进行角色验证
envoy 中的证书验证
match_subject_alt_names:
exact: "api.example.com"验证下游证书配置
{
"@type": "type.googleapis.com/envoy.api.v2.auth.DownstreamTlsContext", //验证下游,接收请求
"common_tls_context": {
"alpn_protocols": [
"istio-peer-exchange",
"h2",
"http/1.1"
],
"tls_certificate_sds_secret_configs": [ //获取证书
{
"name": "default",
"sds_config": {
"api_config_source": {
"api_type": "GRPC",
"grpc_services": [
{
"envoy_grpc": {
"cluster_name": "sds-grpc"
}
}
]
}
}
}
],
"combined_validation_context": { //组合验证规则
"default_validation_context": {
},
"validation_context_sds_secret_config": { //验证CA
"name": "ROOTCA",
"sds_config": {
"api_config_source": {
"api_type": "GRPC",
"grpc_services": [
{
"envoy_grpc": {
"cluster_name": "sds-grpc"
}
}
]
}
}
}
}
},
"require_client_certificate": true // Envoy将拒绝没有有效客户端证书的连接。
}验证上游证书配置
pilot agent处理SDS流程
NewServer
FetchSecrets
StreamSecrets
startXDS
ca server签发证书流程
s.maybeCreateCA
s.startCA
caserver.NewWithGRPC
caServer.Run()
_IstioCertificateService_CreateCertificate_Handler

Last updated