0Pricing
Spring Boot 4 Microservices & REST APIs · Ders

Actuator Uç Noktalarını Güvenceye Alma

Hassas operasyon uç noktalarını koruyun.

Actuator Uç Noktalarını Güvenceye Alma, CoddyKit'te ücretsiz bir Spring Boot 4 Microservices & REST APIs dersidir. Bu, 4 dersinin 4. dersidir. Aşağıdan dersin tamamını ücretsiz okuyabilir, sonra tarayıcıda yerleşik kod editörü ve 7/24 yapay zeka koçu ile uygulamalı olarak pratik yapabilirsin. Bu, Spring Boot 4 Microservices & REST APIs öğrenme yolunun bir parçasıdır ve ilerlemeniz web ve CoddyKit uygulaması arasında senkronize olur. Spring Boot 4 Microservices & REST APIs kursu toplamda 4 dersten oluşur.

Bu dersin bazı bölümleri henüz çevrilmemiş olup İngilizce olarak gösterilmektedir.

Why Actuator Needs Securing

Actuator endpoints can reveal environment variables, beans, mappings, and even heap dumps. Left open, they leak sensitive information and may allow dangerous operations like shutdown. They must be protected in production.

Minimize the Attack Surface First

Security starts with exposure. Expose only the endpoints operators truly need over HTTP, and exclude sensitive ones like env, beans, and heapdump.

management:
  endpoints:
    web:
      exposure:
        include: health,info,prometheus
        exclude: env,beans,heapdump,threaddump

Adding Spring Security

To authenticate access, add Spring Security. Once on the classpath, it secures the application — including Actuator endpoints — and you define the rules.

<!-- pom.xml -->
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-security</artifactId>
</dependency>

The EndpointRequest Matcher

Spring Boot provides EndpointRequest matchers so your security config can target Actuator endpoints precisely, without hardcoding the /actuator path.

import static org.springframework.boot.actuate.autoconfigure.security.servlet.EndpointRequest.*;
// EndpointRequest.toAnyEndpoint()
// EndpointRequest.to("health", "info")

Locking Down the Endpoints

A typical policy: allow health and info anonymously (for probes), but require an authenticated role for everything else.

@Bean
SecurityFilterChain actuatorSecurity(HttpSecurity http) throws Exception {
    http.securityMatcher(EndpointRequest.toAnyEndpoint())
        .authorizeHttpRequests(a -> a
            .requestMatchers(EndpointRequest.to("health", "info")).permitAll()
            .anyRequest().hasRole("ADMIN"))
        .httpBasic(Customizer.withDefaults());
    return http.build();
}

Role-Based Access

Restrict management endpoints to an operations role such as ADMIN. Combine with your existing user store — in-memory for demos, a real identity provider in production.

@Bean
UserDetailsService users(PasswordEncoder encoder) {
    UserDetails admin = User.withUsername("ops")
        .password(encoder.encode("change-me"))
        .roles("ADMIN").build();
    return new InMemoryUserDetailsManager(admin);
}

Isolating with a Management Port

Run Actuator on a separate port that is only reachable inside your network or cluster. Public traffic hits the app port; operators reach management through internal routing.

management:
  server:
    port: 8081
# expose 8081 only to the internal network / sidecar

Probes Without Credentials

Kubernetes probes call health/liveness and health/readiness without auth. Permit those specific paths while still protecting the rest of health details and other endpoints.

.requestMatchers(EndpointRequest.to("health")).permitAll()
// keep show-details restricted so anonymous probes see only status

Hiding Health Details

Even when health is public, do not leak component internals to anonymous callers. Set show-details to when-authorized so probes see only UP/DOWN.

management:
  endpoint:
    health:
      show-details: when-authorized

Disable Dangerous Endpoints

Some endpoints can change runtime state. Keep shutdown disabled, and avoid exposing heapdump or threaddump publicly, as they reveal memory contents and aid attackers.

management:
  endpoint:
    shutdown:
      enabled: false

Defense in Depth

No single control suffices. Combine measures:

  • Minimal exposure
  • Authentication and roles
  • Network isolation / separate port
  • Restricted health details

Quick Check

Test your understanding of securing Actuator.

Recap

Treat Actuator as a security perimeter.

  • Expose minimally; exclude env, beans, heapdump
  • Add Spring Security and use EndpointRequest matchers
  • Permit health/info for probes; require a role for the rest
  • Restrict show-details and disable shutdown
  • Isolate via a separate management port

Sıkça Sorulan Sorular

“Actuator Uç Noktalarını Güvenceye Alma” dersi ücretsiz mi?

Evet — “Actuator Uç Noktalarını Güvenceye Alma” dersin tüm metni burada web'de ücretsiz olarak okunabilir. Etkileşimli olarak pratik yapmak (yerleşik kod editörü ve 7/24 yapay zeka koçu) ve Spring Boot 4 Microservices & REST APIs kursunun geri kalanını açmak için CoddyKit PRO'ya yükselt. Spring Boot 4 Microservices & REST APIs kursu toplamda 4 dersten oluşur.

“Actuator Uç Noktalarını Güvenceye Alma” dersinde ne öğreneceğim?

Hassas operasyon uç noktalarını koruyun. Spring Boot 4 Microservices & REST APIs ile uygulamalı kodu tarayıcıda doğrudan çalıştırarak pratik yaparsın ve 7/24 yapay zeka koçu dersi çalışırken sorularını yanıtlar.

Spring Boot 4 Microservices & REST APIs öğrenmeye başlamak için deneyim gerekli mi?

Önceden deneyim gerekmez. CoddyKit'te Spring Boot 4 Microservices & REST APIs, başlangıçtan ileri seviyeye kadar yapılandırıldığı için buradan başlayabilir veya başından başlayıp kendi hızında ilerleme yapabilirsin. Bu, 4 dersinin 4. dersidir.

“Actuator Uç Noktalarını Güvenceye Alma” dersi ne kadar sürer?

Çoğu CoddyKit dersi yaklaşık 5–10 dakika sürer. Her biri kısa ve etkileşimli olduğu için sabit ilerleme yaparsın ve web ile uygulama arasında tam olarak bıraktığın yerden devam edebilirsin.

Bu Spring Boot 4 Microservices & REST APIs dersinde kod yazıp çalıştırabilir miyim?

Evet. Her Spring Boot 4 Microservices & REST APIs dersi yerleşik bir kod editörü içerir, bu sayede tarayıcıda gerçek kod yazıp çalıştırabilir ve anlık yapay zeka geri bildirimi alırsın — yerel kurulum gerekli değildir.

Bu kursun tüm dersleri

  1. Actuator Uç Noktalarını Etkinleştirme
  2. Sağlık Göstergeleri
  3. Micrometer ile Özel Ölçümler
  4. Actuator Uç Noktalarını Güvenceye Alma
← Spring Boot 4 Microservices & REST APIs Sayfasına Dön