-
Notifications
You must be signed in to change notification settings - Fork 2
Add iptables to http-proxy docker images #658
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 2 commits
c7c060f
611aefe
53cb841
4e0dd49
bbc9046
2cd8a3a
c147d5e
80c44cd
22275da
53780c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,8 +16,14 @@ FROM --platform=$BUILDPLATFORM alpine as user | |||||||||
| RUN adduser -S -u 10000 lantern | ||||||||||
|
|
||||||||||
| FROM alpine | ||||||||||
| RUN apk add --no-cache iptables | ||||||||||
|
||||||||||
|
|
||||||||||
| COPY --from=user /etc/passwd /etc/passwd | ||||||||||
| COPY --from=builder /usr/local/bin/http-proxy /usr/local/bin/http-proxy | ||||||||||
|
|
||||||||||
| COPY servermasq.sh /servermasq.sh | ||||||||||
| RUN chmod +x /servermasq.sh | ||||||||||
|
|
||||||||||
| USER lantern | ||||||||||
| ENTRYPOINT ["/servermasq.sh"] | ||||||||||
|
Comment on lines
22
to
+30
|
||||||||||
| USER lantern | |
| ENTRYPOINT ["/servermasq.sh"] | |
| ENTRYPOINT ["/servermasq.sh"] | |
| USER lantern |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| #!/bin/sh | ||
| set -e | ||
|
|
||
| echo "[+] Setting up LANTERN_SERVERMASQ iptables chain..." | ||
|
|
||
| if [ -z "$PROXY_ADDR" ] || [ -z "$PROXY_PORT" ] || [ -z "$MASQ_ADDR" ]; then | ||
| echo "[~] Required environment variables not set, skipping iptables setup" | ||
| exec "$@" | ||
| fi | ||
|
|
||
| iptables -t nat -N LANTERN_SERVERMASQ 2>/dev/null || true | ||
| iptables -t nat -F LANTERN_SERVERMASQ 2>/dev/null || true | ||
|
|
||
| iptables -t nat -A LANTERN_SERVERMASQ -d "$PROXY_ADDR" ! --dport "$PROXY_PORT" -j DNAT --to-destination "$MASQ_ADDR" | ||
| iptables -t nat -A PREROUTING -d "$PROXY_ADDR" -j LANTERN_SERVERMASQ | ||
|
|
||
| echo "[+] LANTERN_SERVERMASQ setup complete: $@" | ||
| exec "$@" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider adding a comment explaining why
iptablesis required in this image to help future maintainers understand this dependency.