This commit is contained in:
JMARyA 2024-08-30 13:28:33 +02:00
commit c41ef4ba88
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
4 changed files with 49 additions and 0 deletions

18
Dockerfile Normal file
View file

@ -0,0 +1,18 @@
FROM alpine:latest AS builder
RUN apk update && apk upgrade && \
apk add --no-cache go git
WORKDIR /
RUN git clone "https://github.com/jpillora/chisel"
WORKDIR /chisel
RUN go build -o chisel main.go
FROM alpine:latest
RUN apk update && apk upgrade && \
apk add --no-cache socat bash
COPY --from=builder /chisel/chisel /usr/bin/chisel
COPY ./entrypoint.sh /entrypoint.sh
CMD ["/bin/bash", "/entrypoint.sh"]

16
README.md Normal file
View file

@ -0,0 +1,16 @@
# Chisel Forward
This container allows to forward a local port to a remote system running chisel server.
# 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
- `$REMOTE_PORT`: The remote port to expose the forward on
- `$USER`: Authentication User
- `$TOKEN`: Authentication Token

10
docker-compose.yml Normal file
View file

@ -0,0 +1,10 @@
services:
forward:
build: .
restart: unless-stopped
environment:
HOST: "https://chisel.example.com"
LOCAL_PORT: "8080"
REMOTE_PORT: "8080"
USER: "user"
TOKEN: "token"

5
entrypoint.sh Normal file
View file

@ -0,0 +1,5 @@
#!/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