Skip to content

Conversation

Aditya9113
Copy link

Setting up a private pwn college docker registry. documentation is listed under the docs folder named registry.md.

Copy link
Member

@robwaz robwaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's almost real!

Documentation is awesome. Overall, three things to consider:

  • Make all addresses configurable for easy build on dev/prod
  • Make it possible to prevent public image pulls
  • Link to critical knowledge to prevent future pain if anyone needs to revisit this logic

}, 403

dojo_name = m.group("dojo_id")
dojo_hex = m.group("dojo_hex")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All dojos do not have a dojo_hex. A dojo can be made "official" at which point the dojo_hex is removed from the reference_id.

requested = set(a.strip() for a in actions if a)
allowed = set()

if "pull" in requested:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can think of cases where we do not want all challenge images to be pullable.

continue

for client in all_docker_clients():
image_name = f"registry.localhost.pwn.college/{image}"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded address, likely will not resolve on prod or custom deployments.

if DOCKER_USERNAME and DOCKER_TOKEN:
client.login(DOCKER_USERNAME, DOCKER_TOKEN)
logger.info(f"Pulling image {image} on {client.api.base_url}...")
client.login(DOCKER_USERNAME, DOCKER_TOKEN, registry="registry.localhost.pwn.college")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded address


PRIVATE_KEY_PATH = os.getenv("PRIVATE_KEY_PATH", "/keys/private.key")
PUBLIC_KEY_PATH = os.getenv("PUBLIC_KEY_PATH", "/keys/public.key")
ISSUER = os.getenv("TOKEN_ISSUER", "auth.localhost.pwn.college")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardcoded addresses

@@ -0,0 +1,154 @@
#!/usr/bin/env python3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC some of the implementation details here were based on hard to find documentation. Can we include the a link to the relevant documentation as a comment?


## Nginx Proxy Routes

`dojo/nginx-proxy/etc/nginx/vhost.d/registry.localhost.pwn.college` illustrates path-based routing (replace with your domain in production):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably wrap all domain names used in the code in a variable that we can change in the docker-compose.yml.

More generally, we need to easily configure the registry to work in a dev environment (without HTTPS with localhost addresses) and also in prod (with HTTPS with publicly resolvable addresses).

- Confirm vhost routes for `/v2/` and `/auth/token`
- If you change `REGISTRY_AUTH_TOKEN_ISSUER`, remember to change the auth service token issuer variable.

## Private Docker Registry with Token Auth (Correct KID + Cert Flow)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Include link to relevant outside resources on registery auth process?

- VIRTUAL_PORT=5000
- HTTPS_METHOD=noredirect
- REGISTRY_AUTH=token
- REGISTRY_AUTH_TOKEN_REALM=https://registry.pwn.college/auth/token #https://registry.localhost.pwn.college/auth/token
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should set this up such that these environment variables are configured via .env with docker compose to allow easy dev & prod standup.

@robwaz
Copy link
Member

robwaz commented Sep 14, 2025

It'd also be amazing if we could have some tests for this so we don't accidentally break prod. 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants