# Network filtering with Squid with isolated VPCs using Private Service Connect This blueprint shows how to deploy a filtering HTTP proxy to restrict Internet access. Here we show one way to do this using isolated VPCs and Private Service Connect: - The `app` subnet hosts the consumer VMs that will have their Internet access tightly controlled by a non-caching filtering forward proxy. - The `proxy` subnet hosts a Cloud NAT instance and a [Squid](http://www.squid-cache.org/) server. - The `psc` subnet is reserved for the Private Service Connect. The reason for using Privat Service Connect in this setup is to have a common proxy setup between all environments without having to share a VPC between projects. This allows us to enforce the `compute.vmExternalIpAccess` [organization policy](https://cloud.google.com/resource-manager/docs/organization-policy/org-policy-constraints), which prevents the service projects from having external IPs, thus forcing all outbound Internet connections through the proxy. To allow Internet connectivity to the proxy subnet, a Cloud NAT instance is configured to allow usage from [that subnet only](https://cloud.google.com/nat/docs/using-nat#specify_subnet_ranges_for_nat). All other subnets are not allowed to use the Cloud NAT instance. To simplify the usage of the proxy, a Cloud DNS private zone is created in each consumer VPC and the IP address of the proxy is exposed with the FQDN `proxy.internal`. In addition, system-wide `http_proxy` and `https_proxy` environment variables and an APT configuration are rolled out via a [startup script](startup.sh). ## Variables | name | description | type | required | default | |---|---|:---:|:---:|:---:| | [prefix](variables.tf#L44) | Prefix used for resources that need unique names. | string | ✓ | | | [project_id](variables.tf#L66) | Project id used for all resources. | string | ✓ | | | [allowed_domains](variables.tf#L17) | List of domains allowed by the squid proxy. | list(string) | | […] | | [cidrs](variables.tf#L28) | CIDR ranges for subnets. | map(string) | | {…} | | [nat_logging](variables.tf#L38) | Enables Cloud NAT logging if not null, value is one of 'ERRORS_ONLY', 'TRANSLATIONS_ONLY', 'ALL'. | string | | "ERRORS_ONLY" | | [project_create](variables.tf#L49) | Set to non null if project needs to be created. | object({…}) | | null | | [region](variables.tf#L71) | Default region for resources. | string | | "europe-west1" |