ToolypetMCP
advanced6 minutescross hub

Microservice Security Scaffold

Secure a microservice: generate service-to-service JWT, set up mTLS certificates, configure API gateway headers.

microserviceservice-meshmtlsjwtapi-gateway

이 레시피 활용 시점

Secure microservice architectures with defense in depth: JWT for identity, mTLS for transport, HMAC for request integrity, and CORS at the gateway.

단계

1

Per-service secrets

프롬프트:Generate unique secrets for each microservice: auth-service, user-service, payment-service
2

Service JWT tokens

프롬프트:Generate a service-to-service JWT with claims {iss: 'auth-service', aud: 'user-service', scopes: ['read:users']}
3

Generate mTLS keys

프롬프트:Generate RSA key pairs for each service for mTLS (mutual TLS) authentication
4

API gateway CORS

프롬프트:Generate CORS for API gateway: allow only known frontend origins, restrict methods per service
5

Request signing between services

프롬프트:Generate HMAC signatures for inter-service request verification as a secondary auth layer

자주 묻는 질문

JWT vs mTLS for service-to-service auth?

Use both. mTLS verifies the service identity at the transport layer (which server is calling). JWT carries authorization claims (what the service is allowed to do). Defense in depth.

Do microservices need CORS?

Not between backend services (they communicate directly). CORS is needed at the API gateway/BFF layer where browser clients connect. Internal services should reject all browser requests.

관련 레시피