istio.io/archive/v1.6/zh/blog/2019/app-identity-and-access-ada.../index.html

97 lines
37 KiB
HTML
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!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="APP 身份和访问适配器"><meta name=description content="使用 Istio 实现零代码改动保护多云 Kubernetes 应用。"><meta name=author content="Anton Aleksandrov (IBM)"><meta name=keywords content="microservices,services,mesh,security,oidc,jwt,policies"><meta property="og:title" content="APP 身份和访问适配器"><meta property="og:type" content="website"><meta property="og:description" content="使用 Istio 实现零代码改动保护多云 Kubernetes 应用。"><meta property="og:url" content="/v1.6/zh/blog/2019/app-identity-and-access-adapter/"><meta property="og:image" content="/v1.6/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.6 / APP 身份和访问适配器</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.6/blog/feed.xml><link rel=alternate type=application/rss+xml title="Istio News" href=/v1.6/news/feed.xml><link rel=alternate type=application/rss+xml title="Istio Blog and News" href=/v1.6/feed.xml><link rel="shortcut icon" href=/v1.6/favicons/favicon.ico><link rel=apple-touch-icon href=/v1.6/favicons/apple-touch-icon-180x180.png sizes=180x180><link rel=icon type=image/png href=/v1.6/favicons/favicon-16x16.png sizes=16x16><link rel=icon type=image/png href=/v1.6/favicons/favicon-32x32.png sizes=32x32><link rel=icon type=image/png href=/v1.6/favicons/android-36x36.png sizes=36x36><link rel=icon type=image/png href=/v1.6/favicons/android-48x48.png sizes=48x48><link rel=icon type=image/png href=/v1.6/favicons/android-72x72.png sizes=72x72><link rel=icon type=image/png href=/v1.6/favicons/android-96x96.png sizes=96xW96><link rel=icon type=image/png href=/v1.6/favicons/android-144x144.png sizes=144x144><link rel=icon type=image/png href=/v1.6/favicons/android-192x192.png sizes=192x192><link rel=manifest href=/v1.6/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.6/css/all.css><script src=/v1.6/js/themes_init.min.js></script></head><body class="language-unknown archive-site"><script>const branchName="release-1.6";const docTitle="APP 身份和访问适配器";const iconFile="\/v1.6/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.6/js/all.min.js data-manual defer></script><header><nav><a id=brand href=/v1.6/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.6</span></a><div id=hamburger><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#hamburger"/></svg></div><div id=header-links><a title="了解如何部署、使用和运维 Istio。" href=/v1.6/zh/docs/>文档</a>
<a class=current title="关于使用 Istio 的博客文章。" href=/v1.6/zh/blog/2020/>博客<i class=dot data-prefix=/blog></i></a>
<a title="关于 Istio 项目的最新报道。" href=/v1.6/zh/news/>新闻<i class=dot data-prefix=/news></i></a>
<a title="关于 Istio 的常见问题。" href=/v1.6/zh/faq/>FAQ</a>
<a title="关于 Istio 项目的说明。" href=/v1.6/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.6/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/blog\/2019\/app-identity-and-access-adapter\/');return false;">当前版本</a>
<a tabindex=-1 role=menuitem onclick="navigateToUrlOrRoot('https://preliminary.istio.io/blog\/2019\/app-identity-and-access-adapter\/');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.6/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.6/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.6/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=card0 title="2020 年的博客文章。" aria-controls=card0-body><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#blog"/></svg>2020 年的博客文章</button><div class=body aria-labelledby=card0 role=region id=card0-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card0><li role=none><a role=treeitem title="Istiod 将 Istio 控制平面组件合并为一个二进制文件。 (2020年3月19日)" href=/v1.6/zh/blog/2020/istiod/>介绍 istiod简化控制平面</a></li><li role=none><a role=treeitem title="以声明方式为 Envoy 和 Istio 配置 Wasm 扩展。 (2020年3月16日)" href=/v1.6/zh/blog/2020/deploy-wasm-declarative/>在 Istio 中进行 WebAssembly 声明式部署</a></li><li role=none><a role=treeitem title="Istio 的扩展中使用 WASM 的前景。 (2020年3月5日)" href=/v1.6/zh/blog/2020/wasm-announce/>重新定义代理的扩展性Envoy 和 Istio 引入 WebAssembly</a></li><li role=none><a role=treeitem title="Istio 在 2020 年的愿景声明及路线图。 (2020年3月3日)" href=/v1.6/zh/blog/2020/tradewinds-2020/>Istio 2020——为了商用</a></li><li role=none><a role=treeitem title="一种更安全的秘密管理方式。 (2020年2月20日)" href=/v1.6/zh/blog/2020/istio-agent/>移除跨 pod Unix domain socket</a></li><li role=none><a role=treeitem title="为 Istio deploymentcluster提供自动化 Istio 配置,并让其像单个网格一样工作。 (2020年1月5日)" href=/v1.6/zh/blog/2020/multi-cluster-mesh-automation/>使用 Admiral 管理 Istio 多集群的配置和服务发现</a></li></ul></div></div><div class=card><button class="header dynamic" id=card1 title="2019 年的博客文章。" aria-controls=card1-body><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#blog"/></svg>2019 年的博客文章</button><div class="body default" aria-labelledby=card1 role=region id=card1-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card1><li role=none><a role=treeitem title="一种更安全管理 Istio webhook 的方法。 (2019年11月14日)" href=/v1.6/zh/blog/2019/webhook/>安全管理 Webhook</a></li><li role=none><a role=treeitem title="正式启用访问 Istio 资源。 (2019年11月14日)" href=/v1.6/zh/blog/2019/announcing-istio-client-go/>Istio client-go 发布公告</a></li><li role=none><a role=treeitem title="关于 Istio 基于 operator 的安装和控制平面管理特性的介绍。 (2019年11月14日)" href=/v1.6/zh/blog/2019/introducing-istio-operator/>Istio Operator 简介</a></li><li role=none><a role=treeitem title="通过分析 Istio 配置来发现潜在问题和一般问题。 (2019年11月14日)" href=/v1.6/zh/blog/2019/introducing-istioctl-analyze/>istioctl analyze 介绍</a></li><li role=none><a role=treeitem title="在 Istio 中配置和管理 DNS 证书。 (2019年11月14日)" href=/v1.6/zh/blog/2019/dns-cert/>DNS 证书管理</a></li><li role=none><a role=treeitem title="Istio v1beta1 授权策略的设计原则、基本概述及迁移操作。 (2019年11月14日)" href=/v1.6/zh/blog/2019/v1beta1-authorization-policy/>Istio v1beta1 授权策略概述</a></li><li role=none><a role=treeitem title="把 Istio 入口网关配置为外部服务的代理。 (2019年10月15日)" href=/v1.6/zh/blog/2019/proxy/>把 Istio 作为外部服务的代理</a></li><li role=none><a role=treeitem title="将需要隔离的环境部署到单独的网格中,并通过网格联邦启用网格间通信。 (2019年10月2日)" href=/v1.6/zh/blog/2019/isolated-clusters/>用于隔离和边界保护的多网格部署</a></li><li role=none><a role=treeitem title="如何使用 Istio 去监控被阻止的和透传的外部服务流量。 (2019年9月28日)" href=/v1.6/zh/blog/2019/monitoring-external-service-traffic/>监控被阻止的和透传的外部服务流量</a></li><li role=none><a role=treeitem title="本文演示 Mixer 进程外适配器实现 Knative scale-from-zero 逻辑的具体过程。 (2019年9月18日)" href=/v1.6/zh/blog/2019/knative-activator-adapter/>适用于 Knative 的 Mixer 适配器</a></li><li role=none><span role=treeitem class=current title="使用 Istio 实现零代码改动保护多云 Kubernetes 应用。 (2019年9月18日)">APP 身份和访问适配器</span></li><li role=none><a role=treeitem title="利用 Kubernetes 可信任的 JWT 来更安全地为工作负载实例颁发证书。 (2019年9月10日)" href=/v1.6/zh/blog/2019/trustworthy-jwt-sds/>Istio 1.3 Secret 服务发现的更改</a></li><li role=none><a role=treeitem title="Istio API 的设计原则和这些 API 是如何演变的。 (2019年8月5日)" href=/v1.6/zh/blog/2019/evolving-istios-apis/>Istio API 的演变</a></li><li role=none><a role=treeitem title="管控出口流量的备选方案比较,包括性能因素。 (2019年7月22日)" href=/v1.6/zh/blog/2019/egress-traffic-control-in-istio-part-3/>Istio 中安全管控出口流量,第三部分</a></li><li role=none><a role=treeitem title="使用 Istio 的出口流量管控来阻止相关出口流量攻击。 (2019年7月10日)" href=/v1.6/zh/blog/2019/egress-traffic-control-in-istio-part-2/>Istio 中的安全管控出口流量,第二部分</a></li><li role=none><a role=treeitem title="评估 Istio 数据平面性能的工具和指南。 (2019年7月9日)" href=/v1.6/zh/blog/2019/performance-best-practices/>最佳实践Service Mesh 基准性能测试</a></li><li role=none><a role=treeitem title="了解如何延长 Istio 自签名根证书的有效期。 (2019年6月7日)" href=/v1.6/zh/blog/2019/root-transition/>延长 Istio 自签名根证书的有效期</a></li><li role=none><a role=treeitem title="涉及出口流量攻击和出口流量管控要求。 (2019年5月22日)" href=/v1.6/zh/blog/2019/egress-traffic-control-in-istio-part-1/>Istio 中的安全管控出口流量,第一部分</a></li><li role=none><a role=treeitem title="Istio 1.1 性能概览。 (2019年3月19日)" href=/v1.6/zh/blog/2019/istio1.1_perf/>为性能而设计的 Istio 1.1</a></li><li role=none><a role=treeitem title="在多集群服务网格环境中配置 Istio 的路由规则。 (2019年2月7日)" href=/v1.6/zh/blog/2019/multicluster-version-routing/>多集群服务网格中的分版本路由</a></li><li role=none><a role=treeitem title="宣布新的博客策略。 (2019年2月5日)" href=/v1.6/zh/blog/2019/sail-the-blog/>博客策略更新!</a></li><li role=none><a role=treeitem title="评估加入 Egress gateway 对性能造成的影响。 (2019年1月31日)" href=/v1.6/zh/blog/2019/egress-performance/>Egress gateway 性能测试</a></li><li role=none><a role=treeitem title="揭秘 Istio 是如何将其数据平面组件添加到现有 deployment。 (2019年1月31日)" href=/v1.6/zh/blog/2019/data-plane-setup/>揭开 Istio Sidecar 注入模型的神秘面纱</a></li><li role=none><a role=treeitem title="使用 AppSwitch 解决应用程序启动顺序和启动延迟。 (2019年1月14日)" href=/v1.6/zh/blog/2019/appswitch/>使用 AppSwitch 进行 Sidestepping 依赖性排序</a></li><li role=none><a role=treeitem title="如何使用 cert-manager 手工部署一个自定义 Ingress 网关。 (2019年1月10日)" href=/v1.6/zh/blog/2019/custom-ingress-gateway/>使用 Cert-Manager 部署一个自定义 Ingress 网关</a></li><li role=none><a role=treeitem title="Istio 有了一个新的论坛。 (2019年1月10日)" href=/v1.6/zh/blog/2019/announcing-discuss.istio.io/>Istio 论坛成立</a></li></ul></div></div><div class=card><button class="header dynamic" id=card2 title="2018 年的博客文章。" aria-controls=card2-body><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#blog"/></svg>2018 年的博客文章</button><div class=body aria-labelledby=card2 role=region id=card2-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card2><li role=none><a role=treeitem title="如何在不部署 Sidecar 代理的情况下使用 Istio 进行流量管理。 (2018年11月21日)" href=/v1.6/zh/blog/2018/incremental-traffic-management/>增量式应用 Istio 第一部分,流量管理</a></li><li role=none><a role=treeitem title="描述了一个基于 Istio 的 Bookinfo 示例的简单场景。 (2018年11月16日)" href=/v1.6/zh/blog/2018/egress-mongo/>使用外部 MongoDB 服务</a></li><li role=none><a role=treeitem title="Istio 在 Twitch 举办了为期一天的直播庆祝 1.0 的发布。 (2018年8月3日)" href=/v1.6/zh/blog/2018/istio-twitch-stream/>Istio 在 Twitch 上全天直播</a></li><li role=none><a role=treeitem title="惠普如何在 Istio 上构建其下一代鞋类个性化平台。 (2018年7月31日)" href=/v1.6/zh/blog/2018/hp/>Istio 是惠普 FitStation 平台的改变者</a></li><li role=none><a role=treeitem title="使用 AppSwitch 自动接入应用并降低延迟。 (2018年7月30日)" href=/v1.6/zh/blog/2018/delayering-istio/>使用 AppSwitch 精简 Istio 层次</a></li><li role=none><a role=treeitem title="描述 Istio 的授权功能以及如何在各种用例中使用它。 (2018年7月20日)" href=/v1.6/zh/blog/2018/istio-authorization/>基于 Istio 授权的 Micro-Segmentation</a></li><li role=none><a role=treeitem title="如何通过 Stackdriver 将 Istio 访问日志导出到 BigQuery、GCS、Pub/Sub 等不同的接收器。 (2018年7月9日)" href=/v1.6/zh/blog/2018/export-logs-through-stackdriver/>通过 Stackdriver 将日志导出到 BigQuery、GCS、Pub/Sub</a></li><li role=none><a role=treeitem title="描述如何配置 Istio 进行 HTTP Egress 流量监控和访问策略。 (2018年6月22日)" href=/v1.6/zh/blog/2018/egress-monitoring-access-control/>HTTP Egress 流量监控和访问策略</a></li><li role=none><a role=treeitem title="Istio v1alpha3 路由 API 介绍, 动机及其设计原则。 (2018年4月25日)" href=/v1.6/zh/blog/2018/v1alpha3-routing/>Istio v1aplha3 路由 API 介绍</a></li><li role=none><a role=treeitem title="描述如何在 AWS 上使用网络负载均衡器配置 Istio Ingress。 (2018年4月20日)" href=/v1.6/zh/blog/2018/aws-nlb/>使用 AWS NLB 配置 Istio Ingress</a></li><li role=none><a role=treeitem title="使用 Kubernetes 命名空间和 RBAC 为 Istio 构建软性多租户环境。 (2018年4月19日)" href=/v1.6/zh/blog/2018/soft-multitenancy/>Istio 的软性多租户支持</a></li><li role=none><a role=treeitem title="介绍更安全,低风险的部署和发布到生产。 (2018年2月8日)" href=/v1.6/zh/blog/2018/traffic-mirroring/>用于在生产环境进行测试的 Istio 流量镜像功能</a></li><li role=none><a role=treeitem title="描述基于 Istio 的 Bookinfo 示例的简单场景。 (2018年2月6日)" href=/v1.6/zh/blog/2018/egress-tcp/>使用外部 TCP 服务</a></li><li role=none><a role=treeitem title="描述基于 Istio Bookinfo 示例的简单场景。 (2018年1月31日)" href=/v1.6/zh/blog/2018/egress-https/>使用外部 Web 服务</a></li></ul></div></div><div class=card><button class="header dynamic" id=card3 title="2017 年的博客文章。" aria-controls=card3-body><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#blog"/></svg>2017 年的博客文章</button><div class=body aria-labelledby=card3 role=region id=card3-body><ul role=tree aria-expanded=true class=leaf-section aria-labelledby=card3><li role=none><a role=treeitem title="提高可用,降低延迟。 (2017年12月7日)" href=/v1.6/zh/blog/2017/mixer-spof-myth/>Mixer 和 SPOF 神话</a></li><li role=none><a role=treeitem title="概要说明 Mixer 的插件架构。 (2017年11月3日)" href=/v1.6/zh/blog/2017/adapter-model/>Mixer 适配器模型</a></li><li role=none><a role=treeitem title="Istio 的策略如何关联 Kubernetes 的网络策略 。 (2017年8月10日)" href=/v1.6/zh/blog/2017/0.1-using-network-policy/>Istio 使用网络策略</a></li><li role=none><a role=treeitem title="使用 Istio 创建自动缩放的金丝雀部署。 (2017年6月14日)" href=/v1.6/zh/blog/2017/0.1-canary/>使用 Istio 进行金丝雀部署</a></li><li role=none><a role=treeitem title="Istio Auth 0.1 公告。 (2017年5月25日)" href=/v1.6/zh/blog/2017/0.1-auth/>使用 Istio 增强端到端安全</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.6/img/icons.svg#pull"/></svg></button><nav aria-label=Breadcrumb><ol><li><a href=/v1.6/zh/ title=用于连接、保护、控制和观测服务。>Istio</a></li><li><a href=/v1.6/zh/blog/ title="关于使用 Istio 的博客文章。">博客</a></li><li><a href=/v1.6/zh/blog/2019/ title="2019 年的博客文章。">2019 年的博客文章</a></li><li>APP 身份和访问适配器</li></ol></nav><article aria-labelledby=title><div class=title-area><div style=width:100%><h1 id=title>APP 身份和访问适配器</h1><p class=subtitle>使用 Istio 实现零代码改动保护多云 Kubernetes 应用</p><p class=byline><span>作者</span>
<span class=attribution>Anton Aleksandrov (IBM)</span><span> | </span><span><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#calendar"/></svg><span>&nbsp;</span>2019年9月18日</span><span> | </span><span title="374 字"><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#clock"/></svg><span>&nbsp;</span>阅读大约需要 2 分钟</span></p></div></div><nav class=toc-inlined aria-label="Table of Contents"><div><hr><ol><li role=none aria-label="了解 Istio 和其适配器"><a href=#understanding-Istio-and-the-adapter>了解 Istio 和其适配器</a><li role=none aria-label=安装><a href=#installation>安装</a><li role=none aria-label="保护 web 应用程序"><a href=#protecting-web-applications>保护 web 应用程序</a><ol><li role=none aria-label="应用 web 应用程序保护"><a href=#applying-web-application-protection>应用 web 应用程序保护</a></ol></li><li role=none aria-label="保护后端应用程序和 API"><a href=#protecting-backend-application-and-APIs>保护后端应用程序和 API</a><ol><li role=none aria-label="应用后端程序和 API 保护"><a href=#applying-backend-application-and-APIs-protection>应用后端程序和 API 保护</a></ol></li><li role=none aria-label=已知的局限性><a href=#known-limitations>已知的局限性</a><li role=none aria-label=总结><a href=#summary>总结</a><li role=none aria-label=相关内容><a href=#see-also>相关内容</a></li></ol><hr></div></nav><div><aside class="callout warning"><div class=type><svg class="large-icon"><use xlink:href="/v1.6/img/icons.svg#callout-warning"/></svg></div><div class=content>该博客文章是在 Istio 1.3 的版本下编写的,因此其中某些内容现在可能已过时。</div></aside></div><p>如果在 Kubernetes 以容器化的方式运行应用,就可以使用 App 身份和访问适配器获得抽象级别的安全性,而无需更改代码或重新部署。</p><p>无论您的运行环境是单云提供商,还是多个云提供商的组合或者遵循混合云的方式,集中式身份管理都可以帮助您维护现有基础设施并避免被云供应商绑定。</p><p>有了 <a href=https://github.com/ibm-cloud-security/app-identity-and-access-adapter>App 身份和访问适配器</a>,就可以使用以下 OAuth2/OIDC 提供商IBM Cloud App ID、Auth0、Okta、Ping Identity、AWS Cognito、Azure AD B2 等。身份和授权策略可以以高效的方式应用在所有环境(包括前端和后端应用程序),而无需修改代码或重新部署。</p><h2 id=understanding-Istio-and-the-adapter>了解 Istio 和其适配器</h2><p><a href=/v1.6/zh/docs/concepts/what-is-istio/>Istio</a> 是一个开源的服务网格,它对分布式应用来说是一个透明层,它可以和 Kubernetes 无缝集成。为了降低布署复杂性 Istio 提供了对整个服务网格的行为洞察和操作控制。详见 <a href=/v1.6/zh/docs/ops/deployment/architecture/>Istio 架构</a></p><p>Istio 使用 [Envoy sidecar 代理] 来调整服务网格中所有 Pod 的入站和出站流量。Istio 从 Envoy sidecar 中提取遥测数据,并将其发送到负责收集遥测数据和执行策略的 Istio 组件 Mixer。</p><p>APP 身份和访问适配器通过分析针对服务网格上各种访问控制策略的遥测数据(属性)扩展 Mixer 的功能。访问控制策略可以关联到具体的 Kubernetes 服务,并且可以微调到特定的服务端点。关于策略和遥测信息的详情请看 Istio 的文档。</p><p><a href=https://github.com/ibm-cloud-security/app-identity-and-access-adapter>App 身份和访问适配器</a>结合到 Istio 中后,为多云架构提供可扩展的、集成身份和访问解决方案,而且不需要修改任何应用程序代码。</p><h2 id=installation>安装</h2><p>可以直接使用 <code>github.com</code> 仓库中的 Helm 来安装 APP 身份和访问适配器。</p><pre><code class=language-bash data-expandlinks=true data-repo=istio>$ helm repo add appidentityandaccessadapter https://raw.githubusercontent.com/ibm-cloud-security/app-identity-and-access-adapter/master/helm/appidentityandaccessadapter
$ helm install --name appidentityandaccessadapter appidentityandaccessadapter/appidentityandaccessadapter
</code></pre><p>另外,可以从 <code>github.com</code> 仓库 clone 下来,在本地用 Helm chart 进行安装。</p><pre><code class=language-bash data-expandlinks=true data-repo=istio>$ git clone git@github.com:ibm-cloud-security/app-identity-and-access-adapter.git
$ helm install ./helm/appidentityandaccessadapter --name appidentityandaccessadapter.
</code></pre><h2 id=protecting-web-applications>保护 web 应用程序</h2><p>Web 应用程序通常是由 OpenID Connect (OIDC) 工作流保护,也被叫做 <code>authorization_code</code>。当检测到未经认证或未经授权的用户时,它们会自动重定向到所选择的身份服务并展示认证页面。身份验证完成后,浏览器将重定向回适配器拦截的隐式 <code>/oidc/callback</code> 端点。此时,适配器从身份服务获取访问和身份令牌,然后将用户重定向回 Web 应用程序中最初请求的 URL。</p><p>身份状态和令牌是由适配器维护管理的。适配器处理的每个请求会包含访问和身份令牌的认证头,其格式是:<code>Authorization: Bearer &lt;access_token> &lt;id_token></code></p><p>开发者可以根据读取令牌token信息调整应用程序的用户体验比如显示用户名根据用户角色适配用户界面等。</p><p>为了终止经过身份验证的会话并且清除令牌(即用户注销),只需将浏览器重定向到受保护服务下的 <code>/oidc/logout</code> 端点即可。例如,从 <code>https://example.com/myapp</code> 中将应用程序重定向到 <code>https://example.com/myapp/oidc/logout</code></p><p>无论何时访问令牌过期了,系统都会通过刷新令牌自动获取一个新的访问和身份令牌,而无需重新进行身份验证。如果已配置的身份认证提供商返回一个刷新令牌,适配器会将其持久保存,用于老令牌过期时,重新获取新的访问和身份令牌。</p><h3 id=applying-web-application-protection>应用 web 应用程序保护</h3><p>保护 web 应用程序需要创建 2 种类型的资源 - <code>OidcConfig</code> 资源用于定义各种 OIDC 服务提供商,<code>Policy</code> 资源用于定义 web 应用保护策略。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: &#34;security.cloud.ibm.com/v1&#34;
kind: OidcConfig
metadata:
name: my-oidc-provider-config
namespace: sample-namespace
spec:
discoveryUrl: &lt;discovery-url-from-oidc-provider&gt;
clientId: &lt;client-id-from-oidc-provider&gt;
clientSecretRef:
name: &lt;kubernetes-secret-name&gt;
key: &lt;kubernetes-secret-key&gt;
</code></pre><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: &#34;security.cloud.ibm.com/v1&#34;
kind: Policy
metadata:
name: my-sample-web-policy
namespace: sample-namespace
spec:
targets:
- serviceName: &lt;kubernetes-service-name-to-protect&gt;
paths:
- prefix: /webapp
method: ALL
policies:
- policyType: oidc
config: my-oidc-provider-config
rules: // optional
- claim: iss
match: ALL
source: access_token
values:
- &lt;expected-issuer-id&gt;
- claim: scope
match: ALL
source: access_token
values:
- openid
</code></pre><p><a href=https://github.com/ibm-cloud-security/app-identity-and-access-adapter>阅读更多关于如何保护 web 应用程序</a></p><h2 id=protecting-backend-application-and-APIs>保护后端应用程序和 API</h2><p>后端应用程序和 API 的保护是使用 Bearer Token 工作流对特定的策略验证传入的令牌。Bearer Token 授权流程需要在请求中包含 <code>Authorization</code> 头,这个头以 JWT 格式包含了有效的访问令牌。需要的头结构是:<code>Authorization: Bearer {access_token}</code>。如果令牌验证成功请求会被发往被请求的服务。如果令牌验证失败会给客户端返回 HTTP 401 以及访问这个 API 所需要的权限列表。</p><h3 id=applying-backend-application-and-APIs-protection>应用后端程序和 API 保护</h3><p>保护后端程序和 API 需要创建 2 种类型的资源 - <code>JwtConfig</code> 用于定义各种 JWT 服务提供者,<code>Policy</code> 用于定义后端应用保护策略。</p><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: &#34;security.cloud.ibm.com/v1&#34;
kind: JwtConfig
metadata:
name: my-jwt-config
namespace: sample-namespace
spec:
jwksUrl: &lt;the-jwks-url&gt;
</code></pre><pre><code class=language-yaml data-expandlinks=true data-repo=istio>apiVersion: &#34;security.cloud.ibm.com/v1&#34;
kind: Policy
metadata:
name: my-sample-backend-policy
namespace: sample-namespace
spec:
targets:
- serviceName: &lt;kubernetes-service-name-to-protect&gt;
paths:
- prefix: /api/files
method: ALL
policies:
- policyType: jwt
config: my-oidc-provider-config
rules: // optional
- claim: iss
match: ALL
source: access_token
values:
- &lt;expected-issuer-id&gt;
- claim: scope
match: ALL
source: access_token
values:
- files.read
- files.write
</code></pre><p><a href=https://github.com/ibm-cloud-security/app-identity-and-access-adapter>阅读更多如何保护后端应用程序</a></p><h2 id=known-limitations>已知的局限性</h2><p>在写这篇博客的时候,有 2 个关于 APP 身份和访问适配器的已知局限性问题:</p><ul><li><p>如果在 Web 应用程序上启用 APP 身份和访问适配器,只能创建 1 个适配器的副本。由于 Envoy 代理处理 HTTP 头的方式Mixer 有可能给 Envoy 返回多个 <code>Set-Cookie</code> 头。因此,不能设置 Web 应用程序想要设置的所有 cookie。这个问题最近在 Envoy 和 Mixer 的开发上被讨论,计划在后期适配器的版本中解决。<strong>注意这个问题只影响 Web 应用程序,并不会以任何方式影响后端 APP 和 API</strong></p></li><li><p>作为一般最佳实践,集群内通信应该永远考虑使用双向 TLS 通信。现在 Mixer 与 APP 身份和访问适配器之间的通信通道并没有使用双端 TLS 通信。未来计划根据 <a href=https://github.com/istio/istio/wiki/Mixer-Out-of-Process-Adapter-Walkthrough#step-7-encrypt-connection-between-mixer-and-grpc-adapter>Mixer 适配器开发指引</a>实现解决这个问题。</p></li></ul><h2 id=summary>总结</h2><p>当多云部署实施时,随着环境的发展和多样性,安全也会变得复杂起来。当云提供商提供协议和工具来确保其产品的安全性,开发团队仍然要负责应用程序级别的安全,比如基于 OAuth2 的 API 访问控制,通过流量加密防御中间人攻击以及为服务访问控制提供双向 TLS。但是在多云环境中这会变得复杂因为可能要为分别为每个服务定义它的安全策略。有了适当的安全协议这些外部和内部的威胁就可以减轻了。</p><p>开发团队花时间让服务能够移植到不同的云提供商,在同等情况下,安全应该更灵活而不依赖基础设施。</p><p>Istio 和 APP 身份和访问适配器可以加固 Kubernetes app 的安全性,并且无关编程语言和框架,不需要修改任何一行代码并重新部署。使用这种方式保证了 app 的最大可移植性,并且可以在多个环境中方便的去执行相同的安全策略。</p><p>可以在<a href=https://www.ibm.com/cloud/blog/using-istio-to-secure-your-multicloud-kubernetes-applications-with-zero-code-change>发布博客</a>上阅读更多关于 APP 身份和访问适配器的信息。</p><nav id=see-also><h2>相关内容</h2><div class=see-also><div class=entry><p class=link><a data-skipendnotes=true href=/v1.6/zh/docs/tasks/security/authorization/authz-jwt/>基于 JWT 授权</a></p><p class=desc>有关如何在 Istio 中通过 JWT 实现访问控制的教程。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.6/zh/docs/concepts/security/>安全</a></p><p class=desc>描述 Istio 的授权与认证功能。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.6/zh/blog/2020/tradewinds-2020/>Istio 2020——为了商用</a></p><p class=desc>Istio 在 2020 年的愿景声明及路线图。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.6/zh/blog/2020/istio-agent/>移除跨 pod Unix domain socket</a></p><p class=desc>一种更安全的秘密管理方式。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.6/zh/blog/2019/dns-cert/>DNS 证书管理</a></p><p class=desc>在 Istio 中配置和管理 DNS 证书。</p></div><div class=entry><p class=link><a data-skipendnotes=true href=/v1.6/zh/blog/2019/v1beta1-authorization-policy/>Istio v1beta1 授权策略概述</a></p><p class=desc>Istio v1beta1 授权策略的设计原则、基本概述及迁移操作。</p></div></div></nav></article><nav class=pagenav><div class=left><a title="如何使用 Istio 去监控被阻止的和透传的外部服务流量。" href=/v1.6/zh/blog/2019/monitoring-external-service-traffic/><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#left-arrow"/></svg>监控被阻止的和透传的外部服务流量</a></div><div class=right><a title="本文演示 Mixer 进程外适配器实现 Knative scale-from-zero 逻辑的具体过程。" href=/v1.6/zh/blog/2019/knative-activator-adapter/>适用于 Knative 的 Mixer 适配器<svg class="icon"><use xlink:href="/v1.6/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="了解 Istio 和其适配器"><a href=#understanding-Istio-and-the-adapter>了解 Istio 和其适配器</a><li role=none aria-label=安装><a href=#installation>安装</a><li role=none aria-label="保护 web 应用程序"><a href=#protecting-web-applications>保护 web 应用程序</a><ol><li role=none aria-label="应用 web 应用程序保护"><a href=#applying-web-application-protection>应用 web 应用程序保护</a></ol></li><li role=none aria-label="保护后端应用程序和 API"><a href=#protecting-backend-application-and-APIs>保护后端应用程序和 API</a><ol><li role=none aria-label="应用后端程序和 API 保护"><a href=#applying-backend-application-and-APIs-protection>应用后端程序和 API 保护</a></ol></li><li role=none aria-label=已知的局限性><a href=#known-limitations>已知的局限性</a><li role=none aria-label=总结><a href=#summary>总结</a><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.6.8" href=/v1.6/docs/setup/getting-started/#download aria-label="Download Istio"><span>download</span><svg class="icon"><use xlink:href="/v1.6/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.6/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.6/img/icons.svg#stackoverflow"/></svg></a>
<a class=channel title="在 Slack 上与 Istio 社区交互讨论开发问题(仅限邀请)" href=https://istio.slack.com aria-label=slack><span>slack</span><svg class="icon"><use xlink:href="/v1.6/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.6/img/icons.svg#twitter"/></svg></a><div class=tag>对于用户</div></div><div class=info><p class=copyright>中文内容由 ServiceMesher 社区维护,部分文档可能稍微滞后于英文版本,同步工作持续进行中<br>Istio 归档
1.6.8<br>&copy; 2020 Istio Authors, <a href=https://policies.google.com/privacy>隐私政策</a><br>归档于 2020年8月21日</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.6/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.6/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.6/img/icons.svg#working-groups"/></svg></a><div class=tag>对于开发者</div></div></footer><div id=scroll-to-top-container aria-hidden=true><button id=scroll-to-top title=回到顶部><svg class="icon"><use xlink:href="/v1.6/img/icons.svg#top"/></svg></button></div></body></html>