헤더 인증서 인증: Application Load Balancer
헤더 인증서 인증: Application Load Balancer (ALB) 통합 (Header Cert Authentication: ALB integration)
이 문서는 Amazon Application Load Balancer(ALB)를 헤더 인증서 인증 플러그인과 통합하는 방법을 안내해요. ALB의 HTTPS 리스너에서 상호 인증(mTLS) 패스스루를 설정하는 방법과 CA 인증서 같은 사전 준비 항목을 먼저 확인해요. 이어서 decK, Admin API, Konnect API를 사용해 플러그인을 전역으로 구성하는 예시까지 단계별로 살펴봐요
출처: 문서
본문
Application Load Balancer (ALB) 통합v3.8+
Amazon Application Load Balancer (ALB)를 Header Cert Authentication 플러그인과 통합할 수 있어요.
사전 준비
-
플러그인을 설정하기 전에 인증 기관(CA) 인증서를 추가하세요.
-
ALB용으로 생성된 인증서
-
HTTPS 리스너를 추가해서 ALB를 설정하세요:
프로토콜
매핑: HTTPS
포트
매핑: 443
라우팅 액션
매핑: Forward to target groups
인증서 소스
매핑: From AWS Certificate Manager (ACM)
인증서 (ACM에서)
매핑: 사용하려는 인증서를 선택하세요
클라이언트 인증서 처리
매핑: Mutual authentication (mTLS) with Passthrough를 선택하세요
환경 변수
HEADER_NAME: WAF 또는 기타 L7 다운스트림 프록시에서 수신하는, 인증서를 담고 있는 헤더의 이름이에요.
플러그인 설정
전역
decK
이 섹션을 kong.yaml 설정 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: header-cert-auth
config:
ca_certificates:
- 322dce96-d434-4e0d-9038-311b3520f0a3
certificate_header_name: ${{ env "DECK_HEADER_NAME" }}
certificate_header_format: base64_encoded
secure_source: false
{: data-file="kong.yaml" data-tool="deck" }
Admin API
다음 요청을 보내세요:
curl -i -X POST http://localhost:8001/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "header-cert-auth",
"config": {
"ca_certificates": [
"322dce96-d434-4e0d-9038-311b3520f0a3"
],
"certificate_header_name": "'$HEADER_NAME'",
"certificate_header_format": "base64_encoded",
"secure_source": false
}
}
'
Konnect API
다음 요청을 보내세요:
curl -X POST https://{region}.api.konghq.com/v2/control-planes/{controlPlaneId}/core-entities/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "header-cert-auth",
"config": {
"ca_certificates": [
"322dce96-d434-4e0d-9038-311b3520f0a3"
],
"certificate_header_name": "'$HEADER_NAME'",
"certificate_header_format": "base64_encoded",
"secure_source": false
}
}
'
다음 플레이스홀더는 반드시 여러분의 값으로 바꿔 주세요:
-
region: 여러분의 Kong Konnect가 호스팅되고 운영되는 지리적 리전이에요. -
KONNECT_TOKEN: 여러분의 Konnect 계정에 연결된 개인 액세스 토큰(PAT)이에요. -
controlPlaneId: 컨트롤 플레인의id예요.
리전별 URL과 개인 액세스 토큰에 대해 알아보려면 Konnect Control Planes Config API 참조를 확인하세요.
KIC
echo "
apiVersion: configuration.konghq.com/v1
kind: KongClusterPlugin
metadata:
name:
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
labels:
global: 'true'
config:
ca_certificates:
- 322dce96-d434-4e0d-9038-311b3520f0a3
certificate_header_name: '$HEADER_NAME'
certificate_header_format: base64_encoded
secure_source: false
plugin: header-cert-auth
" | kubectl apply -f -
Terraform
사전 준비: 개인 액세스 토큰 설정하기
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Konnect Gateway Plugin을 생성하려면 Terraform 설정에 다음을 추가하세요:
resource "konnect_gateway_plugin_header_cert_auth" "my_header_cert_auth" {
enabled = true
config = {
ca_certificates = ["322dce96-d434-4e0d-9038-311b3520f0a3"]
certificate_header_name = var.header_name
certificate_header_format = "base64_encoded"
secure_source = false
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
}
이 예제에서는 다음 변수들을 매니페스트에 추가해야 해요. TF_VAR_name=value 형식으로 설정하면 런타임에 값을 지정할 수 있어요.
variable "header_name" {
type = string
}
서비스
decK
이 섹션을 kong.yaml 설정 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: header-cert-auth
service: serviceName|Id
config:
ca_certificates:
- 322dce96-d434-4e0d-9038-311b3520f0a3
certificate_header_name: ${{ env "DECK_HEADER_NAME" }}
certificate_header_format: base64_encoded
secure_source: false
{: data-file="kong.yaml" data-tool="deck" }
다음 플레이스홀더는 반드시 여러분의 값으로 바꿔 주세요:
serviceName|Id: 플러그인 설정의 대상이 되는 서비스의id또는name이에요.
Admin API
다음 요청을 보내세요:
curl -i -X POST http://localhost:8001/services/{serviceName|Id}/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "header-cert-auth",
"config": {
"ca_certificates": [
"322dce96-d434-4e0d-9038-311b3520f0a3"
],
"certificate_header_name": "'$HEADER_NAME'",
"certificate_header_format": "base64_encoded",
"secure_source": false
}
}
'
다음 플레이스홀더는 반드시 여러분의 값으로 바꿔 주세요:
serviceName|Id: 플러그인 설정의 대상이 되는 서비스의id또는name이에요.
Konnect API
다음 요청을 보내세요:
curl -X POST https://{region}.api.konghq.com/v2/control-planes/{controlPlaneId}/core-entities/services/{serviceId}/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "header-cert-auth",
"config": {
"ca_certificates": [
"322dce96-d434-4e0d-9038-311b3520f0a3"
],
"certificate_header_name": "'$HEADER_NAME'",
"certificate_header_format": "base64_encoded",
"secure_source": false
}
}
'
다음 플레이스홀더는 반드시 여러분의 값으로 바꿔 주세요:
-
region: 여러분의 Kong Konnect가 호스팅되고 운영되는 지리적 리전이에요. -
KONNECT_TOKEN: 여러분의 Konnect 계정에 연결된 개인 액세스 토큰(PAT)이에요. -
controlPlaneId: 컨트롤 플레인의id예요. -
serviceId: 플러그인 설정의 대상이 되는 서비스의id예요.
리전별 URL과 개인 액세스 토큰에 대해 알아보려면 Konnect Control Planes Config API 참조를 확인하세요.
KIC
echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name:
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
config:
ca_certificates:
- 322dce96-d434-4e0d-9038-311b3520f0a3
certificate_header_name: '$HEADER_NAME'
certificate_header_format: base64_encoded
secure_source: false
plugin: header-cert-auth
" | kubectl apply -f -
다음으로, service 리소스에 어노테이션을 붙여서 KongPlugin 리소스를 적용하세요:
kubectl annotate -n kong service SERVICE_NAME konghq.com/plugins=
Terraform
사전 준비: 개인 액세스 토큰 설정하기
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Konnect Gateway Plugin을 생성하려면 Terraform 설정에 다음을 추가하세요:
resource "konnect_gateway_plugin_header_cert_auth" "my_header_cert_auth" {
enabled = true
config = {
ca_certificates = ["322dce96-d434-4e0d-9038-311b3520f0a3"]
certificate_header_name = var.header_name
certificate_header_format = "base64_encoded"
secure_source = false
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
service = {
id = konnect_gateway_service.my_service.id
}
}
이 예제에서는 다음 변수들을 매니페스트에 추가해야 해요. TF_VAR_name=value 형식으로 설정하면 런타임에 값을 지정할 수 있어요.
variable "header_name" {
type = string
}
라우트
decK
이 섹션을 kong.yaml 설정 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: header-cert-auth
route: routeName|Id
config:
ca_certificates:
- 322dce96-d434-4e0d-9038-311b3520f0a3
certificate_header_name: ${{ env "DECK_HEADER_NAME" }}
certificate_header_format: base64_encoded
secure_source: false
{: data-file="kong.yaml" data-tool="deck" }
다음 플레이스홀더는 반드시 여러분의 값으로 바꿔 주세요:
routeName|Id: 플러그인 설정의 대상이 되는 라우트의id또는name이에요.
Admin API
다음 요청을 보내세요:
curl -i -X POST http://localhost:8001/routes/{routeName|Id}/plugins/ \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '
{
"name": "header-cert-auth",
"config": {
"ca_certificates": [
"322dce96-d434-4e0d-9038-311b3520f0a3"
],
"certificate_header_name": "'$HEADER_NAME'",
"certificate_header_format": "base64_encoded",
"secure_source": false
}
}
'
다음 플레이스홀더는 반드시 여러분의 값으로 바꿔 주세요:
routeName|Id: 플러그인 설정의 대상이 되는 라우트의id또는name이에요.
Konnect API
다음 요청을 보내세요:
curl -X POST https://{region}.api.konghq.com/v2/control-planes/{controlPlaneId}/core-entities/routes/{routeId}/plugins/ \
--header "accept: application/json" \
--header "Content-Type: application/json" \
--header "Authorization: Bearer $KONNECT_TOKEN" \
--data '
{
"name": "header-cert-auth",
"config": {
"ca_certificates": [
"322dce96-d434-4e0d-9038-311b3520f0a3"
],
"certificate_header_name": "'$HEADER_NAME'",
"certificate_header_format": "base64_encoded",
"secure_source": false
}
}
'
다음 플레이스홀더는 반드시 여러분의 값으로 바꿔 주세요:
-
region: 여러분의 Kong Konnect가 호스팅되고 운영되는 지리적 리전이에요. -
KONNECT_TOKEN: 여러분의 Konnect 계정에 연결된 개인 액세스 토큰(PAT)이에요. -
controlPlaneId: 컨트롤 플레인의id예요. -
routeId: 플러그인 설정의 대상이 되는 라우트의id예요.
리전별 URL과 개인 액세스 토큰에 대해 알아보려면 Konnect Control Planes Config API 참조를 확인하세요.
KIC
echo "
apiVersion: configuration.konghq.com/v1
kind: KongPlugin
metadata:
name:
namespace: kong
annotations:
kubernetes.io/ingress.class: kong
config:
ca_certificates:
- 322dce96-d434-4e0d-9038-311b3520f0a3
certificate_header_name: '$HEADER_NAME'
certificate_header_format: base64_encoded
secure_source: false
plugin: header-cert-auth
" | kubectl apply -f -
다음으로, httproute 또는 ingress 리소스에 어노테이션을 붙여서 KongPlugin 리소스를 적용하세요:
Gateway API
kubectl annotate -n kong httproute konghq.com/plugins=
Ingress
kubectl annotate -n kong ingress konghq.com/plugins=
Terraform
사전 준비: 개인 액세스 토큰 설정하기
terraform {
required_providers {
konnect = {
source = "kong/konnect"
}
}
}
provider "konnect" {
personal_access_token = "$KONNECT_TOKEN"
server_url = "https://us.api.konghq.com/"
}
Konnect Gateway Plugin을 생성하려면 Terraform 설정에 다음을 추가하세요:
resource "konnect_gateway_plugin_header_cert_auth" "my_header_cert_auth" {
enabled = true
config = {
ca_certificates = ["322dce96-d434-4e0d-9038-311b3520f0a3"]
certificate_header_name = var.header_name
certificate_header_format = "base64_encoded"
secure_source = false
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
route = {
id = konnect_gateway_route.my_route.id
}
}
이 예제에서는 다음 변수들을 매니페스트에 추가해야 해요. TF_VAR_name=value 형식으로 설정하면 런타임에 값을 지정할 수 있어요.
variable "header_name" {
type = string
}
관련 리소스
더 알아보기 (Learn more)
- 플러그인을 설정하기 전에 추가해야 하는 CA 인증서 엔티티의 개념과 사용법을 설명하는 문서예요 — certificate authority (CA) Certificates
- decK로 플러그인을 구성할 때 작성하는
kong.yaml설정 파일의 시작 방법을 안내해요 —kong.yaml - Konnect API로 플러그인을 구성할 때 참고해야 할 Control Planes Config API 레퍼런스예요 — Konnect Control Planes Config API reference
- Kong Gateway의 인증 방식 전반을 이해하는 데 도움이 되는 개요 문서예요 — About authentication