Notes
open one at a time
1.What it can cause
The production database answers on the internet. An allow-list and a password are all that stand in the way.
- The production database answers on the internet. An allow-list and a password are all that stand in the way.
- The list holds home broadband addresses. When an ISP hands one to someone else, a stranger inherits a path to the database port.
- Queries and their results cross the public internet, so encryption in transit is the only protection - and it is easy to leave optional.
2.Why it is wrong
Private Service Access - managed services live in Google’s tenant and reach your VPC over a peering, drawing private IPs from a range you reserve.
Production database traffic rides the public internet. The PSA peering already exists and Redis already uses it. The work is pointing the database at a path that is already built.
The idea
Private Service Access - managed services live in Google’s tenant and reach your VPC over a peering, drawing private IPs from a range you reserve.
Learn it
- Private services access · GCP 9
- Cloud SQL with private IP, in practice · GCP 9
3.How you would find it
gcloud sql instances list --format="table(name,settings.ipConfiguration.ipv4Enabled,settings.ipConfiguration.privateNetwork,settings.ipConfiguration.authorizedNetworks[].value.list())"
gcloud sql instances list --format="table( name,settings.ipConfiguration.ipv4Enabled, settings.ipConfiguration.privateNetwork, settings.ipConfiguration.authorizedNetworks[].value.list())"4.The change that closes it
Private IP drawn from 10.90.0.0/16 over the existing PSA peering. Public IP removed.
- As found
- Public IP + authorizedNetworks list. No privateNetwork set.
- Fixed
- Private IP drawn from 10.90.0.0/16 over the existing PSA peering. Public IP removed.
# confirm what is actually reserved before migratinggcloud compute addresses list --global --filter="purpose=VPC_PEERING" gcloud sql instances patch harbour-pg \ --network=projects/harbour-net-prod/global/networks/harbour-vpc \ --no-assign-ip