News for hackers. Stuff that matters.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by diNgUrAndI on Saturday April 27, 2019 @12:34AM (#19763795)
What are dockerhub's alternatives? No 2FA. That is bad.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by lskillen on Saturday April 27, 2019 @06:14AM (#19764815)
As others have stated you could run your own registry or use an alternative service for private repositories, to minimise or eliminate the attack vector.

By replicating the images (or packages) that you need into your own account, you can minimise the possibility of a bad actor replacing a well-known image with something untrusted.

An alternative is to side-cart a service like Notary (https://docs.docker.com/notary/getting_started/) in order to establish a chain of trust for images. If an image gets changed, Docker will refuse to use it and you will be warned that it is untrusted.

Biased opinion on an alternative registry:

- Cloudsmith: https://cloudsmith.io/l/docker-registry/

But you've got other options, such as:

- Self-hosted: https://github.com/docker/distribution)

- Cloud-specific (e.g. ECR, GCR, ACR, etc.)

- Sonatype Nexus: https://www.sonatype.com

- ProGet: https://inedo.com/proget

- Gitlab: https://gitlab.com

- Artifactory: https://jfrog.com/artifactory/

If you're missing the auto-build functionality, this can be achieved reasonably easily with any of the mainstream and awesome CI/CD services out there, such as:

- SemaphoreCI: https://semaphoreci.com/

- CircleCI: https://circleci.com/

- DroneCI: https://drone.io/

Disclaimer: I work for Cloudsmith, and still think Docker Hub is great. :-)

Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by netsectoday on Saturday April 27, 2019 @12:55PM (#19766442)
You can run your own private Docker registry but you will still depend upon the base images pulled from hub.docker.com in your deploy chain unless you make sure to clone the base image Dockerfile from github and build it yourself. Even with this protected setup; you still have exposure from poisoned Github repos after this attack because of the compromised Github access keys. I'm not sure you can eliminate this threat, even with third-party services. What a mess.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by lskillen on Saturday April 27, 2019 @05:04PM (#19767625)
It might be OK for the Docker Hub aspect at least, with a caveat later on; the GitHub aspect is unfortunate and I completely agree. Direct access to source is rather dangerous territory.

Back to the images bit first:

Base images are only referenced/pulled at build time. So if you've already built your own image and stored it, it'll contain all of the layers necessary to run it without explicitly pulling from Docker Hub.

In the case that you're building new images (likely), it'll need to pull the base images from Docker Hub. However, if you pull the base image(s) from Docker Hub first, you can tag them and store them in your local (or hosted) registry, then refer to those explicitly instead.

For example (using a Cloudsmith hosted registry):

  docker pull alpine:3.8
  docker tag alpine:3.8 docker.cloudsmith.io/your-account/your-repo/alpine:3.8
  docker push docker.cloudsmith.io/your-account/your-repo/alpine:3.8
Now, instead of the usual FROM directive:

  FROM alpine:3.8
You can refer to your own copy of alpine:

  FROM docker.cloudsmith.io/your-account/your-repo/alpine:3.8
As you can see Docker's syntax doesn't make this extremely pleasant, and you'll have to change existing Dockerfiles to point at the base images, but it's certainly possible to mirror your dependencies without rebuilding.

Caveat: The downside is that you have to trust those dependencies at the exact point you pull them down, so I concede it is still not perfect without rebuilding the lot. :-)

Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by viraptor on Saturday April 27, 2019 @12:41AM (#19763819)
Your own repo, AWS ECR, whatever GCP's version is called, and many others.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by buzer on Saturday April 27, 2019 @01:22AM (#19763949)
There are actually very few alternatives for the autobuild part. The only alternative that I'm aware of is Quay, others require you to roll out your own build & push process.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by dawnerd on Saturday April 27, 2019 @02:15AM (#19764102)
I use drone.io self hosted to build all my images. They then get pushed to a self-hosted hub.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by oszione on Saturday April 27, 2019 @01:59AM (#19764048)
GCP's Cloud Build is also a simple option.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by viraptor on Saturday April 27, 2019 @01:30AM (#19763964)
It's not that hard to roll your own (I'm doing that). It's not trivial, but if you need autobuild rather than just tags, it's not a huge time investment either. Some systems have all the necessary stuff exposed as plugins too (for example buildkite)
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by techntoke on Saturday April 27, 2019 @02:03AM (#19764073)
Autobuilding is really just a free GitLab pipeline.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by geezerjay on Saturday April 27, 2019 @02:33AM (#19764152)
Gitlab provides public and private projects with their own registry which can host Docker images built by Gitlab's CICD service.
Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by ralala on Saturday April 27, 2019 @02:51AM (#19764213)
And you can even run your own gitlab instance and don't expose it to the internet.

Nevertheless: The base images will be pulled from dockerhub by default and I am not sure we should trust them. Do we have any better alternatives for this?

Re:Docker Hub Hacked – 190k accounts, GitHub tokens revoked,... by nurettin on Saturday April 27, 2019 @02:28AM (#19764136)
on-site nexus is good.