mirror of https://github.com/istio/istio.io.git
272 lines
102 KiB
HTML
272 lines
102 KiB
HTML
<!doctype html><html lang=zh itemscope itemtype=https://schema.org/WebPage><head><meta charset=utf-8><meta http-equiv=x-ua-compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name=theme-color content="#466BB0"><meta name=title content="安全"><meta name=description content="描述 Istio 的授权与认证功能。"><meta name=keywords content="microservices,services,mesh,security,policy,policies,authentication,authorization,rbac,access-control"><meta property="og:title" content="安全"><meta property="og:type" content="website"><meta property="og:description" content="描述 Istio 的授权与认证功能。"><meta property="og:url" content="/v1.7/zh/docs/concepts/security/"><meta property="og:image" content="/v1.7/img/istio-whitelogo-bluebackground-framed.svg"><meta property="og:image:alt" content="Istio Logo"><meta property="og:image:width" content="112"><meta property="og:image:height" content="150"><meta property="og:site_name" content="Istio"><meta name=twitter:card content="summary"><meta name=twitter:site content="@IstioMesh"><title>Istioldie 1.7 / 安全</title><script async src="https://www.googletagmanager.com/gtag/js?id=UA-98480406-2"></script><script>window.dataLayer=window.dataLayer||[];function gtag(){dataLayer.push(arguments);}
|
||
gtag('js',new Date());gtag('config','UA-98480406-2');</script><link rel=alternate type=application/rss+xml title="Istio Blog" href=/v1.7/blog/feed.xml><link rel=alternate type=application/rss+xml title="Istio News" href=/v1.7/news/feed.xml><link rel=alternate type=application/rss+xml title="Istio Blog and News" href=/v1.7/feed.xml><link rel="shortcut icon" href=/v1.7/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.7/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.7/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.7/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.7/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.7/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.7/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.7/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.7/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.7/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.7/manifest.json><meta name=apple-mobile-web-app-title content="Istio"><meta name=application-name content="Istio"><link rel=stylesheet href="https://fonts.googleapis.com/css?family=Work+Sans:400|Chivo:400|Work+Sans:500,300,600,300italic,400italic,500italic,600italic|Chivo:500,300,600,300italic,400italic,500italic,600italic"><link rel=stylesheet href=/v1.7/css/all.css><script src=/v1.7/js/themes_init.min.js></script></head><body class="language-unknown archive-site"><script>const branchName="release-1.7";const docTitle="安全";const iconFile="\/v1.7/img/icons.svg";const buttonCopy='复制到剪切板';const buttonPrint='打印';const buttonDownload='下载';</script><script src="https://www.google.com/cse/brand?form=search-form" defer></script><script src=/v1.7/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.7/zh/><span class=logo><svg viewBox="0 0 300 300"><circle cx="150" cy="150" r="146" stroke-width="2"/><polygon points="65 240 225 240 125 270"/><polygon points="65 230 125 220 125 110"/><polygon points="135 220 225 230 135 30"/></svg></span><span class=name>Istioldie 1.7</span></a><div id=hamburger><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#hamburger"/></svg></div><div id=header-links><a class=current title="了解如何部署、使用和运维 Istio。" href=/v1.7/zh/docs/>文档</a>
|
||
<a title="关于使用 Istio 的博客文章。" href=/v1.7/zh/blog/2020/>博客<i class=dot data-prefix=/blog></i></a>
|
||
<a title="关于 Istio 项目的最新报道。" href=/v1.7/zh/news/>新闻<i class=dot data-prefix=/news></i></a>
|
||
<a title="关于 Istio 的常见问题。" href=/v1.7/zh/faq/>FAQ</a>
|
||
<a title="关于 Istio 项目的说明。" href=/v1.7/zh/about/>关于</a><div class=menu><button id=gearDropdownButton class=menu-trigger title=选项和设置 aria-label="Options and Settings" aria-controls=gearDropdownContent><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#gear"/></svg></button><div id=gearDropdownContent class=menu-content aria-labelledby=gearDropdownButton role=menu><a tabindex=-1 role=menuitem lang=en id=switch-lang-en>English</a>
|
||
<a tabindex=-1 role=menuitem lang=zh id=switch-lang-zh class=active>中文</a><div role=separator></div><a tabindex=-1 role=menuitem class=active id=light-theme-item>亮主题</a>
|
||
<a tabindex=-1 role=menuitem id=dark-theme-item>暗主题</a><div role=separator></div><a tabindex=-1 role=menuitem id=syntax-coloring-item>代码高亮</a><div role=separator></div><h6>本站的其它版本</h6><a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://istio.io/docs\/concepts\/security\/');return false;">当前版本</a>
|
||
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/docs\/concepts\/security\/');return false;">下个版本</a>
|
||
<a tabindex=-1 role=menuitem href=https://istio.io/archive>旧版本</a></div></div><button id=search-show title="搜索 istio.io" aria-label=搜索><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#magnifier"/></svg></button></div><form id=search-form name=cse role=search><input type=hidden name=cx value=002184991200833970123:iwwf17ikgf4>
|
||
<input type=hidden name=ie value=utf-8>
|
||
<input type=hidden name=hl value=en>
|
||
<input type=hidden id=search-page-url value=/v1.7/search>
|
||
<input id=search-textbox class=form-control name=q type=search aria-label="搜索 istio.io">
|
||
<button id=search-close title=取消搜索 type=reset aria-label=取消搜索><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#cancel-x"/></svg></button></form></nav></header><div class=banner-container></div><main class=primary><div id=sidebar-container class="sidebar-container sidebar-offcanvas"><nav id=sidebar aria-label="Section Navigation"><div class=directory><div class=card><button class="header dynamic" id=card32 title="一些概念,理解它们有助于您更好地了解 Istio 系统的不同部分及其使用的抽象。" aria-controls=card32-body><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#concepts"/></svg>概念</button><div class="body default" aria-labelledby=card32 role=region id=card32-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card32><li role=none><a role=treeitem title="介绍 Istio,它要解决的问题,高层面的架构和设计目标。" href=/v1.7/zh/docs/concepts/what-is-istio/>Istio 是什么?</a></li><li role=none><a role=treeitem title="描述 Istio 多样的流量路由和控制特性。" href=/v1.7/zh/docs/concepts/traffic-management/>流量管理</a></li><li role=none><a role=treeitem title="讲述 Istio 的 WebAssembly 插件系统。" href=/v1.7/zh/docs/concepts/wasm/>扩展性</a></li><li role=none><span role=treeitem class=current title="描述 Istio 的授权与认证功能。">安全</span></li><li role=none><a role=treeitem title="描述 Istio 提供的遥测和监控特性。" href=/v1.7/zh/docs/concepts/observability/>可观察性</a></li></ul></div></div><div class=card><button class="header dynamic" id=card48 title="关于如何在 Kubernetes 集群中安装 Istio 控制平面和添加虚拟机到 mesh 中的说明。" aria-controls=card48-body><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#setup"/></svg>安装</button><div class=body aria-labelledby=card48 role=region id=card48-body><ul role=tree aria-expanded=true aria-labelledby=card48><li role=none><a role=treeitem title="下载、安装并学习如何快速使用 Istio 的基本特性。" href=/v1.7/zh/docs/setup/getting-started/>开始</a></li><li role=treeitem aria-label=平台安装><button aria-hidden=true></button><a title="在安装 Istio 之前如何准备各种 Kubernetes 平台。" href=/v1.7/zh/docs/setup/platform-setup/>平台安装</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="对阿里云 Kubernetes 集群进行配置以便安装运行 Istio。" href=/v1.7/zh/docs/setup/platform-setup/alicloud/>阿里云</a></li><li role=none><a role=treeitem title="为 Istio 设置一个 Azure 集群的指令。" href=/v1.7/zh/docs/setup/platform-setup/azure/>Azure</a></li><li role=none><a role=treeitem title="在 Docker Desktop 中运行 Istio 的设置说明。" href=/v1.7/zh/docs/setup/platform-setup/docker/>Docker Desktop</a></li><li role=none><a role=treeitem title="在 Google Kubernetes Engine (GKE) 上快速搭建 Istio 服务。" href=/v1.7/zh/docs/setup/platform-setup/gke/>使用 Google Kubernetes Engine 快速开始</a></li><li role=none><a role=treeitem title="在 IBM 公有云或私有云上快速搭建 Istio 服务。" href=/v1.7/zh/docs/setup/platform-setup/ibm/>IBM Cloud 快速开始</a></li><li role=none><a role=treeitem title="为 Istio 设置 kind 的说明。" href=/v1.7/zh/docs/setup/platform-setup/kind/>kind</a></li><li role=none><a role=treeitem title="使用 Gardener 快速搭建 Istio 服务。" href=/v1.7/zh/docs/setup/platform-setup/gardener/>Kubernetes Gardener 快速开始</a></li><li role=none><a role=treeitem title="配置 MicroK8s 以便使用 Istio。" href=/v1.7/zh/docs/setup/platform-setup/microk8s/>MicroK8s</a></li><li role=none><a role=treeitem title="在 Minikube 上配置 Istio。" href=/v1.7/zh/docs/setup/platform-setup/minikube/>Minikube</a></li><li role=none><a role=treeitem title="对 OpenShift 集群进行配置以便安装运行 Istio。" href=/v1.7/zh/docs/setup/platform-setup/openshift/>OpenShift</a></li><li role=none><a role=treeitem title="为 Istio 配置 OKE 集群环境的说明。" href=/v1.7/zh/docs/setup/platform-setup/oci/>Oracle Cloud Infrastructure</a></li></ul></li><li role=treeitem aria-label=安装><button aria-hidden=true></button><a title=选择最适合您的需求和平台的指南。 href=/v1.7/zh/docs/setup/install/>安装</a><ul role=group aria-expanded=false><li role=none><a role=treeitem title="安装和自定义任何 Istio 配置文件以进行深入评估或用于生产。" href=/v1.7/zh/docs/setup/install/istioctl/>使用 Istioctl 安装</a></li><li role=none><a role=treeitem title="安装和配置 Istio 以进行深入评估或用于生产。" href=/v1.7/zh/docs/setup/install/helm/>使用 Helm 自定义安装</a></li><li role=none><a role=treeitem title="使用 Istio operator 在 Kubernetes 集群中安装 Istio 指南。" href=/v1.7/zh/docs/setup/install/standalone-operator/>安装独立 Operator [实验]</a></li><li role=treeitem aria-label=多集群安装><button aria-hidden=true></button><a title="配置跨越多个 Kubernetes 集群的 Istio 服务网格。" href=/v1.7/zh/docs/setup/install/multicluster/>多集群安装</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="配置一个跨多个 Kubernetes 集群的 Istio 网格。" href=/v1.7/zh/docs/setup/install/multicluster/simplified/>简化地多集群安装[实验性]</a></li><li role=none><a role=treeitem title="通过控制平面副本集实例,在多个 Kubernetes 集群上安装 Istio 网格。" href=/v1.7/zh/docs/setup/install/multicluster/gateways/>控制平面副本集</a></li><li role=none><a role=treeitem title="安装一个跨多个 Kubernetes 集群的 Istio 网格,多集群共享控制平面,并且集群间通过 VPN 互连。" href=/v1.7/zh/docs/setup/install/multicluster/shared-vpn/>共享控制平面(单一网络)</a></li><li role=none><a role=treeitem title="跨多个 Kubernetes 集群安装一个 Istio 网格,使互不联通的集群网络共享同一个控制平面。" href=/v1.7/zh/docs/setup/install/multicluster/shared-gateways/>共享的控制平面(多网络)</a></li></ul></li></ul></li><li role=treeitem aria-label=升级><button aria-hidden=true></button><a title="选择与您先前用于安装 Istio 的方法相对应的升级指南。" href=/v1.7/zh/docs/setup/upgrade/>升级</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="使用 istioctl 命令来升级或降级 Istio。" href=/v1.7/zh/docs/setup/upgrade/istioctl-upgrade/>使用 istioctl 命令升级 Istio [实验中]</a></li><li role=none><a role=treeitem title="升级 Istio 控制平面,可以选择使用 Helm 升级 CNI 插件。" href=/v1.7/zh/docs/setup/upgrade/cni-helm-upgrade/>使用 Helm 升级</a></li></ul></li><li role=treeitem aria-label=更多指南><button aria-hidden=true></button><a title=有关其他设置任务的更多信息。 href=/v1.7/zh/docs/setup/additional-setup/>更多指南</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="描述 Istio 内置的安装配置文件。" href=/v1.7/zh/docs/setup/additional-setup/config-profiles/>安装配置</a></li><li role=none><a role=treeitem title="在应用程序 Pod 中使用 sidecar injector webhook 自动安装或使用 istioctl CLI 手动安装 Istio sidecar。" href=/v1.7/zh/docs/setup/additional-setup/sidecar-injection/>设置 Sidecar</a></li><li role=none><a role=treeitem title="安装并使用 Istio CNI 插件,可以让运维人员用更低的权限来部署服务。" href=/v1.7/zh/docs/setup/additional-setup/cni/>安装 Istio CNI 插件</a></li></ul></li></ul></div></div><div class=card><button class="header dynamic" id=card64 title="如何用 Istio 系统实现特定目标的行为。" aria-controls=card64-body><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#tasks"/></svg>任务</button><div class=body aria-labelledby=card64 role=region id=card64-body><ul role=tree aria-expanded=true aria-labelledby=card64><li role=treeitem aria-label=流量管理><button aria-hidden=true></button><a title="演示 Istio 的流量路由功能的任务。" href=/v1.7/zh/docs/tasks/traffic-management/>流量管理</a><ul role=group aria-expanded=false><li role=none><a role=treeitem title=此任务将展示如何将请求动态路由到微服务的多个版本。 href=/v1.7/zh/docs/tasks/traffic-management/request-routing/>配置请求路由</a></li><li role=none><a role=treeitem title=此任务说明如何注入故障并测试应用程序的弹性。 href=/v1.7/zh/docs/tasks/traffic-management/fault-injection/>故障注入</a></li><li role=none><a role=treeitem title=展示如何将流量从旧版本迁移到新版本的服务。 href=/v1.7/zh/docs/tasks/traffic-management/traffic-shifting/>流量转移</a></li><li role=none><a role=treeitem title="展示如何将一个服务的 TCP 流量从旧版本迁移到新版本。" href=/v1.7/zh/docs/tasks/traffic-management/tcp-traffic-shifting/>TCP 流量转移</a></li><li role=none><a role=treeitem title="本任务用于示范如何使用 Istio 在 Envoy 中设置请求超时。" href=/v1.7/zh/docs/tasks/traffic-management/request-timeouts/>设置请求超时</a></li><li role=none><a role=treeitem title=本任务展示如何为连接、请求以及异常检测配置熔断。 href=/v1.7/zh/docs/tasks/traffic-management/circuit-breaking/>熔断</a></li><li role=none><a role=treeitem title="此任务演示了 Istio 的流量镜像/影子功能。" href=/v1.7/zh/docs/tasks/traffic-management/mirroring/>镜像</a></li><li role=treeitem aria-label=Ingress><button aria-hidden=true></button><a title="控制 Istio 服务网格的入口流量。" href=/v1.7/zh/docs/tasks/traffic-management/ingress/>Ingress</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="描述如何配置 Istio gateway,以将服务暴露至服务网格之外。" href=/v1.7/zh/docs/tasks/traffic-management/ingress/ingress-control/>Ingress Gateway</a></li><li role=none><a role=treeitem title="使用文件挂载的证书并通过 TLS 或 mTLS 将服务暴露至服务网格之外。" href=/v1.7/zh/docs/tasks/traffic-management/ingress/secure-ingress-mount/>安全网关(文件挂载)</a></li><li role=none><a role=treeitem title="使用 Secret 发现服务(SDS) 通过 TLS 或者 mTLS 把服务暴露给服务网格外部。" href=/v1.7/zh/docs/tasks/traffic-management/ingress/secure-ingress-sds/>使用 SDS 为 Gateway 提供 HTTPS 加密支持</a></li><li role=none><a role=treeitem title="说明了如何为一个 ingress gateway 配置 SNI 透传。" href=/v1.7/zh/docs/tasks/traffic-management/ingress/ingress-sni-passthrough/>无 TLS 终止的 Ingress Gateway</a></li></ul></li><li role=treeitem aria-label=Egress><button aria-hidden=true></button><a title="控制 Istio 服务网格的出口流量。" href=/v1.7/zh/docs/tasks/traffic-management/egress/>Egress</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="描述如何配置 Istio 以将流量从网格中的服务路由到外部服务。" href=/v1.7/zh/docs/tasks/traffic-management/egress/egress-control/>访问外部服务</a></li><li role=none><a role=treeitem title="描述如何配置 Istio 对来自外部服务的流量执行 TLS 发起。" href=/v1.7/zh/docs/tasks/traffic-management/egress/egress-tls-origination/>Egress TLS Origination</a></li><li role=none><a role=treeitem title="描述如何配置 Istio 通过专用网关服务将流量定向到外部服务。" href=/v1.7/zh/docs/tasks/traffic-management/egress/egress-gateway/>Egress Gateway</a></li><li role=none><a role=treeitem title="描述如何配置一个 Egress 网关,来向外部服务发起 TLS 连接。" href=/v1.7/zh/docs/tasks/traffic-management/egress/egress-gateway-tls-origination/>Egress 网关的 TLS 发起过程</a></li><li role=none><a role=treeitem title="描述如何开启通用域中一组主机的 egress,无需单独配置每一台主机。" href=/v1.7/zh/docs/tasks/traffic-management/egress/wildcard-egress-hosts/>Wildcard 主机的 egress</a></li><li role=none><a role=treeitem title="描述如何在 TLS Egress 上配置 SNI 监控和策略。" href=/v1.7/zh/docs/tasks/traffic-management/egress/egress_sni_monitoring_and_policies/>TLS Egress 监控和策略配置</a></li><li role=none><a role=treeitem title="描述如何配置 Istio 以允许应用程序使用外部 HTTPS 代理。" href=/v1.7/zh/docs/tasks/traffic-management/egress/http-proxy/>使用外部 HTTPS 代理</a></li><li role=none><a role=treeitem title="展示如何配置 Istio Kubernetes 外部服务。" href=/v1.7/zh/docs/tasks/traffic-management/egress/egress-kubernetes-services/>Kubernetes Egress 流量服务</a></li></ul></li></ul></li><li role=treeitem aria-label=安全><button aria-hidden=true></button><a title=演示如何保护网格。 href=/v1.7/zh/docs/tasks/security/>安全</a><ul role=group aria-expanded=false><li role=treeitem aria-label=认证><button aria-hidden=true></button><a title="管控网格服务间的双向 TLS 和终端用户的身份认证。" href=/v1.7/zh/docs/tasks/security/authentication/>认证</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="通过一个简化的工作流和最小化配置实现双向 TLS。" href=/v1.7/zh/docs/tasks/security/authentication/auto-mtls/>自动双向 TLS</a></li><li role=none><a role=treeitem title="为您展示如何使用 Istio 认证策略设置双向 TLS 和基础终端用户认证。" href=/v1.7/zh/docs/tasks/security/authentication/authn-policy/>认证策略</a></li><li role=none><a role=treeitem title="展示如何在 HTTPS 服务上启用双向 TLS。" href=/v1.7/zh/docs/tasks/security/authentication/https-overlay/>通过 HTTPS 进行 TLS</a></li><li role=none><a role=treeitem title="阐述如何将 Istio 服务逐步迁移至双向 TLS 通信模式。" href=/v1.7/zh/docs/tasks/security/authentication/mtls-migration/>双向 TLS 迁移</a></li></ul></li><li role=treeitem aria-label="Citadel 配置"><button aria-hidden=true></button><a title="定制 Citadel 证书颁发机构。" href=/v1.7/zh/docs/tasks/security/citadel-config/>Citadel 配置</a><ul role=group aria-expanded=false class=leaf-section></ul></li><li role=treeitem aria-label=授权><button aria-hidden=true></button><a title="展示如何控制到 Istio 服务的访问。" href=/v1.7/zh/docs/tasks/security/authorization/>授权</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="展示如何设置基于角色的 HTTP 流量访问控制。" href=/v1.7/zh/docs/tasks/security/authorization/authz-http/>HTTP 流量授权</a></li><li role=none><a role=treeitem title="展示如何设置 TCP 流量的访问控制。" href=/v1.7/zh/docs/tasks/security/authorization/authz-tcp/>TCP 流量的授权</a></li><li role=none><a role=treeitem title="有关如何在 Istio 中通过 JWT 实现访问控制的教程。" href=/v1.7/zh/docs/tasks/security/authorization/authz-jwt/>基于 JWT 授权</a></li><li role=none><a role=treeitem title=阐述如何在不更改授权策略的前提下从一个信任域迁移到另一个。 href=/v1.7/zh/docs/tasks/security/authorization/authz-td-migration/>授权策略信任域迁移</a></li></ul></li><li role=none><a role=treeitem title="演示系统管理员如何使用现有的根证书、签名证书和密钥配置 Istio 的 CA。" href=/v1.7/zh/docs/tasks/security/plugin-ca-cert/>插入外部 CA 证书</a></li><li role=none><a role=treeitem title="展示如何准备和管理 Istio DNS 证书。" href=/v1.7/zh/docs/tasks/security/dns-cert/>Istio DNS 证书管理</a></li></ul></li><li role=treeitem aria-label=策略><button aria-hidden=true></button><a title=演示策略执行功能。 href=/v1.7/zh/docs/tasks/policy-enforcement/>策略</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="这个任务将告诉你如何开启 Istio 的策略检查功能。" href=/v1.7/zh/docs/tasks/policy-enforcement/enabling-policy/>启用策略检查功能</a></li><li role=none><a role=treeitem title="这部分内容将向您展示如何使用 Istio 去动态限制服务间的流量。" href=/v1.7/zh/docs/tasks/policy-enforcement/rate-limiting/>启用速率限制</a></li><li role=none><a role=treeitem title=演示如何使用策略适配器修改请求头和路由。 href=/v1.7/zh/docs/tasks/policy-enforcement/control-headers/>请求头和路由控制</a></li><li role=none><a role=treeitem title="描述如何使用简单的 denials 或黑白名单来控制对服务的访问。" href=/v1.7/zh/docs/tasks/policy-enforcement/denial-and-list/>Denials 和黑白名单</a></li></ul></li><li role=treeitem aria-label=可观察性><button aria-hidden=true></button><a title=演示如何从网格收集遥测信息。 href=/v1.7/zh/docs/tasks/observability/>可观察性</a><ul role=group aria-expanded=false><li role=treeitem aria-label=指标度量><button aria-hidden=true></button><a title="演示 Istio 网格指标度量的配置、收集和处理。" href=/v1.7/zh/docs/tasks/observability/metrics/>指标度量</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="此任务向您展示如何配置 Istio 以采集和自定义指标。" href=/v1.7/zh/docs/tasks/observability/metrics/collecting-metrics/>采集指标</a></li><li role=none><a role=treeitem title="本任务展示了如何配置 Istio 进行 TCP 服务的指标收集。" href=/v1.7/zh/docs/tasks/observability/metrics/tcp-metrics/>收集 TCP 服务指标</a></li><li role=none><a role=treeitem title="本任务介绍如何通过 Prometheus 查询 Istio 度量指标。" href=/v1.7/zh/docs/tasks/observability/metrics/querying-metrics/>通过 Prometheus 查询度量指标</a></li><li role=none><a role=treeitem title="此任务展示了如何设置和使用 Istio Dashboard 监控网格流量。" href=/v1.7/zh/docs/tasks/observability/metrics/using-istio-dashboard/>使用 Grafana 可视化指标</a></li></ul></li><li role=treeitem aria-label=日志><button aria-hidden=true></button><a title="演示 Istio 网格日志的配置、收集和处理。" href=/v1.7/zh/docs/tasks/observability/logs/>日志</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="本任务向您展示如何配置 Istio 来收集和定制日志。" href=/v1.7/zh/docs/tasks/observability/logs/collecting-logs/>收集日志</a></li><li role=none><a role=treeitem title="此任务向您展示如何配置 Envoy 代理将访问日志打印到其标准输出。" href=/v1.7/zh/docs/tasks/observability/logs/access-log/>获取 Envoy 访问日志</a></li><li role=none><a role=treeitem title="此任务向您展示如何配置 Istio 以连接到 Fluentd 守护程序进行日志收集。" href=/v1.7/zh/docs/tasks/observability/logs/fluentd/>使用 Fluentd 进行日志收集</a></li></ul></li><li role=treeitem aria-label=分布式追踪><button aria-hidden=true></button><a title="该任务展示了如何为启用了 Istio 支持的应用进行追踪。" href=/v1.7/zh/docs/tasks/observability/distributed-tracing/>分布式追踪</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="Istio 分布式追踪的概述。" href=/v1.7/zh/docs/tasks/observability/distributed-tracing/overview/>概述</a></li><li role=none><a role=treeitem title="了解如何通过配置代理以将追踪请求发送到 Zipkin。" href=/v1.7/zh/docs/tasks/observability/distributed-tracing/zipkin/>Zipkin</a></li><li role=none><a role=treeitem title="了解如何配置代理以向 Jaeger 发送追踪请求。" href=/v1.7/zh/docs/tasks/observability/distributed-tracing/jaeger/>Jaeger</a></li><li role=none><a role=treeitem title="怎样配置代理才能把追踪请求发送到 LightStep。" href=/v1.7/zh/docs/tasks/observability/distributed-tracing/lightstep/>LightStep</a></li></ul></li><li role=none><a role=treeitem title="此任务向您展示如何在 Istio 网格中可视化服务。" href=/v1.7/zh/docs/tasks/observability/kiali/>网络可视化</a></li><li role=none><a role=treeitem title="此任务向您展示如何配置从外部访问 Istio 遥测插件。" href=/v1.7/zh/docs/tasks/observability/gateways/>远程访问遥测插件</a></li></ul></li></ul></div></div><div class=card><button class="header dynamic" id=card116 title="这里包括多个可供 Istio 使用的可完整工作的示例,你可以用来亲自部署和体验这些示例。" aria-controls=card116-body><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#examples"/></svg>示例</button><div class=body aria-labelledby=card116 role=region id=card116-body><ul role=tree aria-expanded=true aria-labelledby=card116><li role=none><a role=treeitem title="部署一个用于演示多种 Istio 特性的应用,由四个单独的微服务构成。" href=/v1.7/zh/docs/examples/bookinfo/>Bookinfo 应用</a></li><li role=treeitem aria-label=虚拟机><button aria-hidden=true></button><a title="将虚拟机中运行的工作负载添加到 Istio 网格的示例。" href=/v1.7/zh/docs/examples/virtual-machines/>虚拟机</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="学习如何新增一个服务,使其运行在单网络 Istio 网格的虚拟机上。" href=/v1.7/zh/docs/examples/virtual-machines/single-network/>单个网络网格中的虚拟机</a></li><li role=none><a role=treeitem title="学习怎样添加运行在虚拟机上的服务到您的多网络 Istio 网格中。" href=/v1.7/zh/docs/examples/virtual-machines/multi-network/>多网络网格中的虚拟机</a></li><li role=none><a role=treeitem title="使用在网格内的虚拟机上运行的 MySQL 服务运行 Bookinfo 应用程序。" href=/v1.7/zh/docs/examples/virtual-machines/bookinfo/>在虚拟机上部署 Bookinfo 应用程序</a></li></ul></li><li role=treeitem aria-label="使用 Kubernetes 和 Istio 学习微服务"><button aria-hidden=true></button><a title="该模块化教程为新用户提供了一步步将 Istio 应用于常见微服务场景的动手经验。" href=/v1.7/zh/docs/examples/microservices-istio/>使用 Kubernetes 和 Istio 学习微服务</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem href=/v1.7/zh/docs/examples/microservices-istio/prereq/>前提条件</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/examples/microservices-istio/setup-kubernetes-cluster/>设置 Kubernetes 集群</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/examples/microservices-istio/setup-local-computer/>设置本地计算机</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/examples/microservices-istio/single/>本地运行微服务</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/examples/microservices-istio/package-service/>在 Docker 中运行 ratings 服务</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/examples/microservices-istio/bookinfo-kubernetes/>使用 Kubernetes 运行 Bookinfo</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/examples/microservices-istio/production-testing/>生产测试</a></li></ul></li></ul></div></div><div class=card><button class="header dynamic" id=card122 title="关于部署和管理 Istio 网格的概念、工具和技术。" aria-controls=card122-body><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#guide"/></svg>运维</button><div class=body aria-labelledby=card122 role=region id=card122-body><ul role=tree aria-expanded=true aria-labelledby=card122><li role=treeitem aria-label=部署><button aria-hidden=true></button><a title="设置 Istio 部署的要求、概念和注意事项。" href=/v1.7/zh/docs/ops/deployment/>部署</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="描述 Istio 的整体架构与设计目标。" href=/v1.7/zh/docs/ops/deployment/architecture/>架构</a></li><li role=none><a role=treeitem title="描述 Istio 部署中的选择和建议。" href=/v1.7/zh/docs/ops/deployment/deployment-models/>部署模型</a></li><li role=none><a role=treeitem title="介绍 Istio 的性能和可扩展性。" href=/v1.7/zh/docs/ops/deployment/performance-and-scalability/>性能和可扩展性</a></li><li role=none><a role=treeitem title="在启用了 Istio 的集群中运行 Kubernetes 的 Pod 和 Service,您需要做些准备。" href=/v1.7/zh/docs/ops/deployment/requirements/>Pod 和 Service</a></li></ul></li><li role=treeitem aria-label=配置><button aria-hidden=true></button><a title="配置运行中的 Istio 网格的高级概念和功能。" href=/v1.7/zh/docs/ops/configuration/>配置</a><ul role=group aria-expanded=false><li role=treeitem aria-label=网格配置><button aria-hidden=true></button><a title=帮助您管理全局网格配置。 href=/v1.7/zh/docs/ops/configuration/mesh/>网格配置</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="简要描述 Istio 对 Kubernetes webhook 的使用以及可能出现的相关问题。" href=/v1.7/zh/docs/ops/configuration/mesh/webhook/>动态准入 Webhook 概述</a></li><li role=none><a role=treeitem title="介绍 Istio 是如何通过 Kubernetes 的 webhooks 机制来实现 Sidecar 自动注入。" href=/v1.7/zh/docs/ops/configuration/mesh/injection-concepts/>Sidecar 自动注入</a></li><li role=none><a role=treeitem title="描述 Citadel 如何确定是否创建服务账号 secret。" href=/v1.7/zh/docs/ops/configuration/mesh/secret-creation/>创建服务账号 Secret</a></li><li role=none><a role=treeitem title="为您展示如何对 Istio 服务做健康检查。" href=/v1.7/zh/docs/ops/configuration/mesh/app-health-check/>Istio 服务的健康检查</a></li></ul></li><li role=treeitem aria-label=流量管理><button aria-hidden=true></button><a title=帮助您管理正在运行的网格的网络方面。 href=/v1.7/zh/docs/ops/configuration/traffic-management/>流量管理</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title=关于怎么声明协议的信息。 href=/v1.7/zh/docs/ops/configuration/traffic-management/protocol-selection/>协议选择</a></li><li role=none><a role=treeitem title=有关如何启用和理解地域负载平衡。 href=/v1.7/zh/docs/ops/configuration/traffic-management/locality-load-balancing/>地域负载均衡</a></li></ul></li><li role=treeitem aria-label=安全><button aria-hidden=true></button><a title=帮助您管理正在运行的网格的安全性方面。 href=/v1.7/zh/docs/ops/configuration/security/>安全</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="使用加固的容器镜像来减小 Istio 的攻击面。" href=/v1.7/zh/docs/ops/configuration/security/harden-docker-images/>加固 Docker 容器镜像</a></li><li role=none><a role=treeitem title="学习如何延长 Istio 自签名根证书的寿命。" href=/v1.7/zh/docs/ops/configuration/security/root-transition/>延长自签名证书的寿命</a></li></ul></li><li role=treeitem aria-label=可观测性><button aria-hidden=true></button><a title=帮助您管理正在运行的网格中的遥测收集和可视化。 href=/v1.7/zh/docs/ops/configuration/telemetry/>可观测性</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="精细化控制 Envoy 的统计信息。" href=/v1.7/zh/docs/ops/configuration/telemetry/envoy-stats/>Envoy 的统计信息</a></li><li role=none><a role=treeitem title=怎样使用代理生成服务级别的指标。 href=/v1.7/zh/docs/ops/configuration/telemetry/in-proxy-service-telemetry/>不使用 Mixer 生成 Istio 指标 [Alpha]</a></li></ul></li></ul></li><li role=treeitem aria-label=最佳实践><button aria-hidden=true></button><a title="设置和管理 Istio 服务网格的最佳实践。" href=/v1.7/zh/docs/ops/best-practices/>最佳实践</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="设置 Istio 服务网格时的最佳实践。" href=/v1.7/zh/docs/ops/best-practices/deployment/>Deployment 最佳实践</a></li><li role=none><a role=treeitem title=避免网络或流量管理问题的配置最佳实践。 href=/v1.7/zh/docs/ops/best-practices/traffic-management/>流量管理最佳实践</a></li><li role=none><a role=treeitem title="使用 Istio 保护应用的最佳实践。" href=/v1.7/zh/docs/ops/best-practices/security/>安全最佳实践</a></li></ul></li><li role=treeitem aria-label=常见问题><button aria-hidden=true></button><a title="描述如何辨认和解决 Istio 中的常见问题。" href=/v1.7/zh/docs/ops/common-problems/>常见问题</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="定位常见的 Istio 流量管理和网络问题的技术。" href=/v1.7/zh/docs/ops/common-problems/network-issues/>流量管理问题</a></li><li role=none><a role=treeitem title="定位常见 Istio 认证、授权、安全相关问题的技巧。" href=/v1.7/zh/docs/ops/common-problems/security-issues/>安全问题</a></li><li role=none><a role=treeitem title="处理 Telemetry 收集问题。" href=/v1.7/zh/docs/ops/common-problems/observability-issues/>可观测性问题</a></li><li role=none><a role=treeitem title="解决 Istio 使用 Kubernetes Webhooks 进行 sidecar 自动注入的常见问题。" href=/v1.7/zh/docs/ops/common-problems/injection/>Sidecar 自动注入问题</a></li><li role=none><a role=treeitem title=如何解决配置验证的问题。 href=/v1.7/zh/docs/ops/common-problems/validation/>配置验证的问题</a></li></ul></li><li role=treeitem aria-label=诊断工具><button aria-hidden=true></button><a title="帮助解决 Istio 网格问题的工具和技术。" href=/v1.7/zh/docs/ops/diagnostic-tools/>诊断工具</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="Istio 自带的一个可以为服务网格部署提供调试和诊断的补充工具。" href=/v1.7/zh/docs/ops/diagnostic-tools/istioctl/>使用 Istioctl 命令行工具</a></li><li role=none><a role=treeitem title="描述诊断与流量管理相关的 Envoy 配置问题的工具和技术。" href=/v1.7/zh/docs/ops/diagnostic-tools/proxy-cmd/>调试 Envoy 和 Pilot</a></li><li role=none><a role=treeitem title="向您展示如何使用 istioctl describe 来验证您的网格中的 pod 的配置。" href=/v1.7/zh/docs/ops/diagnostic-tools/istioctl-describe/>通过 Istioctl Describe 理解您的网格</a></li><li role=none><a role=treeitem title="演示如何使用 istioctl analyze 来识别配置中的潜在问题。" href=/v1.7/zh/docs/ops/diagnostic-tools/istioctl-analyze/>使用 Istioctl Analyze 诊断配置</a></li><li role=none><a role=treeitem title="介绍如何使用 ControlZ 深入了解各个运行组件。" href=/v1.7/zh/docs/ops/diagnostic-tools/controlz/>组件自检</a></li><li role=none><a role=treeitem title=如何使用组件的级别日志来记录正在运行中的组件的行为。 href=/v1.7/zh/docs/ops/diagnostic-tools/component-logging/>组件日志记录</a></li></ul></li><li role=treeitem aria-label=集成><button aria-hidden=true></button><a title="能够与 Istio 集成以提供额外功能的其他软件。" href=/v1.7/zh/docs/ops/integrations/>集成</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="关于如何与 cert-manager 集成的相关说明。" href=/v1.7/zh/docs/ops/integrations/certmanager/>cert-manager</a></li></ul></li></ul></div></div><div class=card><button class="header dynamic" id=card155 title="参考部分包含详细的权威参考资料,如命令行选项、配置选项和 API 调用参数。" aria-controls=card155-body><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#reference"/></svg>参考</button><div class=body aria-labelledby=card155 role=region id=card155-body><ul role=tree aria-expanded=true aria-labelledby=card155><li role=treeitem aria-label=配置><button aria-hidden=true></button><a title=关于配置选项的详细信息。 href=/v1.7/zh/docs/reference/config/>配置</a><ul role=group aria-expanded=false><li role=none><a role=treeitem title="Configuration affecting the service mesh as a whole." href=/v1.7/zh/docs/reference/config/istio.mesh.v1alpha1/>Service Mesh</a></li><li role=none><a role=treeitem title="Configuration for Istio control plane installation through the Operator." href=/v1.7/zh/docs/reference/config/istio.operator.v1alpha12.pb/>Operator Installation</a></li><li role=none><a role=treeitem title="描述使用 Helm chart 安装 Istio 时的可选项。" href=/v1.7/zh/docs/reference/config/installation-options/>安装选项(Helm)</a></li><li role=none><a role=treeitem title="Configuration affecting Istio control plane installation version and shape." href=/v1.7/zh/docs/reference/config/istio.operator.v1alpha1/>IstioOperator Options</a></li><li role=none><a role=treeitem title="Resource annotations used by Istio." href=/v1.7/zh/docs/reference/config/annotations/>Resource Annotations</a></li><li role=treeitem aria-label=流量管理><button aria-hidden=true></button><a title="描述如何配置 HTTP/TCP 路由功能。" href=/v1.7/zh/docs/reference/config/networking/>流量管理</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="Configuration affecting load balancing, outlier detection, etc." href=/v1.7/zh/docs/reference/config/networking/destination-rule/>Destination Rule</a></li><li role=none><a role=treeitem title="Customizing Envoy configuration generated by Istio." href=/v1.7/zh/docs/reference/config/networking/envoy-filter/>Envoy Filter</a></li><li role=none><a role=treeitem title="Configuration affecting edge load balancer." href=/v1.7/zh/docs/reference/config/networking/gateway/>Gateway</a></li><li role=none><a role=treeitem title="Configuration affecting label/content routing, sni routing, etc." href=/v1.7/zh/docs/reference/config/networking/virtual-service/>Virtual Service</a></li><li role=none><a role=treeitem title="Configuration affecting network reachability of a sidecar." href=/v1.7/zh/docs/reference/config/networking/sidecar/>Sidecar</a></li><li role=none><a role=treeitem title="Configuration affecting service registry." href=/v1.7/zh/docs/reference/config/networking/service-entry/>Service Entry</a></li></ul></li><li role=treeitem aria-label=Security><button aria-hidden=true></button><a title="如何配置 Istio 的安全功能。" href=/v1.7/zh/docs/reference/config/security/>Security</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="Configuration to validate JWT." href=/v1.7/zh/docs/reference/config/security/jwt/>JWTRule</a></li><li role=none><a role=treeitem title="Request authentication configuration for workloads." href=/v1.7/zh/docs/reference/config/security/request_authentication/>RequestAuthentication</a></li><li role=none><a role=treeitem title="Peer authentication configuration for workloads." href=/v1.7/zh/docs/reference/config/security/peer_authentication/>PeerAuthentication</a></li><li role=none><a role=treeitem title="Authentication policy for Istio services." href=/v1.7/zh/docs/reference/config/security/istio.authentication.v1alpha1/>Authentication Policy</a></li><li role=none><a role=treeitem title="Configuration for access control on workloads." href=/v1.7/zh/docs/reference/config/security/authorization-policy/>Authorization Policy</a></li><li role=none><a role=treeitem title=授权策略中支持的条件。 href=/v1.7/zh/docs/reference/config/security/conditions/>授权策略</a></li><li role=none><a role=treeitem title="Configuration for Role Based Access Control." href=/v1.7/zh/docs/reference/config/security/istio.rbac.v1alpha1/>RBAC (deprecated)</a></li><li role=none><a role=treeitem title=受支持的约束条件和属性。 href=/v1.7/zh/docs/reference/config/security/constraints-and-properties/>RBAC 约束和属性(不建议使用)</a></li></ul></li><li role=treeitem aria-label="Telemetry V2"><button aria-hidden=true></button><a title="介绍如何配置 Istio telemetry V2。" href=/v1.7/zh/docs/reference/config/telemetry/>Telemetry V2</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="通过 Istio 遥测导出的 Istio 标准指标。" href=/v1.7/zh/docs/reference/config/telemetry/metrics/>Istio 标准度量指标</a></li><li role=none><a role=treeitem title="如何通过 Wasm 运行时启用 Telemetry V2(实验性)。" href=/v1.7/zh/docs/reference/config/telemetry/telemetry_v2_with_wasm/>使用 Wasm 运行时的 Telemetry V2(实验性)</a></li><li role=none><a role=treeitem title="如何配置 v2 指标(实验性)。" href=/v1.7/zh/docs/reference/config/telemetry/configurable_metrics/>可配置指标(实验性)</a></li></ul></li><li role=treeitem aria-label=配置分析消息><button aria-hidden=true></button><a title=记录配置分析期间产生的各个错误和警告消息。 href=/v1.7/zh/docs/reference/config/analysis/>配置分析消息</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/message-format/>Analyzer Message Format</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0109/>ConflictingMeshGatewayVirtualServiceHosts</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0110/>ConflictingSidecarWorkloadSelectors</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0002/>Deprecated</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0104/>GatewayPortNotOnWorkload</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0001/>InternalError</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0105/>IstioProxyImageMismatch</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0119/>JwtFailureDueToInvalidServicePortPrefix</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0107/>MisplacedAnnotation</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0113/>MTLSPolicyConflict</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0111/>MultipleSidecarsWithoutWorkloadSelectors</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0102/>NamespaceNotInjected</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0112/>VirtualServiceDestinationPortSelectorRequired</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0108/>UnknownAnnotation</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0106/>SchemaValidationError</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0101/>ReferencedResourceNotFound</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0118/>PortNameIsNotUnderNamingConvention</a></li><li role=none><a role=treeitem href=/v1.7/zh/docs/reference/config/analysis/ist0103/>PodMissingProxy</a></li></ul></li><li role=treeitem aria-label="Mixer 策略和遥测"><button aria-hidden=true></button><a title="描述如何配置 Mixer 的策略和遥测功能。" href=/v1.7/zh/docs/reference/config/policy-and-telemetry/>Mixer 策略和遥测</a><ul role=group aria-expanded=false><li role=none><a role=treeitem title="Configuration state for the Mixer client library." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/istio.mixer.v1.config.client/>Mixer Client</a></li><li role=none><a role=treeitem title="Describes the rules used to configure Mixer's policy and telemetry features." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/istio.policy.v1beta1/>Rules</a></li><li role=none><a role=treeitem title="描述 Istio 策略执行和遥测机制的配置模型。" href=/v1.7/zh/docs/reference/config/policy-and-telemetry/mixer-overview/>Mixer 配置模型</a></li><li role=none><a role=treeitem title=描述用于策略和控制的基本属性词汇表。 href=/v1.7/zh/docs/reference/config/policy-and-telemetry/attribute-vocabulary/>属性词汇</a></li><li role=none><a role=treeitem title="Mixer 配置表达式语言手册。" href=/v1.7/zh/docs/reference/config/policy-and-telemetry/expression-language/>表达式语言</a></li><li role=treeitem aria-label=适配器><button aria-hidden=true></button><a title="Mixer 适配器能够让 Istio 连接各种基础设施后端以完成类似指标和日志这样的功能。" href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/>适配器</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="Adapter to deliver metrics to Apache SkyWalking." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/apache-skywalking/>Apache SkyWalking</a></li><li role=none><a role=treeitem title="Adapter for Apigee's distributed policy checks and analytics." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/apigee/>Apigee</a></li><li role=none><a role=treeitem title="Adapter to enforce authentication and authorization policies for web apps and APIs." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/app-identity-access-adapter/>App Identity and Access</a></li><li role=none><a role=treeitem title="Adapter for circonus.com's monitoring solution." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/circonus/>Circonus</a></li><li role=none><a role=treeitem title="Adapter for cloudmonitor metrics." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/cloudmonitor/>CloudMonitor</a></li><li role=none><a role=treeitem title="Adapter for cloudwatch metrics." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/cloudwatch/>CloudWatch</a></li><li role=none><a role=treeitem title="Adapter to deliver metrics to a dogstatsd agent for delivery to DataDog." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/datadog/>Datadog</a></li><li role=none><a role=treeitem title="Adapter to deliver tracing data to Zipkin." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/zipkin/>Zipkin</a></li><li role=none><a role=treeitem title="Adapter that always returns a precondition denial." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/denier/>Denier</a></li><li role=none><a role=treeitem title="Adapter that delivers logs to a Fluentd daemon." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/fluentd/>Fluentd</a></li><li role=none><a role=treeitem title="Adapter that extracts information from a Kubernetes environment." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/kubernetesenv/>Kubernetes Env</a></li><li role=none><a role=treeitem title="Adapter that performs whitelist or blacklist checks." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/list/>List</a></li><li role=none><a role=treeitem title="Adapter for a simple in-memory quota management system." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/memquota/>Memory quota</a></li><li role=none><a role=treeitem title="An Istio Mixer adapter to send telemetry data to New Relic." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/newrelic/>New Relic</a></li><li role=none><a role=treeitem title="Adapter to deliver metrics to Wavefront by VMware." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/wavefront/>Wavefront by VMware</a></li><li role=none><a role=treeitem title="Adapter to locally output logs and metrics." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/stdio/>Stdio</a></li><li role=none><a role=treeitem title="Adapter to deliver metrics to a StatsD backend." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/statsd/>StatsD</a></li><li role=none><a role=treeitem title="Adapter to deliver logs, metrics, and traces to Stackdriver." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/stackdriver/>Stackdriver</a></li><li role=none><a role=treeitem title="Adapter to deliver logs and metrics to Papertrail and AppOptics backends." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/solarwinds/>SolarWinds</a></li><li role=none><a role=treeitem title="Adapter for a Redis-based quota management system." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/redisquota/>Redis Quota</a></li><li role=none><a role=treeitem title="Adapter that exposes Istio metrics for ingestion by a Prometheus harvester." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/prometheus/>Prometheus</a></li><li role=none><a role=treeitem title="Adapter that implements an Open Policy Agent engine." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/adapters/opa/>OPA</a></li></ul></li><li role=treeitem aria-label=模板><button aria-hidden=true></button><a title="Mixer 模板用于将数据发送到各个适配器。" href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/>模板</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="The Analytics template is used to dispatch runtime telemetry to Apigee." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/analytics/>Analytics</a></li><li role=none><a role=treeitem title="A template that represents a single API key." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/apikey/>API Key</a></li><li role=none><a role=treeitem title="A template used to represent an access control query." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/authorization/>Authorization</a></li><li role=none><a role=treeitem title="A template that carries no data, useful for testing." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/checknothing/>Check Nothing</a></li><li role=none><a role=treeitem title="A template designed to report observed communication edges between workloads." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/edge/>Edge</a></li><li role=none><a role=treeitem title="A template that is used to control the production of Kubernetes-specific attributes." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/kubernetes/>Kubernetes</a></li><li role=none><a role=treeitem title="A template designed to let you perform list checking operations." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/listentry/>List Entry</a></li><li role=none><a role=treeitem title="A template that represents a single runtime log entry." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/logentry/>Log Entry</a></li><li role=none><a role=treeitem title="A template that represents a single runtime metric." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/metric/>Metric</a></li><li role=none><a role=treeitem title="A template that represents an individual span within a distributed trace." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/tracespan/>Trace Span</a></li><li role=none><a role=treeitem title="A template that carries no data, useful for testing." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/reportnothing/>Report Nothing</a></li><li role=none><a role=treeitem title="A template that represents a quota allocation request." href=/v1.7/zh/docs/reference/config/policy-and-telemetry/templates/quota/>Quota</a></li></ul></li><li role=none><a role=treeitem title="通过 Mixer 从 Istio 导出的默认监控指标。" href=/v1.7/zh/docs/reference/config/policy-and-telemetry/metrics/>默认监控指标</a></li></ul></li></ul></li><li role=treeitem aria-label=命令><button aria-hidden=true></button><a title="描述 Istio 命令和工具的用法及选项。" href=/v1.7/zh/docs/reference/commands/>命令</a><ul role=group aria-expanded=false class=leaf-section><li role=none><a role=treeitem title="Galley provides configuration management services for Istio." href=/v1.7/zh/docs/reference/commands/galley/>galley</a></li><li role=none><a role=treeitem title="Istio Certificate Authority (CA)." href=/v1.7/zh/docs/reference/commands/istio_ca/>istio_ca</a></li><li role=none><a role=treeitem title="Istio control interface." href=/v1.7/zh/docs/reference/commands/istioctl/>istioctl</a></li><li role=none><a role=treeitem title="Mixer is Istio's abstraction on top of infrastructure backends." href=/v1.7/zh/docs/reference/commands/mixs/>mixs</a></li><li role=none><a role=treeitem title="Kubernetes webhook for automatic Istio sidecar injection." href=/v1.7/zh/docs/reference/commands/sidecar-injector/>sidecar-injector</a></li><li role=none><a role=treeitem title="Istio Pilot." href=/v1.7/zh/docs/reference/commands/pilot-discovery/>pilot-discovery</a></li><li role=none><a role=treeitem title="Istio Pilot agent." href=/v1.7/zh/docs/reference/commands/pilot-agent/>pilot-agent</a></li><li role=none><a role=treeitem title="The Istio operator." href=/v1.7/zh/docs/reference/commands/operator/>operator</a></li><li role=none><a role=treeitem title="Istio security per-node agent." href=/v1.7/zh/docs/reference/commands/node_agent/>node_agent</a></li></ul></li><li role=none><a role=treeitem title="Istio 常用术语的词汇表。" href=/v1.7/zh/docs/reference/glossary/>术语表</a></li></ul></div></div></div></nav></div><div class=article-container><button tabindex=-1 id=sidebar-toggler title=折叠导航栏><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#pull"/></svg></button><nav aria-label=Breadcrumb><ol><li><a href=/v1.7/zh/ title=用于连接、保护、控制和观测服务。>Istio</a></li><li><a href=/v1.7/zh/docs/ title="了解如何部署、使用和运维 Istio。">文档</a></li><li><a href=/v1.7/zh/docs/concepts/ title="一些概念,理解它们有助于您更好地了解 Istio 系统的不同部分及其使用的抽象。">概念</a></li><li>安全</li></ol></nav><article aria-labelledby=title><div class=title-area><div style=width:100%><h1 id=title>安全</h1><p class=byline><span title="1323 字"><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#clock"/></svg><span> </span>阅读大约需要 7 分钟</span>
|
||
<span> </span>
|
||
<span></span></p></div></div><nav class=toc-inlined aria-label="Table of Contents"><div><hr><ol><li role=none aria-label=高级架构><a href=#high-level-architecture>高级架构</a><li role=none aria-label="Istio 身份"><a href=#istio-identity>Istio 身份</a><li role=none aria-label="公钥基础设施 (PKI)"><a href=#PKI>公钥基础设施 (PKI)</a><li role=none aria-label=认证><a href=#authentication>认证</a><ol><li role=none aria-label="双向 TLS 认证"><a href=#mutual-TLS-authentication>双向 TLS 认证</a><ol><li role=none aria-label=宽容模式><a href=#permissive-mode>宽容模式</a><li role=none aria-label=安全命名><a href=#secure-naming>安全命名</a></ol></li><li role=none aria-label=认证架构><a href=#authentication-architecture>认证架构</a><li role=none aria-label=认证策略><a href=#authentication-policies>认证策略</a><ol><li role=none aria-label=策略存储><a href=#policy-storage>策略存储</a><li role=none aria-label="Selector 字段"><a href=#selector-field>Selector 字段</a><li role=none aria-label="Peer authentication"><a href=#peer-authentication>Peer authentication</a><li role=none aria-label="Request authentication"><a href=#request-authentication>Request authentication</a><li role=none aria-label=Principals><a href=#principals>Principals</a></ol></li><li role=none aria-label=更新认证策略><a href=#updating-authentication-policies>更新认证策略</a></ol></li><li role=none aria-label=授权><a href=#authorization>授权</a><ol><li role=none aria-label=授权架构><a href=#authorization-architecture>授权架构</a><li role=none aria-label=隐式启用><a href=#implicit-enablement>隐式启用</a><li role=none aria-label=授权策略><a href=#authorization-policies>授权策略</a><ol><li role=none aria-label=策略目标><a href=#policy-target>策略目标</a><li role=none aria-label=值匹配><a href=#value-matching>值匹配</a><li role=none aria-label=排除匹配><a href=#exclusion-matching>排除匹配</a><li role=none aria-label=全部允许和默认全部拒绝授权策略><a href=#allow-all-and-default-deny-all-authorization-policies>全部允许和默认全部拒绝授权策略</a><li role=none aria-label=自定义条件><a href=#custom-conditions>自定义条件</a><li role=none aria-label=认证与未认证身份><a href=#authenticated-and-unauthenticated-identity>认证与未认证身份</a></ol></li><li role=none aria-label="在普通 TCP 协议上使用 Istio 授权"><a href=#using-Istio-authorization-on-plain-TCP-protocols>在普通 TCP 协议上使用 Istio 授权</a><li role=none aria-label="对双向 TLS 的依赖"><a href=#dependency-on-mutual-TLS>对双向 TLS 的依赖</a></ol></li><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol><hr></div></nav><p>将单一应用程序分解为微服务可提供各种好处,包括更好的灵活性、可伸缩性以及服务复用的能力。但是,微服务也有特殊的安全需求:</p><ul><li>为了抵御中间人攻击,需要流量加密。</li><li>为了提供灵活的服务访问控制,需要双向 TLS 和细粒度的访问策略。</li><li>要确定谁在什么时候做了什么,需要审计工具。</li></ul><p>Istio Security 尝试提供全面的安全解决方案来解决所有这些问题。本页概述了如何使用 Istio 的安全功能来保护您的服务,无论您在何处运行它们。特别是 Istio 安全性可以缓解针对您的数据、端点、通信和平台的内部和外部威胁。</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:56.25%><a data-skipendnotes=true href=/v1.7/zh/docs/concepts/security/overview.svg title=安全概述><img class=element-to-stretch src=/v1.7/zh/docs/concepts/security/overview.svg alt=安全概述></a></div><figcaption>安全概述</figcaption></figure><p>Istio 安全功能提供强大的身份,强大的策略,透明的 TLS 加密,认证,授权和审计(AAA)工具来保护你的服务和数据。Istio 安全的目标是:</p><ul><li>默认安全:应用程序代码和基础设施无需更改</li><li>深度防御:与现有安全系统集成以提供多层防御</li><li>零信任网络:在不受信任的网络上构建安全解决方案</li></ul><p>请访问我们的<a href=/v1.7/zh/docs/tasks/security/authentication/mtls-migration/>双向 TLS 迁移</a>相关文章,开始在已部署的服务中使用 Istio 安全功能。
|
||
请访问我们的<a href=/v1.7/zh/docs/tasks/security/>安全任务</a>,以获取有关使用安全功能的详细说明。</p><h2 id=high-level-architecture>高级架构</h2><p>Istio 中的安全性涉及多个组件:</p><ul><li>用于密钥和证书管理的证书颁发机构(CA)</li><li><p>配置 API 服务器分发给代理:</p><ul><li><a href=/v1.7/zh/docs/concepts/security/#authentication-policies>认证策略</a></li><li><a href=/v1.7/zh/docs/concepts/security/#authorization-policies>授权策略</a></li><li><a href=/v1.7/zh/docs/concepts/security/#secure-naming>安全命名信息</a></li></ul></li><li><p>Sidecar 和边缘代理作为 <a href=https://www.jerichosystems.com/technology/glossaryterms/policy_enforcement_point.html>Policy Enforcement Points</a>(PEPs) 以保护客户端和服务器之间的通信安全.</p></li><li><p>一组 Envoy 代理扩展,用于管理遥测和审计</p></li></ul><p>控制面处理来自 API server 的配置,并且在数据面中配置 PEPs。PEPs 用 Envoy 实现。下图显示了架构。</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:47.54566412484483%><a data-skipendnotes=true href=/v1.7/zh/docs/concepts/security/arch-sec.svg title=安全架构><img class=element-to-stretch src=/v1.7/zh/docs/concepts/security/arch-sec.svg alt=安全架构></a></div><figcaption>安全架构</figcaption></figure><p>在下面的部分中,我们将详细介绍 Istio 安全功能。</p><h2 id=istio-identity>Istio 身份</h2><p>身份是任何安全基础架构的基本概念。在工作负载间通信开始时,双方必须交换包含身份信息的凭证以进行双向验证。在客户端,根据<a href=/v1.7/zh/docs/concepts/security/#secure-naming>安全命名</a>信息检查服务器的标识,以查看它是否是该服务的授权运行程序。在服务器端,服务器可以根据<a href=/v1.7/zh/docs/concepts/security/#authorization-policies>授权策略</a>确定客户端可以访问哪些信息,审计谁在什么时间访问了什么,根据他们使用的工作负载向客户收费,并拒绝任何未能支付账单的客户访问工作负载。</p><p>Istio 身份模型使用 <code>service identity</code> (服务身份)来确定一个请求源端的身份。这种模型有极好的灵活性和粒度,可以用服务身份来标识人类用户、单个工作负载或一组工作负载。在没有服务身份的平台上,Istio 可以使用其它可以对服务实例进行分组的身份,例如服务名称。</p><p>下面的列表展示了在不同平台上可以使用的服务身份:</p><ul><li>Kubernetes: Kubernetes service account</li><li>GKE/GCE: GCP service account</li><li>GCP: GCP service account</li><li>AWS: AWS IAM user/role account</li><li>本地(非 Kubernetes):用户帐户、自定义服务帐户、服务名称、Istio 服务帐户或 GCP 服务帐户。自定义服务帐户引用现有服务帐户,就像客户的身份目录管理的身份一样。</li></ul><h2 id=PKI>公钥基础设施 (PKI)</h2><p>Istio PKI 使用 X.509 证书为每个工作负载都提供强大的身份标识。可以大规模进行自动化密钥和证书轮换,伴随每个 Envoy 代理都运行着一个 <code>istio-agent</code> 负责证书和密钥的供应。下图显示了这个机制的运行流程。</p><div><aside class="callout tip"><div class=type><svg class="large-icon"><use xlink:href="/v1.7/img/icons.svg#callout-tip"/></svg></div><div class=content>译者注:这里用 <code>istio-agent</code> 来表述,是因为下图及对图的相关解读中反复用到了 “Istio agent” 这个术语,这样的描述更容易理解。
|
||
另外,在实现层面,<code>istio-agent</code> 是指 sidecar 容器中的 <code>pilot-agent</code> 进程,它有很多功能,这里不表,只特别提一下:它通过 Unix socket 的方式在本地提供 SDS 服务供 Envoy 使用,这个信息对了解 Envoy 与 SDS 之间的交互有意义。</div></aside></div><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:91.58709730986384%><a data-skipendnotes=true href=/v1.7/zh/docs/concepts/security/id-prov.svg title=身份供应><img class=element-to-stretch src=/v1.7/zh/docs/concepts/security/id-prov.svg alt=身份供应></a></div><figcaption>身份供应</figcaption></figure><p>Istio 供应身份是通过 secret discovery service(SDS)来实现的,具体流程如下:</p><ol><li>CA 提供 gRPC 服务以接受<a href=https://en.wikipedia.org/wiki/Certificate_signing_request>证书签名请求</a>(CSRs)。</li><li>Envoy 通过 Envoy 秘密发现服务(SDS)API 发送证书和密钥请求。</li><li>在收到 SDS 请求后,<code>istio-agent</code> 创建私钥和 CSR,然后将 CSR 及其凭据发送到 Istio CA 进行签名。</li><li>CA 验证 CSR 中携带的凭据并签署 CSR 以生成证书。</li><li><code>Istio-agent</code> 通过 Envoy SDS API 将私钥和从 Istio CA 收到的证书发送给 Envoy。</li><li>上述 CSR 过程会周期性地重复,以处理证书和密钥轮换。</li></ol><h2 id=authentication>认证</h2><p>Istio 提供两种类型的认证:</p><ul><li><p>Peer authentication:用于服务到服务的认证,以验证进行连接的客户端。Istio 提供<a href=https://en.wikipedia.org/wiki/Mutual_authentication>双向 TLS</a> 作为传输认证的全栈解决方案,无需更改服务代码就可以启用它。这个解决方案:</p><ul><li>为每个服务提供强大的身份,表示其角色,以实现跨群集和云的互操作性。</li><li>保护服务到服务的通信。</li><li>提供密钥管理系统,以自动进行密钥和证书的生成,分发和轮换。</li></ul></li><li><p>Request authentication:用于最终用户认证,以验证附加到请求的凭据。 Istio 使用 JSON Web Token(JWT)验证启用请求级认证,并使用自定义认证实现或任何 OpenID Connect 的认证实现(例如下面列举的)来简化的开发人员体验。</p><ul><li><a href=https://www.ory.sh/>ORY Hydra</a></li><li><a href=https://www.keycloak.org/>Keycloak</a></li><li><a href=https://auth0.com/>Auth0</a></li><li><a href=https://firebase.google.com/docs/auth/>Firebase Auth</a></li><li><a href=https://developers.google.com/identity/protocols/OpenIDConnect>Google Auth</a></li></ul></li></ul><p>在所有情况下,Istio 都通过自定义 Kubernetes API 将认证策略存储在 <code>Istio config store</code>。<span class=term data-title=Istiod data-body='<p>The Istiod component is the consolidated monolithic control plane binary that encapsulates the functions of Pilot, Citadel, Mixer, and Galley.</p>
|
||
|
||
<p><a href="/zh/blog/2020/tradewinds-2020/#fewer-moving-parts">Learn more about Istiod</a>.</p>'>Istiod</span> 使每个代理保持最新状态,并在适当时提供密钥。此外,Istio 的认证机制支持宽容模式(permissive mode),以帮助您了解策略更改在实施之前如何影响您的安全状况。</p><h3 id=mutual-TLS-authentication>双向 TLS 认证</h3><p>Istio 通过客户端和服务器端 PEPs 建立服务到服务的通信通道,PEPs 被实现为<a href=https://envoyproxy.github.io/envoy/>Envoy 代理</a>。当一个工作负载使用双向 TLS 认证向另一个工作负载发送请求时,该请求的处理方式如下:</p><ol><li>Istio 将出站流量从客户端重新路由到客户端的本地 sidecar Envoy。</li><li>客户端 Envoy 与服务器端 Envoy 开始双向 TLS 握手。在握手期间,客户端 Envoy 还做了<a href=/v1.7/zh/docs/concepts/security/#secure-naming>安全命名</a>检查,以验证服务器证书中显示的服务帐户是否被授权运行目标服务。</li><li>客户端 Envoy 和服务器端 Envoy 建立了一个双向的 TLS 连接,Istio 将流量从客户端 Envoy 转发到服务器端 Envoy。</li><li>授权后,服务器端 Envoy 通过本地 TCP 连接将流量转发到服务器服务。</li></ol><h4 id=permissive-mode>宽容模式</h4><p>Istio 双向 TLS 具有一个宽容模式(permissive mode),允许服务同时接受纯文本流量和双向 TLS 流量。这个功能极大的提升了双向 TLS 的入门体验。</p><p>在运维人员希望将服务移植到启用了双向 TLS 的 Istio 上时,许多非 Istio 客户端和非 Istio 服务端通信时会产生问题。通常情况下,运维人员无法同时为所有客户端安装 Istio sidecar,甚至没有这样做的权限。即使在服务端上安装了 Istio sidecar,运维人员也无法在不中断现有连接的情况下启用双向 TLS。</p><p>启用宽容模式后,服务可以同时接受纯文本和双向 TLS 流量。这个模式为入门提供了极大的灵活性。服务中安装的 Istio sidecar 立即接受双向 TLS 流量而不会打断现有的纯文本流量。因此,运维人员可以逐步安装和配置客户端 Istio sidecar 发送双向 TLS 流量。一旦客户端配置完成,运维人员便可以将服务端配置为仅 TLS 模式。更多信息请访问<a href=/v1.7/zh/docs/tasks/security/authentication/mtls-migration>双向 TLS 迁移向导</a>。</p><h4 id=secure-naming>安全命名</h4><p>服务器身份(Server identities)被编码在证书里,但服务名称(service names)通过服务发现或 DNS 被检索。安全命名信息将服务器身份映射到服务名称。身份 <code>A</code> 到服务名称 <code>B</code> 的映射表示“授权 <code>A</code> 运行服务 <code>B</code>“。控制平面监视 <code>apiserver</code>,生成安全命名映射,并将其安全地分发到 PEPs。 以下示例说明了为什么安全命名对身份验证至关重要。</p><p>假设运行服务 <code>datastore</code> 的合法服务器仅使用 <code>infra-team</code> 身份。恶意用户拥有 <code>test-team</code> 身份的证书和密钥。恶意用户打算模拟服务以检查从客户端发送的数据。恶意用户使用证书和 <code>test-team</code> 身份的密钥部署伪造服务器。假设恶意用户成功攻击了发现服务或 DNS,以将 <code>datastore</code> 服务名称映射到伪造服务器。</p><p>当客户端调用 <code>datastore</code> 服务时,它从服务器的证书中提取 <code>test-team</code> 身份,并用安全命名信息检查 <code>test-team</code> 是否被允许运行 <code>datastore</code>。客户端检测到 <code>test-team</code> 不允许运行 <code>datastore</code> 服务,认证失败。</p><p>安全命名能够防止 HTTPS 流量受到一般性网络劫持,除了 DNS 欺骗外,它还可以保护 TCP 流量免受一般网络劫持。如果攻击者劫持了 DNS 并修改了目的地的 IP 地址,它将无法用于 TCP 通信。这是因为 TCP 流量不包含主机名信息,我们只能依靠 IP 地址进行路由,而且甚至在客户端 Envoy 收到流量之前,也可能发生 DNS 劫持。</p><h3 id=authentication-architecture>认证架构</h3><p>您可以使用 peer 和 request 认证策略为在 Istio 网格中接收请求的工作负载指定认证要求。网格运维人员使用 <code>.yaml</code> 文件来指定策略。部署后,策略将保存在 Istio 配置存储中。Istio 控制器监视配置存储。</p><p>一有任何的策略变更,新策略都会转换为适当的配置,告知 PEP 如何执行所需的认证机制。控制平面可以获取公共密钥,并将其附加到配置中以进行 JWT 验证。或者,Istiod 提供了 Istio 系统管理的密钥和证书的路径,并将它们安装到应用程序 pod 用于双向 TLS。您可以在 <a href=/v1.7/zh/docs/concepts/security/#PKI>PKI 部分</a>中找到更多信息。</p><p>Istio 异步发送配置到目标端点。代理收到配置后,新的认证要求会立即生效。</p><p>发送请求的客户端服务负责遵循必要的认证机制。对于 peer authentication,应用程序负责获取 JWT 凭证并将其附加到请求。对于双向 TLS,Istio 会自动将两个 PEPs 之间的所有流量升级为双向 TLS。如果认证策略禁用了双向 TLS 模式,则 Istio 将继续在 PEPs 之间使用纯文本。要覆盖此行为,请使用 <a href=/v1.7/zh/docs/concepts/traffic-management/#destination-rules>destination rules</a>显式禁用双向 TLS 模式。您可以在<a href=/v1.7/zh/docs/concepts/security/#mutual-TLS-authentication>双向 TLS 认证</a> 中找到有关双向 TLS 如何工作的更多信息。</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:69.53840153094185%><a data-skipendnotes=true href=/v1.7/zh/docs/concepts/security/authn.svg title=认证架构><img class=element-to-stretch src=/v1.7/zh/docs/concepts/security/authn.svg alt=认证架构></a></div><figcaption>认证架构</figcaption></figure><p>Istio 将两种类型的身份验证以及凭证中的其他声明(如果适用)输出到下一层:<a href=/v1.7/zh/docs/concepts/security/#authorization>授权</a>。</p><h3 id=authentication-policies>认证策略</h3><p>本节中提供了更多 Istio 认证策略方面的细节。正如<a href=/v1.7/zh/docs/concepts/security/#authentication-architecture>认证架构</a>中所说的,认证策略是对服务收到的请求生效的。要在双向 TLS 中指定客户端认证策略,需要在 <code>DetinationRule</code> 中设置 <code>TLSSettings</code>。<a href=/v1.7/zh/docs/reference/config/networking/destination-rule/#TLSSettings>TLS 设置参考文档</a>中有更多这方面的信息。</p><p>和其他的 Istio 配置一样,可以用 <code>.yaml</code> 文件的形式来编写认证策略。部署策略使用 <code>kubectl</code>。
|
||
下面例子中的认证策略要求:与带有 <code>app:reviews</code> 标签的工作负载的传输层认证,必须使用双向 TLS:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: "security.istio.io/v1beta1"
|
||
kind: "PeerAuthentication"
|
||
metadata:
|
||
name: "example-peer-policy"
|
||
namespace: "foo"
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: reviews
|
||
mtls:
|
||
mode: STRICT
|
||
</code></pre><h4 id=policy-storage>策略存储</h4><p>Istio 将网格范围的策略存储在根命名空间。这些策略使用一个空的 selector 适用于网格中的所有工作负载。具有名称空间范围的策略存储在相应的名称空间中。它们仅适用于其命名空间内的工作负载。如果你配置了 <code>selector</code> 字段,则认证策略仅适用于与您配置的条件匹配的工作负载。</p><p>Peer 和 request 认证策略用 kind 字段区分,分别是 <code>PeerAuthentication</code> 和 <code>RequestAuthentication</code>。</p><h4 id=selector-field>Selector 字段</h4><p>Peer 和 request 认证策略使用 <code>selector</code> 字段来指定该策略适用的工作负载的标签。以下示例显示适用于带有 <code>app:product-page</code> 标签的工作负载的策略的 selector 字段:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>selector:
|
||
matchLabels:
|
||
app: product-page
|
||
</code></pre><p>如果您没有为 <code>selector</code> 字段提供值,则 Istio 会将策略与策略存储范围内的所有工作负载进行匹配。因此,<code>selector</code> 字段可帮助您指定策略的范围:</p><ul><li>网格范围策略:为根名称空间指定的策略,不带或带有空的 <code>selector</code> 字段。</li><li>命名空间范围的策略:为非root命名空间指定的策略,不带有或带有空的 <code>selector</code> 字段。</li><li>特定于工作负载的策略:在常规名称空间中定义的策略,带有非空 <code>selector</code> 字段。</li></ul><p>Peer 和 request 认证策略对 <code>selector</code> 字段遵循相同的层次结构原则,但是 Istio 以略有不同的方式组合和应用它们。</p><p>只能有一个网格范围的 Peer 认证策略,每个命名空间也只能有一个命名空间范围的 Peer 认证策略。当您为同一网格或命名空间配置多个网格范围或命名空间范围的 Peer 认证策略时,Istio 会忽略较新的策略。当多个特定于工作负载的 Peer 认证策略匹配时,Istio 将选择最旧的策略。</p><p>Istio 按照以下顺序为每个工作负载应用最窄的匹配策略:</p><ol><li>特定于工作负载的</li><li>命名空间范围</li><li>网格范围</li></ol><p>Istio 可以将所有匹配的 request 认证策略组合起来,就像它们来自单个 request 认证策略一样。因此,您可以在网格或名称空间中配置多个网格范围或命名空间范围的策略。但是,避免使用多个网格范围或命名空间范围的 request 认证策略仍然是一个好的实践。</p><h4 id=peer-authentication>Peer authentication</h4><p>Peer 认证策略指定 Istio 对目标工作负载实施的双向 TLS 模式。支持以下模式:</p><ul><li>PERMISSIVE:工作负载接受双向 TLS 和纯文本流量。此模式在迁移因为没有 sidecar 而无法使用双向 TLS 的工作负载的过程中非常有用。一旦工作负载完成 sidecar 注入的迁移,应将模式切换为 STRICT。</li><li>STRICT: 工作负载仅接收双向 TLS 流量。</li><li>DISABLE:禁用双向 TLS。 从安全角度来看,除非您提供自己的安全解决方案,否则请勿使用此模式。</li></ul><p>如果未设置模式,将继承父作用域的模式。未设置模式的网格范围的 peer 认证策略默认使用 <code>PERMISSIVE</code> 模式。</p><p>下面的 peer 认证策略要求命名空间 <code>foo</code> 中的所有工作负载都使用双向 TLS:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: "security.istio.io/v1beta1"
|
||
kind: "PeerAuthentication"
|
||
metadata:
|
||
name: "example-policy"
|
||
namespace: "foo"
|
||
spec:
|
||
mtls:
|
||
mode: STRICT
|
||
</code></pre><p>对于特定于工作负载的 peer 认证策略,可以为不同的端口指定不同的双向 TLS 模式。您只能将工作负载声明过的端口用于端口范围的双向 TLS 配置。以下示例为 <code>app:example-app</code> 工作负载禁用了端口80上的双向TLS,并对所有其他端口使用名称空间范围的 peer 认证策略的双向 TLS 设置:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: "security.istio.io/v1beta1"
|
||
kind: "PeerAuthentication"
|
||
metadata:
|
||
name: "example-workload-policy"
|
||
namespace: "foo"
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: example-app
|
||
portLevelMtls:
|
||
80:
|
||
mode: DISABLE
|
||
</code></pre><p>上面的 peer 认证策略仅在有如下 Service 定义时工作,将流向 <code>example-service</code> 服务的请求绑定到 <code>example-app</code> 工作负载的 <code>80</code> 端口</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: v1
|
||
kind: Service
|
||
metadata:
|
||
name: example-service
|
||
namespace: foo
|
||
spec:
|
||
ports:
|
||
- name: http
|
||
port: 8000
|
||
protocol: TCP
|
||
targetPort: 80
|
||
selector:
|
||
app: example-app
|
||
</code></pre><h4 id=request-authentication>Request authentication</h4><p>Request 认证策略指定验证 JSON Web Token(JWT)所需的值。 这些值包括:</p><ul><li>token 在请求中的位置</li><li>请求的 issuer</li><li>公共 JSON Web Key Set(JWKS)</li></ul><p>Istio 会根据 request 认证策略中的规则检查提供的令牌(如果已提供),并拒绝令牌无效的请求。当请求不带有令牌时,默认情况下将接受它们。要拒绝没有令牌的请求,请提供授权规则,该规则指定对特定操作(例如,路径或操作)的限制。</p><p>如果 Request 认证策略使用唯一的位置,则它们可以指定多个JWT。当多个策略与工作负载匹配时,Istio 会将所有规则组合起来,就好像它们被指定为单个策略一样。此行为对于开发接受来自不同 JWT 提供者的工作负载时很有用。但是,不支持具有多个有效 JWT 的请求,因为此类请求的输出主体未定义。</p><h4 id=principals>Principals</h4><p>使用 peer 认证策略和双向 TLS 时,Istio 将身份从 peer 认证提取到 <code>source.principal</code> 中。同样,当您使用 request 认证策略时,Istio 会将 JWT 中的身份赋值给 <code>request.auth.principal</code>。使用这些 principals 设置授权策略和作为遥测的输出。</p><h3 id=updating-authentication-policies>更新认证策略</h3><p>您可以随时更改认证策略,Istio 几乎实时将新策略推送到工作负载。但是,Istio 无法保证所有工作负载都同时收到新政策。以下建议有助于避免在更新认证策略时造成干扰:</p><ul><li>将 peer 认证策略的模式从 <code>DISABLE</code> 更改为 <code>STRICT</code> 时,请使用 <code>PERMISSIVE</code> 模式来过渡,反之亦然。当所有工作负载成功切换到所需模式时,您可以将策略应用于最终模式。您可以使用 Istio 遥测技术来验证工作负载已成功切换。</li><li>将 request 认证策略从一个 JWT 迁移到另一个 JWT 时,将新 JWT 的规则添加到该策略中,而不删除旧规则。这样,工作负载接受两种类型的 JWT,当所有流量都切换到新的 JWT 时,您可以删除旧规则。但是,每个 JWT 必须使用不同的位置。</li></ul><h2 id=authorization>授权</h2><p>Istio 的授权功能为网格中的工作负载提供网格、命名空间和工作负载级别的访问控制。这种控制层级提供了以下优点:</p><ul><li>工作负载间和最终用户到工作负载的授权。</li><li>一个简单的 API:它包括一个单独的并且很容易使用和维护的 <a href=/v1.7/zh/docs/reference/config/security/authorization-policy/><code>AuthorizationPolicy</code> CRD</a>。</li><li>灵活的语义:运维人员可以在 Istio 属性上定义自定义条件,并使用 DENY 和 ALLOW 动作。</li><li>高性能:Istio 授权是在 Envoy 本地强制执行的。</li><li>高兼容性:原生支持 HTTP、HTTPS 和 HTTP2,以及任意普通 TCP 协议。</li></ul><h3 id=authorization-architecture>授权架构</h3><p>每个 Envoy 代理都运行一个授权引擎,该引擎在运行时授权请求。当请求到达代理时,授权引擎根据当前授权策略评估请求上下文,并返回授权结果 <code>ALLOW</code> 或 <code>DENY</code>。
|
||
运维人员使用 <code>.yaml</code> 文件指定 Istio 授权策略。</p><figure style=width:75%><div class=wrapper-with-intrinsic-ratio style=padding-bottom:50.38227195500615%><a data-skipendnotes=true href=/v1.7/zh/docs/concepts/security/authz.svg title=授权架构><img class=element-to-stretch src=/v1.7/zh/docs/concepts/security/authz.svg alt=授权架构></a></div><figcaption>授权架构</figcaption></figure><h3 id=implicit-enablement>隐式启用</h3><p>您无需显式启用 Istio 的授权功能。只需将授权策略应用于工作负载即可实施访问控制。对于未应用授权策略的工作负载,Istio 不会执行访问控制,放行所有请求。</p><p>授权策略支持 <code>ALLOW</code> 和 <code>DENY</code> 动作。 拒绝策略优先于允许策略。如果将任何允许策略应用于工作负载,则默认情况下将拒绝对该工作负载的访问,除非策略中的规则明确允许。当您将多个授权策略应用于相同的工作负载时,Istio 会累加地应用它们。</p><h3 id=authorization-policies>授权策略</h3><p>要配置授权策略,请创建一个 <a href=/v1.7/zh/docs/reference/config/security/authorization-policy/><code>AuthorizationPolicy</code> 自定义资源</a>。
|
||
一个授权策略包括选择器(selector),动作(action) 和一个规则(rules)列表:</p><ul><li><code>selector</code> 字段指定策略的目标</li><li><code>action</code> 字段指定允许还是拒绝请求</li><li><code>rules</code> 指定何时触发动作<ul><li><code>rules</code> 下的 <code>from</code> 字段指定请求的来源</li><li><code>rules</code> 下的 <code>to</code> 字段指定请求的操作</li><li><code>rules</code> 下的 <code>when</code> 字段指定应用规则所需的条件</li></ul></li></ul><p>以下示例显示了一个授权策略,该策略允许两个源(服务帐号 <code>cluster.local/ns/default/sa/sleep</code> 和命名空间 <code>dev</code>),在使用有效的 JWT 令牌发送请求时,可以访问命名空间 foo 中的带有标签 <code>app: httpbin</code> 和 <code>version: v1</code> 的工作负载。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: httpbin
|
||
namespace: foo
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: httpbin
|
||
version: v1
|
||
action: ALLOW
|
||
rules:
|
||
- from:
|
||
- source:
|
||
principals: ["cluster.local/ns/default/sa/sleep"]
|
||
- source:
|
||
namespaces: ["dev"]
|
||
to:
|
||
- operation:
|
||
methods: ["GET"]
|
||
when:
|
||
- key: request.auth.claims[iss]
|
||
values: ["https://accounts.google.com"]
|
||
</code></pre><p>下例显示了一个授权策略,如果请求来源不是命名空间 <code>foo</code>,请求将被拒绝。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: httpbin-deny
|
||
namespace: foo
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: httpbin
|
||
version: v1
|
||
action: DENY
|
||
rules:
|
||
- from:
|
||
- source:
|
||
notNamespaces: ["foo"]
|
||
</code></pre><p>拒绝策略优先于允许策略。如果请求同时匹配上允许策略和拒绝策略,请求将被拒绝。Istio 首先评估拒绝策略,以确保允许策略不能绕过拒绝策略</p><h4 id=policy-target>策略目标</h4><p>您可以通过 <code>metadata/namespace</code> 字段和可选的 <code>selector</code> 字段来指定策略的范围或目标。<code>metadata/namespace</code> 告诉该策略适用于哪个命名空间。如果将其值设置为根名称空间,则该策略将应用于网格中的所有名称空间。根命名空间的值是可配置的,默认值为 <code>istio-system</code>。如果设置为任何其他名称空间,则该策略仅适用于指定的名称空间。</p><p>您可以使用 <code>selector</code> 字段来进一步限制策略以应用于特定工作负载。<code>selector</code> 使用标签选择目标工作负载。<code>slector</code> 包含 <code>{key: value}</code>对的列表,其中 <code>key</code> 是标签的名称。如果未设置,则授权策略将应用于与授权策略相同的命名空间中的所有工作负载。</p><p>以下示例策略 <code>allow-read</code> 允许对 <code>default</code> 命名空间中带有标签 <code>app: products</code> 的工作负载的 <code>"GET"</code> 和 <code>"HEAD"</code> 访问。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: allow-read
|
||
namespace: default
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: products
|
||
action: ALLOW
|
||
rules:
|
||
- to:
|
||
- operation:
|
||
methods: ["GET", "HEAD"]
|
||
</code></pre><h4 id=value-matching>值匹配</h4><p>授权策略中的大多数字段都支持以下所有匹配模式:</p><ul><li>完全匹配:即完整的字符串匹配。</li><li>前缀匹配:<code>"*"</code> 结尾的字符串。例如,<code>"test.abc.*"</code> 匹配 <code>"test.abc.com"</code>、<code>"test.abc.com.cn"</code>、<code>"test.abc.org"</code> 等等。</li><li>后缀匹配:<code>"*"</code> 开头的字符串。例如,<code>"*.abc.com"</code> 匹配 <code>"eng.abc.com"</code>、<code>"test.eng.abc.com"</code> 等等。</li><li>存在匹配:<code>*</code> 用于指定非空的任意内容。您可以使用格式 <code>fieldname: ["*"]</code> 指定必须存在的字段。这意味着该字段可以匹配任意内容,但是不能为空。请注意这与不指定字段不同,后者意味着包括空的任意内容。</li></ul><p>有一些例外。 例如,以下字段仅支持完全匹配:</p><ul><li><code>when</code> 部分下的 <code>key</code> 字段</li><li><code>source</code> 部分下 的 <code>ipBlocks</code></li><li><code>to</code> 部分下的 <code>ports</code> 字段</li></ul><p>以下示例策略允许访问前缀为 <code>/test/*</code> 或后缀为 <code>*/info</code> 的路径。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: tester
|
||
namespace: default
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: products
|
||
action: ALLOW
|
||
rules:
|
||
- to:
|
||
- operation:
|
||
paths: ["/test/*", "*/info"]
|
||
</code></pre><h4 id=exclusion-matching>排除匹配</h4><p>为了匹配诸如 <code>when</code> 字段中的 <code>notValues</code>,<code>source</code> 字段中的 <code>notIpBlocks</code>,<code>to</code> 字段中的 <code>notPorts</code> 之类的否定条件,Istio 支持排除匹配。</p><p>以下示例:如果请求路径不是 <code>/healthz</code>,则要求从请求的 JWT 认证中导出的主体是有效的。
|
||
因此,该策略从 JWT 身份验证中排除对 <code>/healthz</code> 路径的请求:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: disable-jwt-for-healthz
|
||
namespace: default
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: products
|
||
action: ALLOW
|
||
rules:
|
||
- to:
|
||
- operation:
|
||
notPaths: ["/healthz"]
|
||
from:
|
||
- source:
|
||
requestPrincipals: ["*"]
|
||
</code></pre><p>下面的示例拒绝到 <code>/admin</code> 路径且不带请求主体的请求:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: enable-jwt-for-admin
|
||
namespace: default
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: products
|
||
action: DENY
|
||
rules:
|
||
- to:
|
||
- operation:
|
||
paths: ["/admin"]
|
||
from:
|
||
- source:
|
||
notRequestPrincipals: ["*"]
|
||
</code></pre><h4 id=allow-all-and-default-deny-all-authorization-policies>全部允许和默认全部拒绝授权策略</h4><p>以下示例显示了一个简单的 <code>allow-all</code> 授权策略,该策略允许完全访问 <code>default</code> 命名空间中的所有工作负载。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: allow-all
|
||
namespace: default
|
||
spec:
|
||
action: ALLOW
|
||
rules:
|
||
- {}
|
||
</code></pre><p>以下示例显示了一个策略,该策略不允许任何对 <code>admin</code> 命名空间工作负载的访问。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: deny-all
|
||
namespace: admin
|
||
spec:
|
||
{}
|
||
</code></pre><h4 id=custom-conditions>自定义条件</h4><p>您还可以使用 <code>when</code> 部分指定其他条件。
|
||
例如,下面的 <code>AuthorizationPolicy</code> 定义包括以下条件:<code>request.headers [version]</code> 是 <code>v1</code> 或 <code>v2</code>。
|
||
在这种情况下,key 是 <code>request.headers [version]</code>,它是 Istio 属性 <code>request.headers</code>(是个字典)中的一项。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: httpbin
|
||
namespace: foo
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: httpbin
|
||
version: v1
|
||
action: ALLOW
|
||
rules:
|
||
- from:
|
||
- source:
|
||
principals: ["cluster.local/ns/default/sa/sleep"]
|
||
to:
|
||
- operation:
|
||
methods: ["GET"]
|
||
when:
|
||
- key: request.headers[version]
|
||
values: ["v1", "v2"]
|
||
</code></pre><p><a href=/v1.7/zh/docs/reference/config/security/conditions/>条件页面</a>中列出了支持的条件 <code>key</code> 值。</p><h4 id=authenticated-and-unauthenticated-identity>认证与未认证身份</h4><p>如果要使工作负载可公开访问,则需要将 <code>source</code> 部分留空。这允许来自所有(经过认证和未经认证)的用户和工作负载的源,例如:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: httpbin
|
||
namespace: foo
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: httpbin
|
||
version: v1
|
||
action: ALLOW
|
||
rules:
|
||
- to:
|
||
- operation:
|
||
methods: ["GET", "POST"]
|
||
</code></pre><p>要仅允许经过认证的用户,请将 <code>principal</code> 设置为 <code>"*"</code>,例如:</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: security.istio.io/v1beta1
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: httpbin
|
||
namespace: foo
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: httpbin
|
||
version: v1
|
||
action: ALLOW
|
||
rules:
|
||
- from:
|
||
- source:
|
||
principals: ["*"]
|
||
to:
|
||
- operation:
|
||
methods: ["GET", "POST"]
|
||
</code></pre><h3 id=using-Istio-authorization-on-plain-TCP-protocols>在普通 TCP 协议上使用 Istio 授权</h3><p>Istio 授权支持工作负载使用任意普通 TCP 协议,如 MongoDB。
|
||
在这种情况下,您可以按照与 HTTP 工作负载相同的方式配置授权策略。
|
||
不同之处在于某些字段和条件仅适用于 HTTP 工作负载。
|
||
这些字段包括:</p><ul><li>授权策略对象 <code>source</code> 部分中的 <code>request_principals</code> 字段</li><li>授权策略对象 <code>operation</code> 部分中的 <code>hosts</code>、<code>methods</code> 和 <code>paths</code> 字段</li></ul><p><a href=/v1.7/zh/docs/reference/config/security/conditions/>条件页面</a>中列出了支持的条件。</p><p>如果您在授权策略中对 TCP 工作负载使用了任何只适用于 HTTP 的字段,Istio 将会忽略它们。</p><p>假设您在端口 <code>27017</code> 上有一个 MongoDB 服务,下例配置了一个授权策略,只允许 Istio 网格中的 <code>bookinfo-ratings-v2</code> 服务访问该 MongoDB 工作负载。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: "security.istio.io/v1beta1"
|
||
kind: AuthorizationPolicy
|
||
metadata:
|
||
name: mongodb-policy
|
||
namespace: default
|
||
spec:
|
||
selector:
|
||
matchLabels:
|
||
app: mongodb
|
||
action: ALLOW
|
||
rules:
|
||
- from:
|
||
- source:
|
||
principals: ["cluster.local/ns/default/sa/bookinfo-ratings-v2"]
|
||
to:
|
||
- operation:
|
||
ports: ["27017"]
|
||
</code></pre><h3 id=dependency-on-mutual-TLS>对双向 TLS 的依赖</h3><p>Istio 使用双向 TLS 将某些信息从客户端安全地传递到服务器。在使用授权策略中的以下任何字段之前,必须先启用双向 TLS:</p><ul><li><code>source</code> 部分下的 <code>principals</code> 字段</li><li><code>source</code> 部分下的 <code>namespaces</code> 字段</li><li><code>source.principal</code> 自定义条件</li><li><code>source.namespace</code> 自定义条件</li><li><code>connection.sni</code> 自定义条件</li></ul><p>如果您不使用授权策略中的上述任何字段,则双向 TLS 不是必须的。</p><nav id=see-also><h2>相关内容</h2><div class=see-also><div class=entry><p class=link><a data-skipendnotes=true href=/v1.7/zh/docs/tasks/security/authorization/authz-http/>HTTP 流量授权</a></p><p class=desc>展示如何设置基于角色的 HTTP 流量访问控制。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.7/zh/docs/tasks/security/authorization/authz-tcp/>TCP 流量的授权</a></p><p class=desc>展示如何设置 TCP 流量的访问控制。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.7/zh/docs/tasks/security/authorization/authz-td-migration/>授权策略信任域迁移</a></p><p class=desc>阐述如何在不更改授权策略的前提下从一个信任域迁移到另一个。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.7/zh/blog/2018/istio-authorization/>基于 Istio 授权的 Micro-Segmentation</a></p><p class=desc>描述 Istio 的授权功能以及如何在各种用例中使用它。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.7/zh/blog/2019/v1beta1-authorization-policy/>Istio v1beta1 授权策略概述</a></p><p class=desc>Istio v1beta1 授权策略的设计原则、基本概述及迁移操作。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.7/zh/blog/2019/app-identity-and-access-adapter/>APP 身份和访问适配器</a></p><p class=desc>使用 Istio 实现零代码改动保护多云 Kubernetes 应用。</p></div></div></nav></article><nav class=pagenav><div class=left><a title="讲述 Istio 的 WebAssembly 插件系统。" href=/v1.7/zh/docs/concepts/wasm/><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#left-arrow"/></svg>扩展性</a></div><div class=right><a title="描述 Istio 提供的遥测和监控特性。" href=/v1.7/zh/docs/concepts/observability/>可观察性<svg class="icon"><use xlink:href="/v1.7/img/icons.svg#right-arrow"/></svg></a></div></nav><div id=feedback><div id=feedback-initial>这些信息有用吗?<br><button class="btn feedback" onclick="sendFeedback('zh',1)">是的</button>
|
||
<button class="btn feedback" onclick="sendFeedback('zh',0)">没有</button></div><div id=feedback-comment>Do you have any suggestions for improvement?<br><br><input id=feedback-textbox type=text placeholder="Help us improve..." data-lang=zh></div><div id=feedback-thankyou>Thanks for your feedback!</div></div><div id=endnotes-container aria-hidden=true><h2>链接</h2><ol id=endnotes></ol></div></div><div class=toc-container><nav class=toc aria-label="Table of Contents"><div id=toc><ol><li role=none aria-label=高级架构><a href=#high-level-architecture>高级架构</a><li role=none aria-label="Istio 身份"><a href=#istio-identity>Istio 身份</a><li role=none aria-label="公钥基础设施 (PKI)"><a href=#PKI>公钥基础设施 (PKI)</a><li role=none aria-label=认证><a href=#authentication>认证</a><ol><li role=none aria-label="双向 TLS 认证"><a href=#mutual-TLS-authentication>双向 TLS 认证</a><ol><li role=none aria-label=宽容模式><a href=#permissive-mode>宽容模式</a><li role=none aria-label=安全命名><a href=#secure-naming>安全命名</a></ol></li><li role=none aria-label=认证架构><a href=#authentication-architecture>认证架构</a><li role=none aria-label=认证策略><a href=#authentication-policies>认证策略</a><ol><li role=none aria-label=策略存储><a href=#policy-storage>策略存储</a><li role=none aria-label="Selector 字段"><a href=#selector-field>Selector 字段</a><li role=none aria-label="Peer authentication"><a href=#peer-authentication>Peer authentication</a><li role=none aria-label="Request authentication"><a href=#request-authentication>Request authentication</a><li role=none aria-label=Principals><a href=#principals>Principals</a></ol></li><li role=none aria-label=更新认证策略><a href=#updating-authentication-policies>更新认证策略</a></ol></li><li role=none aria-label=授权><a href=#authorization>授权</a><ol><li role=none aria-label=授权架构><a href=#authorization-architecture>授权架构</a><li role=none aria-label=隐式启用><a href=#implicit-enablement>隐式启用</a><li role=none aria-label=授权策略><a href=#authorization-policies>授权策略</a><ol><li role=none aria-label=策略目标><a href=#policy-target>策略目标</a><li role=none aria-label=值匹配><a href=#value-matching>值匹配</a><li role=none aria-label=排除匹配><a href=#exclusion-matching>排除匹配</a><li role=none aria-label=全部允许和默认全部拒绝授权策略><a href=#allow-all-and-default-deny-all-authorization-policies>全部允许和默认全部拒绝授权策略</a><li role=none aria-label=自定义条件><a href=#custom-conditions>自定义条件</a><li role=none aria-label=认证与未认证身份><a href=#authenticated-and-unauthenticated-identity>认证与未认证身份</a></ol></li><li role=none aria-label="在普通 TCP 协议上使用 Istio 授权"><a href=#using-Istio-authorization-on-plain-TCP-protocols>在普通 TCP 协议上使用 Istio 授权</a><li role=none aria-label="对双向 TLS 的依赖"><a href=#dependency-on-mutual-TLS>对双向 TLS 的依赖</a></ol></li><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol></div></nav></div></main><footer><div class=user-links><a class=channel title="立刻下载 Istio 1.7.4" href=/v1.7/docs/setup/getting-started/#download aria-label="Download Istio"><span>download</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#download"/></svg>
|
||
</a><a class=channel title="加入 Istio discussion board 参与讨论获取帮助" href=https://discuss.istio.io aria-label="Istio discussion board"><span>discuss</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#discourse"/></svg></a>
|
||
<a class=channel title="Stack Overflow 中列举了针对实际问题以及部署、配置和使用 Istio 的各项回答" href=https://stackoverflow.com/questions/tagged/istio aria-label="Stack Overflow"><span>stack overflow</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#stackoverflow"/></svg></a>
|
||
<a class=channel title="在 Slack 上与 Istio 社区交互讨论开发问题(仅限邀请)" href=https://slack.istio.io aria-label=slack><span>slack</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#slack"/></svg></a>
|
||
<a class=channel title="关注我们的 Twitter 来获取最新信息" href=https://twitter.com/IstioMesh aria-label=Twitter><span>twitter</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
|
||
1.7.4<br>© 2020 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2020年11月19日</p></div><div class=dev-links><a class=channel title="Istio 的代码在 GitHub 上开发" href=https://github.com/istio/community aria-label=GitHub><span>github</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#github"/></svg></a>
|
||
<a class=channel title="如果您想深入了解 Istio 的技术细节,请查看我们日益完善的设计文档" href=https://groups.google.com/forum/#!forum/istio-team-drive-access aria-label="team drive"><span>drive</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#drive"/></svg></a>
|
||
<a class=channel title="如果您想为 Istio 项目做出贡献,请考虑加入我们的工作组" href=https://github.com/istio/community/blob/master/WORKING-GROUPS.md aria-label="working groups"><span>working groups</span><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#working-groups"/></svg></a><div class=tag>对于开发者</div></div></footer><script src=https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js defer></script><div id=scroll-to-top-container aria-hidden=true><button id=scroll-to-top title=回到顶部><svg class="icon"><use xlink:href="/v1.7/img/icons.svg#top"/></svg></button></div></body></html> |