Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Storage access based on IP Address

Is there a way to give access to a Google Cloud Storage bucket based on the IP address it is coming from.

On Amazon s3, you can just set this in the access policy like this:

"Condition" :  {
       "IpAddress" : {
          "aws:SourceIp" : ["192.168.176.0/24","192.168.143.0/24"]
      }
}

I do not want to use a signed url.

like image 707
sren Avatar asked Dec 04 '14 10:12

sren


People also ask

Does cloud storage have an IP address?

Cloud providers and data centers have a limited pool of IP addresses that they own, and they often re-use previously assigned IPs in order to maximize them. You can't simply move your existing IP addresses along with your services. Rather, you'll receive a dynamically assigned internal and external IP address.

What is the difference between internal and external IP addresses within Google Cloud?

Google Cloud uses the following labels to describe different IP address types. For example, an internal IP address is not publicly routed. An external IP address is a publicly routed IP address. You can assign an external IP address to the network interface of a Google Cloud VM.


2 Answers

The updated answers on this page are only partially correct and should not be recommended for the use case of access control to Cloud Storage Objects.

Access Context Manager (ACM) defines rules to allow access (e.g. an IP address).

VPC Service Controls create an "island" around a project and ACM rules can be attached. These rules are "ingress" rules and not "egress" rules meaning "anyone at that IP can get into all resources in the project with the correct IAM permissions".

The ACM rule specifying an IP address will allow that IP address to access all Cloud Storage Objects and all other protected resources owned by that project. This is usually not the intended result. You cannot apply an IP address rule to an object, only to all objects in a project. VPC Service Controls are designed to prevent data from getting out of a project and are NOT designed to allow untrusted anonymous users access to a project's resources.

like image 107
John Hanley Avatar answered Oct 28 '22 06:10

John Hanley


UPDATE: This is now possible using VPC Service Controls


No, this is not currently possible.

There's currently a Feature request to restrict google cloud storage bucket by IP Address.

like image 7
jterrace Avatar answered Oct 28 '22 07:10

jterrace