Add router image for allowlisted egress
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
FROM artifactapi.k8s.syd1.au.unkin.net/dockerhub/library/alpine:3.22
|
||||
|
||||
# hadolint ignore=DL3018
|
||||
RUN apk add --no-cache dnsmasq nginx nginx-mod-stream socat
|
||||
|
||||
COPY start.sh /usr/local/bin/router-start
|
||||
COPY forwarder /usr/local/bin/forwarder
|
||||
# The launcher mounts the per-session config at /etc/router.
|
||||
ENTRYPOINT ["/usr/local/bin/router-start"]
|
||||
Executable
+10
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
# Loopback forwarders in the sandbox netns. FORWARDS holds
|
||||
# "bind:port:router:router_port" words.
|
||||
set -eu
|
||||
for fwd in $FORWARDS; do
|
||||
# shellcheck disable=SC2046
|
||||
set -- $(echo "$fwd" | tr : ' ')
|
||||
socat "TCP-LISTEN:$2,bind=$1,fork,reuseaddr" "TCP:$3:$4" &
|
||||
done
|
||||
wait
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
# Start the per-session router from the launcher's config in /etc/router.
|
||||
set -eu
|
||||
resolver=$(awk '/^nameserver/ {print $2; exit}' /etc/resolv.conf)
|
||||
sed "s/@RESOLVER@/$resolver/" /etc/router/nginx.conf >/tmp/nginx.conf
|
||||
dnsmasq --conf-file=/etc/router/dnsmasq.conf
|
||||
# ponytail: no supervisor; if dnsmasq dies the session loses DNS, restart the session.
|
||||
exec nginx -c /tmp/nginx.conf -g 'daemon off;'
|
||||
Reference in New Issue
Block a user