Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/build: restrict outbound network access from builds by default #30612

Closed
bradfitz opened this issue Mar 6, 2019 · 7 comments

Comments

Projects
None yet
3 participants
@bradfitz
Copy link
Member

commented Mar 6, 2019

We should make sure our tests never do outbound network requests by default, or that we only hit endpoints that we control.

For instance, the longtest builder is often failing now on:

--- FAIL: TestScript (0.00s)
    --- FAIL: TestScript/mod_gopkg_unstable (54.35s)
        script_test.go:188: 
            > env GO111MODULE=on
            > cp go.mod.empty go.mod
            > go get -d gopkg.in/dummy.v2-unstable
....
            go: golang.org/x/net@v0.0.0-20180906233101-161cd47e91fd: git -c protocol.version=0 fetch --unshallow -f origin refs/heads/*:refs/heads/* refs/tags/*:refs/tags/* in $WORK/gopath/pkg/mod/cache/vcs/4a22365141bc4eea5d5ac4a1395e653f2669485db75ef119e7bbec8e19b12a21: exit status 128:
            	fatal: remote error: Access denied to IP 35.193.215.129

... because we're hitting some Gerrit quota issue it seems.

I'm going to firewall outbound port 443 and port 22 connections for now and set the GOPROXY to our existing private Athens service on GKE to fix the longtest issue above.

/cc @dmitshur @bcmills

@bradfitz bradfitz self-assigned this Mar 6, 2019

@gopherbot gopherbot added this to the Unreleased milestone Mar 6, 2019

@gopherbot gopherbot added the Builders label Mar 6, 2019

@dmitshur

This comment has been minimized.

Copy link
Member

commented Mar 6, 2019

We should make sure our tests never do outbound network requests by default, or that we only hit endpoints that we control.

I agree.

Package cmd/go tests doing go get of import paths we don't control came up previously at least in #27692. In #27692 (comment), I said:

It might also be worth rethinking whether the test should depend on your repo tags not changing.

And the commit message of CL 153460 that resolved it by @bcmills said:

I think we ought to make these tests hermetic

Edit: Another related open issue is #28856.

@gopherbot

This comment has been minimized.

Copy link

commented Mar 6, 2019

Change https://golang.org/cl/165637 mentions this issue: env, buildlet, dashboard: support outbound firewalls for Linux

gopherbot pushed a commit to golang/build that referenced this issue Mar 6, 2019

env, buildlet, dashboard: support outbound firewalls for Linux
Updates golang/go#30612

Change-Id: Ib13a286d0944a7f4a13b9e93a01533693052858b
Reviewed-on: https://go-review.googlesource.com/c/build/+/165637
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@gopherbot

This comment has been minimized.

Copy link

commented Mar 6, 2019

Change https://golang.org/cl/165618 mentions this issue: net/http: failing test for new outbound firewall

@gopherbot

This comment has been minimized.

Copy link

commented Mar 6, 2019

Change https://golang.org/cl/165638 mentions this issue: dashboard: enable outbound firewall on a few more Linux-based builders

gopherbot pushed a commit to golang/build that referenced this issue Mar 6, 2019

dashboard: enable outbound firewall on a few more Linux-based builders
Updates golang/go#30612

Change-Id: Id472e753043976b8671c15491b82bb57e3804d95
Reviewed-on: https://go-review.googlesource.com/c/build/+/165638
Reviewed-by: Dmitri Shuralyov <dmitshur@golang.org>
@gopherbot

This comment has been minimized.

Copy link

commented Mar 6, 2019

Change https://golang.org/cl/165777 mentions this issue: kubernetes/gke: skip API tests in short mode

gopherbot pushed a commit to golang/build that referenced this issue Mar 6, 2019

kubernetes/gke: skip API tests in short mode
Updates golang/go#30612

Change-Id: I752c57f8631025f1784951e701340d2c21ee277c
Reviewed-on: https://go-review.googlesource.com/c/build/+/165777
Reviewed-by: Bryan C. Mills <bcmills@google.com>
@gopherbot

This comment has been minimized.

Copy link

commented Mar 12, 2019

Change https://golang.org/cl/167039 mentions this issue: dashboard: set GOPROXY=off for the "go" repo to catch more network usage

gopherbot pushed a commit to golang/build that referenced this issue Mar 13, 2019

dashboard: set GOPROXY=off for the "go" repo to catch more network usage
Updates golang/go#30612
Updates golang/go#30760

Change-Id: I296f4f7a163c1bdd59e839229c0961b21f26da89
Reviewed-on: https://go-review.googlesource.com/c/build/+/167039
Reviewed-by: Bryan C. Mills <bcmills@google.com>
@bradfitz

This comment has been minimized.

Copy link
Member Author

commented Apr 2, 2019

This is sufficiently done. We do it on enough builders now that we catch network usage.

@bradfitz bradfitz closed this Apr 2, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.