Mengelola gateway yang aman

Halaman ini menjelaskan cara menyelesaikan tugas pengelolaan gateway aman umum.

Menyiapkan lingkungan shell

Untuk menyederhanakan proses penyiapan dan berinteraksi dengan API gateway aman, tentukan variabel lingkungan berikut di shell kerja Anda.

  • Parameter umum

    PROJECT_ID=PROJECT_ID
    APPLICATION_ID=APPLICATION_ID
    APPLICATION_DISPLAY_NAME="APPLICATION_DISPLAY_NAME"
    HOST_NAME=HOST_NAME

    Ganti kode berikut:

    • PROJECT_ID: ID project tempat gateway aman dibuat.
    • APPLICATION_ID: ID aplikasi Anda, seperti github. Nama dapat berisi maksimal 63 karakter, dan dapat berisi huruf kecil, angka, dan tanda hubung. Karakter pertama harus berupa huruf, dan karakter terakhir dapat berupa huruf atau angka.
    • APPLICATION_DISPLAY_NAME: Nama yang dapat dibaca manusia untuk ditampilkan.
    • HOST_NAME: Nama host aplikasi Anda. Misalnya, github.com. Nama host dapat berisi maksimal 253 karakter, dan harus mematuhi salah satu format berikut:

      • Alamat IPv4 yang valid
      • Alamat IPv6 yang valid
      • Nama DNS yang valid
      • Tanda bintang (*)
      • Tanda bintang (*) diikuti dengan nama DNS yang valid
  • Parameter gateway aman

    SECURITY_GATEWAY_ID=SECURITY_GATEWAY_ID
    SECURITY_GATEWAY_DISPLAY_NAME="SECURITY_GATEWAY_DISPLAY_NAME"

    Ganti kode berikut:

    • SECURITY_GATEWAY_ID: ID gateway aman. ID dapat berisi maksimal 63 karakter, dan dapat berisi huruf kecil, angka, dan tanda hubung. Karakter pertama harus berupa huruf, dan karakter terakhir dapat berupa huruf atau angka.
    • SECURITY_GATEWAY_DISPLAY_NAME: Nama gateway aman yang dapat dibaca manusia. Nama dapat berisi maksimal 63 karakter dan hanya dapat berisi karakter yang dapat dicetak.

Mengupdate gateway aman

Contoh berikut menunjukkan cara mengupdate hub gateway aman yang ada.

console

Untuk mengupdate hub keluar gateway aman, lakukan hal berikut:

  1. Di Google Cloud konsol, buka halaman SaaS Egress Hubs.
    Buka SaaS Egress Hubs
  2. Pilih project yang ingin Anda update SaaS Egress Hubs-nya.
  3. Untuk menambahkan hub keluar SaaS, klik Add SaaS egress hub.
  4. Dari daftar drop-down, pilih region tempat Anda ingin menambahkan hub keluar.
  5. Untuk menambahkan hub, klik Add SaaS egress hub. Untuk mengupdate hub keluar, klik Save.

gcloud

gcloud beyondcorp security-gateways update SECURITY_GATEWAY_ID \
    --project=PROJECT_ID \
    --location=global \
    --hubs=us-central1,us-east1
      

REST

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -X PATCH \
    -d "{ \"hubs\": {\"us-central1\": {}, \"us-east1\": {}} }" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID?update_mask=hubs"
      

Mendapatkan detail gateway aman

Untuk mendapatkan detail gateway aman, jalankan perintah berikut.

gcloud

gcloud beyondcorp security-gateways describe SECURITY_GATEWAY_ID \
    --project=PROJECT_ID \
    --location=global
      

REST

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID"
      

Mencantumkan gateway aman

Untuk mencantumkan semua gateway aman dalam project, jalankan perintah berikut.

gcloud

gcloud beyondcorp security-gateways list \
    --project=PROJECT_ID \
    --location=global
      

REST

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways"
      

Menghapus gateway aman

Untuk menghapus gateway aman, jalankan perintah berikut.

gcloud

gcloud beyondcorp security-gateways delete SECURITY_GATEWAY_ID \
    --project=PROJECT_ID \
    --location=global
      

REST

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -X DELETE \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID"
      

Mengaktifkan logging gateway aman

Untuk mengaktifkan logging gateway aman, jalankan perintah berikut.

gcloud

        gcloud beyondcorp security-gateways update SECURITY_GATEWAY_ID \
        --project=PROJECT_ID \
        --location=global \
        --logging={}
      

