IP 주소 허용 목록 구성

신뢰할 수 있는 IP 주소를 reCAPTCHA 시행에서 제외하려면 사이트와 연결된 reCAPTCHA 키의 허용 목록을 만들고 해당 허용 목록에 IP 주소와 서브넷을 추가합니다.

허용 목록에서 IP 주소와 서브넷을 삭제하고 허용 목록에 추가된 IP 주소와 서브넷을 나열할 수도 있습니다.

시작하기 전에

  • 허용 목록에 추가할 모든 IP 주소와 서브넷을 수집합니다.

  • 허용 목록에서 삭제할 IP 주소와 서브넷을 식별합니다.

  • reCAPTCHA Enterprise 관리자(roles/recaptchaenterprise.admin)라는 Identity and Access Management 역할이 있는지 확인합니다.

허용 목록에 IP 주소 또는 서브넷 추가

허용 목록에 IP 주소 또는 서브넷을 추가하면 reCAPTCHA가 인증을 건너뛰고 해당 IP 주소 또는 서브넷에서 들어오는 요청에 항상 0.9 점수를 부여합니다. 허용 목록에 최대 1,000개의 IP 주소와 서브넷을 추가할 수 있습니다.

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 아래의 명령어 데이터를 사용하기 전에 다음을 바꿉니다.

    • KEY: 사이트와 연결된 reCAPTCHA 키입니다.
    • IP_ADDRESS_OR_SUBNET: 허용 목록에 추가해야 하는 IP 주소 또는 서브넷입니다.

    다음 명령어를 실행합니다.

    Linux, macOS 또는 Cloud Shell

    gcloud recaptcha keys add-ip-override
    KEY \
    --ip=IP_ADDRESS_OR_SUBNET \
    --override=ALLOW

    Windows(PowerShell)

    gcloud recaptcha keys add-ip-override
    KEY `
    --ip=IP_ADDRESS_OR_SUBNET `
    --override=ALLOW

    Windows(cmd.exe)

    gcloud recaptcha keys add-ip-override
    KEY ^
    --ip=IP_ADDRESS_OR_SUBNET ^
    --override=ALLOW

  3. REST

    요청 데이터를 사용하기 전에 다음을 바꿉니다.

    • KEY: 사이트와 연결된 reCAPTCHA 키입니다.
    • IP_ADDRESS_OR_SUBNET: 허용 목록에 추가해야 하는 IP 주소 또는 서브넷입니다.
    • PROJECT_ID: Google Cloud 프로젝트 ID

    HTTP 메서드 및 URL:

    POST https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/keys/KEY:addIpOverride

    JSON 요청 본문:

    
    {
      "ip_override_data": {
        "ip": "IP_ADDRESS_OR_SUBNET",
        "override_type": "ALLOW"
      }
    }
    
    

    요청을 보내려면 다음 옵션 중 하나를 선택합니다.

    curl

    요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/keys/KEY:addIpOverride"

    PowerShell

    요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/keys/KEY:addIpOverride" | Select-Object -Expand Content

    성공 상태 코드(2xx)와 빈 응답을 받게 됩니다.

IP 주소 또는 서브넷을 허용 목록에 추가하면 변경사항이 몇 분 이내에 적용됩니다.

