Authentication istio从ext auth中排除服务
嗨,伙计们,我在minikube上设置了istio,在网关上设置了特使ext auth过滤器。我有两个微服务运行在不同的pod中,向外界公开虚拟服务/auther和/appone。我设置的extauth过滤器会将每个请求发送到/auther/auth进行身份验证,如果响应为200,则让请求通过并到达它想要的其他服务。 问题是istio正在对所有端点的每个请求进行身份验证,甚至是/auther。我想排除发送到/auther进行身份验证的请求(因为auther服务将自行处理身份验证)。但它不起作用。 下面是我的ext auth筛选器:Authentication istio从ext auth中排除服务,authentication,filter,istio,envoyproxy,Authentication,Filter,Istio,Envoyproxy,嗨,伙计们,我在minikube上设置了istio,在网关上设置了特使ext auth过滤器。我有两个微服务运行在不同的pod中,向外界公开虚拟服务/auther和/appone。我设置的extauth过滤器会将每个请求发送到/auther/auth进行身份验证,如果响应为200,则让请求通过并到达它想要的其他服务。 问题是istio正在对所有端点的每个请求进行身份验证,甚至是/auther。我想排除发送到/auther进行身份验证的请求(因为auther服务将自行处理身份验证)。但它不起作用。
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: authn-filter
namespace: istio-system
spec:
workloadSelector:
labels:
istio: ingressgateway
configPatches:
- applyTo: HTTP_FILTER
match:
context: GATEWAY
listener:
filterChain:
filter:
name: "envoy.http_connection_manager"
subFilter:
name: "envoy.router"
patch:
operation: INSERT_BEFORE
value:
name: envoy.ext_authz
typed_config:
"@type": "type.googleapis.com/envoy.config.filter.http.ext_authz.v2.ExtAuthz"
http_service:
server_uri:
uri: http://auther.default.svc.cluster.local
cluster: outbound|3000||auther.default.svc.cluster.local
timeout: 1.5s
path_prefix: /auther/auth?user=
authorizationRequest:
allowedHeaders:
patterns:
- exact: "cookie"
- exact: "authorization"
authorizationResponse:
allowedClientHeaders:
patterns:
- exact: "set-cookie"
- exact: "authorization"
下面是我试图实现的异常过滤器:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: bypass-filter
namespace: default
spec:
configPatches:
# The first patch adds the lua filter to the listener/http connection manager
- applyTo: HTTP_ROUTE
match:
context: GATEWAY
routeConfiguration:
vhost:
name: auther
route:
name: auther
patch:
operation: MERGE
value:
typed_per_filter_config:
envoy.ext_authz:
"@type": type.googleapis.com/envoy.config.filter.http.ext_authz.v2.ExtAuthzPerRoute
disabled: true
第一个过滤器工作正常。但是将从身份验证ext筛选器中排除auther服务的第二个筛选器不起作用。您已将
@type
设置为特使.config.filter.http.ext_authz.v2.ExtAuthzPerRoute
,但正确的路径是特使.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
此外,路由名称必须与虚拟服务中的名称匹配。并且它必须作为您的authn筛选器部署到istio系统
命名空间。此配置适用于我:
apiVersion: networking.istio.io/v1alpha3
kind: EnvoyFilter
metadata:
name: bypass-authn
namespace: istio-system
spec:
workloadSelector:
labels:
istio: ingressgateway
configPatches:
- applyTo: HTTP_ROUTE
match:
routeConfiguration:
vhost:
route:
name: my-route #from virtual service http route name
patch:
operation: MERGE
value:
name: envoy.ext_authz_disabled
typed_per_filter_config:
envoy.ext_authz:
"@type": type.googleapis.com/envoy.extensions.filters.http.ext_authz.v3.ExtAuthzPerRoute
disabled: true
您使用的是哪个istio版本?我在istio 1.6和1.7中使用了此版本。正如您所说,我使用了一些配置。我没有工作。您还将部署和服务部署在istio系统命名空间中,或者仅部署在网关和虚拟服务中?部署、服务、网关和虚拟服务位于我所有应用程序的同一命名空间中(不是istio系统)。