REST

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -X PATCH \
    -d "{ \"logging\": {} }" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID?update_mask=logging"
      

Menonaktifkan logging gateway aman

Untuk menonaktifkan logging gateway aman, jalankan perintah berikut.

gcloud

        gcloud beyondcorp security-gateways update SECURITY_GATEWAY_ID \
        --project=PROJECT_ID \
        --location=global \
        --clear-logging
      

REST

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -X PATCH \
    -d "{ \"logging\": null }" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID?update_mask=logging"
      

Mengupdate resource aplikasi

Contoh berikut menunjukkan cara mengupdate aplikasi yang ada. Kolom yang dapat diedit mencakup hal berikut:

  • display_name
  • endpoint_matchers

console

Untuk mengupdate resource aplikasi, lakukan hal berikut:

  1. Untuk mengubah resource aplikasi, buka halaman Applications.
    Buka Applications
  2. Temukan aplikasi yang ingin Anda edit.
  3. Untuk mengedit aplikasi, klik menu More actions (), lalu pilih View Details.
  4. Di halaman Application details, klik Edit.
  5. Ubah Application name atau Domain matchers sesuai kebutuhan.
  6. Untuk mengupdate resource aplikasi, klik Save.

gcloud

gcloud beyondcorp security-gateways applications update APPLICATION_ID \
    --project=PROJECT_ID \
    --security-gateway=SECURITY_GATEWAY_ID \
    --location=global \
    --endpoint-matchers="hostname=HOST_NAME,ports=[443]"
      

REST

Anda dapat menggunakan update_mask untuk mengontrol kolom mana yang diupdate. Contoh berikut menunjukkan cara mengupdate kolom endpoint_matchers:

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -X PATCH \
    -d "{ \"endpoint_matchers\": [{hostname: \"HOST_NAME\", ports: [443]}] }" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID/applications/APPLICATION_ID?update_mask=endpoint_matchers"
      

Mendapatkan detail resource aplikasi

console

Untuk mendapatkan detail resource aplikasi, lakukan hal berikut:

  1. Buka halaman Applications.
    Buka Applications
  2. Temukan aplikasi yang detailnya ingin Anda lihat.
  3. Untuk melihat detail aplikasi, klik nama aplikasi atau buka menu More actions (), lalu pilih View Details.

gcloud

Untuk mendapatkan detail aplikasi, jalankan perintah berikut:

gcloud beyondcorp security-gateways applications describe APPLICATION_ID \
    --project=PROJECT_ID \
    --security-gateway=SECURITY_GATEWAY_ID \
    --location=global
      

REST

Untuk mendapatkan detail aplikasi, jalankan perintah berikut:

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID/applications/APPLICATION_ID"
      

Mencantumkan resource aplikasi

console

Untuk mencantumkan semua resource aplikasi, lakukan hal berikut:

  1. Buka halaman Applications.
    Buka Applications
  2. Halaman ini menampilkan tabel yang mencantumkan semua resource aplikasi untuk gateway aman, yang menampilkan detail seperti Type dan Name.

gcloud

Untuk mencantumkan semua aplikasi di gateway aman, jalankan perintah berikut.

gcloud beyondcorp security-gateways applications list \
    --project=PROJECT_ID \
    --security-gateway=SECURITY_GATEWAY_ID \
    --location=global
        

REST

Untuk mencantumkan semua aplikasi di gateway aman, jalankan perintah berikut.

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID/applications"
      

Menghapus resource aplikasi

console

Untuk menghapus resource aplikasi, lakukan hal berikut:

  1. Buka halaman Applications.
    Buka Applications
  2. Temukan aplikasi yang ingin Anda hapus.
  3. Untuk melihat detail aplikasi, klik nama aplikasi atau buka menu More actions (), lalu pilih View Details.
  4. Untuk menghapus resource aplikasi, klik Remove.

gcloud

Untuk menghapus aplikasi, jalankan perintah berikut.

gcloud beyondcorp security-gateways applications delete APPLICATION_ID \
    --project=PROJECT_ID \
    --security-gateway=SECURITY_GATEWAY_ID \
    --location=global
      

REST

Untuk menghapus aplikasi, jalankan perintah berikut.

curl \
    -H "Authorization: Bearer $(gcloud auth print-access-token)" \
    -H "Content-Type: application/json" \
    -X DELETE \
    "https://beyondcorp.googleapis.com/v1/projects/PROJECT_ID/locations/global/securityGateways/SECURITY_GATEWAY_ID/applications/APPLICATION_ID"