허용 목록에서 IP 주소 또는 서브넷 삭제하기

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 아래의 명령어 데이터를 사용하기 전에 다음을 바꿉니다.

    • KEY: 사이트와 연결된 reCAPTCHA 키입니다.
    • IP_ADDRESS_OR_SUBNET: 허용 목록에 추가해야 하는 IP 주소 또는 서브넷입니다.

    다음 명령어를 실행합니다.

    Linux, macOS 또는 Cloud Shell

    gcloud recaptcha keys remove-ip-override
    KEY \
    --ip=IP_ADDRESS_OR_SUBNET \
    --override=ALLOW

    Windows(PowerShell)

    gcloud recaptcha keys remove-ip-override
    KEY `
    --ip=IP_ADDRESS_OR_SUBNET `
    --override=ALLOW

    Windows(cmd.exe)

    gcloud recaptcha keys remove-ip-override
    KEY ^
    --ip=IP_ADDRESS_OR_SUBNET ^
    --override=ALLOW

  3. REST

    요청 데이터를 사용하기 전에 다음을 바꿉니다.

    • KEY: 사이트와 연결된 reCAPTCHA 키입니다.
    • IP_ADDRESS_OR_SUBNET: 허용 목록에 추가해야 하는 IP 주소 또는 서브넷입니다.
    • PROJECT_ID: Google Cloud 프로젝트 ID

    HTTP 메서드 및 URL:

    POST https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/keys/KEY:removeIpOverride

    JSON 요청 본문:

    
    {
      "ip_override_data": {
        "ip": "IP_ADDRESS_OR_SUBNET",
        "override_type": "ALLOW"
      }
    }
    
    

    요청을 보내려면 다음 옵션 중 하나를 선택합니다.

    curl

    요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

    curl -X POST \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json; charset=utf-8" \
    -d @request.json \
    "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/keys/KEY:removeIpOverride"

    PowerShell

    요청 본문을 request.json 파일에 저장하고 다음 명령어를 실행합니다.

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method POST `
    -Headers $headers `
    -ContentType: "application/json; charset=utf-8" `
    -InFile request.json `
    -Uri "https://recaptchaenterprise.googleapis.com/v1/projects/PROJECT_ID/keys/KEY:removeIpOverride" | Select-Object -Expand Content

    성공 상태 코드(2xx)와 빈 응답을 받게 됩니다.

허용 목록에서 IP 주소 또는 서브넷을 삭제하면 변경사항이 몇 분 이내에 적용됩니다.

허용 목록의 모든 IP 주소 나열

gcloud

  1. In the Google Cloud console, activate Cloud Shell.

    Activate Cloud Shell

    At the bottom of the Google Cloud console, a Cloud Shell session starts and displays a command-line prompt. Cloud Shell is a shell environment with the Google Cloud CLI already installed and with values already set for your current project. It can take a few seconds for the session to initialize.

  2. 아래의 명령어 데이터를 사용하기 전에 다음을 바꿉니다.

    • KEY: 사이트와 연결된 reCAPTCHA 키입니다.

    다음 명령어를 실행합니다.

    Linux, macOS 또는 Cloud Shell

    gcloud recaptcha keys list-ip-overrides KEY --format=json

    Windows(PowerShell)

    gcloud recaptcha keys list-ip-overrides KEY --format=json

    Windows(cmd.exe)

    gcloud recaptcha keys list-ip-overrides KEY --format=json

  3. REST

    요청 데이터를 사용하기 전에 다음을 바꿉니다.

    • KEY: 사이트와 연결된 reCAPTCHA 키입니다.
    • PROJECT_ID: Google Cloud 프로젝트 ID

    HTTP 메서드 및 URL:

    GET https://recaptchaenterprise.googleapis.com/v1/projects//keys/:listIpOverrides

    요청을 보내려면 다음 옵션 중 하나를 선택합니다.

    curl

    다음 명령어를 실행합니다.

    curl -X GET \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    "https://recaptchaenterprise.googleapis.com/v1/projects//keys/:listIpOverrides"

    PowerShell

    다음 명령어를 실행합니다.

    $cred = gcloud auth print-access-token
    $headers = @{ "Authorization" = "Bearer $cred" }

    Invoke-WebRequest `
    -Method GET `
    -Headers $headers `
    -Uri "https://recaptchaenterprise.googleapis.com/v1/projects//keys/:listIpOverrides" | Select-Object -Expand Content

    다음과 비슷한 JSON 응답이 표시됩니다.

    
    {
      "ipOverrides": [
        {
          "ip": "1.2.3.4",
          "overrideType": "ALLOW"
        }
      ],
      "nextPageToken": ""
    }
    
    
    

다음 단계