보안 작업 API

이 페이지는 ApigeeApigee Hybrid에 적용됩니다.

Apigee Edge 문서 보기

이 페이지에서는 Apigee Management API를 사용하여 보안 작업을 관리하는 방법을 설명합니다. 제한사항 및 지연 시간을 비롯한 보안 작업 기능에 대한 개요는 보안 작업 개요 및 UI를 참고하세요.

Apigee 관리 API를 통해 모든 보안 작업 기능에 액세스할 수 있습니다. 사용 가능한 모든 명령어에 관한 자세한 내용은 보안 작업 API 참조를 참고하세요. 이 페이지에서는 사용 가능한 명령어의 몇 가지 예를 보여줍니다.

예시에 사용된 변수

이 페이지의 예시에는 다음 변수가 포함될 수 있습니다.

  • ORG는 조직입니다.
  • ENV는 보안 작업을 위한 환경입니다.
  • ACTION_NAME은 보안 작업 이름입니다.

보안 작업 만들기

이 섹션에서는 다양한 작업 유형으로 보안 작업을 만드는 방법을 보여주는 예시를 제공합니다.

거부 작업 만들기

거부 작업을 만들려면 다음과 유사한 명령어를 입력합니다.

curl -X POST "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions?security_action_id=ACTION_NAME \
       -H "Authorization: Bearer $TOKEN" \
       -H "Content-Type: application/json" \
       -d '{"state": "ENABLED", "deny": {"response_code": 404}, "condition_config": {"ip_address_ranges": ["100.0.225.0"]}}'

이렇게 하면 ip_address_ranges 뒤에 나열된 IP 주소에 대한 요청에 대한 액세스를 거부하고 응답 코드 404를 반환하는 보안 작업이 생성됩니다.

플래그 작업 만들기

플래그 작업을 만들려면 다음과 유사한 명령어를 입력합니다.

curl -X POST "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions?security_action_id=ACTION_NAME" \
       -H "Authorization: Bearer $TOKEN" \
       -H "Content-Type: application/json" \
       -d '{"state": "ENABLED", "flag": {"headers": [{"name": "senseflag", "value": "flagvalue"}]}, "condition_config": {"ip_address_ranges": ["100.0.230.0"]}}'

이렇게 하면 ip_address_ranges 뒤에 나열된 IP 주소의 요청에 플래그를 지정하고 값이 flagvaluesenseflag 헤더를 추가하는 보안 작업이 생성됩니다.

허용 작업 만들기

허용 작업을 만들려면 다음과 유사한 명령어를 입력합니다.

curl -X POST "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions?security_action_id=ACTION_NAME \
       -H "Authorization: Bearer $TOKEN" \
       -H "Content-Type: application/json" \
       -d '{"state": "ENABLED", "allow": {}, "condition_config": {"ip_address_ranges": ["100.0.220.0", "200.0.0.0"]}}'

이렇게 하면 ip_address_ranges 뒤에 나열된 IP 주소의 요청을 허용하는 보안 작업이 생성됩니다.

보안 작업 수정

이 섹션에서는 기존 보안 작업 구성을 수정하는 방법의 예를 제공합니다. 이러한 유형의 변경사항에 관한 예는 보안 작업 사용 설정 또는 사용 중지 또는 보안 작업 삭제를 참고하세요.

거부 작업 수정

이 섹션에서는 거부 작업을 수정하는 예를 보여줍니다. API는 다른 작업 유형의 수정도 지원합니다.

update_mask에는 description,condition_config, api_proxies,expire_time,ttl,flag,allow,deny,*(모두) 또는 생략(기본값은 모두) 옵션이 포함될 수 있습니다.

작업을 수정할 때 가능한 값에 관한 자세한 내용은 보안 작업 API 참고 문서를 참고하세요.

  curl -X PATCH "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions/ACTION_NAME?update_mask=deny,condition_config" \
         -H "Authorization: Bearer $TOKEN" \
         -d '{"deny": {"response_code": 404}, "condition_config": {"ip_address_ranges": ["100.0.230.0"]}}' \
         -H "Content-Type: application/json"
         {
           "name": "ACTION_NAME",
           "state": "ENABLED",
           "createTime": "2022-12-29T18:28:50Z",
           "updateTime": "2022-12-29T18:28:50Z",
           "conditionConfig": {
             "ipAddressRanges": [
               "100.0.230.0"
             ]
           },
           "deny": {
             "responseCode": 404
           }
         }

