【问题标题】:Forbidden errors at app initialization when using spring cloud vault使用 Spring Cloud Vault 时应用程序初始化时出现禁止错误
【发布时间】:2020-12-10 00:31:22
【问题描述】:

使用 Spring Cloud HOXTON.SR6,搭配 Spring boot 2.3.2

启动服务时,尝试访问“/secret/application”和“/secret/application/{profile}”时出现 403 错误。这些路径中的“应用程序”应替换为我的应用程序名称。

错误:

[RequestedSecret [path='secret/application/{profile}’, mode=ROTATE]] Lease [leaseId='null', leaseDuration=PT0S, renewable=false] Status 403 Forbidden [secret/application/{profile}]: 1 error occurred: * permission denied ; nested exception is org.springframework.web.client.HttpClientErrorException$Forbidden: 403 Forbidden: [{"errors":["1 error occurred:\n\t* permission denied\n\n"]} ] org.springframework.vault.VaultException: Status 403 Forbidden [secret/application/{profile}]: 1 error occurred: * permission denied ; nested exception is org.springframework.web.client.HttpClientErrorException$Forbidden: 403 Forbidden: [{"errors":["1 error occurred:\n\t* permission denied\n\n"]} ]

如果我设置 spring.cloud.vault.generic.enabled = false,替换工作正常并且错误消失。 问题是这个属性被设置为弃用。那么怎么解决呢?

错误出现在:

spring:
    cloud:
        vault:
            authentication: approle
            app-role:
                role-id: <<role-id>>
                secret-id: <<secret-id>>
            kv:
                enabled: true
                backend: secret
                application-name: <<application-name>>
                default-context: <<application-name>>
            host: <<vault-host>>

但不再是:

spring:
    cloud:
        vault:
            authentication: approle
            app-role:
                role-id: <<role-id>>
                secret-id: <<secret-id>>
            kv:
                enabled: true
                backend: secret
                application-name: <<application-name>>
                default-context: <<application-name>>
            generic:
                enabled: false
            host: <<vault-host>>

我应该以不同的方式使用它吗?

【问题讨论】:

    标签: spring spring-boot hashicorp-vault spring-cloud-vault-config


    【解决方案1】:

    正如你所说,将泛型设置为 false 可以解决问题,所以我的建议是保留它,直到他们将其删除

    【讨论】:

      猜你喜欢
      • 2021-08-06
      • 2018-12-07
      • 2018-02-09
      • 2018-07-25
      • 2021-03-06
      • 1970-01-01
      • 1970-01-01
      • 2021-11-05
      • 1970-01-01
      相关资源
      最近更新 更多