Spring Boot Actuator - Unable to disable / info endpoint

I tried to disable all endpoints of the actuator for the working environment in the application.yml configuration file:

 endpoints.enabled: false 

It works for all endpoints except / info. How to disable all endpoints for a given environment?

UPDATE:

The project I'm working on also acts as an Eureka client. The documentation for Spring Cloud Netflix in the Status and Health Indicator Page section ( http://cloud.spring.io/spring-cloud-netflix/spring-cloud-netflix.html ) says that "the default Eureka instance is" / info " and "/ health" respectively. "

Is there any solution to disable these endpoints?

I managed to disable / end of health with endpoints.enabled: false , but not the endpoint / info.

+6
source share
2 answers

Finally I managed to solve my problem. I only included the endpoints / info and / health in the drive. And to allow access to the / info endpoint only for users with the ADMIN role, I needed to set up drive control protection and spring security configuration.

So my application.yml looks like this:

 endpoints.enabled: false endpoints: info.enabled: true health.enabled: true management.security.role: ADMIN 

And spring security setting like this (where I needed to change the management order of ManagementSecurityConfig to have a higher priority):

 @Configuration @EnableWebSecurity @EnableGlobalMethodSecurity(prePostEnabled = true) public class SecurityConfiguration { @Configuration protected static class AuthenticationSecurity extends GlobalAuthenticationConfigurerAdapter { @Autowired private AuthenticationProvider authenticationProvider; public AuthenticationSecurity() { super(); } @Override public void init(AuthenticationManagerBuilder auth) throws Exception { auth.inMemoryAuthentication().withUser("admin").password("secret").roles("ADMIN"); } } @Configuration @Order(Ordered.HIGHEST_PRECEDENCE + 2) public static class ManagementSecurityConfig extends WebSecurityConfigurerAdapter { @Override protected void configure(HttpSecurity http) throws Exception { http.csrf().disable() .requestMatchers() .antMatchers("/info/**") .and() .authorizeRequests() .anyRequest().hasRole("ADMIN") .and() .httpBasic(); } } @Configuration public static class ApiWebSecurityConfigurationAdapter extends WebSecurityConfigurerAdapter { protected void configure(HttpSecurity http) throws Exception { // API security configuration } } } 
+10
source

Your sample configuration looks suspicious to me. I think you meant

 endpoints: enabled: true 

In any case, I just tried to add this to the willa Spring boot application (using 1.3.1 , and all the endpoints were disabled (as expected).

0
source

All Articles