Sécuriser IAP pour le transfert TCP avec VPC Service Controls
Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment utiliser VPC Service Controls afin de protéger IAP pour le transfert TCP et comment utiliser IAP pour le transfert TCP dans un périmètre VPC Service Controls.
Ajoutez le projet contenant l'instance Compute Engine à laquelle vous souhaitez vous connecter avec IAP aux projets de votre périmètre de service. Si vous exécutez IAP pour un client TCP sur une instance Compute Engine, placez également le projet contenant cette instance dans le périmètre.
Ajoutez l'API TCP d'Identity-Aware Proxy à la liste des services protégés par votre périmètre de service.
Si vous avez créé votre périmètre de service sans ajouter les projets et services nécessaires, consultez la section Gérer les périmètres de service pour savoir comment mettre votre périmètre de service à jour.
Configurer les enregistrements DNS à l'aide de Cloud DNS
Si votre IAP pour un client TCP, qui est probablement la Google Cloud CLI, ne s'exécute dans aucun périmètre, vous pouvez ignorer cette étape. Par ailleurs, si vous exécutez le client dans un périmètre, vous devez configurer les enregistrements DNS pour l'IAP pour TCP.
L'IAP pour TCP utilise des domaines qui ne sont pas des sous-domaines de googleapis.com. À l'aide de Cloud DNS, ajoutez des enregistrements DNS pour faire en sorte que votre réseau VPC gère correctement les requêtes envoyées à ces domaines. Pour en savoir plus sur les routes VPC, consultez la présentation des routes.
Procédez comme suit pour créer une zone gérée pour un domaine, ajouter des enregistrements DNS pour acheminer les requêtes et exécuter la transaction. Vous pouvez utiliser la CLI gcloud avec le terminal de votre choix ou utiliser Cloud Shell, où la CLI gcloud est préinstallée.
Configurez le DNS *.googleapis.com comme d'habitude pour les intégrations de VPC Service Controls.
Recueillez les informations suivantes à utiliser lors de la configuration de vos enregistrements DNS :
PROJECT_ID est l'ID du projet qui héberge votre réseau VPC.
NETWORK_NAME est le nom du réseau VPC dans lequel vous exécutez votre IAP pour le client TCP.
ZONE_NAME est le nom de la zone que vous créez. Exemple : iap-tcp-zone.
Créez une zone gérée privée pour le domaine tunnel.cloudproxy.app afin que le réseau VPC puisse la gérer.
gclouddnsmanaged-zonescreateZONE_NAME\--visibility=private\--networks=https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/NETWORK_NAME\--dns-name=tunnel.cloudproxy.app\--description="Description of your managed zone"
Ajoutez l'enregistrement DNS CNAME suivant pour pointer vers l'enregistrement A que vous venez d'ajouter. Ainsi, tout le trafic correspondant au domaine est redirigé vers les adresses IP mentionnées à l'étape précédente.
Au lieu d'utiliser Cloud DNS, vous pouvez utiliser BIND. Dans ce cas, suivez les instructions permettant de configurer DNS avec BIND, mais utilisez les IAP pour les domaines TCP plutôt que les domaines googleapis.com généraux.
Utiliser l'adresse IP virtuelle privée
Au lieu d'utiliser l'adresse IP virtuelle restreinte, vous pourrez peut-être utiliser l'adresse IP virtuelle privée, selon la configuration du périmètre et du réseau. Si vous préférez procéder ainsi, utilisez
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/09/04 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/09/04 (UTC)."],[[["\u003cp\u003eThis page explains how to use VPC Service Controls to safeguard IAP for TCP forwarding, including using IAP for TCP forwarding within a VPC Service Controls perimeter.\u003c/p\u003e\n"],["\u003cp\u003eA service perimeter can be created to protect Google-managed resources, and when doing so, the project with the Compute Engine instance must be added, as well as Identity-Aware Proxy TCP API.\u003c/p\u003e\n"],["\u003cp\u003eDNS records need to be configured for IAP for TCP if the client runs inside a perimeter, ensuring that the VPC network properly handles requests to non-\u003ccode\u003egoogleapis.com\u003c/code\u003e domains, especially \u003ccode\u003etunnel.cloudproxy.app\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eTo configure DNS, a private managed zone is created for \u003ccode\u003etunnel.cloudproxy.app\u003c/code\u003e, with DNS A and CNAME records added to reroute traffic to Google's restricted VIP or the private VIP, depending on network configuration.\u003c/p\u003e\n"],["\u003cp\u003eWhen utilizing a shared VPC, it's essential to include both the host and service projects within the service perimeter to maintain proper access control.\u003c/p\u003e\n"]]],[],null,["# Securing IAP for TCP forwarding with VPC Service Controls\n\nThis page describes how to use VPC Service Controls to protect\nIAP for TCP forwarding, and how to use IAP\nfor TCP forwarding within a VPC Service Controls perimeter.\n\nBefore you begin\n----------------\n\n1. Read the [Overview of\n VPC Service Controls](/vpc-service-controls/docs/overview).\n\n2. [Set up](/iap/docs/using-tcp-forwarding) usage of IAP TCP\n forwarding without a service perimeter.\n\n3. [Create a service perimeter using\n VPC Service Controls](/vpc-service-controls/docs/create-service-perimeters).\n This service perimeter protects the Google-managed resources of services\n that you specify. When you create your service perimeter, do the following:\n\n 1. Add the project that contains the Compute Engine instance you want to\n connect to with IAP to the projects within your\n service perimeter. If you are running an IAP for TCP\n client on a Compute Engine instance, also put the project\n containing this instance into the perimeter.\n\n 2. Add **Identity-Aware Proxy TCP API** to the list of services protected by your\n service perimeter.\n\n If you created your service perimeter without adding the projects and\n services you need, see\n [Managing service\n perimeters](/vpc-service-controls/docs/manage-service-perimeters)\n to learn how to update your service perimeter.\n\nConfigure your DNS records using Cloud DNS\n------------------------------------------\n\nIf your IAP for TCP client, which is likely the\n[Google Cloud CLI](/sdk/gcloud), is not running inside any perimeter, then\nyou can skip this step. On the other hand, if you run the client inside a\nperimeter, you must configure DNS records for IAP for TCP.\n\nIAP for TCP uses domains that are not subdomains of\n`googleapis.com`. Using Cloud DNS, add DNS records to ensure that your\nVPC network correctly handles requests sent to those domains. To\nlearn more about VPC routes, read the\n[Routes overview](/vpc/docs/routes).\n\nUse the following steps to create a [managed zone](/dns/zones) for a domain, add\nDNS records to route requests, and execute the transaction. You can use the\ngcloud CLI with your preferred terminal or use\n[Cloud Shell](/shell/docs/using-cloud-shell), which has the\ngcloud CLI preinstalled.\n\n1. [Configure](/vpc-service-controls/docs/set-up-private-connectivity#configuring_dns_with)\n the `*.googleapis.com` DNS as is typical for VPC Service Controls\n integrations.\n\n2. Collect this information to use when configuring your DNS records:\n\n - \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e is the ID of the project that hosts your\n VPC network.\n\n - \u003cvar translate=\"no\"\u003eNETWORK_NAME\u003c/var\u003e is the name of the VPC network in\n which you are running your IAP for TCP client.\n\n - \u003cvar translate=\"no\"\u003eZONE_NAME\u003c/var\u003e is a name for the zone that you are creating. For\n example, `iap-tcp-zone`.\n\n3. Create a private managed zone for the domain `tunnel.cloudproxy.app` so the\n VPC network can handle it.\n\n ```bash\n gcloud dns managed-zones create ZONE_NAME \\\n --visibility=private \\\n --networks=https://www.googleapis.com/compute/v1/projects/PROJECT_ID/global/networks/NETWORK_NAME \\\n --dns-name=tunnel.cloudproxy.app \\\n --description=\"Description of your managed zone\"\n ```\n4. Start a transaction.\n\n ```bash\n gcloud dns record-sets transaction start --zone=ZONE_NAME\n ```\n5. Add the following DNS A record. This reroutes traffic to Google's\n [restricted VIP](/vpc-service-controls/docs/set-up-private-connectivity)\n (virtual IP address).\n\n ```bash\n gcloud dns record-sets transaction add \\\n --name=tunnel.cloudproxy.app. \\\n --type=A 199.36.153.4 199.36.153.5 199.36.153.6 199.36.153.7 \\\n --zone=ZONE_NAME \\\n --ttl=300\n ```\n6. Add the following DNS CNAME record to point to the A record that you just\n added. This redirects all traffic matching the domain to the IP addresses\n listed in the previous step.\n\n ```bash\n gcloud dns record-sets transaction add \\\n --name=\"*.tunnel.cloudproxy.app.\" \\\n --type=CNAME tunnel.cloudproxy.app. \\\n --zone=ZONE_NAME \\\n --ttl=300\n ```\n7. Execute the transaction.\n\n ```bash\n gcloud dns record-sets transaction execute --zone=ZONE_NAME\n ```\n\n### Configuring DNS with BIND\n\nInstead of using Cloud DNS, you can use\n[BIND](https://www.wikipedia.org/wiki/BIND). In that case,\nfollow the directions for\n[configuring DNS with\nBIND](/vpc-service-controls/docs/set-up-private-connectivity#configuring_dns_with_bind),\nbut use the IAP for TCP domains instead of the general\n`googleapis.com` domains.\n\n### Using the private VIP\n\nInstead of using the restricted VIP, it might be possible to use the\n[private VIP](/vpc/docs/configure-private-google-access-hybrid#config-choose-domain),\ndepending on how you've configured your perimeter and network. If you prefer to\ndo that, then use\n\n`199.36.153.8 199.36.153.9 199.36.153.10 199.36.153.11`\n\nin place of\n\n`199.36.153.4 199.36.153.5 199.36.153.6 199.36.153.7`\n\nin the instructions for configuring your DNS records.\n\nUsing a shared VPC\n------------------\n\nIf you're using a [shared VPC](/vpc/docs/shared-vpc),\nyou must add the host and the service projects to the service perimeter. See\n[Managing service\nperimeters](/vpc-service-controls/docs/manage-service-perimeters).\n\nWhat's next\n-----------\n\n- See [Managing service\n perimeters](/vpc-service-controls/docs/manage-service-perimeters) to add more resources to your service perimeter."]]