|
| 1 | +# Docker Setup for Reverse-SOXY |
| 2 | + |
| 3 | +This document provides instructions for running Reverse-SOXY in Docker containers. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- [Docker](https://docs.docker.com/get-docker/) |
| 8 | +- [Docker Compose](https://docs.docker.com/compose/install/) (optional, for running multi-container setups) |
| 9 | + |
| 10 | +## Building the Docker Image |
| 11 | + |
| 12 | +To build the Docker image: |
| 13 | + |
| 14 | +```bash |
| 15 | +docker build -t reverse-soxy . |
| 16 | +``` |
| 17 | + |
| 18 | +## Running with Docker |
| 19 | + |
| 20 | +### Proxy Mode |
| 21 | + |
| 22 | +```bash |
| 23 | +docker run -p 1080:1080 -p 9000:9000 reverse-soxy --proxy-listen-addr 0.0.0.0:1080 --tunnel-listen-port 9000 --secret yourSecretHere |
| 24 | +``` |
| 25 | + |
| 26 | +### Agent Mode |
| 27 | + |
| 28 | +```bash |
| 29 | +docker run reverse-soxy --tunnel-addr proxy.host:9000 --secret yourSecretHere |
| 30 | +``` |
| 31 | + |
| 32 | +### Relay Mode |
| 33 | + |
| 34 | +```bash |
| 35 | +docker run -p 9000:9000 reverse-soxy --mode relay --relay-listen-port 9000 --secret yourSecretHere |
| 36 | +``` |
| 37 | + |
| 38 | +### Proxy via Relay Mode |
| 39 | + |
| 40 | +```bash |
| 41 | +docker run -p 1080:1080 reverse-soxy --mode proxy --register --relay-addr relay.host:9000 --proxy-listen-addr 0.0.0.0:1080 --secret yourSecretHere |
| 42 | +``` |
| 43 | + |
| 44 | +### Agent via Relay Mode |
| 45 | + |
| 46 | +```bash |
| 47 | +docker run reverse-soxy --mode agent --relay-addr relay.host:9000 --secret yourSecretHere |
| 48 | +``` |
| 49 | + |
| 50 | +## Running with Docker Compose |
| 51 | + |
| 52 | +The included `docker-compose.yml` file provides configurations for all modes of operation. |
| 53 | + |
| 54 | +### Setting a Secure Secret |
| 55 | + |
| 56 | +Before running, set a secure secret: |
| 57 | + |
| 58 | +```bash |
| 59 | +export SECRET=yourSecretHere |
| 60 | +``` |
| 61 | + |
| 62 | +### Running Different Setups |
| 63 | + |
| 64 | +#### Direct Proxy and Agent |
| 65 | + |
| 66 | +```bash |
| 67 | +# Start the proxy |
| 68 | +docker-compose up proxy |
| 69 | + |
| 70 | +# In another terminal, start the agent |
| 71 | +docker-compose up agent |
| 72 | +``` |
| 73 | + |
| 74 | +#### Relay Server with Proxy and Agent |
| 75 | + |
| 76 | +```bash |
| 77 | +# Start the relay server |
| 78 | +docker-compose up relay |
| 79 | + |
| 80 | +# In another terminal, start the proxy via relay |
| 81 | +docker-compose up proxy-via-relay |
| 82 | + |
| 83 | +# In another terminal, start the agent via relay |
| 84 | +docker-compose up agent-via-relay |
| 85 | +``` |
| 86 | + |
| 87 | +## Configuration |
| 88 | + |
| 89 | +### Environment Variables |
| 90 | + |
| 91 | +- `SECRET`: The shared secret for encryption/authentication |
| 92 | +- `PROXY_HOST`: The hostname of the proxy (for agent mode) |
| 93 | +- `RELAY_HOST`: The hostname of the relay server (for proxy-via-relay and agent-via-relay modes) |
| 94 | + |
| 95 | +### Custom Configuration File |
| 96 | + |
| 97 | +You can mount a custom YAML configuration file: |
| 98 | + |
| 99 | +```bash |
| 100 | +docker run -v /path/to/your/config.yml:/app/config/config.yml reverse-soxy --config /app/config/config.yml --secret yourSecretHere |
| 101 | +``` |
| 102 | + |
| 103 | +## Security Considerations |
| 104 | + |
| 105 | +- Always use a strong, unique secret for each deployment |
| 106 | +- Consider using Docker secrets or environment variables for the secret in production |
| 107 | +- The default configuration exposes ports to all interfaces (0.0.0.0) within the container, so be careful with port mappings |
| 108 | +- In production, consider using a non-root user in the container |
| 109 | + |
| 110 | +## Troubleshooting |
| 111 | + |
| 112 | +### Debugging |
| 113 | + |
| 114 | +Add the `--debug` flag to enable debug logging: |
| 115 | + |
| 116 | +```bash |
| 117 | +docker run reverse-soxy --secret yourSecretHere --debug |
| 118 | +``` |
| 119 | + |
| 120 | +### Checking Container Logs |
| 121 | + |
| 122 | +```bash |
| 123 | +docker logs <container_id> |
| 124 | +``` |
| 125 | + |
| 126 | +### Inspecting a Running Container |
| 127 | + |
| 128 | +```bash |
| 129 | +docker exec -it <container_id> /bin/sh |
| 130 | +``` |
0 commit comments