Skip to content

Commit 19cbdfe

Browse files
author
ricardop
committed
0.3.0-beta2: don't leak Authorization header from the registry to the redirected destination during @handle_redirects
1 parent bbd4d60 commit 19cbdfe

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ docker run --rm --name docker_registry_proxy -it \
4343
-v $(pwd)/docker_mirror_certs:/ca \
4444
-e REGISTRIES="k8s.gcr.io gcr.io quay.io your.own.registry another.public.registry" \
4545
-e AUTH_REGISTRIES="auth.docker.io:dockerhub_username:dockerhub_password your.own.registry:username:password" \
46-
rpardini/docker-registry-proxy:0.3.0-beta1
46+
rpardini/docker-registry-proxy:0.3.0-beta2
4747
```
4848

4949
Example with GCR using credentials from a service account from a key file `servicekey.json`:
@@ -57,7 +57,7 @@ docker run --rm --name docker_registry_proxy -it \
5757
-e AUTH_REGISTRIES_DELIMITER=";;;" \
5858
-e AUTH_REGISTRY_DELIMITER=":::" \
5959
-e AUTH_REGISTRIES="gcr.io:::_json_key:::$(cat servicekey.json);;;auth.docker.io:::dockerhub_username:::dockerhub_password" \
60-
rpardini/docker-registry-proxy:0.3.0-beta1
60+
rpardini/docker-registry-proxy:0.3.0-beta2
6161
```
6262

6363
Let's say you did this on host `192.168.66.72`, you can then `curl http://192.168.66.72:3128/ca.crt` and get the proxy CA certificate.

nginx.conf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,12 @@ echo "Docker configured with HTTPS_PROXY=$scheme://$http_host/"
240240
set $original_uri $uri;
241241
set $orig_loc $upstream_http_location;
242242

243+
# during this process, nginx will preserve the headers intended for the original destination.
244+
# in most cases thats okay, but for some (eg: google storage), passing an Authorization
245+
# header can cause problems. Also, that would leak the credentials for the registry
246+
# into the storage system (unrelated).
247+
proxy_set_header Authorization "";
248+
243249
# nginx goes to fetch the value from the upstream Location header
244250
proxy_pass $orig_loc;
245251
proxy_cache cache;

0 commit comments

Comments
 (0)