This commit is contained in:
JMARyA 2024-09-03 10:47:08 +02:00
parent c41ef4ba88
commit 6d4f96cabb
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
5 changed files with 11 additions and 13 deletions

6
.env Normal file
View file

@ -0,0 +1,6 @@
HOST="https://chisel.example.com"
LOCAL_PORT="8080"
REMOTE_PORT="8080"
USER="user"
TOKEN="token"
PROTOCOL="tcp"

View file

@ -11,7 +11,7 @@ RUN go build -o chisel main.go
FROM alpine:latest
RUN apk update && apk upgrade && \
apk add --no-cache socat bash
apk add --no-cache bash
COPY --from=builder /chisel/chisel /usr/bin/chisel
COPY ./entrypoint.sh /entrypoint.sh

View file

@ -3,14 +3,13 @@ This container allows to forward a local port to a remote system running chisel
# TODO
- Load Balancing
- Error Handling
- UDP
## Configuration
The container is configured through environment variables:
- `$HOST`: The host running chisel server
- `$LOCAL_PORT`: The local port to forward
- `$LOCAL_HOST`: The local host address
- `$LOCAL_PORT`: The local port to forward
- `$REMOTE_PORT`: The remote port to expose the forward on
- `$USER`: Authentication User
- `$TOKEN`: Authentication Token
- `$PROTOCOL`: The protocol to use (`tcp` / `udp`)

View file

@ -2,9 +2,4 @@ services:
forward:
build: .
restart: unless-stopped
environment:
HOST: "https://chisel.example.com"
LOCAL_PORT: "8080"
REMOTE_PORT: "8080"
USER: "user"
TOKEN: "token"
env_file: .env

View file

@ -1,5 +1,3 @@
#!/bin/bash
socat TCP4-LISTEN:$LOCAL_PORT,fork,reuseaddr TCP4:TCP4:$LOCAL_HOST:$LOCAL_PORT &
chisel client --auth "$USER:$TOKEN" "$HOST" "R:$LOCAL_HOST:$LOCAL_PORT:127.0.0.1:$REMOTE_PORT" &
wait
chisel client --auth "$USER:$TOKEN" "$HOST" "R:0.0.0.0:$REMOTE_PORT:$LOCAL_HOST:$LOCAL_PORT/${PROTOCOL:-tcp}"