ACE 플러그인: 요청이 작업과 일치할 때만 동작
ACE 플러그인: 요청이 작업과 일치할 때만 동작 (Access Control Enforcement: Only engage when a request matches an operation)
이 문서에서는 ACE 플러그인의 match_policy를 if_present로 설정하는 방법을 알려드려요 이 설정을 사용하면 요청이 정의된 작업과 일치할 때만 플러그인이 동작하고, 일치하지 않는 요청은 그대로 통과시켜 다른 플러그인이 처리할 수 있도록 해요 따라서 Dev Portal에 노출된 API와 그렇지 않은 라우트를 구분하여 접근 제어를 적용할 수 있어요 설정은 Global, Admin API, Konnect API, KIC 등 다양한 방법으로 가능해요
출처: 문서
본문
요청이 작업과 일치할 때만 개입operationv3.13+
ACE 플러그인은 요청이 작업과 일치할 때만 개입해요. 요청이 일치하지 않으면 ACE는 요청을 그대로 통과시켜요. 즉, 일치하지 않는 요청이 거부되지는 않지만, ACE가 해당 요청에 대해 인증 및 권한 부여를 수행하지 않아요. 이렇게 하면 ACE보다 낮은 우선순위를 가진 다른 플러그인이 요청을 계속 처리할 수 있어요.
이 방법의 한계는 ACE가 활성화된 Kong Gateway에 연결된 API 외부의 모든 트래픽이 액세스 제어되지 않는다는 점이에요. 이는 다른 플러그인으로 구성해야 해요. Dev Portal은 모든 작업을 보호할 수 없어요.
사용 사례:
- 일부 Gateway Service나 Route는 Dev Portal에 노출된 API(ACE 사용)로 관리되고, 다른 것들은 그대로 두어야 하는 일반 Route인 환경이 있어요.
- 이미 기존 트래픽과 다른 액세스 제어가 마련되어 있고 중단을 피하고 싶은 경우예요.
사전 요구 사항
- ACE 플러그인 인스턴스를 사용하는 컨트롤 플레인에 연결된 Dev Portal의 API 또는 API 패키지
플러그인 설정
전역
decK
다음 섹션을 kong.yaml 구성 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: ace
config:
match_policy: if_present
{: 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": "ace",
"config": {
"match_policy": "if_present"
}
}
'
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": "ace",
"config": {
"match_policy": "if_present"
}
}
'
다음 자리표시자를 자신의 값으로 바꾸는 것을 잊지 마세요:
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:
match_policy: if_present
plugin: ace
" | 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_ace" "my_ace" {
enabled = true
config = {
match_policy = "if_present"
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
}
서비스
decK
다음 섹션을 kong.yaml 구성 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: ace
service: serviceName|Id
config:
match_policy: if_present
{: 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": "ace",
"config": {
"match_policy": "if_present"
}
}
'
다음 자리표시자를 자신의 값으로 바꾸는 것을 잊지 마세요:
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": "ace",
"config": {
"match_policy": "if_present"
}
}
'
다음 자리표시자를 자신의 값으로 바꾸는 것을 잊지 마세요:
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:
match_policy: if_present
plugin: ace
" | 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_ace" "my_ace" {
enabled = true
config = {
match_policy = "if_present"
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
service = {
id = konnect_gateway_service.my_service.id
}
}
라우트
decK
다음 섹션을 kong.yaml 구성 파일에 추가하세요:
_format_version: "3.0"
plugins:
- name: ace
route: routeName|Id
config:
match_policy: if_present
{: 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": "ace",
"config": {
"match_policy": "if_present"
}
}
'
다음 자리표시자를 자신의 값으로 바꾸는 것을 잊지 마세요:
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": "ace",
"config": {
"match_policy": "if_present"
}
}
'
다음 자리표시자를 자신의 값으로 바꾸는 것을 잊지 마세요:
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:
match_policy: if_present
plugin: ace
" | 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_ace" "my_ace" {
enabled = true
config = {
match_policy = "if_present"
}
control_plane_id = konnect_gateway_control_plane.my_konnect_cp.id
route = {
id = konnect_gateway_route.my_route.id
}
}
관련 리소스
더 알아보기 (Learn more)
- ACE 플러그인보다 낮은 우선순위를 가진 플러그인이 요청을 처리하는 방식에 대해 알아봐요 — lower priority
- decK을 사용한 ACE 플러그인 설정 파일 예제를 확인해요 —
kong.yaml - Konnect API를 통해 ACE 플러그인을 설정할 때 필요한 API 레퍼런스예요 — Konnect Control Planes Config API reference
- Dev Portal에서 API 패키징과 ACE 플러그인 연동을 위한 사전 조건을 설명해요 — Dev Portal API packaging