带有证书的SSL / TLS配置

问题描述 投票:2回答:1

我在TSL / SSL配置中遇到问题。一切都像在文档https://cloud.spring.io/spring-cloud-gateway/multi/multi__tls_ssl.html

中一样进行配置
server:
  port: 8080
  ssl:
    enabled: true
    key-password: password
    key-store-password: password
    key-store: certificate.p12
    key-store-type: PKCS12

spring:
  cloud:
    gateway:
      httpclient:
        ssl:
          trustedX509Certificates:
            - someCert.pem

使用此配置,无法用http://localhost:8080/home呼叫端点-这是所需的行为。

尽管进行了配置,但我可以在不应用适当证书的情况下调用所有端点,例如https:localhost:8080 / home。在chrome中,我可以单击“仍然继续”,然后获取端点的内容。

我不想允许它-如果要从外部呼叫端点,则需要具有客户端证书。这是我的目标,但我缺少一些东西。

如何使用Spring Cloud Gateway实现这一目标?

spring-security netty spring-cloud-config spring-cloud-gateway
1个回答
0
投票

我知道这很旧,但是如果有人碰到它,您可能会缺少一个属性:

server:
  ssl:
    client-auth: need

这将强制服务器在接受连接之前要求获得客户端证书。

© www.soinside.com 2019 - 2024. All rights reserved.