【问题标题】:Health endpoints only says "status: up" and does not show up sensitive information健康端点只说“状态:up”,不显示敏感信息
【发布时间】:2016-06-06 22:06:28
【问题描述】:
我用 ResourceServerConfigurerAdapeer 搭建了一个春季展位。我想显示我的健康端点的敏感数据,但它只显示
{状态:正常}
spring.profiles.active: oauth
endpoints.health.sensitive: false
这是我从 Spring 文档中读到的。
HealthIndicators 返回的信息通常在本质上有些敏感。例如,您可能不想向全世界发布您的数据库服务器的详细信息。因此,默认情况下,只有健康状态通过未经身份验证的 HTTP 连接公开。如果您愿意始终公开完整的健康信息,您可以将 endpoints.health.sensitive 设置为 false。
我们如何显示其他信息?
谢谢。
【问题讨论】:
标签:
java
spring-security
spring-boot
endpoint
health-monitoring
【解决方案1】:
我有一个类似的问题,我可以通过将此行添加到 application.properties 文件来解决。
# Disable security for actuator endpoints
management.security.enabled=false
# Disable sensitive filter for the health endpoint
endpoints.health.sensitive=false
这会禁用所有执行器端点的安全性,因此请注意这一点。我建议关闭所有端点并仅启用您需要的端点,例如
# Set all actuator endpoints disabled by default
endpoints.enabled=false
要启用health 端点,您可以执行以下操作,
endpoints.health.enabled=true
希望对你有帮助。
另请参阅 Github Repository for Spring Actuator 上的 issue。
【解决方案2】:
我在添加一些属性时解决了这种情况:
## HEALTH
endpoints.health.enabled.sensitive=false
management.health.db.enabled=true
management.health.defaults.enabled=true
management.health.diskspace.enabled=true
management.security.enabled=false
endpoints.enabled=false
endpoints.health.enabled=true
并显示 Json {"status":"", "diskSpace":{}, "db":""}。希望能帮到你。