cas 配置https改为ip而不是使用域名

本文介绍如何通过IP地址实现CAS单点登录系统的HTTPS访问,并解决因缺少Subject Alternative Name而导致的CertificateException错误。文中提供了使用Java 1.7及keytool生成包含特定IP地址的证书的具体步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

cas注销时地址是https,提示Error is [java.security.cert.CertificateException: No subject alternative names present]

因为某些原因,访问cas以及子系统希望通过ip来访问并且要使用https协议

网上很多文章说要使用CAS单点登录必须要配置域名, cas server是不能通过ip访问的,这实际上是错误的,这和cas无关,目前可以通过java 1.7来生成证书,需要JDK1.7,因为需要-ext参数 

生成证书方式 

keytool -genkey -alias cas41key -keyalg RSA -keysize 1024 -keypass 123456 -storepass 123456  -dname "CN=10.1.4.41,OU=csoa,O=csoa,L=FZ,ST=FZ,C=CN" -ext san=ip:10.1.4.41   -validity 3600  -keystore /home/nloa/bak/cas41.keystore

RFC 2818 (Section 3.1) 

If a subjectAltName extension of type dNSName is present, that MUST be used as the identity. Otherwise, the (most specific) Common Name field in the Subject field of the certificate MUST be used. Although the use of the Common Name is existing practice, it is deprecated and Certification Authorities are encouraged to use the dNSName instead.

[...]

In some cases, the URI is specified as an IP address rather than a hostname. In this case, the iPAddress subjectAltName must be present in the certificate and must exactly match the IP in the URI.

jdk1.7,查阅keytool参数文档,keytool可以使用-ext san=dns:www.example.com 或者 -ext san=ip:10.0.0.1 来包括Subject Alternative Name (SAN,主题备用名称)


评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

编程小泓哥

你的鼓励是我创作的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值