File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed
webapp/src/main/java/com/box/l10n/mojito/security Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change 1+ package com .box .l10n .mojito .security ;
2+
3+ import org .springframework .boot .context .properties .ConfigurationProperties ;
4+ import org .springframework .context .annotation .Configuration ;
5+
6+ /**
7+ * Configures insecure access to Kubernetes probes.
8+ *
9+ * @author wadimw
10+ */
11+ @ Configuration
12+ @ ConfigurationProperties ("l10n.actuator.health" )
13+ public class ActuatorHealthConfig {
14+
15+ boolean allowInsecureKubernetesProbes = false ;
16+
17+ public boolean getAllowInsecureKubernetesProbes () {
18+ return allowInsecureKubernetesProbes ;
19+ }
20+
21+ public void setAllowInsecureKubernetesProbes (boolean allowInsecureKubernetesProbes ) {
22+ this .allowInsecureKubernetesProbes = allowInsecureKubernetesProbes ;
23+ }
24+ }
Original file line number Diff line number Diff line change @@ -58,6 +58,8 @@ public class WebSecurityConfig {
5858
5959 @ Autowired ActuatorHealthLegacyConfig actuatorHealthLegacyConfig ;
6060
61+ @ Autowired ActuatorHealthConfig actuatorHealthConfig ;
62+
6163 @ Autowired UserDetailsContextMapperImpl userDetailsContextMapperImpl ;
6264
6365 @ Autowired UserService userService ;
@@ -217,8 +219,13 @@ public SecurityFilterChain configure(HttpSecurity http) throws Exception {
217219 http .csrf ()
218220 .ignoringRequestMatchers ("/actuator/shutdown" , "/actuator/loggers/**" , "/api/rotation" );
219221
220- setAuthorizationRequests (
221- http , getHealthcheckPatterns (actuatorHealthLegacyConfig .isForwarding ()));
222+ List <String > extraPermitAllPatterns =
223+ new ArrayList <>(getHealthcheckPatterns (actuatorHealthLegacyConfig .isForwarding ()));
224+ if (actuatorHealthConfig .getAllowInsecureKubernetesProbes ()) {
225+ extraPermitAllPatterns .add ("/actuator/health/liveness" );
226+ extraPermitAllPatterns .add ("/actuator/health/readiness" );
227+ }
228+ setAuthorizationRequests (http , extraPermitAllPatterns );
222229
223230 logger .debug ("For APIs, we don't redirect to login page. Instead we return a 401" );
224231 http .exceptionHandling ()
You can’t perform that action at this time.
0 commit comments