当前位置: 首页 > news >正文

备考ICA----Istio实验12---配置双向TLS Istio Ingress Gateway实验

备考ICA----Istio实验12—配置双向TLS Istio Ingress Gateway实验

本实验部分配置延续上个Istio实验11

1. 重新配置secret

重新配置secret使其带有ca证书可以验证客户端证书是否合法
先删除原有secret,再配置新的secret

# 删除原tls类型的secret
kubectl -n istio-system delete secret pana-credential
# 重新创建secret,带有ca的证书
kubectl create secret -n istio-system generic pana-credential \
--from-file=tls.key=example_certs_pana/pana.example.com.key \
--from-file=tls.crt=example_certs_pana/pana.example.com.crt \
--from-file=ca.crt=example_certs_root/example.com.crt
# 确认secret被正确创建
kubectl get  secrets -n istio-system 

在这里插入图片描述

2. Gateway配置

将Gateway设置为MUTUAL模式
mode: MUTUAL
tls-ingress/pana-tls-gateway-mutual.yaml

apiVersion: networking.istio.io/v1beta1
kind: Gateway
metadata:name: mygateway
spec:selector:istio: ingressgateway                # use istio default ingress gatewayservers:- port:number: 443name: panaprotocol: HTTPStls:mode: MUTUALcredentialName: pana-credential    # must be the same as secrethosts:- pana.example.com

更新部署gateway

kubectl apply -f tls-ingress/pana-tls-gateway-mutual.yaml

3. 测试

3.1 没有客户端证书访问测试

curl -v -HHost:pana.example.com --resolve "pana.example.com:443:192.168.126.220" \
--cacert example_certs_root/example.com.crt "https://pana.example.com:443/hello"

在这里插入图片描述

3.2 生成客户端证书

mkdir example_certs_client
# 生成key和证书请求文件
openssl req -out example_certs_client/client.example.com.csr  -newkey rsa:2048 \
-nodes -keyout example_certs_client/client.example.com.key \
-subj "/CN=pana.example.com/O=client organization"
# 使用ca签发证书,用于区别其他证书这里有效期设置成2年
openssl x509 -req -sha256 -days 730 -CA example_certs_root/example.com.crt \
-CAkey example_certs_root/example.com.key \
-set_serial 1 -in example_certs_client/client.example.com.csr \
-out example_certs_client/client.example.com.crt

这样就在example_certs_client目录下生成了3个文件
在这里插入图片描述

3.3 使用client证书再次访问

带上客户端证书再次访问测试

curl -v -HHost:pana.example.com --resolve "pana.example.com:443:192.168.126.220" \
--cacert example_certs_root/example.com.crt \
--cert example_certs_client/client.example.com.crt \
--key example_certs_client/client.example.com.key \
"https://pana.example.com:443/hello"

通过之前定义的vs将请求转到了helloworld的后端
在这里插入图片描述
此时由于带了客户端证书,并且可以通过ca进行验证通过.这样就不再报错了
至此备考ICA----Istio实验12—配置双向TLS Istio Ingress Gateway实验完成.

http://www.lryc.cn/news/326337.html

相关文章:

  • SpringBoot 统一后端返回格式、处理全局异常
  • C++学习基础版(一)
  • Rust 双向链表 LinkedList 和安全删除元素的方法
  • Android 开发中 Gradle 使用详解:构建、配置与优化技巧
  • 聚道云助力:易快报CDP无缝对接,登录同步一步到位!
  • Java解决幸运数字
  • 将一个nextjs项目部署到vercel
  • RocketMQ学习笔记:分布式事务
  • 单臂路由和三层交换机
  • 红岩思维导图的制作软件,分享4款热门的!
  • es 集群开机自动启动
  • 使用JMeter从JSON响应的URL参数中提取特定值
  • 汽车电子行业知识:自动驾驶系统结构和各模块功能
  • Oracle参数文件详解
  • 鸿蒙(HarmonyOS)Navigation如何实现多场景UI适配?
  • PTGui图像拼接实验
  • C++|类封装、类的分文件编写练习:设计立方体类、点和圆的关系
  • 大数据开发扩展shell--尚硅谷shell笔记
  • 考研数学|《1800》《1000》《880》《660》最佳搭配使用方法
  • 【GameFramework框架内置模块】17、声音(Sound)
  • 视频记录历史播放位置效果
  • Request Response
  • How to convert .py to .ipynb in Ubuntu 22.04
  • 【prometheus-operator】k8s监控集群外redis
  • MySQL索引(图文并茂)
  • Redis 教程系列之Redis PHP 使用 Redis(十二)
  • JavaScript语法和数据类型
  • 解决华为云服务器宝塔面板无法访问显示“此站点的连接不安全”问题
  • 【Python】 Python脚本实现某平台视频流下载
  • LangChain核心模块 Model I/O——Prompts