Skip to main content

Running Binaries in Challenge Containers

When you deploy a web server to a challenge container, you would only need to properly configure the EXPOSE'd port that is in use by your server. However, if you'd like to deploy a binary into a challenge container there is additional work that needs to be done.

First you will need to use a tool like socat to execute the binary for every network connection and connect the input/output to the user.

For example, if your binary is called main you can turn wrap the binary with socat with the following command:

serve.sh
#!/bin/sh
socat \
-T60 \
TCP-LISTEN:12345,reuseaddr,fork \
EXEC:"timeout 60 ./main"

In the example script above, every connection to port 12345 of the container, socat will execute ./main and then connect the I/O from the container's port to the I/O of the binary. It will also timeout the connection after 60 seconds.

Once you've deployed your container like this you will need to Request a TCP Port to expose your container to standard tools like netcat.