EKS - Envoy 动态转发代理 CA 验证错误

如何解决EKS - Envoy 动态转发代理 CA 验证错误

我试图在 eks 内设置一个转发代理,使用一个特使边车容器,它应该进行 TLS 发起; IE。特使从主容器获取 http 请求,执行 ssl 加密并使用文件 ca-certificates.crt 验证 ca。 特使配置基于官方文档 (https://www.envoyproxy.io/docs/envoy/latest/configuration/http/http_filters/dynamic_forward_proxy_filter#config-http-filters-dynamic-forward-proxy)。

特使将 aws 机密管理器中的 ca 文件 ca-certificates.crt 挂载到 /etc/cert-volume/ca-certificates.crt,这似乎有效,因为该文件存在于容器中。

ca-certificates.crt 文件似乎也是有效的,因为以下 cmd,从我的本地机器运行,给出了 HTTP 302 Found(远程 wget 不支持 --ca-certificate参数):

wget --ca-certificate=ca-certificates.crt  https://git.tech.rz.blub.de
--2021-04-26 11:03:16--  https://git.tech.rz.blub.de/
Loaded CA certificate 'ca-certificates.crt'
Resolving git.tech.rz.blub.de (git.tech.rz.blub.de)... 10.104.85.137,10.104.84.192,10.104.86.175
Connecting to git.tech.rz.blub.de (git.tech.rz.blub.de)|10.104.85.137|:443... connected.
HTTP request sent,awaiting response... 302 Found

当我在 envoy-Container 上打开 shell 并尝试通过代理发送 http-Request 时,我收到 503 Service Unavailable:

export http_proxy="localhost:10000"
wget git.tech.rz.blub.de
Connecting to localhost:10000 (127.0.0.1:10000)
wget: server returned error: HTTP/1.1 503 Service Unavailable

正如 envoy-logs 显示的那样,请求已处理并且 DNS 解析成功,但是 ca-validation 失败并出现错误 TLS 错误:268435581:SSLroutines:OPENSSL_internal:CERTIFICATE_VERIFY_FAILED

可以在此处找到日志:https://pastebin.com/pUZZqhSA

完整的特使配置如下所示:

  admin:
  access_log_path: /dev/stdout
  address: 
    socket_address: {​ address: 127.0.0.1,port_value: 9901,protocol: TCP }​
static_resources:
  secrets:
  - name: server_cert
    tls_certificate:
      certificate_chain:
        filename: /etc/cert-volume/server.crt
      private_key:
        filename: /etc/cert-volume/server.key
  - name: validation_context
    validation_context:
      trusted_ca:
        filename: /etc/cert-volume/ca-certificates.crt
  listeners:
    - name: listener_incoming
      address:
        socket_address: {​ address: 0.0.0.0,port_value: 8443 }​
      filter_chains:
        filters:
          - name: envoy.filters.network.http_connection_manager
            typed_config:
              "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
              stat_prefix: ingress_http
              route_config:
                name: local_route
                virtual_hosts:
                  - name: local_service
                    domains: ["*"]
                    routes:
                      - match: {​ prefix: "/config/" }​
                        route: {​ cluster: local_config }​
                      - match: {​ prefix: "/basic/" }​
                        route: {​ cluster: local }​
                      - match: {​ prefix: "/" }​
                        route: {​ cluster: local }​
              access_log:
              - name: envoy.access_loggers.file
                typed_config:
                  "@type": type.googleapis.com/envoy.extensions.access_loggers.file.v3.FileAccessLog
                  path: /dev/stdout
                  log_format:
                    json_format:
                      protocol: "%PROTOCOL%"
                      response_code: "%RESPONSE_CODE%"
                      response_code_details: "%RESPONSE_CODE_DETAILS%"
                      connection_termination_details: "%CONNECTION_TERMINATION_DETAILS%"
                      message: "%LOCAL_REPLY_BODY%"
                      response_flags: "%RESPONSE_FLAGS%"
                      local_reply_body: "%LOCAL_REPLY_BODY%"
              http_filters:
                  - name: envoy.filters.http.router
        transport_socket:
          name: envoy.transport_sockets.tls
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext
            common_tls_context:
              tls_certificate_sds_secret_configs:
              - name: server_cert
    - name: listener_outgoing
      address:
        socket_address:
          address: 0.0.0.0
          port_value: 10000
      filter_chains:
      - filters:
        - name: envoy.filters.network.http_connection_manager
          typed_config:
            "@type": type.googleapis.com/envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager
            codec_type: AUTO
            stat_prefix: http_to_https
            route_config:
              name: local_route
              virtual_hosts:
              - name: app
                domains:
                - "*"
                routes:
                - match:
                    prefix: "/"
                  route:
                    cluster: dynamic_forward_proxy_cluster
            http_filters:
            - name: envoy.filters.http.dynamic_forward_proxy
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.http.dynamic_forward_proxy.v3.FilterConfig
                dns_cache_config:
                  name: dynamic_forward_proxy_cache_config
                  dns_lookup_family: V4_ONLY
            - name: envoy.filters.http.router
              typed_config:
                "@type": type.googleapis.com/envoy.extensions.filters.http.router.v3.Router
  clusters:
  - name: local
    connect_timeout: 0.25s
    type: STATIC
    load_assignment:
      cluster_name: local
      endpoints:
        - lb_endpoints:
          - endpoint:
              address:
                socket_address:
                  address: 127.0.0.1
                  port_value: 8080
  - name: local_config
    connect_timeout: 0.25s
    type: STATIC
    load_assignment:
      cluster_name: local_config
      endpoints:
        - lb_endpoints:
          - endpoint:
              address:
                socket_address:
                  address: 127.0.0.1
                  port_value: 8081
  - name: dynamic_forward_proxy_cluster
    connect_timeout: 1s
    lb_policy: CLUSTER_PROVIDED
    cluster_type:
      name: envoy.clusters.dynamic_forward_proxy
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.clusters.dynamic_forward_proxy.v3.ClusterConfig
        dns_cache_config:
          name: dynamic_forward_proxy_cache_config
          dns_lookup_family: V4_ONLY
    transport_socket:
      name: envoy.transport_sockets.tls
      typed_config:
        "@type": type.googleapis.com/envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext
        common_tls_context:
          validation_context_sds_secret_config:
            name: validation_context

envoy-admin 端点显示,使用了正确的证书:

wget localhost:9901/certs
Connecting to localhost:9901 (127.0.0.1:9901)
saving to 'certs'
certs                100% |*********************************************|   710  0:00:00 ETA
'certs' saved
/ # cat certs
{​
 "certificates": [
  {​
   "ca_cert": [
    {​
     "path": "/etc/cert-volume/ca-certificates.crt","serial_number": "612a55dd000000000002","subject_alt_names": [],"days_until_expiration": "1305","valid_from": "2013-11-21T15:40:58Z","expiration_time": "2024-11-21T15:50:58Z"
    }​
   ],"cert_chain": []
  }​,{​
   "ca_cert": [],"cert_chain": [
    {​
     "path": "/etc/cert-volume/server.crt","serial_number": "74af53b8463a1714","subject_alt_names": [
      {​
       "dns": "*.test.comp.blub.de"
      }​
     ],"days_until_expiration": "173","valid_from": "2019-10-18T07:10:38Z","expiration_time": "2021-10-17T07:10:38Z"
    }​
   ]
  }​
 ]
}​

有没有人有想法,这里出了什么问题?

解决方法

问题解决了。 ca-certificates.crt 缺少必需的 CA。我不知道为什么 wget 没有抛出异常,但是 openssl 却...

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


依赖报错 idea导入项目后依赖报错,解决方案:https://blog.csdn.net/weixin_42420249/article/details/81191861 依赖版本报错:更换其他版本 无法下载依赖可参考:https://blog.csdn.net/weixin_42628809/a
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下 2021-12-03 13:33:33.927 ERROR 7228 [ main] o.s.b.d.LoggingFailureAnalysisReporter : *************************** APPL
错误1:gradle项目控制台输出为乱码 # 解决方案:https://blog.csdn.net/weixin_43501566/article/details/112482302 # 在gradle-wrapper.properties 添加以下内容 org.gradle.jvmargs=-Df
错误还原:在查询的过程中,传入的workType为0时,该条件不起作用 <select id="xxx"> SELECT di.id, di.name, di.work_type, di.updated... <where> <if test=&qu
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct redisServer’没有名为‘server_cpulist’的成员 redisSetCpuAffinity(server.server_cpulist); ^ server.c: 在函数‘hasActiveC
解决方案1 1、改项目中.idea/workspace.xml配置文件,增加dynamic.classpath参数 2、搜索PropertiesComponent,添加如下 <property name="dynamic.classpath" value="tru
删除根组件app.vue中的默认代码后报错:Module Error (from ./node_modules/eslint-loader/index.js): 解决方案:关闭ESlint代码检测,在项目根目录创建vue.config.js,在文件中添加 module.exports = { lin
查看spark默认的python版本 [root@master day27]# pyspark /home/software/spark-2.3.4-bin-hadoop2.7/conf/spark-env.sh: line 2: /usr/local/hadoop/bin/hadoop: No s
使用本地python环境可以成功执行 import pandas as pd import matplotlib.pyplot as plt # 设置字体 plt.rcParams['font.sans-serif'] = ['SimHei'] # 能正确显示负号 p
错误1:Request method ‘DELETE‘ not supported 错误还原:controller层有一个接口,访问该接口时报错:Request method ‘DELETE‘ not supported 错误原因:没有接收到前端传入的参数,修改为如下 参考 错误2:cannot r
错误1:启动docker镜像时报错:Error response from daemon: driver failed programming external connectivity on endpoint quirky_allen 解决方法:重启docker -> systemctl r
错误1:private field ‘xxx‘ is never assigned 按Altʾnter快捷键,选择第2项 参考:https://blog.csdn.net/shi_hong_fei_hei/article/details/88814070 错误2:启动时报错,不能找到主启动类 #
报错如下,通过源不能下载,最后警告pip需升级版本 Requirement already satisfied: pip in c:\users\ychen\appdata\local\programs\python\python310\lib\site-packages (22.0.4) Coll
错误1:maven打包报错 错误还原:使用maven打包项目时报错如下 [ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources)
错误1:服务调用时报错 服务消费者模块assess通过openFeign调用服务提供者模块hires 如下为服务提供者模块hires的控制层接口 @RestController @RequestMapping("/hires") public class FeignControl
错误1:运行项目后报如下错误 解决方案 报错2:Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project sb 解决方案:在pom.
参考 错误原因 过滤器或拦截器在生效时,redisTemplate还没有注入 解决方案:在注入容器时就生效 @Component //项目运行时就注入Spring容器 public class RedisBean { @Resource private RedisTemplate<String
使用vite构建项目报错 C:\Users\ychen\work>npm init @vitejs/app @vitejs/create-app is deprecated, use npm init vite instead C:\Users\ychen\AppData\Local\npm-