Exposing services
Every port you list under ports is reachable by the team that owns the instance. All of them are served over TLS on port 443, and the platform tells them apart by the domain (SNI): each port of each instance gets its own domain, like web-8080-my-challenge-<instance>.ctf.example.com. That's why published doesn't matter, only target (the port inside the container).
Use the long port syntax to tell the frontend what kind of service it is:
services:
web:
# ...
ports:
- name: web
target: 8080
app_protocol: httpapp_protocol | What players get |
|---|---|
http | A link to their instance (HTTPS) |
| unset, or anything else | A command to connect with TLS, ncat --ssl-verify <domain> 443. With pwntools: remote(domain, 443, ssl=True) |
ssh | SSH access through the platform's SSH gateway |
Your service itself doesn't need to know about TLS: the platform terminates it, and forwards plain HTTP or TCP to the container.
Ports that aren't listed (or only listed in expose) are only reachable by the other services of the same instance, by service name: http://db:5432.
INFO
Only TCP is supported. UDP needs a separate IP address per instance, which is on the roadmap.
SSH
For app_protocol: ssh, also set the credentials of your service:
services:
shell:
# ...
ports:
- target: 22
app_protocol: ssh
x-username: ctf
x-password: ctfPlayers don't see these. They connect to the SSH gateway with credentials the platform generates for their instance, and the gateway logs into your service with x-username and x-password. Shells, commands, scp/sftp and port forwarding work:
ssh -L 8080:localhost:80(andssh -D) reaches ports of the instance from the player's machine.ssh -R 9000:localhost:9000makes the instance's SSH service listen on port 9000, and forwards connections to the player's machine, for example for reverse shells or callbacks. Your SSH server decides which address it listens on: OpenSSH only listens onlocalhostunlessGatewayPortsis enabled.