├── run.sh ├── README.md └── Dockerfile /run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | echo "[+] Running the web app" 4 | 5 | screen -dmS c3-web /bin/bash -c "cd /app/C3/WebController && dotnet C3WebController.dll --urls \"http://0.0.0.0:52935\"" 6 | 7 | echo "[+] Waiting for Web to come up" 8 | 9 | while : 10 | do 11 | if `curl -s localhost:52935/api/gateway/exe/x64\?name\=gateway --output /app/gateway/gateway.zip >/dev/null` ; then 12 | echo "[+] Web App is online, downloaded gateway executable" 13 | break 14 | else 15 | echo "[x] Web app not yet running, sleeping for 10s before retrying" 16 | fi 17 | sleep 10 18 | done 19 | 20 | cd /app/gateway 21 | 22 | #only download the gateway if it doesn't exist 23 | if [ ! -e "GatewayX64_gateway.exe" ]; then 24 | unzip gateway.zip 25 | chmod +xr GatewayX64_gateway.exe 26 | chmod +r GatewayConfiguration.json 27 | fi 28 | 29 | screen -L -Logfile /app/gateway/gateway.log -dmS gateway wine64 GatewayX64_gateway.exe 30 | 31 | #run forever 32 | while true; do sleep 1000; done 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DockerC3 2 | 3 | Dockerised version of the C3 project. 4 | 5 | Uses dotnet-runtime and wine on linux to run the C3 web app, downloads the first gateway and runs it with wine. 6 | # Usage 7 | 8 | * Download and compile/grab a compiled version of the C3 project. 9 | 10 | * Store it in the root directory of this repo as "C3" (eg `unzip ~/C3-0.1.19861a4c.zip && mv C3-0.1.19861a4c C3`) 11 | * build the image 12 | 13 | 14 | `docker build -t c3 .` 15 | 16 | * Run `./build_server.sh ` 17 | 18 | * Once completed: 19 | 20 | 1. A C3 server will be accessible on http://localhost:500$id 21 | 22 | 2. A folder will be created for that C3 instance in ./data/c3\_server\_$id 23 | 24 | 3. To view Gateway logs execute `tail -f ./data/c3_server_$id/gateway/gateway.log` 25 | 26 | 4. To upload customised relay executables for new relays simply move them to ./data/c3_server_$id/Bin 27 | 28 | * If the Gateway errors for some reason, you can run `docker restart c3_server_$id`, the network will not be deleted. 29 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:20.04 2 | 3 | # Set the working directory to /app 4 | WORKDIR /app 5 | 6 | COPY . /app 7 | 8 | # Install packages for C3 to run 9 | RUN apt update && apt install -y wget software-properties-common apt-transport-https curl screen unzip smbclient cifs-utils samba winbind 10 | 11 | #install winehq (v5.0) and winetricks 12 | RUN dpkg --add-architecture i386 && apt update 13 | RUN wget -O - https://dl.winehq.org/wine-builds/winehq.key | apt-key add - 14 | RUN add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main' && apt update && apt install --install-recommends -y winehq-stable wine-stable 15 | 16 | # Install dotnet sdk 17 | RUN wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb && dpkg -i packages-microsoft-prod.deb 18 | RUN add-apt-repository universe 19 | RUN apt install -y apt-transport-https 20 | RUN apt update 21 | RUN apt install -y aspnetcore-runtime-5.0 aspnetcore-runtime-2.1 dotnet-sdk-5.0 aspnetcore-runtime-3.1 22 | # Run the web app, wait for it to come alive and then start a gateway using Wine 23 | CMD ["/bin/bash", "run.sh"] 24 | --------------------------------------------------------------------------------