보안 작업 사용 설정 또는 사용 중지

다음 예시에서는 보안 작업을 사용 설정하거나 사용 중지하는 API 호출을 보여줍니다.

보안 작업 사용 설정

보안 작업을 사용 설정하려면 다음과 유사한 명령어를 입력합니다.

curl -X POST "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions/ACTION_NAME:enable"
       -H "Authorization: Bearer $TOKEN"

그러면 다음과 같은 응답이 반환됩니다.

{
      "name": "ACTION_NAME",
      "state": "ENABLED",
      "createTime": "2022-12-29T18:27:31Z",
      "updateTime": "2023-01-03T23:19:26.650965481Z",
      "conditionConfig": {
        "ipAddressRanges": [
          "100.0.220.0",
          "200.0.0.0"
        ]
      },
      "allow": {},
      "expireTime": "2028-01-01T00:00:00Z"
}

보안 작업 사용 중지

보안 작업을 사용 중지하려면 다음과 유사한 명령어를 입력합니다.

curl -X POST "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions/ACTION_NAME:disable"
       -H "Authorization: Bearer $TOKEN"

그러면 다음과 같은 응답이 반환됩니다.

{
      "name": "actionallow",
      "state": "DISABLED",
      "createTime": "2022-12-29T18:27:31Z",
      "updateTime": "2023-01-03T23:13:04.874540001Z",
      "conditionConfig": {
        "ipAddressRanges": [
          "100.0.220.0",
          "200.0.0.0"
        ]
      },
      "allow": {},
      "expireTime": "2028-01-01T00:00:00Z"
}

보안 작업 가져오기 또는 나열

다음 예에서는 보안 작업을 가져오거나 나열하는 방법을 보여줍니다.

보안 작업 가져오기

보안 작업을 가져오려면 다음과 유사한 명령어를 입력합니다.

curl -X GET "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions/ACTION_NAME"
       -H "Authorization: Bearer $TOKEN"

그러면 다음과 같은 응답이 반환됩니다.

{
      "name": "ACTION_NAME",
      "state": "DISABLED",
      "createTime": "2022-12-29T18:27:31Z",
      "updateTime": "2023-01-03T23:13:04Z",
      "conditionConfig": {
        "ipAddressRanges": [
          "100.0.220.0",
          "200.0.0.0"
        ]
      },
      "allow": {},
      "expireTime": "2028-01-01T00:00:00Z"
}

보안 작업 나열

모든 보안 작업을 나열하려면 다음과 유사한 명령어를 입력합니다.

curl -X GET "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions"
       -H "Authorization: Bearer $TOKEN"

보안 작업 일시중지 또는 재개

다음 예에서는 보안 작업을 일시중지하거나 재개하는 방법을 보여줍니다.

모든 보안 작업 일시중지

모든 보안 작업을 일시중지하려면 다음과 유사한 명령어를 입력합니다.

curl -X PATCH "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActionsConfig" \
       -H "Authorization: Bearer $TOKEN" \
       -H "Content-Type: application/json" \
       -d '{"enabled": "false", "name": "organizations/ORG/environments/ENV/securityActionsConfig"}'

그러면 다음과 같은 응답이 반환됩니다.

{
      "name": "organizations/ORG/environments/ENV/securityActionsConfig",
      "enabled": false,
      "updateTime": "2023-01-23T21:44:58.063807Z"
}

일시중지된 보안 작업 재개

일시중지된 보안 작업을 재개하려면 다음과 유사한 명령어를 입력합니다.

curl -X PATCH "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActionsConfig" \
       -H "Authorization: Bearer $TOKEN" \
       -H "Content-Type: application/json" \
       -d '{"enabled": "true", "name": "organizations/ORG/environments/ENV/securityActionsConfig"}'

그러면 다음과 같은 응답이 반환됩니다.

{
      "name": "organizations/ORG/environments/ENV/securityActionsConfig",
      "enabled": true,
      "updateTime": "2023-01-23T21:44:58.063807Z"
}

보안 작업 삭제

보안 작업을 삭제하려면 다음과 유사한 명령어를 입력합니다.

curl -X DELETE "https://apigee.googleapis.com/v1/organizations/ORG/environments/ENV/securityActions/ACTION_NAME"
       -H "Authorization: Bearer $TOKEN"